On Mon, Sep 15, 2003 at 03:42:05PM -0700, David Brownell wrote:
* Use device_del() not device_unregister(), which matches with using device_add() to create the devices instead of device_register() ... resolves one refcounting problem.
Hm, how does it do that? If you want to call device_del() yourself, you have to do the final put_device() on the device. I don't see that happening here. What is the refcounting issue?
It was the assumption that when interfaces de-activate then usbcore is giving up its reference and should drop the count. Not true unless they only de-activate during disconnection.
Since usbcore is still keeping the config[i]->interface[j] reference, dropping the refcount then would lead to oopsing later when it got re-used. I got tired of oopsing. :)
You might be right that another put_device() is needed, but 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?
Combining device_initialize() and device_add() is the same as device_register(), it's just in 2 steps. It is safe to call device_unregister() after doing that.
Only if you really intend to give up the reference, which usbcore doesn't want to do just because the config changed.
- 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