From: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
To: Wenyou Yang <wenyou.yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>,
<broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
<khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH] spi/atmel: improve the system suspend/resume functions implementation
Date: Tue, 21 Oct 2014 19:00:54 +0200 [thread overview]
Message-ID: <54469146.8050402@atmel.com> (raw)
In-Reply-To: <1413863014-1791-1-git-send-email-wenyou.yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
On 21/10/2014 05:43, Wenyou Yang :
> To make it cleaner, the system suspend/resume directly call
> the runtime suspend/resume functions
> and remove the wapper of CONFIG_PM_RUNTIME, CONFIG_PM_SLEEP.
>
> Signed-off-by: Wenyou Yang <wenyou.yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
It looks very neat. Thanks Wenyou and Kevin!
If needed:
Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
even if I admit that I tend to put my confidence in you guys for this
enhancement ;-)
Bye,
> ---
> drivers/spi/spi-atmel.c | 61 ++++++++++++++++++++---------------------------
> 1 file changed, 26 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 3f50014..6ed1893 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -1451,11 +1451,30 @@ static int atmel_spi_remove(struct platform_device *pdev)
> }
>
> #ifdef CONFIG_PM
> -#ifdef CONFIG_PM_SLEEP
> +static int atmel_spi_runtime_suspend(struct device *dev)
> +{
> + struct spi_master *master = dev_get_drvdata(dev);
> + struct atmel_spi *as = spi_master_get_devdata(master);
> +
> + clk_disable_unprepare(as->clk);
> + pinctrl_pm_select_sleep_state(dev);
> +
> + return 0;
> +}
> +
> +static int atmel_spi_runtime_resume(struct device *dev)
> +{
> + struct spi_master *master = dev_get_drvdata(dev);
> + struct atmel_spi *as = spi_master_get_devdata(master);
> +
> + pinctrl_pm_select_default_state(dev);
> +
> + return clk_prepare_enable(as->clk);
> +}
> +
> static int atmel_spi_suspend(struct device *dev)
> {
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> + struct spi_master *master = dev_get_drvdata(dev);
> int ret;
>
> /* Stop the queue running */
> @@ -1465,23 +1484,19 @@ static int atmel_spi_suspend(struct device *dev)
> return ret;
> }
>
> - if (!pm_runtime_suspended(dev)) {
> - clk_disable_unprepare(as->clk);
> - pinctrl_pm_select_sleep_state(dev);
> - }
> + if (!pm_runtime_suspended(dev))
> + atmel_spi_runtime_suspend(dev);
>
> return 0;
> }
>
> static int atmel_spi_resume(struct device *dev)
> {
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> + struct spi_master *master = dev_get_drvdata(dev);
> int ret;
>
> if (!pm_runtime_suspended(dev)) {
> - pinctrl_pm_select_default_state(dev);
> - ret = clk_prepare_enable(as->clk);
> + ret = atmel_spi_runtime_resume(dev);
> if (ret)
> return ret;
> }
> @@ -1493,30 +1508,6 @@ static int atmel_spi_resume(struct device *dev)
>
> return ret;
> }
> -#endif
> -
> -#ifdef CONFIG_PM_RUNTIME
> -static int atmel_spi_runtime_suspend(struct device *dev)
> -{
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> -
> - clk_disable_unprepare(as->clk);
> - pinctrl_pm_select_sleep_state(dev);
> -
> - return 0;
> -}
> -
> -static int atmel_spi_runtime_resume(struct device *dev)
> -{
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> -
> - pinctrl_pm_select_default_state(dev);
> -
> - return clk_prepare_enable(as->clk);
> -}
> -#endif
>
> static const struct dev_pm_ops atmel_spi_pm_ops = {
> SET_SYSTEM_SLEEP_PM_OPS(atmel_spi_suspend, atmel_spi_resume)
>
--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] spi/atmel: improve the system suspend/resume functions implementation
Date: Tue, 21 Oct 2014 19:00:54 +0200 [thread overview]
Message-ID: <54469146.8050402@atmel.com> (raw)
In-Reply-To: <1413863014-1791-1-git-send-email-wenyou.yang@atmel.com>
On 21/10/2014 05:43, Wenyou Yang :
> To make it cleaner, the system suspend/resume directly call
> the runtime suspend/resume functions
> and remove the wapper of CONFIG_PM_RUNTIME, CONFIG_PM_SLEEP.
>
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
It looks very neat. Thanks Wenyou and Kevin!
If needed:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
even if I admit that I tend to put my confidence in you guys for this
enhancement ;-)
Bye,
> ---
> drivers/spi/spi-atmel.c | 61 ++++++++++++++++++++---------------------------
> 1 file changed, 26 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 3f50014..6ed1893 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -1451,11 +1451,30 @@ static int atmel_spi_remove(struct platform_device *pdev)
> }
>
> #ifdef CONFIG_PM
> -#ifdef CONFIG_PM_SLEEP
> +static int atmel_spi_runtime_suspend(struct device *dev)
> +{
> + struct spi_master *master = dev_get_drvdata(dev);
> + struct atmel_spi *as = spi_master_get_devdata(master);
> +
> + clk_disable_unprepare(as->clk);
> + pinctrl_pm_select_sleep_state(dev);
> +
> + return 0;
> +}
> +
> +static int atmel_spi_runtime_resume(struct device *dev)
> +{
> + struct spi_master *master = dev_get_drvdata(dev);
> + struct atmel_spi *as = spi_master_get_devdata(master);
> +
> + pinctrl_pm_select_default_state(dev);
> +
> + return clk_prepare_enable(as->clk);
> +}
> +
> static int atmel_spi_suspend(struct device *dev)
> {
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> + struct spi_master *master = dev_get_drvdata(dev);
> int ret;
>
> /* Stop the queue running */
> @@ -1465,23 +1484,19 @@ static int atmel_spi_suspend(struct device *dev)
> return ret;
> }
>
> - if (!pm_runtime_suspended(dev)) {
> - clk_disable_unprepare(as->clk);
> - pinctrl_pm_select_sleep_state(dev);
> - }
> + if (!pm_runtime_suspended(dev))
> + atmel_spi_runtime_suspend(dev);
>
> return 0;
> }
>
> static int atmel_spi_resume(struct device *dev)
> {
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> + struct spi_master *master = dev_get_drvdata(dev);
> int ret;
>
> if (!pm_runtime_suspended(dev)) {
> - pinctrl_pm_select_default_state(dev);
> - ret = clk_prepare_enable(as->clk);
> + ret = atmel_spi_runtime_resume(dev);
> if (ret)
> return ret;
> }
> @@ -1493,30 +1508,6 @@ static int atmel_spi_resume(struct device *dev)
>
> return ret;
> }
> -#endif
> -
> -#ifdef CONFIG_PM_RUNTIME
> -static int atmel_spi_runtime_suspend(struct device *dev)
> -{
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> -
> - clk_disable_unprepare(as->clk);
> - pinctrl_pm_select_sleep_state(dev);
> -
> - return 0;
> -}
> -
> -static int atmel_spi_runtime_resume(struct device *dev)
> -{
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> -
> - pinctrl_pm_select_default_state(dev);
> -
> - return clk_prepare_enable(as->clk);
> -}
> -#endif
>
> static const struct dev_pm_ops atmel_spi_pm_ops = {
> SET_SYSTEM_SLEEP_PM_OPS(atmel_spi_suspend, atmel_spi_resume)
>
--
Nicolas Ferre
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Wenyou Yang <wenyou.yang@atmel.com>, <broonie@kernel.org>,
<khilman@kernel.org>
Cc: <linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] spi/atmel: improve the system suspend/resume functions implementation
Date: Tue, 21 Oct 2014 19:00:54 +0200 [thread overview]
Message-ID: <54469146.8050402@atmel.com> (raw)
In-Reply-To: <1413863014-1791-1-git-send-email-wenyou.yang@atmel.com>
On 21/10/2014 05:43, Wenyou Yang :
> To make it cleaner, the system suspend/resume directly call
> the runtime suspend/resume functions
> and remove the wapper of CONFIG_PM_RUNTIME, CONFIG_PM_SLEEP.
>
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
It looks very neat. Thanks Wenyou and Kevin!
If needed:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
even if I admit that I tend to put my confidence in you guys for this
enhancement ;-)
Bye,
> ---
> drivers/spi/spi-atmel.c | 61 ++++++++++++++++++++---------------------------
> 1 file changed, 26 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 3f50014..6ed1893 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -1451,11 +1451,30 @@ static int atmel_spi_remove(struct platform_device *pdev)
> }
>
> #ifdef CONFIG_PM
> -#ifdef CONFIG_PM_SLEEP
> +static int atmel_spi_runtime_suspend(struct device *dev)
> +{
> + struct spi_master *master = dev_get_drvdata(dev);
> + struct atmel_spi *as = spi_master_get_devdata(master);
> +
> + clk_disable_unprepare(as->clk);
> + pinctrl_pm_select_sleep_state(dev);
> +
> + return 0;
> +}
> +
> +static int atmel_spi_runtime_resume(struct device *dev)
> +{
> + struct spi_master *master = dev_get_drvdata(dev);
> + struct atmel_spi *as = spi_master_get_devdata(master);
> +
> + pinctrl_pm_select_default_state(dev);
> +
> + return clk_prepare_enable(as->clk);
> +}
> +
> static int atmel_spi_suspend(struct device *dev)
> {
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> + struct spi_master *master = dev_get_drvdata(dev);
> int ret;
>
> /* Stop the queue running */
> @@ -1465,23 +1484,19 @@ static int atmel_spi_suspend(struct device *dev)
> return ret;
> }
>
> - if (!pm_runtime_suspended(dev)) {
> - clk_disable_unprepare(as->clk);
> - pinctrl_pm_select_sleep_state(dev);
> - }
> + if (!pm_runtime_suspended(dev))
> + atmel_spi_runtime_suspend(dev);
>
> return 0;
> }
>
> static int atmel_spi_resume(struct device *dev)
> {
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> + struct spi_master *master = dev_get_drvdata(dev);
> int ret;
>
> if (!pm_runtime_suspended(dev)) {
> - pinctrl_pm_select_default_state(dev);
> - ret = clk_prepare_enable(as->clk);
> + ret = atmel_spi_runtime_resume(dev);
> if (ret)
> return ret;
> }
> @@ -1493,30 +1508,6 @@ static int atmel_spi_resume(struct device *dev)
>
> return ret;
> }
> -#endif
> -
> -#ifdef CONFIG_PM_RUNTIME
> -static int atmel_spi_runtime_suspend(struct device *dev)
> -{
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> -
> - clk_disable_unprepare(as->clk);
> - pinctrl_pm_select_sleep_state(dev);
> -
> - return 0;
> -}
> -
> -static int atmel_spi_runtime_resume(struct device *dev)
> -{
> - struct spi_master *master = dev_get_drvdata(dev);
> - struct atmel_spi *as = spi_master_get_devdata(master);
> -
> - pinctrl_pm_select_default_state(dev);
> -
> - return clk_prepare_enable(as->clk);
> -}
> -#endif
>
> static const struct dev_pm_ops atmel_spi_pm_ops = {
> SET_SYSTEM_SLEEP_PM_OPS(atmel_spi_suspend, atmel_spi_resume)
>
--
Nicolas Ferre
next prev parent reply other threads:[~2014-10-21 17:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 3:43 [PATCH] spi/atmel: improve the system suspend/resume functions implementation Wenyou Yang
2014-10-21 3:43 ` Wenyou Yang
2014-10-21 3:43 ` Wenyou Yang
[not found] ` <1413863014-1791-1-git-send-email-wenyou.yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2014-10-21 16:55 ` Kevin Hilman
2014-10-21 16:55 ` Kevin Hilman
2014-10-21 16:55 ` Kevin Hilman
2014-10-21 17:00 ` Nicolas Ferre [this message]
2014-10-21 17:00 ` Nicolas Ferre
2014-10-21 17:00 ` Nicolas Ferre
2014-10-21 21:27 ` Mark Brown
2014-10-21 21:27 ` Mark Brown
2014-10-21 21:27 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54469146.8050402@atmel.com \
--to=nicolas.ferre-aife0yeh4naavxtiumwx3w@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=wenyou.yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.