* [PATCH v2 0/2] spi: davinci: fix spurious i/o error
@ 2015-12-10 16:29 Sekhar Nori
2015-12-10 16:29 ` [PATCH v2 1/2] " Sekhar Nori
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Sekhar Nori @ 2015-12-10 16:29 UTC (permalink / raw)
To: Mark Brown
Cc: Grygorii Strashko, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
Linux ARM Mailing List, linux-spi-u79uwXL29TY76Z2rM5mHXA
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(-)
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] spi: davinci: fix spurious i/o error
2015-12-10 16:29 [PATCH v2 0/2] spi: davinci: fix spurious i/o error Sekhar Nori
@ 2015-12-10 16:29 ` Sekhar Nori
[not found] ` <fbcc972e6612cf3d069e7230dd078d8a1e0e2e5a.1449764266.git.nsekhar-l0cyMroinI0@public.gmane.org>
2015-12-10 16:29 ` [PATCH v2 2/2] spi: davinci: use dev_err() for error reporting Sekhar Nori
[not found] ` <cover.1449764266.git.nsekhar-l0cyMroinI0@public.gmane.org>
2 siblings, 1 reply; 6+ messages in thread
From: Sekhar Nori @ 2015-12-10 16:29 UTC (permalink / raw)
To: Mark Brown
Cc: Grygorii Strashko, linux-kernel, Linux ARM Mailing List,
linux-spi
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().
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
drivers/spi/spi-davinci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 7d3af3eacf57..57d6960a6252 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -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);
--
2.6.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] spi: davinci: use dev_err() for error reporting
2015-12-10 16:29 [PATCH v2 0/2] spi: davinci: fix spurious i/o error Sekhar Nori
2015-12-10 16:29 ` [PATCH v2 1/2] " Sekhar Nori
@ 2015-12-10 16:29 ` Sekhar Nori
[not found] ` <83b3c0bb63ff958d10c773ab7bf128393cc7ddad.1449764266.git.nsekhar-l0cyMroinI0@public.gmane.org>
[not found] ` <cover.1449764266.git.nsekhar-l0cyMroinI0@public.gmane.org>
2 siblings, 1 reply; 6+ messages in thread
From: Sekhar Nori @ 2015-12-10 16:29 UTC (permalink / raw)
To: Mark Brown
Cc: Grygorii Strashko, linux-kernel, Linux ARM Mailing List,
linux-spi
Use dev_err() for reporting errors rather than
dev_dbg().
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
drivers/spi/spi-davinci.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 57d6960a6252..fddb7a3be322 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -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;
}
}
--
2.6.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Applied "spi: davinci: use dev_err() for error reporting" to the spi tree
[not found] ` <83b3c0bb63ff958d10c773ab7bf128393cc7ddad.1449764266.git.nsekhar-l0cyMroinI0@public.gmane.org>
@ 2015-12-12 23:08 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2015-12-12 23:08 UTC (permalink / raw)
To: Sekhar Nori, Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
The 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
>From 21c015b776d4013b656bca8a4f42b953297b8b8c Mon Sep 17 00:00:00 2001
From: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
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 than
dev_dbg().
Signed-off-by: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/spi/spi-davinci.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 57d6960..fddb7a3 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -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;
}
}
--
2.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Applied "spi: davinci: fix spurious i/o error" to the spi tree
[not found] ` <fbcc972e6612cf3d069e7230dd078d8a1e0e2e5a.1449764266.git.nsekhar-l0cyMroinI0@public.gmane.org>
@ 2015-12-12 23:08 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2015-12-12 23:08 UTC (permalink / raw)
To: Sekhar Nori, Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
The 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
>From 7f3ac71ac3b05aaa2c55c266448f973188275a8c Mon Sep 17 00:00:00 2001
From: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
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().
Signed-off-by: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/spi/spi-davinci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 7d3af3e..57d6960 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -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);
--
2.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] spi: davinci: fix spurious i/o error
[not found] ` <cover.1449764266.git.nsekhar-l0cyMroinI0@public.gmane.org>
@ 2015-12-17 13:26 ` Grygorii Strashko
0 siblings, 0 replies; 6+ messages in thread
From: Grygorii Strashko @ 2015-12-17 13:26 UTC (permalink / raw)
To: Sekhar Nori, Mark Brown
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Linux ARM Mailing List,
linux-spi-u79uwXL29TY76Z2rM5mHXA
On 12/10/2015 06:29 PM, Sekhar Nori wrote:
> 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(-)
>
Looks good:
Reviewed-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
--
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-12-17 13:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-10 16:29 [PATCH v2 0/2] spi: davinci: fix spurious i/o error Sekhar Nori
2015-12-10 16:29 ` [PATCH v2 1/2] " Sekhar Nori
[not found] ` <fbcc972e6612cf3d069e7230dd078d8a1e0e2e5a.1449764266.git.nsekhar-l0cyMroinI0@public.gmane.org>
2015-12-12 23:08 ` Applied "spi: davinci: fix spurious i/o error" to the spi tree Mark Brown
2015-12-10 16:29 ` [PATCH v2 2/2] spi: davinci: use dev_err() for error reporting Sekhar Nori
[not found] ` <83b3c0bb63ff958d10c773ab7bf128393cc7ddad.1449764266.git.nsekhar-l0cyMroinI0@public.gmane.org>
2015-12-12 23:08 ` Applied "spi: davinci: use dev_err() for error reporting" to the spi tree Mark Brown
[not found] ` <cover.1449764266.git.nsekhar-l0cyMroinI0@public.gmane.org>
2015-12-17 13:26 ` [PATCH v2 0/2] spi: davinci: fix spurious i/o error Grygorii Strashko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).