Commit f06327d1 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Greg Kroah-Hartman

sysrq: Remove sysrq_handler_registered

sysrq_toggle_support() can be called in parallel, in return calling
input_(un)register_handler(), which fortunately is safe to call
in parallel and regardless of registered/unregistered status of
sysrq_handler.
Remove sysrq_handler_registered as it doesn't have any function there
and may confuse reader about possible race.
Signed-off-by: default avatarDmitry Safonov <dima@arista.com>
Link: https://lore.kernel.org/r/20191213000657.931618-2-dima@arista.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4484aa80
...@@ -967,8 +967,6 @@ static struct input_handler sysrq_handler = { ...@@ -967,8 +967,6 @@ static struct input_handler sysrq_handler = {
.id_table = sysrq_ids, .id_table = sysrq_ids,
}; };
static bool sysrq_handler_registered;
static inline void sysrq_register_handler(void) static inline void sysrq_register_handler(void)
{ {
int error; int error;
...@@ -978,16 +976,11 @@ static inline void sysrq_register_handler(void) ...@@ -978,16 +976,11 @@ static inline void sysrq_register_handler(void)
error = input_register_handler(&sysrq_handler); error = input_register_handler(&sysrq_handler);
if (error) if (error)
pr_err("Failed to register input handler, error %d", error); pr_err("Failed to register input handler, error %d", error);
else
sysrq_handler_registered = true;
} }
static inline void sysrq_unregister_handler(void) static inline void sysrq_unregister_handler(void)
{ {
if (sysrq_handler_registered) {
input_unregister_handler(&sysrq_handler); input_unregister_handler(&sysrq_handler);
sysrq_handler_registered = false;
}
} }
static int sysrq_reset_seq_param_set(const char *buffer, static int sysrq_reset_seq_param_set(const char *buffer,
......
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