Re: [PATCH 2/3] usb: xhci: Add the suspend/resume functionality

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

 



On Wed, Oct 10, 2012 at 07:35:48PM +0530, Vikas C Sajjan wrote:
> From: Vikas Sajjan <vikas.sajjan@xxxxxxxxxx>
> 
> Adding the suspend and resume functionality for the XHCI driver
> 
> Signed-off-by: Abhilash Kesavan <a.kesavan@xxxxxxxxxxx>
> Signed-off-by: Vikas C Sajjan <vikas.sajjan@xxxxxxxxxx>
> CC: Doug Anderson <dianders@xxxxxxxxxxxx>
> ---
>  drivers/usb/host/xhci-plat.c |   44 ++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 44 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index df90fe5..384cf4d 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -185,11 +185,55 @@ static int xhci_plat_remove(struct platform_device *dev)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM
> +static int xhci_plat_suspend(struct device *dev)
> +{
> +	struct usb_hcd		*hcd;
> +	struct xhci_hcd		*xhci;
> +
> +	hcd = dev_get_drvdata(dev);

make it a single line, together with declaration.

> +	if (!hcd)
> +		return -EINVAL;

remove this.

> +	xhci = hcd_to_xhci(hcd);

make it a single line, together with declaration.

> +	/* Make sure that the HCD Core as set state HC_STATE_SUSPENDED */

HCD Core *HAS* set ??? I think this also deserves a "to" after "state":

	/* Make sure HCD Core has set state to HC_STATE_SUSPENDED */

> +	if (hcd->state != HC_STATE_SUSPENDED ||
> +		xhci->shared_hcd->state != HC_STATE_SUSPENDED)
> +		return -EINVAL;
> +
> +	return xhci_suspend(xhci);
> +}
> +
> +static int xhci_plat_resume(struct device *dev)
> +{
> +	struct usb_hcd		*hcd;
> +	struct xhci_hcd		*xhci;
> +
> +	hcd = dev_get_drvdata(dev);

make it a single line, together with declaration.


> +	if (!hcd)
> +		return -EINVAL;

remove this.

> +
> +	xhci = hcd_to_xhci(hcd);

make it a single line, together with declaration.

> +	return xhci_resume(xhci, 0);
> +}

this should look like:

static int xhci_plat_resume(struct device *dev)
{
	struct usb_hcd		*hcd = dev_get_drvdata(dev);
	struct xhci_hcd		*xhci = hcd_to_xhci(hcd);

	return xhci_resume(xhci, 0);
}

> +static const struct dev_pm_ops xhci_plat_pm_ops = {
> +	.suspend		= xhci_plat_suspend,
> +	.resume			= xhci_plat_resume,
> +};

#define XHCI_PLAT_PM_OPS	(&xhci_plat_pm_ops)
#else
#define XHCI_PLAT_PM_OPS	NULL
#endif

> +#endif
> +
>  static struct platform_driver usb_xhci_driver = {
>  	.probe	= xhci_plat_probe,
>  	.remove	= xhci_plat_remove,
>  	.driver	= {
>  		.name = "xhci-hcd",
> +#ifdef CONFIG_PM
> +		.pm = &xhci_plat_pm_ops,
> +#endif

		.pm = XHCI_PLAT_PM_OPS,

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux