Re: [PATCH v2 6/9] usb: add runtime pm support for usb port device

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

 



On Fri, 4 Jan 2013, Lan Tianyu wrote:

> This patch is to add runtime pm callback for usb port device.
> Set/clear PORT_POWER feature in the resume/suspend callbak.
> Add portnum for struct usb_port to record port number. Do
> pm_rumtime_get_sync/put(portdev) when a device is plugged/unplugged
> to prevent it from being power off when it is active.

> --- a/drivers/usb/core/port.c
> +++ b/drivers/usb/core/port.c

> @@ -68,9 +69,42 @@ static void usb_port_device_release(struct device *dev)
>  	kfree(port_dev);
>  }
>  
> +static int usb_port_runtime_resume(struct device *dev)
> +{
> +	struct usb_port *port_dev = to_usb_port(dev);
> +	struct usb_device *hdev =
> +		to_usb_device(dev->parent->parent);
> +
> +	return usb_hub_set_port_power(hdev, port_dev->portnum,
> +			true);
> +}

usb_port_runtime_resume can be called while the hub is suspended,
right?  So it needs to call usb_autopm_get_interface and
usb_autopm_put_interface.

The same is probably true for usb_port_runtime_suspend.

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