spi: davinci: fix spurious i/o error
v2 cover spi: davinci: fix spurious i/o error
This patch series fixes a spurious I/O error with
DaVinci SPI.
v2:
- Update to handle DMA case
- add a patch to use dev_err() for error reporting
Sekhar Nori (2):
spi: davinci: fix spurious i/o error
spi: davinci: use dev_err() for error reporting
drivers/spi/spi-davinci.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
Signature · 1 line
2.6.3
PATCH v2 1/2 spi: davinci: fix spurious i/o error
davinci_spi_bufs() uses wait_for_completion_interruptible() without bothering to handle -ERESTARTSYS. Due to this, sometime, it returns prematurely when a signal is received. Since the return value is never checked, userspace eventually receives a spurious -EIO.
To fix this, use un-interruptible wait_for_completion_timeout().
--- drivers/spi/spi-davinci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-davinci.c +2 -1
@@ -703,7 +703,8 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)/* Wait for the transfer to complete */ if (spicfg->io_type !=SPI_IO_TYPE_POLL ) { -wait_for_completion_interruptible (&(dspi->done)); +if (wait_for_completion_timeout (&dspi->done,HZ ) ==0 ) + errors =SPIFLG_TIMEOUT_MASK ; }else {while (dspi->rcount >0 || dspi->wcount >0 ) { errors =davinci_spi_process_events (dspi);
Signature · 1 line
2.6.3
PATCH v2 2/2 spi: davinci: use dev_err() for error reporting
In reply to Sekhar NoriUse dev_err() for reporting errors rather thandev_dbg().
--- drivers/spi/spi-davinci.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/spi/spi-davinci.c +7 -7
@@ -477,33 +477,33 @@ static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status)struct device *sdev = dspi->bitbang.master->dev.parent;if (int_status &SPIFLG_TIMEOUT_MASK ) { -dev_dbg (sdev,"SPI Time-out Error\n" ); +dev_err (sdev,"SPI Time-out Error\n" );return -ETIMEDOUT ; }if (int_status &SPIFLG_DESYNC_MASK ) { -dev_dbg (sdev,"SPI Desynchronization Error\n" ); +dev_err (sdev,"SPI Desynchronization Error\n" );return -EIO ; }if (int_status &SPIFLG_BITERR_MASK ) { -dev_dbg (sdev,"SPI Bit error\n" ); +dev_err (sdev,"SPI Bit error\n" );return -EIO ; }if (dspi->version ==SPI_VERSION_2 ) {if (int_status &SPIFLG_DLEN_ERR_MASK ) { -dev_dbg (sdev,"SPI Data Length Error\n" ); +dev_err (sdev,"SPI Data Length Error\n" );return -EIO ; }if (int_status &SPIFLG_PARERR_MASK ) { -dev_dbg (sdev,"SPI Parity Error\n" ); +dev_err (sdev,"SPI Parity Error\n" );return -EIO ; }if (int_status &SPIFLG_OVRRUN_MASK ) { -dev_dbg (sdev,"SPI Data Overrun error\n" ); +dev_err (sdev,"SPI Data Overrun error\n" );return -EIO ; }if (int_status &SPIFLG_BUF_INIT_ACTIVE_MASK ) { -dev_dbg (sdev,"SPI Buffer Init Active\n" ); +dev_err (sdev,"SPI Buffer Init Active\n" );return -EBUSY ; } }
Signature · 1 line
2.6.3
Applied "spi: davinci: use dev_err() for error reporting" to the spi tree
In reply to a message not in the archiveThe patch
spi: davinci: use dev_err() for error reporting
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
21c015b776d4013b656bca8a4f42b953297b8b8cMon Sep 17 00:00:00 2001
From: Sekhar Nori <[email protected]>
Date: Thu, 10 Dec 2015 21:59:05 +0530
Subject: [PATCH] spi: davinci: use dev_err() for error reporting
Use dev_err() for reporting errors rather thandev_dbg().
--- drivers/spi/spi-davinci.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/spi/spi-davinci.c +7 -7
@@ -477,33 +477,33 @@ static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status)struct device *sdev = dspi->bitbang.master->dev.parent;if (int_status &SPIFLG_TIMEOUT_MASK ) { -dev_dbg (sdev,"SPI Time-out Error\n" ); +dev_err (sdev,"SPI Time-out Error\n" );return -ETIMEDOUT ; }if (int_status &SPIFLG_DESYNC_MASK ) { -dev_dbg (sdev,"SPI Desynchronization Error\n" ); +dev_err (sdev,"SPI Desynchronization Error\n" );return -EIO ; }if (int_status &SPIFLG_BITERR_MASK ) { -dev_dbg (sdev,"SPI Bit error\n" ); +dev_err (sdev,"SPI Bit error\n" );return -EIO ; }if (dspi->version ==SPI_VERSION_2 ) {if (int_status &SPIFLG_DLEN_ERR_MASK ) { -dev_dbg (sdev,"SPI Data Length Error\n" ); +dev_err (sdev,"SPI Data Length Error\n" );return -EIO ; }if (int_status &SPIFLG_PARERR_MASK ) { -dev_dbg (sdev,"SPI Parity Error\n" ); +dev_err (sdev,"SPI Parity Error\n" );return -EIO ; }if (int_status &SPIFLG_OVRRUN_MASK ) { -dev_dbg (sdev,"SPI Data Overrun error\n" ); +dev_err (sdev,"SPI Data Overrun error\n" );return -EIO ; }if (int_status &SPIFLG_BUF_INIT_ACTIVE_MASK ) { -dev_dbg (sdev,"SPI Buffer Init Active\n" ); +dev_err (sdev,"SPI Buffer Init Active\n" );return -EBUSY ; } }
Signature · 6 lines
2.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Applied "spi: davinci: fix spurious i/o error" to the spi tree
In reply to a message not in the archiveThe patch
spi: davinci: fix spurious i/o error
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
7f3ac71ac3b05aaa2c55c266448f973188275a8cMon Sep 17 00:00:00 2001
From: Sekhar Nori <[email protected]>
Date: Thu, 10 Dec 2015 21:59:04 +0530
Subject: [PATCH] spi: davinci: fix spurious i/o error
davinci_spi_bufs() uses wait_for_completion_interruptible() without bothering to handle -ERESTARTSYS. Due to this, sometime, it returns prematurely when a signal is received. Since the return value is never checked, userspace eventually receives a spurious -EIO.
To fix this, use un-interruptible wait_for_completion_timeout().
--- drivers/spi/spi-davinci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-davinci.c +2 -1
@@ -703,7 +703,8 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)/* Wait for the transfer to complete */ if (spicfg->io_type !=SPI_IO_TYPE_POLL ) { -wait_for_completion_interruptible (&(dspi->done)); +if (wait_for_completion_timeout (&dspi->done,HZ ) ==0 ) + errors =SPIFLG_TIMEOUT_MASK ; }else {while (dspi->rcount >0 || dspi->wcount >0 ) { errors =davinci_spi_process_events (dspi);
Signature · 6 lines
2.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Sekhar Nori
This patch series fixes a spurious I/O error with
DaVinci SPI.v2:
- Update to handle DMA case
- add a patch to usedev_err()for error reporting
Quoted 7 lines
Sekhar Nori (2):
spi: davinci: fix spurious i/o error
spi: davinci: usedev_err()for error reportingdrivers/spi/spi-davinci.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
Looks good:
Signature · 2 lines
regards, -grygorii