staging: speakup: add functions to register and unregister ldisc
authorOkash Khawaja <okash.khawaja@gmail.com>
Sun, 16 Jul 2017 16:18:25 +0000 (17:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Jul 2017 07:03:21 +0000 (09:03 +0200)
This patch adds the above two functions and makes them available to
main.c where they will be called during init and exit functions of
main speakup module. Following patch will make use of them.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/speakup/spk_priv.h
drivers/staging/speakup/spk_ttyio.c

index 87b6a0a4c54dc80c8cbbbbf3b3c7d4208827cbcc..046040ac074c63851e8b289d5a6bf0f05b31684d 100644 (file)
@@ -48,6 +48,8 @@ void spk_stop_serial_interrupt(void);
 int spk_wait_for_xmitr(struct spk_synth *in_synth);
 void spk_serial_release(void);
 void spk_ttyio_release(void);
+void spk_ttyio_register_ldisc(void);
+void spk_ttyio_unregister_ldisc(void);
 
 void synth_buffer_skip_nonlatin1(void);
 u16 synth_buffer_getc(void);
index 924034a3de4b72a372c53f6fe371a3449ae9016b..9b02345f66cc2dab27ab5d5c49b0f4239ef63073 100644 (file)
@@ -200,6 +200,18 @@ static int spk_ttyio_initialise_ldisc(struct spk_synth *synth)
        return ret;
 }
 
+void spk_ttyio_register_ldisc(void)
+{
+       if (tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops))
+               pr_warn("speakup: Error registering line discipline. Most synths won't work.\n");
+}
+
+void spk_ttyio_unregister_ldisc(void)
+{
+       if (tty_unregister_ldisc(N_SPEAKUP))
+               pr_warn("speakup: Couldn't unregister ldisc\n");
+}
+
 static int spk_ttyio_out(struct spk_synth *in_synth, const char ch)
 {
        if (in_synth->alive && speakup_tty && speakup_tty->ops->write) {