if so I've to to suspect that's because there's an extra get_device() ... like the one in "config.c". Isn't the object initialized to count == 1, so that get_device() makes usbcore track count == 2 for just one copy of that pointer?
That's right, and you're also right that there's an extra get_device(). In fact, there are two extra. The first is indeed in config.c; this patch (as111) gets rid of it.
The extra device refcounts are a separate problem, they've been there for quite a while. I don't know what they cover up. :)
- - /* put happens in usb_destroy_configuration */ - get_device(&interface->dev);
No, taking this out is wrong. Read the comment :)
But it matches one of the changes you'd asked about in my patch... take another look at the two, in combination.
We need to increment the count by one, as we want the interfaces to stick around until the whole device is cleaned up. That happens from a call to usb_release_dev when the final kobject put is called on the struct usb_device. Then that calls usb_destroy_configuration() which cleans up the raw descriptors of the interfaces that were owned by the struct usb_device, and then calls the last put on the struct usb_interface, which then will finally free that memory.
Except for that first refcounting bug I noted, where you agreed it was correct to call device_del() not device_unregister(). Given that fix, there's no reason to add the extra reference count here.
If this patch goes in, the interface memory will be freed when the interface is unregistered from the driver core (with the call to device_unregister(&interface->dev); in usb_disconnect) which is way too early in the cleanup sequence.
Remember that device_unregister() will be device_del(); this patch of Alan's goes on top of the usb_set_configuration() rework. No extra decrement means no need for an extra increment.
- Dave
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel