power/poweroff.c: mark variables with __initdata and __maybe_unused
Subsystems (2)
PATCH 1/1 power/poweroff.c: mark variables with __initdata and __maybe_unused
There is no need to keep sysrq_poweroff_op after initialization, so mark it with __initdata. Mark some of the function parameters with __maybe_unused to avoid compilation warnings.
--- kernel/power/poweroff.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/power/poweroff.c +4 -3
@@ -11,26 +11,27 @@#include <linux/workqueue.h> #include <linux/reboot.h> #include <linux/cpumask.h> +#include <linux/compiler_attributes.h> /* * When the user hits Sys-Rq o to power down the machine this is the * callback we use. */ -static void do_poweroff (struct work_struct *dummy) +static void do_poweroff (struct work_struct *dummy__maybe_unused ) {kernel_power_off (); } static DECLARE_WORK(poweroff_work, do_poweroff); -static void handle_poweroff (int key) +static void handle_poweroff (int key__maybe_unused ) {/* run sysrq poweroff on boot cpu */ schedule_work_on (cpumask_first (cpu_online_mask), &poweroff_work); } -static struct sysrq_key_op sysrq_poweroff_op = { +static struct sysrq_key_op sysrq_poweroff_op__initdata = { .handler = handle_poweroff, .help_msg ="poweroff(o)" , .action_msg ="Power Off" ,
Signature · 1 line
2.10.0
Quoted 2 lines · Nikitas Angelinas
There is no need to keep
sysrq_poweroff_opafter initialization, so mark it with__initdata.
Are you sure?
pavel@duo:/data/l/k$ grep -ri sysrq_key_op . | grep initdata pavel@duo:/data/l/k$
Pavel
Quoted 6 lines
kernel/power/poweroff.c +1
-1-static struct sysrq_key_op sysrq_poweroff_op = { +static struct sysrq_key_op sysrq_poweroff_op__initdata = { .handler = handle_poweroff, .help_msg ="poweroff(o)" , .action_msg ="Power Off" ,
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 4 lines · Pavel Machek
Quoted 2 lines · Nikitas Angelinas
There is no need to keep
sysrq_poweroff_opafter initialization, so mark it with__initdata.
Quoted 8 lines
Are you sure?
pavel@duo:/data/l/k$ grep -ri sysrq_key_op . | grep initdata pavel@duo:/data/l/k$Pavel
I am sorry about this. I completely missed the point of registering this structure. Please ignore this patch.
Cheers,
Nikitas
Quoted 10 lines
Quoted 6 lines
kernel/power/poweroff.c +1
-1-static struct sysrq_key_op sysrq_poweroff_op = { +static struct sysrq_key_op sysrq_poweroff_op__initdata = { .handler = handle_poweroff, .help_msg ="poweroff(o)" , .action_msg ="Power Off" ,Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 7 lines · Nikitas Angelinas
Quoted 6 lines · Pavel Machek
Quoted 2 lines · Nikitas Angelinas
There is no need to keep
sysrq_poweroff_opafter initialization, so mark it with__initdata.Are you sure?
Quoted 9 lines
Quoted 6 lines
pavel@duo:/data/l/k$ grep -ri sysrq_key_op . | grep initdata pavel@duo:/data/l/k$Pavel
I am sorry about this. I completely missed the point of registering this structure. Please ignore this patch.
Yup. You can have Acked-by: for the other parts.
Pavel
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
kernel/power/poweroff.c +1
-1-static struct sysrq_key_op sysrq_poweroff_op = { +static struct sysrq_key_op sysrq_poweroff_op__initdata = { .handler = handle_poweroff, .help_msg ="poweroff(o)" , .action_msg ="Power Off" ,Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html