diff options
author | Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | 2015-08-18 17:42:39 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-08-26 17:20:44 +0200 |
commit | ab7373bf235ede864a72f0d2f8f9a21a1748c4a2 (patch) | |
tree | 3c4f4cc4965006f31f5556bc2c4d4f3c8633e8b4 /drivers/s390/char/ctrlchar.c | |
parent | de9c35f32410c225c585535a321ce591ea001645 (diff) | |
download | linux-ab7373bf235ede864a72f0d2f8f9a21a1748c4a2.tar.gz |
s390/ctrlchar: improve handling of magic sysrequests
Extract the sysrq handling from the ctrlchar_handle() into a separate function that can be directly used by other users. Introduce a new sysrq_work structure to embed the work_struct and to specify the magic sysrq function to be invoked. Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/char/ctrlchar.c')
-rw-r--r-- | drivers/s390/char/ctrlchar.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/s390/char/ctrlchar.c b/drivers/s390/char/ctrlchar.c index 8de2deb176d7..f7d92584b993 100644 --- a/drivers/s390/char/ctrlchar.c +++ b/drivers/s390/char/ctrlchar.c @@ -14,15 +14,21 @@ #include "ctrlchar.h" #ifdef CONFIG_MAGIC_SYSRQ -static int ctrlchar_sysrq_key; +static struct sysrq_work ctrlchar_sysrq; static void ctrlchar_handle_sysrq(struct work_struct *work) { - handle_sysrq(ctrlchar_sysrq_key); + struct sysrq_work *sysrq = container_of(work, struct sysrq_work, work); + + handle_sysrq(sysrq->key); } -static DECLARE_WORK(ctrlchar_work, ctrlchar_handle_sysrq); +void schedule_sysrq_work(struct sysrq_work *sw) +{ + INIT_WORK(&sw->work, ctrlchar_handle_sysrq); + schedule_work(&sw->work); +} #endif @@ -51,8 +57,8 @@ ctrlchar_handle(const unsigned char *buf, int len, struct tty_struct *tty) #ifdef CONFIG_MAGIC_SYSRQ /* racy */ if (len == 3 && buf[1] == '-') { - ctrlchar_sysrq_key = buf[2]; - schedule_work(&ctrlchar_work); + ctrlchar_sysrq.key = buf[2]; + schedule_sysrq_work(&ctrlchar_sysrq); return CTRLCHAR_SYSRQ; } #endif |