diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-01-25 10:54:25 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-09 20:39:56 -0500 |
commit | 990162f038400bd229685316beea1155be095125 (patch) | |
tree | 71695cf035b137fe12937beb875936e2c5c1a0fb /drivers/char/nwbutton.c | |
parent | c74c9318a3a76c3714785bc06147dd207a9d0aa3 (diff) |
char: nwbutton: avoid unused variable warning
When CONFIG_NWBUTTON_REBOOT is disabled, we get a warning about
an unused variable:
drivers/char/nwbutton.c:37:12: warning: 'reboot_count' defined but not used [-Wunused-variable]
static int reboot_count = NUM_PRESSES_REBOOT; /* Number of presses to reboot */
Using if(IS_ENABLED()) instead of #ifdef around the user makes the
code nicer to read and avoids the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char/nwbutton.c')
-rw-r--r-- | drivers/char/nwbutton.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c index 76c490fa0511..0e184426db98 100644 --- a/drivers/char/nwbutton.c +++ b/drivers/char/nwbutton.c | |||
@@ -129,10 +129,9 @@ static void button_consume_callbacks (int bpcount) | |||
129 | 129 | ||
130 | static void button_sequence_finished (unsigned long parameters) | 130 | static void button_sequence_finished (unsigned long parameters) |
131 | { | 131 | { |
132 | #ifdef CONFIG_NWBUTTON_REBOOT /* Reboot using button is enabled */ | 132 | if (IS_ENABLED(CONFIG_NWBUTTON_REBOOT) && |
133 | if (button_press_count == reboot_count) | 133 | button_press_count == reboot_count) |
134 | kill_cad_pid(SIGINT, 1); /* Ask init to reboot us */ | 134 | kill_cad_pid(SIGINT, 1); /* Ask init to reboot us */ |
135 | #endif /* CONFIG_NWBUTTON_REBOOT */ | ||
136 | button_consume_callbacks (button_press_count); | 135 | button_consume_callbacks (button_press_count); |
137 | bcount = sprintf (button_output_buffer, "%d\n", button_press_count); | 136 | bcount = sprintf (button_output_buffer, "%d\n", button_press_count); |
138 | button_press_count = 0; /* Reset the button press counter */ | 137 | button_press_count = 0; /* Reset the button press counter */ |