* [PATCH] power/poweroff.c: mark variables with __initdata and __maybe_unused
@ 2019-05-02 7:43 Nikitas Angelinas
2019-05-02 10:15 ` Pavel Machek
0 siblings, 1 reply; 4+ messages in thread
From: Nikitas Angelinas @ 2019-05-02 7:43 UTC (permalink / raw)
To: Rafael J. Wysocki, Pavel Machek, Len Brown, linux-pm,
linux-kernel
Cc: nikitas.angelinas
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.
Signed-off-by: Nikitas Angelinas <nikitas.angelinas@gmail.com>
---
kernel/power/poweroff.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/power/poweroff.c b/kernel/power/poweroff.c
index 7ef6866..d507152 100644
--- a/kernel/power/poweroff.c
+++ b/kernel/power/poweroff.c
@@ -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",
--
2.10.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] power/poweroff.c: mark variables with __initdata and __maybe_unused
2019-05-02 7:43 [PATCH] power/poweroff.c: mark variables with __initdata and __maybe_unused Nikitas Angelinas
@ 2019-05-02 10:15 ` Pavel Machek
2019-05-02 17:59 ` Nikitas Angelinas
0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2019-05-02 10:15 UTC (permalink / raw)
To: Nikitas Angelinas; +Cc: Rafael J. Wysocki, Len Brown, linux-pm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 655 bytes --]
On Thu 2019-05-02 00:43:05, Nikitas Angelinas wrote:
> There is no need to keep sysrq_poweroff_op after 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
>
> -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",
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] power/poweroff.c: mark variables with __initdata and __maybe_unused
2019-05-02 10:15 ` Pavel Machek
@ 2019-05-02 17:59 ` Nikitas Angelinas
2019-05-02 18:22 ` Pavel Machek
0 siblings, 1 reply; 4+ messages in thread
From: Nikitas Angelinas @ 2019-05-02 17:59 UTC (permalink / raw)
To: Pavel Machek; +Cc: Rafael J. Wysocki, Len Brown, linux-pm, linux-kernel
On Thu, May 02, 2019 at 12:15:00PM +0200, Pavel Machek wrote:
> On Thu 2019-05-02 00:43:05, Nikitas Angelinas wrote:
> > There is no need to keep sysrq_poweroff_op after 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
>
I am sorry about this. I completely missed the point of registering this
structure. Please ignore this patch.
Cheers,
Nikitas
> >
> > -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",
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] power/poweroff.c: mark variables with __initdata and __maybe_unused
2019-05-02 17:59 ` Nikitas Angelinas
@ 2019-05-02 18:22 ` Pavel Machek
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2019-05-02 18:22 UTC (permalink / raw)
To: Nikitas Angelinas; +Cc: Rafael J. Wysocki, Len Brown, linux-pm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1199 bytes --]
On Thu 2019-05-02 10:59:58, Nikitas Angelinas wrote:
> On Thu, May 02, 2019 at 12:15:00PM +0200, Pavel Machek wrote:
> > On Thu 2019-05-02 00:43:05, Nikitas Angelinas wrote:
> > > There is no need to keep sysrq_poweroff_op after 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
> >
> 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
> > >
> > > -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",
> >
> > --
> > (english) http://www.livejournal.com/~pavelmachek
> > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-02 18:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-02 7:43 [PATCH] power/poweroff.c: mark variables with __initdata and __maybe_unused Nikitas Angelinas
2019-05-02 10:15 ` Pavel Machek
2019-05-02 17:59 ` Nikitas Angelinas
2019-05-02 18:22 ` Pavel Machek
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).