diff options
author | Okash Khawaja <okash.khawaja@gmail.com> | 2017-06-25 19:40:02 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-06-27 09:12:33 +0200 |
commit | 8a21ff775f5654eb078ae57ba64cdbd32b9297c4 (patch) | |
tree | 88844ed5263939622249d8baa8f360feddcb693e /drivers/staging/speakup/spk_ttyio.c | |
parent | staging: speakup: check and convert dev name or ser to dev_t (diff) | |
download | linux-dev-8a21ff775f5654eb078ae57ba64cdbd32b9297c4.tar.xz linux-dev-8a21ff775f5654eb078ae57ba64cdbd32b9297c4.zip |
staging: speakup: make ttyio synths use device name
This patch introduces new module parameter, dev, which takes a string
representing the device that the external synth is connected to, e.g.
ttyS0, ttyUSB0 etc. This is then used to communicate with the synth.
That way, speakup can support more than ttyS*. As of this patch, it
only supports ttyS*, ttyUSB* and selected synths for lp*. dev parameter
is only available for tty-migrated synths.
Users will either use dev or ser as both serve same purpose. This patch
maintains backward compatility by allowing ser to be specified. When
both are specified, whichever is non-default, i.e. not ttyS0, is used.
If both are non-default then dev is used.
Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/speakup/spk_ttyio.c')
-rw-r--r-- | drivers/staging/speakup/spk_ttyio.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index 0a5436706e74..442f191a017e 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -147,11 +147,12 @@ static inline void get_termios(struct tty_struct *tty, struct ktermios *out_term up_read(&tty->termios_rwsem); } -static int spk_ttyio_initialise_ldisc(int ser) +static int spk_ttyio_initialise_ldisc(struct spk_synth *synth) { int ret = 0; struct tty_struct *tty; struct ktermios tmp_termios; + dev_t dev; ret = tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops); if (ret) { @@ -159,13 +160,11 @@ static int spk_ttyio_initialise_ldisc(int ser) return ret; } - if (ser < 0 || ser > (255 - 64)) { - pr_err("speakup: Invalid ser param. Must be between 0 and 191 inclusive.\n"); - return -EINVAL; - } + ret = get_dev_to_use(synth, &dev); + if (ret) + return ret; - /* TODO: support more than ttyS* */ - tty = tty_open_by_driver(MKDEV(4, (ser + 64)), NULL, NULL); + tty = tty_open_by_driver(dev, NULL, NULL); if (IS_ERR(tty)) return PTR_ERR(tty); @@ -277,7 +276,7 @@ static void spk_ttyio_flush_buffer(void) int spk_ttyio_synth_probe(struct spk_synth *synth) { - int rv = spk_ttyio_initialise_ldisc(synth->ser); + int rv = spk_ttyio_initialise_ldisc(synth); if (rv) return rv; |