Re: cleanup of suspend/resume 2nd try

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 3 Jan 2012, Oliver Neukum wrote:

> What about this version?

Much better.  Just one little problem and a couple of suggestions...

> +static void unbind_no_reset_resume_drivers_interfaces(struct usb_device *udev)

Add a comment before this routine:

/* Unbind drivers for @udev's interfaces that failed to support reset-resume.
 * These interfaces have the needs_binding flag set by usb_resume_interface().
 *
 * The caller must hold @udev's device lock.
 */

> +{
> +	struct usb_host_config	*config;
> +	int			i;
> +	struct usb_interface	*intf;
> +
> +	config = udev->actconfig;
> +	if (config) {
> +		for (i = 0; i < config->desc.bNumInterfaces; ++i) {
> +			intf = config->interface[i];
> +
> +			if (intf->needs_binding)

This test should be:  if (intf->dev.driver && intf->needs_binding)
(And you don't need to add the blank line.)

> +				usb_forced_unbind_intf(intf);
> +		}
> +	}
> +}


> @@ -1307,15 +1329,18 @@ int usb_resume(struct device *dev, pm_message_t msg)
>  	struct usb_device	*udev = to_usb_device(dev);
>  	int			status;
>  
> -	/* For PM complete calls, all we do is rebind interfaces */
> +	/* For PM complete calls, all we do is rebind interfaces
> +	 * whose needs_binding flag is set
> +	 */
>  	if (msg.event == PM_EVENT_ON) {
>  		if (udev->state != USB_STATE_NOTATTACHED)
> -			do_unbind_rebind(udev, DO_REBIND);
> +			do_rebind_interfaces(udev);
>  		status = 0;
>  
>  	/* For all other calls, take the device back to full power and
>  	 * tell the PM core in case it was autosuspended previously.
> -	 * Unbind the interfaces that will need rebinding later.
> +	 * Unbind the interfaces that will need rebinding later,
> +	 * because they fail to support reset_resume if it was needed
>  	 */

It might be better to say:

	 * Also, unbind the interfaces whose drivers failed to support
	 * reset-resume.  (This can't be done in usb_resume_interface()
	 * above because it doesn't own the right set of locks.)

Alan Stern



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux