On Fri, Dec 13, 2002 at 11:48:30PM +0100, Oliver Neukum wrote: > Am Donnerstag, 12. Dezember 2002 23:55 schrieb Greg KH: > > Here's a patch from Kari Hameenaho that I just applied to the 2.5 tree > > for the USB core that allows the drivers that use the USB_MAJOR number > > to remove their static arrays of devices. It also converts the usblp > > and scanner drivers to use this logic. > > Well, you might have posted it for comments, but anyway.
Heh, consider this the post :) > > I also just checked in some changes for the usb-skeleton.c driver to > > take advantage of this, reducing both the memory footprint and lines of > > code of this driver. > > The memory footprint is small. The cache footprint is actually increased. Yes, a bit. But this is the way that device lookups are moving toward. Look at the block devices now, no more fixed arrays. Character devices are next, and I'm trying to prepare for this. > > I would like to publicly thank Kari for working with me over the past > > few weeks to implement this patch. He has taken a crazy, half-baked > > idea of mine and turned it into working code. Very nice job. > > Secondly, it takes the data structure away from the drivers but leaves > them with the locking. This really looks like a beautiful opportunity > to introduce full reference counting but fails to go the whole way. What would be reference counted? The interface? And yes, I need to work on my reference count patch, it's getting stale, and conflicts massively with the patch that David sent out. I need to address both of them soon. > [..] > > - device major (USB_MAJOR for now) and minor are stored in probe() > > function to struct usb_interface as kdev_t > > - open() can use new core function usb_find_interface() to find matching > > device in drivers device list > > - disconnect() will set kdev_t struct usb_interface to NODEV, so open > > wont open it anymore without new probe() > > This should be encapsulated. Where, in the disconnect function? That's easy enough. > > [..] > To the patch itself: > > up(&scn_mutex); > > dev_set_drvdata(&intf->dev, scn); > > /* add device id so the device works when advertised */ > intf->kdev = mk_kdev(USB_MAJOR,scn->scn_minor); > -> Race condition. You need to set it under lock. > And that should be encapsulated as well. The scn pointer can't change after the lock is released, only possibly the data in it. Hm, no, not really, as probe is not finished yet, ah but open() could happen already... Yeah moving this would be good. thanks, greg k-h ------------------------------------------------------- This sf.net email is sponsored by: With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel http://hpc.devchannel.org/ _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
