From: Kevin Hilman <khilman@ti.com>
To: Aaro Koskinen <aaro.koskinen@nokia.com>
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm: mach-omap2: pm: cleanup !CONFIG_SUSPEND handling
Date: Wed, 05 Jan 2011 16:25:32 -0800 [thread overview]
Message-ID: <874o9mvpxf.fsf@ti.com> (raw)
In-Reply-To: <1293640483-25610-1-git-send-email-aaro.koskinen@nokia.com> (Aaro Koskinen's message of "Wed, 29 Dec 2010 18:34:43 +0200")
Hi Aaro,
Aaro Koskinen <aaro.koskinen@nokia.com> writes:
> Make !CONFIG_SUSPEND init declarations identical on all OMAPs and
> eliminate some ifdefs.
>
> Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
I like this solution, but it introduces compiler warnings:
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm44xx.c: In function 'omap4_pm_init':
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm44xx.c:119: warning: passing argument 1 of 'suspend_set_ops' discards qualifiers from pointer target type
/opt/home/khilman/work.local/kernel/omap/pm/include/linux/suspend.h:125: note: expected 'struct platform_suspend_ops *' but argument is of type 'const struct platform_suspend_ops *'
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm24xx.c: In function 'omap2_pm_init':
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm24xx.c:585: warning: passing argument 1 of 'suspend_set_ops' discards qualifiers from pointer target type
/opt/home/khilman/work.local/kernel/omap/pm/include/linux/suspend.h:125: note: expected 'struct platform_suspend_ops *' but argument is of type 'const struct platform_suspend_ops *'
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm34xx.c: In function 'omap3_pm_init':
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm34xx.c:1072: warning: passing argument 1 of 'suspend_set_ops' discards qualifiers from pointer target type
/opt/home/khilman/work.local/kernel/omap/pm/include/linux/suspend.h:125:
note: expected 'struct platform_suspend_ops *' but argument is of type
'const struct platform_suspend_ops *'
As you likely noticed, removing the const leads to checkpatch warnings:
WARNING: struct platform_suspend_ops should normally be const
so the choice is between a checkpatch warning or a bunch of compiler
warnings.
Alternatively, I just posted a patch[1] to linux-pm propsing to fix this
at the source. Let's see what happens there. Merging $SUBJECT patch
will depend on how this is fixed upstream.
Kevin
[1] https://patchwork.kernel.org/patch/455831/
> ---
> arch/arm/mach-omap2/pm.h | 4 ++++
> arch/arm/mach-omap2/pm24xx.c | 16 ++++++++--------
> arch/arm/mach-omap2/pm34xx.c | 16 ++++++++--------
> arch/arm/mach-omap2/pm44xx.c | 17 +++++++++--------
> 4 files changed, 29 insertions(+), 24 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index 1c1b0ab..704766b 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -138,4 +138,8 @@ static inline int omap4_twl_init(void)
> }
> #endif
>
> +#ifndef CONFIG_SUSPEND
> +#define omap_pm_ops NULL
> +#endif
> +
> #endif
> diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
> index dac2d1d..e65b329 100644
> --- a/arch/arm/mach-omap2/pm24xx.c
> +++ b/arch/arm/mach-omap2/pm24xx.c
> @@ -350,14 +350,14 @@ static void omap2_pm_end(void)
> enable_hlt();
> }
>
> -static struct platform_suspend_ops omap_pm_ops = {
> - .begin = omap2_pm_begin,
> - .enter = omap2_pm_enter,
> - .end = omap2_pm_end,
> - .valid = suspend_valid_only_mem,
> +static const struct platform_suspend_ops omap_pm_ops[] = {
> + {
> + .begin = omap2_pm_begin,
> + .enter = omap2_pm_enter,
> + .end = omap2_pm_end,
> + .valid = suspend_valid_only_mem,
> + }
> };
> -#else
> -static const struct platform_suspend_ops __initdata omap_pm_ops;
> #endif /* CONFIG_SUSPEND */
>
> /* XXX This function should be shareable between OMAP2xxx and OMAP3 */
> @@ -582,7 +582,7 @@ static int __init omap2_pm_init(void)
> omap24xx_cpu_suspend_sz);
> }
>
> - suspend_set_ops(&omap_pm_ops);
> + suspend_set_ops(omap_pm_ops);
> pm_idle = omap2_pm_idle;
>
> return 0;
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 5b323f2..a4c9283 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -605,11 +605,13 @@ static void omap3_pm_end(void)
> return;
> }
>
> -static struct platform_suspend_ops omap_pm_ops = {
> - .begin = omap3_pm_begin,
> - .end = omap3_pm_end,
> - .enter = omap3_pm_enter,
> - .valid = suspend_valid_only_mem,
> +static const struct platform_suspend_ops omap_pm_ops[] = {
> + {
> + .begin = omap3_pm_begin,
> + .end = omap3_pm_end,
> + .enter = omap3_pm_enter,
> + .valid = suspend_valid_only_mem,
> + }
> };
> #endif /* CONFIG_SUSPEND */
>
> @@ -1067,9 +1069,7 @@ static int __init omap3_pm_init(void)
> core_clkdm = clkdm_lookup("core_clkdm");
>
> omap_push_sram_idle();
> -#ifdef CONFIG_SUSPEND
> - suspend_set_ops(&omap_pm_ops);
> -#endif /* CONFIG_SUSPEND */
> + suspend_set_ops(omap_pm_ops);
>
> pm_idle = omap3_pm_idle;
> omap3_idle_init();
> diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
> index e9f4862..6022c0a 100644
> --- a/arch/arm/mach-omap2/pm44xx.c
> +++ b/arch/arm/mach-omap2/pm44xx.c
> @@ -16,6 +16,7 @@
> #include <linux/err.h>
> #include <linux/slab.h>
>
> +#include "pm.h"
> #include "powerdomain.h"
> #include <mach/omap4-common.h>
>
> @@ -65,11 +66,13 @@ static void omap4_pm_end(void)
> return;
> }
>
> -static struct platform_suspend_ops omap_pm_ops = {
> - .begin = omap4_pm_begin,
> - .end = omap4_pm_end,
> - .enter = omap4_pm_enter,
> - .valid = suspend_valid_only_mem,
> +static const struct platform_suspend_ops omap_pm_ops[] = {
> + {
> + .begin = omap4_pm_begin,
> + .end = omap4_pm_end,
> + .enter = omap4_pm_enter,
> + .valid = suspend_valid_only_mem,
> + }
> };
> #endif /* CONFIG_SUSPEND */
>
> @@ -113,9 +116,7 @@ static int __init omap4_pm_init(void)
> }
> #endif
>
> -#ifdef CONFIG_SUSPEND
> - suspend_set_ops(&omap_pm_ops);
> -#endif /* CONFIG_SUSPEND */
> + suspend_set_ops(omap_pm_ops);
>
> err2:
> return ret;
WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: mach-omap2: pm: cleanup !CONFIG_SUSPEND handling
Date: Wed, 05 Jan 2011 16:25:32 -0800 [thread overview]
Message-ID: <874o9mvpxf.fsf@ti.com> (raw)
In-Reply-To: <1293640483-25610-1-git-send-email-aaro.koskinen@nokia.com> (Aaro Koskinen's message of "Wed, 29 Dec 2010 18:34:43 +0200")
Hi Aaro,
Aaro Koskinen <aaro.koskinen@nokia.com> writes:
> Make !CONFIG_SUSPEND init declarations identical on all OMAPs and
> eliminate some ifdefs.
>
> Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
I like this solution, but it introduces compiler warnings:
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm44xx.c: In function 'omap4_pm_init':
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm44xx.c:119: warning: passing argument 1 of 'suspend_set_ops' discards qualifiers from pointer target type
/opt/home/khilman/work.local/kernel/omap/pm/include/linux/suspend.h:125: note: expected 'struct platform_suspend_ops *' but argument is of type 'const struct platform_suspend_ops *'
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm24xx.c: In function 'omap2_pm_init':
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm24xx.c:585: warning: passing argument 1 of 'suspend_set_ops' discards qualifiers from pointer target type
/opt/home/khilman/work.local/kernel/omap/pm/include/linux/suspend.h:125: note: expected 'struct platform_suspend_ops *' but argument is of type 'const struct platform_suspend_ops *'
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm34xx.c: In function 'omap3_pm_init':
/opt/home/khilman/work.local/kernel/omap/pm/arch/arm/mach-omap2/pm34xx.c:1072: warning: passing argument 1 of 'suspend_set_ops' discards qualifiers from pointer target type
/opt/home/khilman/work.local/kernel/omap/pm/include/linux/suspend.h:125:
note: expected 'struct platform_suspend_ops *' but argument is of type
'const struct platform_suspend_ops *'
As you likely noticed, removing the const leads to checkpatch warnings:
WARNING: struct platform_suspend_ops should normally be const
so the choice is between a checkpatch warning or a bunch of compiler
warnings.
Alternatively, I just posted a patch[1] to linux-pm propsing to fix this
at the source. Let's see what happens there. Merging $SUBJECT patch
will depend on how this is fixed upstream.
Kevin
[1] https://patchwork.kernel.org/patch/455831/
> ---
> arch/arm/mach-omap2/pm.h | 4 ++++
> arch/arm/mach-omap2/pm24xx.c | 16 ++++++++--------
> arch/arm/mach-omap2/pm34xx.c | 16 ++++++++--------
> arch/arm/mach-omap2/pm44xx.c | 17 +++++++++--------
> 4 files changed, 29 insertions(+), 24 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index 1c1b0ab..704766b 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -138,4 +138,8 @@ static inline int omap4_twl_init(void)
> }
> #endif
>
> +#ifndef CONFIG_SUSPEND
> +#define omap_pm_ops NULL
> +#endif
> +
> #endif
> diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
> index dac2d1d..e65b329 100644
> --- a/arch/arm/mach-omap2/pm24xx.c
> +++ b/arch/arm/mach-omap2/pm24xx.c
> @@ -350,14 +350,14 @@ static void omap2_pm_end(void)
> enable_hlt();
> }
>
> -static struct platform_suspend_ops omap_pm_ops = {
> - .begin = omap2_pm_begin,
> - .enter = omap2_pm_enter,
> - .end = omap2_pm_end,
> - .valid = suspend_valid_only_mem,
> +static const struct platform_suspend_ops omap_pm_ops[] = {
> + {
> + .begin = omap2_pm_begin,
> + .enter = omap2_pm_enter,
> + .end = omap2_pm_end,
> + .valid = suspend_valid_only_mem,
> + }
> };
> -#else
> -static const struct platform_suspend_ops __initdata omap_pm_ops;
> #endif /* CONFIG_SUSPEND */
>
> /* XXX This function should be shareable between OMAP2xxx and OMAP3 */
> @@ -582,7 +582,7 @@ static int __init omap2_pm_init(void)
> omap24xx_cpu_suspend_sz);
> }
>
> - suspend_set_ops(&omap_pm_ops);
> + suspend_set_ops(omap_pm_ops);
> pm_idle = omap2_pm_idle;
>
> return 0;
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 5b323f2..a4c9283 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -605,11 +605,13 @@ static void omap3_pm_end(void)
> return;
> }
>
> -static struct platform_suspend_ops omap_pm_ops = {
> - .begin = omap3_pm_begin,
> - .end = omap3_pm_end,
> - .enter = omap3_pm_enter,
> - .valid = suspend_valid_only_mem,
> +static const struct platform_suspend_ops omap_pm_ops[] = {
> + {
> + .begin = omap3_pm_begin,
> + .end = omap3_pm_end,
> + .enter = omap3_pm_enter,
> + .valid = suspend_valid_only_mem,
> + }
> };
> #endif /* CONFIG_SUSPEND */
>
> @@ -1067,9 +1069,7 @@ static int __init omap3_pm_init(void)
> core_clkdm = clkdm_lookup("core_clkdm");
>
> omap_push_sram_idle();
> -#ifdef CONFIG_SUSPEND
> - suspend_set_ops(&omap_pm_ops);
> -#endif /* CONFIG_SUSPEND */
> + suspend_set_ops(omap_pm_ops);
>
> pm_idle = omap3_pm_idle;
> omap3_idle_init();
> diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
> index e9f4862..6022c0a 100644
> --- a/arch/arm/mach-omap2/pm44xx.c
> +++ b/arch/arm/mach-omap2/pm44xx.c
> @@ -16,6 +16,7 @@
> #include <linux/err.h>
> #include <linux/slab.h>
>
> +#include "pm.h"
> #include "powerdomain.h"
> #include <mach/omap4-common.h>
>
> @@ -65,11 +66,13 @@ static void omap4_pm_end(void)
> return;
> }
>
> -static struct platform_suspend_ops omap_pm_ops = {
> - .begin = omap4_pm_begin,
> - .end = omap4_pm_end,
> - .enter = omap4_pm_enter,
> - .valid = suspend_valid_only_mem,
> +static const struct platform_suspend_ops omap_pm_ops[] = {
> + {
> + .begin = omap4_pm_begin,
> + .end = omap4_pm_end,
> + .enter = omap4_pm_enter,
> + .valid = suspend_valid_only_mem,
> + }
> };
> #endif /* CONFIG_SUSPEND */
>
> @@ -113,9 +116,7 @@ static int __init omap4_pm_init(void)
> }
> #endif
>
> -#ifdef CONFIG_SUSPEND
> - suspend_set_ops(&omap_pm_ops);
> -#endif /* CONFIG_SUSPEND */
> + suspend_set_ops(omap_pm_ops);
>
> err2:
> return ret;
next prev parent reply other threads:[~2011-01-06 0:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-29 16:34 [PATCH] arm: mach-omap2: pm: cleanup !CONFIG_SUSPEND handling Aaro Koskinen
2010-12-29 16:34 ` Aaro Koskinen
2011-01-04 22:41 ` Kevin Hilman
2011-01-04 22:41 ` Kevin Hilman
2011-01-06 0:25 ` Kevin Hilman [this message]
2011-01-06 0:25 ` Kevin Hilman
2011-01-06 10:15 ` aaro.koskinen
2011-01-06 10:15 ` aaro.koskinen at nokia.com
2011-01-06 17:03 ` Kevin Hilman
2011-01-06 17:03 ` Kevin Hilman
2011-01-06 22:31 ` Kevin Hilman
2011-01-06 22:31 ` Kevin Hilman
2011-01-06 11:19 ` Russell King - ARM Linux
2011-01-06 11:19 ` Russell King - ARM Linux
2011-01-06 12:05 ` aaro.koskinen
2011-01-06 12:05 ` aaro.koskinen at nokia.com
2011-01-06 13:58 ` Russell King - ARM Linux
2011-01-06 13:58 ` Russell King - ARM Linux
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=874o9mvpxf.fsf@ti.com \
--to=khilman@ti.com \
--cc=aaro.koskinen@nokia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.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.