* [PATCH] PM: fix suspend_set_ops() to take const pointer
@ 2011-01-06 0:22 Kevin Hilman
2011-01-06 18:55 ` Kevin Hilman
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Hilman @ 2011-01-06 0:22 UTC (permalink / raw)
To: linux-arm-kernel
checkpatch warns that pointers for certain structs should be const,
and platform_suspend_ops is one of those structs. If you follow this
suggestion you trade a checkpatch warning for a compiler warning of
the form:
warning: passing argument 1 of 'suspend_set_ops' discards qualifiers from pointer target type
Fix suspend_set_ops() to take a const pointer so everyone expects
const.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
Applies to v2.6.37, but also applies cleanly to suspend-2.6/linux-next
include/linux/suspend.h | 4 ++--
kernel/power/suspend.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 2669751..bb98383 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -122,7 +122,7 @@ struct platform_suspend_ops {
* suspend_set_ops - set platform dependent suspend operations
* @ops: The new suspend operations to set.
*/
-extern void suspend_set_ops(struct platform_suspend_ops *ops);
+extern void suspend_set_ops(const struct platform_suspend_ops *ops);
extern int suspend_valid_only_mem(suspend_state_t state);
/**
@@ -147,7 +147,7 @@ extern int pm_suspend(suspend_state_t state);
#else /* !CONFIG_SUSPEND */
#define suspend_valid_only_mem NULL
-static inline void suspend_set_ops(struct platform_suspend_ops *ops) {}
+static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
#endif /* !CONFIG_SUSPEND */
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index ecf7705..0c0af3d 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -36,7 +36,7 @@ static struct platform_suspend_ops *suspend_ops;
* suspend_set_ops - Set the global suspend method table.
* @ops: Pointer to ops structure.
*/
-void suspend_set_ops(struct platform_suspend_ops *ops)
+void suspend_set_ops(const struct platform_suspend_ops *ops)
{
mutex_lock(&pm_mutex);
suspend_ops = ops;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] PM: fix suspend_set_ops() to take const pointer
2011-01-06 0:22 [PATCH] PM: fix suspend_set_ops() to take const pointer Kevin Hilman
@ 2011-01-06 18:55 ` Kevin Hilman
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Hilman @ 2011-01-06 18:55 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 2011-01-05 at 16:22 -0800, Kevin Hilman wrote:
> checkpatch warns that pointers for certain structs should be const,
> and platform_suspend_ops is one of those structs. If you follow this
> suggestion you trade a checkpatch warning for a compiler warning of
> the form:
>
> warning: passing argument 1 of 'suspend_set_ops' discards qualifiers from pointer target type
>
> Fix suspend_set_ops() to take a const pointer so everyone expects
> const.
>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
> ---
> Applies to v2.6.37, but also applies cleanly to suspend-2.6/linux-next
Oops, plese disregard. This is already fixed in linux-next.
Kevin
> include/linux/suspend.h | 4 ++--
> kernel/power/suspend.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/suspend.h b/include/linux/suspend.h
> index 2669751..bb98383 100644
> --- a/include/linux/suspend.h
> +++ b/include/linux/suspend.h
> @@ -122,7 +122,7 @@ struct platform_suspend_ops {
> * suspend_set_ops - set platform dependent suspend operations
> * @ops: The new suspend operations to set.
> */
> -extern void suspend_set_ops(struct platform_suspend_ops *ops);
> +extern void suspend_set_ops(const struct platform_suspend_ops *ops);
> extern int suspend_valid_only_mem(suspend_state_t state);
>
> /**
> @@ -147,7 +147,7 @@ extern int pm_suspend(suspend_state_t state);
> #else /* !CONFIG_SUSPEND */
> #define suspend_valid_only_mem NULL
>
> -static inline void suspend_set_ops(struct platform_suspend_ops *ops) {}
> +static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
> static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
> #endif /* !CONFIG_SUSPEND */
>
> diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
> index ecf7705..0c0af3d 100644
> --- a/kernel/power/suspend.c
> +++ b/kernel/power/suspend.c
> @@ -36,7 +36,7 @@ static struct platform_suspend_ops *suspend_ops;
> * suspend_set_ops - Set the global suspend method table.
> * @ops: Pointer to ops structure.
> */
> -void suspend_set_ops(struct platform_suspend_ops *ops)
> +void suspend_set_ops(const struct platform_suspend_ops *ops)
> {
> mutex_lock(&pm_mutex);
> suspend_ops = ops;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-06 18:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-06 0:22 [PATCH] PM: fix suspend_set_ops() to take const pointer Kevin Hilman
2011-01-06 18:55 ` Kevin Hilman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).