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.
> 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.
> 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.
[..]
> - 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.
[..]
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.
Regards
Oliver
-------------------------------------------------------
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