On Mon, 19 Feb 2007, Oliver Neukum wrote:

> Hi Alan,
> 
> if probe() fails, you fail to restore the old pm count. If the driver
> supports autosuspend, but doesn't bind, the interface, though unbound,
> will not suspend again.
> 
>       Regards
>               Oliver
> 
> Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]>
> ------
> 
> --- a/drivers/usb/core/driver.c       2007-02-19 14:27:11.000000000 +0100
> +++ b/drivers/usb/core/driver.c       2007-02-19 14:32:13.000000000 +0100
> @@ -189,6 +189,7 @@
>       struct usb_interface *intf;
>       struct usb_device *udev;
>       const struct usb_device_id *id;
> +     int old_usage_count;
>       int error = -ENODEV;
>  
>       dev_dbg(dev, "%s\n", __FUNCTION__);
> @@ -219,12 +220,14 @@
>               /* The interface should always appear to be in use
>                * unless the driver suports autosuspend.
>                */
> +             old_usage_count = intf->pm_usage_cnt;
>               intf->pm_usage_cnt = !(driver->supports_autosuspend);
>  
>               error = driver->probe(intf, id);
>               if (error) {
>                       mark_quiesced(intf);
>                       intf->needs_remote_wakeup = 0;
> +                     intf->pm_usage_cnt = old_usage_count;
>                       intf->condition = USB_INTERFACE_UNBOUND;
>               } else
>                       intf->condition = USB_INTERFACE_BOUND;

This change isn't needed.  The fact that mark_quiesced() is called for the 
interface means that the pm_usage_cnt won't be used for anything -- until 
another driver is probed.

After all, if no driver is bound to the interface then the pm_usage_cnt 
value is meaningless.  By definition, the interface cannot be in use.

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to