Re: [PATCH 0/3] drm: Store USB device in struct drm_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 21, 2020 at 10:01:29PM +0200, Daniel Vetter wrote:
> On Wed, Oct 21, 2020 at 03:07:29PM +0200, Thomas Zimmermann wrote:
> > The drivers gm12u320 and udl operate on USB devices. They leave the
> > PCI device in struct drm_device empty and store the USB device in their
> > own driver structure.
> > 
> > Fix this special case and save a few bytes by putting the USB device
> > into an anonymous union with the PCI data. It's expected that DRM
> > core and helpers only touch the PCI-device field for actual PCI devices.
> 
> Uh no.
> 
> If you're really concerned about the 8 bytes wasted, use drm_device->dev
> instead, and upcast it to the usb device. I think some drivers do this
> already (at least on the platform side iirc).
> 
> But we had this entire drm_bus midlayer stuff already, and it took forever
> to sunset it. I don't want to go back, and saving 8 bytes in a giantic
> structure isn't worth that risk imo.

Typing this I realized that we could even move the pdev pointer to the
legacy chunk of drm_device. Instead of checking for drm_device->pdev we
could instead check for dev_is_pci(drm_device->dev) in the 1-2 core code
places.

But it's a pile of churn to roll that out to drivers, and I'm not sure the
8 bytes saved is even close to paying for that huge effort.
-Daniel

> > Thomas Zimmermann (3):
> >   drm: Add reference to USB device to struct drm_device
> >   drm/tiny/gm12u320: Store USB device in struct drm_device.udev
> >   drm/udl: Store USB device in struct drm_device.udev
> > 
> >  drivers/gpu/drm/tiny/gm12u320.c     | 52 +++++++++++++----------------
> >  drivers/gpu/drm/udl/udl_connector.c |  8 ++---
> >  drivers/gpu/drm/udl/udl_drv.c       |  2 +-
> >  drivers/gpu/drm/udl/udl_drv.h       |  1 -
> >  drivers/gpu/drm/udl/udl_main.c      | 15 +++++----
> >  include/drm/drm_device.h            | 21 ++++++++----
> >  6 files changed, 52 insertions(+), 47 deletions(-)
> > 
> > --
> > 2.28.0
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux