diff mbox series

[1/3] drm: Add reference to USB device to struct drm_device

Message ID 20201021130732.4048-2-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm: Store USB device in struct drm_device | expand

Commit Message

Thomas Zimmermann Oct. 21, 2020, 1:07 p.m. UTC
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@suse.de>
---
 include/drm/drm_device.h | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
diff mbox series

Patch

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;