Commit 990162f0 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c74c9318
...@@ -129,10 +129,9 @@ static void button_consume_callbacks (int bpcount) ...@@ -129,10 +129,9 @@ static void button_consume_callbacks (int bpcount)
static void button_sequence_finished (unsigned long parameters) static void button_sequence_finished (unsigned long parameters)
{ {
#ifdef CONFIG_NWBUTTON_REBOOT /* Reboot using button is enabled */ if (IS_ENABLED(CONFIG_NWBUTTON_REBOOT) &&
if (button_press_count == reboot_count) button_press_count == reboot_count)
kill_cad_pid(SIGINT, 1); /* Ask init to reboot us */ kill_cad_pid(SIGINT, 1); /* Ask init to reboot us */
#endif /* CONFIG_NWBUTTON_REBOOT */
button_consume_callbacks (button_press_count); button_consume_callbacks (button_press_count);
bcount = sprintf (button_output_buffer, "%d\n", button_press_count); bcount = sprintf (button_output_buffer, "%d\n", button_press_count);
button_press_count = 0; /* Reset the button press counter */ button_press_count = 0; /* Reset the button press counter */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment