All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: mxs: dont print error on NAK
@ 2017-05-18 14:14 Michael Thalmeier
  2017-05-19 12:44 ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Thalmeier @ 2017-05-18 14:14 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, Marek Vasut, michael

When mxs_i2c_pio_wait_xfer_end returns with a return code of -ENXIO, the
NO_SLAVE_ACK_IRQ bit is set in CTRL1.
In this case, do not print an error message, because every NAK would
otherwise generate a new message.

Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
---
 drivers/i2c/busses/i2c-mxs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 5738556..e2dbb9c 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -527,7 +527,7 @@ static int mxs_i2c_pio_setup_xfer(struct i2c_adapter *adap,
 
 			/* Wait for the end of the transfer. */
 			ret = mxs_i2c_pio_wait_xfer_end(i2c);
-			if (ret) {
+			if (ret && ret != -ENXIO) {
 				dev_err(i2c->dev,
 					"PIO: Failed to finish WRITE cmd!\n");
 				break;
-- 
2.9.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: mxs: dont print error on NAK
  2017-05-18 14:14 [PATCH] i2c: mxs: dont print error on NAK Michael Thalmeier
@ 2017-05-19 12:44 ` Wolfram Sang
  2017-05-31  9:40   ` [PATCH] i2c: mxs: change error printing to debug for mxs_i2c_pio_wait_xfer_end Michael Thalmeier
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2017-05-19 12:44 UTC (permalink / raw)
  To: Michael Thalmeier; +Cc: linux-i2c, linux-kernel, Marek Vasut, michael

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

On Thu, May 18, 2017 at 04:14:50PM +0200, Michael Thalmeier wrote:
> When mxs_i2c_pio_wait_xfer_end returns with a return code of -ENXIO, the
> NO_SLAVE_ACK_IRQ bit is set in CTRL1.
> In this case, do not print an error message, because every NAK would
> otherwise generate a new message.

Why not also for the read case?

Also, I think all the error printing for mxs_i2c_pio_wait_xfer_end()
could go. NAK can happen on the bus as well as timeouts, e.g. EEPROMs
currently erasing a page. Upper layers ought to handle that.

Thanks,

   Wolfram

> 
> Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
> ---
>  drivers/i2c/busses/i2c-mxs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index 5738556..e2dbb9c 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -527,7 +527,7 @@ static int mxs_i2c_pio_setup_xfer(struct i2c_adapter *adap,
>  
>  			/* Wait for the end of the transfer. */
>  			ret = mxs_i2c_pio_wait_xfer_end(i2c);
> -			if (ret) {
> +			if (ret && ret != -ENXIO) {
>  				dev_err(i2c->dev,
>  					"PIO: Failed to finish WRITE cmd!\n");
>  				break;
> -- 
> 2.9.2
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] i2c: mxs: change error printing to debug for mxs_i2c_pio_wait_xfer_end
  2017-05-19 12:44 ` Wolfram Sang
@ 2017-05-31  9:40   ` Michael Thalmeier
  2017-06-02 20:58     ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Thalmeier @ 2017-05-31  9:40 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, Marek Vasut

Instead of printing errors after mxs_i2c_pio_wait_xfer_end returns with
an error code just print a debug message.

NAKs and timeouts can occur in this situation normally, so do not treat
them as errors.

Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
---
 drivers/i2c/busses/i2c-mxs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 5738556..d4e8f19 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -419,7 +419,7 @@ static int mxs_i2c_pio_setup_xfer(struct i2c_adapter *adap,
 
 		ret = mxs_i2c_pio_wait_xfer_end(i2c);
 		if (ret) {
-			dev_err(i2c->dev,
+			dev_dbg(i2c->dev,
 				"PIO: Failed to send SELECT command!\n");
 			goto cleanup;
 		}
@@ -431,7 +431,7 @@ static int mxs_i2c_pio_setup_xfer(struct i2c_adapter *adap,
 
 		ret = mxs_i2c_pio_wait_xfer_end(i2c);
 		if (ret) {
-			dev_err(i2c->dev,
+			dev_dbg(i2c->dev,
 				"PIO: Failed to send READ command!\n");
 			goto cleanup;
 		}
@@ -528,7 +528,7 @@ static int mxs_i2c_pio_setup_xfer(struct i2c_adapter *adap,
 			/* Wait for the end of the transfer. */
 			ret = mxs_i2c_pio_wait_xfer_end(i2c);
 			if (ret) {
-				dev_err(i2c->dev,
+				dev_dbg(i2c->dev,
 					"PIO: Failed to finish WRITE cmd!\n");
 				break;
 			}
-- 
2.9.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: mxs: change error printing to debug for mxs_i2c_pio_wait_xfer_end
  2017-05-31  9:40   ` [PATCH] i2c: mxs: change error printing to debug for mxs_i2c_pio_wait_xfer_end Michael Thalmeier
@ 2017-06-02 20:58     ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2017-06-02 20:58 UTC (permalink / raw)
  To: Michael Thalmeier; +Cc: linux-i2c, linux-kernel, Marek Vasut

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

On Wed, May 31, 2017 at 11:40:03AM +0200, Michael Thalmeier wrote:
> Instead of printing errors after mxs_i2c_pio_wait_xfer_end returns with
> an error code just print a debug message.
> 
> NAKs and timeouts can occur in this situation normally, so do not treat
> them as errors.
> 
> Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-02 20:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18 14:14 [PATCH] i2c: mxs: dont print error on NAK Michael Thalmeier
2017-05-19 12:44 ` Wolfram Sang
2017-05-31  9:40   ` [PATCH] i2c: mxs: change error printing to debug for mxs_i2c_pio_wait_xfer_end Michael Thalmeier
2017-06-02 20:58     ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.