[PATCH 1/3] drm: Add reference to USB device to struct drm_device
Thomas Zimmermann
tzimmermann at suse.de
Wed Oct 21 13:07:30 UTC 2020
We have DRM drivers that operate on USB devices. So far they had
to store a pointer to the USB device structure. Move the reference
into struct drm_device. Putting the USB device into a union with
the PCI data saves a few bytes. Both should mutually exclusive.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
include/drm/drm_device.h | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index f4f68e7a9149..9871fcabd720 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -25,6 +25,7 @@ struct inode;
struct pci_dev;
struct pci_controller;
+struct usb_device;
/**
* enum drm_switch_power - power state of drm device
@@ -283,16 +284,24 @@ struct drm_device {
*/
spinlock_t event_lock;
- /** @agp: AGP data */
- struct drm_agp_head *agp;
+ union {
+ struct {
+ /** @agp: AGP data */
+ struct drm_agp_head *agp;
- /** @pdev: PCI device structure */
- struct pci_dev *pdev;
+ /** @pdev: PCI device structure */
+ struct pci_dev *pdev;
#ifdef __alpha__
- /** @hose: PCI hose, only used on ALPHA platforms. */
- struct pci_controller *hose;
+ /** @hose: PCI hose, only used on ALPHA platforms. */
+ struct pci_controller *hose;
#endif
+ };
+
+ /** @udev: USB device structure */
+ struct usb_device *udev;
+ };
+
/** @num_crtcs: Number of CRTCs on this device */
unsigned int num_crtcs;
--
2.28.0
More information about the dri-devel
mailing list