From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux@maxim.org.za, linux-arm-kernel@lists.infradead.org,
rjw@sisk.pl, plagnioj@jcrosoft.com, linux-pm@vger.kernel.org,
linaro-kernel@lists.linaro.org
Subject: Re: [RFC patch 1/2] ARM: at91: cpuidle: encapsulate the standby code
Date: Mon, 15 Apr 2013 15:54:38 +0200 [thread overview]
Message-ID: <516C069E.2040205@atmel.com> (raw)
In-Reply-To: <1366032598-23053-2-git-send-email-daniel.lezcano@linaro.org>
Hi Daniel,
On 04/15/2013 03:29 PM, Daniel Lezcano :
> In order to split the pm code from the cpuidle driver, add an ops for the
> standby function which will be initialized by the pm init functions directly,
> thus no need of the SoC specific headers.
>
> Cleanup also the headers included in this file as they are no longer needed.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> arch/arm/mach-at91/cpuidle.c | 19 ++++---------------
> arch/arm/mach-at91/pm.c | 8 +++++++-
> 2 files changed, 11 insertions(+), 16 deletions(-)
>
> diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
> index 48f1228..b2bec92 100644
> --- a/arch/arm/mach-at91/cpuidle.c
> +++ b/arch/arm/mach-at91/cpuidle.c
> @@ -13,32 +13,21 @@
> * #2 wait-for-interrupt and RAM self refresh
> */
>
> -#include <linux/kernel.h>
> +#include <linux/module.h>
> #include <linux/init.h>
> -#include <linux/platform_device.h>
> #include <linux/cpuidle.h>
> -#include <linux/io.h>
> -#include <linux/export.h>
> -#include <asm/proc-fns.h>
> #include <asm/cpuidle.h>
> -#include <mach/cpu.h>
> -
> -#include "pm.h"
>
> #define AT91_MAX_STATES 2
>
> +extern void (*at91_standby_ops)(void);
> +
> /* Actual code that puts the SoC in different idle states */
> static int at91_enter_idle(struct cpuidle_device *dev,
> struct cpuidle_driver *drv,
> int index)
> {
> - if (cpu_is_at91rm9200())
> - at91rm9200_standby();
> - else if (cpu_is_at91sam9g45())
> - at91sam9g45_standby();
> - else
> - at91sam9_standby();
> -
> + at91_standby_ops();
> return index;
> }
>
> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
> index 73f1f25..f456e86 100644
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -39,6 +39,8 @@
> #include "at91_rstc.h"
> #include "at91_shdwc.h"
>
> +void (*at91_standby_ops)(void);
Is this a common pattern to have such a floating function pointer in the
pm code?
> +
> static void __init show_reset_status(void)
> {
> static char reset[] __initdata = "reset";
> @@ -321,8 +323,12 @@ static int __init at91_pm_init(void)
> pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : ""));
>
> /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */
> - if (cpu_is_at91rm9200())
> + if (cpu_is_at91rm9200()) {
> at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0);
> + at91_standby_ops = at91rm9200_standby;
> + } else if (cpu_is_at91sam9g45())
CodingStyle: ending "{" is missing.
> + at91_standby_ops= at91sam9g45_standby;
CodingStyle: " " is missing
> + else at91_standby_ops = at91sam9_standby;
CodingStyle: not on the same line + "{}" missing
>
> suspend_set_ops(&at91_pm_ops);
I am in favor for the move. But please rewrite a new series.
Bye,
--
Nicolas Ferre
WARNING: multiple messages have this Message-ID (diff)
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC patch 1/2] ARM: at91: cpuidle: encapsulate the standby code
Date: Mon, 15 Apr 2013 15:54:38 +0200 [thread overview]
Message-ID: <516C069E.2040205@atmel.com> (raw)
In-Reply-To: <1366032598-23053-2-git-send-email-daniel.lezcano@linaro.org>
Hi Daniel,
On 04/15/2013 03:29 PM, Daniel Lezcano :
> In order to split the pm code from the cpuidle driver, add an ops for the
> standby function which will be initialized by the pm init functions directly,
> thus no need of the SoC specific headers.
>
> Cleanup also the headers included in this file as they are no longer needed.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> arch/arm/mach-at91/cpuidle.c | 19 ++++---------------
> arch/arm/mach-at91/pm.c | 8 +++++++-
> 2 files changed, 11 insertions(+), 16 deletions(-)
>
> diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
> index 48f1228..b2bec92 100644
> --- a/arch/arm/mach-at91/cpuidle.c
> +++ b/arch/arm/mach-at91/cpuidle.c
> @@ -13,32 +13,21 @@
> * #2 wait-for-interrupt and RAM self refresh
> */
>
> -#include <linux/kernel.h>
> +#include <linux/module.h>
> #include <linux/init.h>
> -#include <linux/platform_device.h>
> #include <linux/cpuidle.h>
> -#include <linux/io.h>
> -#include <linux/export.h>
> -#include <asm/proc-fns.h>
> #include <asm/cpuidle.h>
> -#include <mach/cpu.h>
> -
> -#include "pm.h"
>
> #define AT91_MAX_STATES 2
>
> +extern void (*at91_standby_ops)(void);
> +
> /* Actual code that puts the SoC in different idle states */
> static int at91_enter_idle(struct cpuidle_device *dev,
> struct cpuidle_driver *drv,
> int index)
> {
> - if (cpu_is_at91rm9200())
> - at91rm9200_standby();
> - else if (cpu_is_at91sam9g45())
> - at91sam9g45_standby();
> - else
> - at91sam9_standby();
> -
> + at91_standby_ops();
> return index;
> }
>
> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
> index 73f1f25..f456e86 100644
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -39,6 +39,8 @@
> #include "at91_rstc.h"
> #include "at91_shdwc.h"
>
> +void (*at91_standby_ops)(void);
Is this a common pattern to have such a floating function pointer in the
pm code?
> +
> static void __init show_reset_status(void)
> {
> static char reset[] __initdata = "reset";
> @@ -321,8 +323,12 @@ static int __init at91_pm_init(void)
> pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : ""));
>
> /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */
> - if (cpu_is_at91rm9200())
> + if (cpu_is_at91rm9200()) {
> at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0);
> + at91_standby_ops = at91rm9200_standby;
> + } else if (cpu_is_at91sam9g45())
CodingStyle: ending "{" is missing.
> + at91_standby_ops= at91sam9g45_standby;
CodingStyle: " " is missing
> + else at91_standby_ops = at91sam9_standby;
CodingStyle: not on the same line + "{}" missing
>
> suspend_set_ops(&at91_pm_ops);
I am in favor for the move. But please rewrite a new series.
Bye,
--
Nicolas Ferre
next prev parent reply other threads:[~2013-04-15 13:54 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-15 13:29 [RFC patch 0/2] ARM: at91: cpuidle: move driver to drivers/cpuidle Daniel Lezcano
2013-04-15 13:29 ` Daniel Lezcano
2013-04-15 13:29 ` [RFC patch 1/2] ARM: at91: cpuidle: encapsulate the standby code Daniel Lezcano
2013-04-15 13:29 ` Daniel Lezcano
2013-04-15 13:54 ` Nicolas Ferre [this message]
2013-04-15 13:54 ` Nicolas Ferre
2013-04-15 14:13 ` Daniel Lezcano
2013-04-15 14:13 ` Daniel Lezcano
2013-04-15 14:17 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-15 14:17 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-15 13:29 ` [RFC patch 2/2] ARM: at91: cpuidle: move the driver to drivers/cpuidle directory Daniel Lezcano
2013-04-15 13:29 ` Daniel Lezcano
2013-04-15 14:14 ` Nicolas Ferre
2013-04-15 14:14 ` Nicolas Ferre
2013-04-15 14:29 ` Daniel Lezcano
2013-04-15 14:29 ` Daniel Lezcano
2013-04-15 14:20 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-15 14:20 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-15 14:37 ` Daniel Lezcano
2013-04-15 14:37 ` Daniel Lezcano
2013-04-15 16:00 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-15 16:00 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-16 22:39 ` Daniel Lezcano
2013-04-16 22:39 ` Daniel Lezcano
2013-06-21 10:51 ` Daniel Lezcano
2013-06-21 10:51 ` Daniel Lezcano
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=516C069E.2040205@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=daniel.lezcano@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@maxim.org.za \
--cc=plagnioj@jcrosoft.com \
--cc=rjw@sisk.pl \
/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.