Duncan Sands wrote:
Hi Dave, the obvious thing to do (once intf->driver is thrown away)
is to call device_release_driver in usb_driver_release_interface.

The usb_driver_release_interface() call could reasonably become just an inline function (without those null checks) doing exactly that.


Why drop the checks? It is not a fast path.

There are a lot of "is it null?" tests that are just pointless code bloat. It's not a big deal, but getting rid of such stuff needs to start somewhere.



do you really want disconnect to be called from the middle of a probe
routine?

In principle it should be fine; the driver model code is fine with such things.

I suspect the cdc_unbind should  guard against that call from
cdc_bind though (it's a special case) and likewise from the last
failure case in usbnet_probe (almost the same special case).

Those failure modes are uncommon ... in the normal case (where
the probe succeeded), they won't make problems.


Or how about this:

static void usbnet_disconnect (struct usb_interface *intf)
{
        struct usbnet           *dev;
        struct usb_device       *xdev;

        dev = usb_get_intfdata(intf);
        usb_set_intfdata(intf, NULL);
        if (!dev)
                return;
  ...
        unregister_netdev (dev->net);

        /* we don't hold rtnl here ... */
        flush_scheduled_work ();

        if (dev->driver_info->unbind)
                dev->driver_info->unbind (dev, intf); <== HERE

This may call usb_driver_release_interface on a different
interface, which will immediately call back into usbnet_disconnect
on another interface.  Is it OK to call unregister_netdev twice on
the same device?

That "if (!dev)" test was supposed to break the recursion there, but I suspect you're right that it needs tweaking before that'll work right. Which is part of why there's still that "half bound" state in usbcore ... removing it would call for a certain amount of testing! :)

- Dave






------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to