lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 12 Sep 2014 18:36:35 +0200
From:	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To:	dinguyen@...nsource.altera.com
Cc:	paulz@...opsys.com, gregkh@...uxfoundation.org, balbi@...com,
	dinh.linux@...il.com, swarren@...dotorg.org, matthijs@...in.nl,
	r.baldyga@...sung.com, jg1.han@...sung.com,
	sachin.kamat@...aro.org, ben-linux@...ff.org,
	dianders@...omium.org, kever.yang@...k-chips.com,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv4 10/12] usb: dwc2: Add suspend/resume for gadget


[ added linux-kernel ML to cc: ]

Hi,

On Tuesday, August 26, 2014 11:20:01 AM dinguyen@...nsource.altera.com wrote:
> From: Dinh Nguyen <dinguyen@...nsource.altera.com>
> 
> Move suspend/resume code to common platform code.

This should be done at the same time that gadget/host probing is merged
to preserve bisectability.

> Signed-off-by: Dinh Nguyen <dinguyen@...nsource.altera.com>
> Acked-by: Paul Zimmerman <paulz@...opsys.com>
> ---
>  drivers/usb/dwc2/core.h     |  6 ++++++
>  drivers/usb/dwc2/gadget.c   |  4 ++--
>  drivers/usb/dwc2/platform.c | 23 +++++++++++++++++++++++
>  3 files changed, 31 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index bbb0f52..5bb7e801 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -964,12 +964,18 @@ extern u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg);
>  #if defined(CONFIG_USB_DWC2_PERIPHERAL) || defined(CONFIG_USB_DWC2_DUAL_ROLE)
>  extern int s3c_hsotg_remove(struct dwc2_hsotg *hsotg);
>  extern void s3c_hsotg_core_init(struct dwc2_hsotg *dwc2);
> +extern int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2);
> +extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2);
>  extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq);
>  irqreturn_t s3c_hsotg_irq(int irq, void *pw);
>  #else
>  static inline void s3c_hsotg_core_init(struct dwc2_hsotg *dwc2) {}
>  static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2)
>  { return 0; }
> +static inline int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2)
> +{ return 0; }
> +static inline int s3c_hsotg_resume(struct dwc2_hsotg *dwc2)
> +{ return 0; }
>  static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
>  { return 0; }
>  static inline irqreturn_t s3c_hsotg_irq(int irq, void *pw)
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index aab1b45..09d591e 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -3552,7 +3552,7 @@ int s3c_hsotg_remove(struct dwc2_hsotg *hsotg)
>  	return 0;
>  }
>  
> -static int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg)
> +int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg)
>  {
>  	unsigned long flags;
>  	int ret = 0;
> @@ -3581,7 +3581,7 @@ static int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg)
>  	return ret;
>  }
>  
> -static int s3c_hsotg_resume(struct dwc2_hsotg *hsotg)
> +int s3c_hsotg_resume(struct dwc2_hsotg *hsotg)
>  {
>  	unsigned long flags;
>  	int ret = 0;
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index 278135d..59265ad 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -206,6 +206,27 @@ static int dwc2_driver_probe(struct platform_device *dev)
>  	return retval;
>  }
>  
> +static int dwc2_suspend(struct platform_device *dev, pm_message_t state)
> +{
> +	struct dwc2_hsotg *dwc2 = platform_get_drvdata(dev);
> +	int ret = 0;
> +
> +	if (dwc2_is_device_mode(dwc2))
> +		ret = s3c_hsotg_suspend(dwc2);
> +	return ret;
> +}
> +
> +static int dwc2_resume(struct platform_device *dev)
> +{
> +	struct dwc2_hsotg *dwc2 = platform_get_drvdata(dev);
> +	int ret = 0;
> +
> +	if (dwc2_is_device_mode(dwc2))
> +		ret = s3c_hsotg_resume(dwc2);
> +
> +	return ret;
> +}
> +
>  static struct platform_driver dwc2_platform_driver = {
>  	.driver = {
>  		.name = dwc2_driver_name,
> @@ -213,6 +234,8 @@ static struct platform_driver dwc2_platform_driver = {
>  	},
>  	.probe = dwc2_driver_probe,
>  	.remove = dwc2_driver_remove,
> +	.suspend = dwc2_suspend,
> +	.resume = dwc2_resume,

Please use the new PM API (struct dev_pm_ops).

>  };
>  
>  module_platform_driver(dwc2_platform_driver);

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ