Re: [patch] staging: speakup: remove support for lp*
Testing has shown that lp* devices don't work correctly with speakup just yet. That will require some additional work. Until then, this patch removes code related to that. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault --- drivers/staging/speakup/spk_ttyio.c | 23 +-- 1 file changed, 1 insertion(+), 22 deletions(-) --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -7,11 +7,6 @@ #include "spk_types.h" #include "spk_priv.h" -#define DEV_PREFIX_LP "lp" - -static const char * const lp_supported[] = { "acntsa", "bns", "dummy", - "txprt" }; - struct spk_ldisc_data { char buf; struct semaphore sem; @@ -36,24 +31,8 @@ static int get_dev_to_use(struct spk_syn { /* use ser only when dev is not specified */ if (strcmp(synth->dev_name, SYNTH_DEFAULT_DEV) || - synth->ser == SYNTH_DEFAULT_SER) { - /* for /dev/lp* check if synth is supported */ - if (strncmp(synth->dev_name, DEV_PREFIX_LP, - strlen(DEV_PREFIX_LP)) == 0) - if (match_string(lp_supported, ARRAY_SIZE(lp_supported), - synth->name) < 0) { - int i; - - pr_err("speakup: lp* is only supported on:"); - for (i = 0; i < ARRAY_SIZE(lp_supported); i++) - pr_cont(" %s", lp_supported[i]); - pr_cont("\n"); - - return -ENOTSUPP; - } - + synth->ser == SYNTH_DEFAULT_SER) return tty_dev_name_to_number(synth->dev_name, dev_no); - } return ser_to_dev(synth->ser, dev_no); } ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[patch] staging: speakup: fix async usb removal
When an external USB synth is unplugged while the module is loaded, we get a null pointer deref. This is because the tty disappears while speakup tries to use to to communicate with the synth. This patch fixes it by checking tty for null before using it. Since tty can become null between the check and its usage, a mutex is introduced. tty usage is now surrounded by the mutex, as is the code in speakup_ldisc_close which sets the tty to null. The mutex also serialises calls to tty from speakup code. In case of tty being null, this sets synth->alive to zero and restarts ttys in case they were stopped by speakup. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault --- drivers/staging/speakup/spk_ttyio.c | 50 1 file changed, 50 insertions(+) --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -15,6 +15,11 @@ struct spk_ldisc_data { static struct spk_synth *spk_ttyio_synth; static struct tty_struct *speakup_tty; +/* mutex to protect against speakup_tty disappearing from underneath us while + * we are using it. this can happen when the device physically unplugged, + * while in use. it also serialises access to speakup_tty. + */ +static DEFINE_MUTEX(speakup_tty_mutex); static int ser_to_dev(int ser, dev_t *dev_no) { @@ -60,8 +65,10 @@ static int spk_ttyio_ldisc_open(struct t static void spk_ttyio_ldisc_close(struct tty_struct *tty) { + mutex_lock(&speakup_tty_mutex); kfree(speakup_tty->disc_data); speakup_tty = NULL; + mutex_unlock(&speakup_tty_mutex); } static int spk_ttyio_receive_buf2(struct tty_struct *tty, @@ -189,9 +196,11 @@ void spk_ttyio_unregister_ldisc(void) static int spk_ttyio_out(struct spk_synth *in_synth, const char ch) { + mutex_lock(&speakup_tty_mutex); if (in_synth->alive && speakup_tty && speakup_tty->ops->write) { int ret = speakup_tty->ops->write(speakup_tty, &ch, 1); + mutex_unlock(&speakup_tty_mutex); if (ret == 0) /* No room */ return 0; @@ -207,17 +216,50 @@ static int spk_ttyio_out(struct spk_synt } return 1; } + + mutex_unlock(&speakup_tty_mutex); + return 0; +} + +static int check_tty(struct tty_struct *tty) +{ + if (!tty) { + pr_warn("%s: I/O error, deactivating speakup\n", + spk_ttyio_synth->long_name); + /* No synth any more, so nobody will restart TTYs, and we thus +* need to do it ourselves. Now that there is no synth we can +* let application flood anyway +*/ + spk_ttyio_synth->alive = 0; + speakup_start_ttys(); + return 1; + } + return 0; } static void spk_ttyio_send_xchar(char ch) { + mutex_lock(&speakup_tty_mutex); + if (check_tty(speakup_tty)) { + mutex_unlock(&speakup_tty_mutex); + return; + } + speakup_tty->ops->send_xchar(speakup_tty, ch); + mutex_unlock(&speakup_tty_mutex); } static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear) { + mutex_lock(&speakup_tty_mutex); + if (check_tty(speakup_tty)) { + mutex_unlock(&speakup_tty_mutex); + return; + } + speakup_tty->ops->tiocmset(speakup_tty, set, clear); + mutex_unlock(&speakup_tty_mutex); } static unsigned char ttyio_in(int timeout) @@ -257,8 +299,16 @@ static unsigned char spk_ttyio_in_nowait static void spk_ttyio_flush_buffer(void) { + mutex_lock(&speakup_tty_mutex); + if (check_tty(speakup_tty)) { + mutex_unlock(&speakup_tty_mutex); + return; + } + if (speakup_tty->ops->flush_buffer) speakup_tty->ops->flush_buffer(speakup_tty); + + mutex_unlock(&speakup_tty_mutex); } int spk_ttyio_synth_probe(struct spk_synth *synth) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: iio: adc: fix error return code in ad7606_par_probe()
On Wed, 9 Aug 2017 10:38:56 -0500 "Gustavo A. R. Silva" wrote: > platform_get_irq() returns an error code, but the ad7606_par driver > ignores it and always returns -ENODEV. This is not correct and, > prevents -EPROBE_DEFER from being propagated properly. > > Print and propagate the return value of platform_get_irq on failure. > > This issue was detected with the help of Coccinelle. > > Signed-off-by: Gustavo A. R. Silva Applied to the togreg branch of iio.git. As we have no reports of anyone actually finding this a problem I'm taking it the slow way and it will wait for the next merge window. Thanks, Jonathan > --- > drivers/staging/iio/adc/ad7606_par.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/iio/adc/ad7606_par.c > b/drivers/staging/iio/adc/ad7606_par.c > index cd6c410c..3eb6f8f 100644 > --- a/drivers/staging/iio/adc/ad7606_par.c > +++ b/drivers/staging/iio/adc/ad7606_par.c > @@ -57,8 +57,8 @@ static int ad7606_par_probe(struct platform_device *pdev) > > irq = platform_get_irq(pdev, 0); > if (irq < 0) { > - dev_err(&pdev->dev, "no irq\n"); > - return -ENODEV; > + dev_err(&pdev->dev, "no irq: %d\n", irq); > + return irq; > } > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: Fix warnings from sparse
Running sparse produced warnings regarding use of conflicting enum types and logical vs bitwise operator use. Signed-off-by: Quentin Swain --- drivers/staging/pi433/pi433_if.c | 4 ++-- drivers/staging/pi433/rf69.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index ed737f4..9d35e8d 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -210,7 +210,7 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg) { SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, always)); } - SET_CHECKED(rf69_set_packet_format (dev->spi, rx_cfg->enable_length_byte)); + SET_CHECKED(rf69_set_packet_format(dev->spi, (enum packetFormat)rx_cfg->enable_length_byte)); SET_CHECKED(rf69_set_adressFiltering(dev->spi, rx_cfg->enable_address_filtering)); SET_CHECKED(rf69_set_crc_enable (dev->spi, rx_cfg->enable_crc)); @@ -267,7 +267,7 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg) SET_CHECKED(rf69_set_preamble_length(dev->spi, 0)); } SET_CHECKED(rf69_set_sync_enable (dev->spi, tx_cfg->enable_sync)); - SET_CHECKED(rf69_set_packet_format(dev->spi, tx_cfg->enable_length_byte)); + SET_CHECKED(rf69_set_packet_format(dev->spi, (enum packetFormat)tx_cfg->enable_length_byte)); SET_CHECKED(rf69_set_crc_enable (dev->spi, tx_cfg->enable_crc)); /* configure sync, if enabled */ diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index f83523e..e6332e1 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -203,7 +203,7 @@ int rf69_set_deviation(struct spi_device *spi, u32 deviation) lsb = (f_reg&0xff); // check msb - if (msb & !FDEVMASB_MASK) + if (msb & ~FDEVMASB_MASK) { dev_dbg(&spi->dev, "set_deviation: err in calc of msb"); INVALID_PARAM; -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[GIT PULL] Staging/IIO driver fixes for 4.13-rc5
The following changes since commit 520eccdfe187591a51ea9ab4c1a024ae4d0f68d9: Linux 4.13-rc2 (2017-07-23 16:15:17 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ tags/staging-4.13-rc5 for you to fetch changes up to cef988642cdac44e910a27cb6e8166c96f86a0df: staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING (2017-07-30 08:38:43 -0700) staging/iio fixes for 4.13-rc5 Here are some Staging and IIO driver fixes for 4.13-rc5. Nothing major, just a number of small fixes for reported issues. All of these have been in linux-next for a while now with no reported issues. Full details are in the shortlog. Signed-off-by: Greg Kroah-Hartman Akinobu Mita (1): iio: light: tsl2563: use correct event code Arnd Bergmann (1): staging:iio:resolver:ad2s1210 fix negative IIO_ANGL_VEL read Greg Kroah-Hartman (1): Merge tag 'iio-fixes-for-4.13a' of git://git.kernel.org/.../jic23/iio into staging-linus Hans de Goede (3): iio: adc: Revert "axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications" iio: adc: axp288: Fix the GPADC pin reading often wrongly returning 0 iio: accel: bmc150: Always restore device to normal mode after suspend-resume Ian Abbott (1): staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING Lorenzo Bianconi (2): iio: pressure: st_pressure_core: disable multiread by default for LPS22HB iio: accel: st_accel: add SPI-3wire support Mykola Kostenok (1): iio: aspeed-adc: wait for initial sequence. Quentin Schulz (1): iio: adc: sun4i-gpadc-iio: fix unbalanced irq enable/disable Stefan-Gabriel Mirea (1): iio: adc: vf610_adc: Fix VALT selection value for REFSEL bits drivers/iio/accel/bmc150-accel-core.c | 9 +- drivers/iio/accel/st_accel_core.c | 32 +++ drivers/iio/adc/aspeed_adc.c| 26 +++ drivers/iio/adc/axp288_adc.c| 42 - drivers/iio/adc/sun4i-gpadc-iio.c | 3 +- drivers/iio/adc/vf610_adc.c | 2 +- drivers/iio/common/st_sensors/st_sensors_core.c | 29 + drivers/iio/light/tsl2563.c | 2 +- drivers/iio/pressure/st_pressure_core.c | 2 +- drivers/staging/comedi/comedi_fops.c| 3 ++ drivers/staging/iio/resolver/ad2s1210.c | 2 +- include/linux/iio/common/st_sensors.h | 7 + include/linux/platform_data/st_sensors_pdata.h | 2 ++ 13 files changed, 146 insertions(+), 15 deletions(-) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel