public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c-pca-algo: Fix errorcode
@ 2008-05-20 17:18 Wolfram Sang
       [not found] ` <20080520171848.10908.23451.stgit-WosDo8ZsKtpoC+DoxizDebTfikLOBL9CDsAVuJBuCrE@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2008-05-20 17:18 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Give a more concrete error code, when the bus is not idle.

Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---

 drivers/i2c/algos/i2c-algo-pca.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
index e954a20..8001d6d 100644
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -182,7 +182,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
 	}
 	if (state != 0xf8) {
 		dev_dbg(&i2c_adap->dev, "bus is not idle. status is %#04x\n", state);
-		return -EIO;
+		return -EBUSY;
 	}
 
 	DEB1("{{{ XFER %d messages\n", num);


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

* Re: [PATCH] i2c-pca-algo: Fix errorcode
       [not found] ` <20080520171848.10908.23451.stgit-WosDo8ZsKtpoC+DoxizDebTfikLOBL9CDsAVuJBuCrE@public.gmane.org>
@ 2008-05-20 18:17   ` Jean Delvare
       [not found]     ` <20080520201755.59b140f5-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Jean Delvare @ 2008-05-20 18:17 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

Hi Wolfram,

On Tue, 20 May 2008 19:18:49 +0200, Wolfram Sang wrote:
> Give a more concrete error code, when the bus is not idle.
> 
> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
> 
>  drivers/i2c/algos/i2c-algo-pca.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
> index e954a20..8001d6d 100644
> --- a/drivers/i2c/algos/i2c-algo-pca.c
> +++ b/drivers/i2c/algos/i2c-algo-pca.c
> @@ -182,7 +182,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
>  	}
>  	if (state != 0xf8) {
>  		dev_dbg(&i2c_adap->dev, "bus is not idle. status is %#04x\n", state);
> -		return -EIO;
> +		return -EBUSY;
>  	}
>  
>  	DEB1("{{{ XFER %d messages\n", num);

EBUSY is a fatal error, while a you should be able to retry the
transaction later when the bus is free. So I think that EAGAIN would be
more appropriate.

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

* Re: [PATCH] i2c-pca-algo: Fix errorcode
       [not found]     ` <20080520201755.59b140f5-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2008-05-20 19:42       ` Wolfram Sang
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2008-05-20 19:42 UTC (permalink / raw)
  To: Jean Delvare; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA


[-- Attachment #1.1: Type: text/plain, Size: 748 bytes --]

Hi Jean,

On Tue, May 20, 2008 at 08:17:55PM +0200, Jean Delvare wrote:

> EBUSY is a fatal error, while a you should be able to retry the
> transaction later when the bus is free. So I think that EAGAIN would be
> more appropriate.
Okay, fine with me. (Does somebody know of a guide with references for
using errorcodes? EBUSY or EAGAIN? ENODEV or ENXIO? Preferred error
value if ioremap fails? It seems a bit messy. The patch that was
recently posted, defining possible situations for errorcodes within I2C
is really great. I wished I would have something like this for the
general kernel-routines.)

   Wolfram

-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

end of thread, other threads:[~2008-05-20 19:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-20 17:18 [PATCH] i2c-pca-algo: Fix errorcode Wolfram Sang
     [not found] ` <20080520171848.10908.23451.stgit-WosDo8ZsKtpoC+DoxizDebTfikLOBL9CDsAVuJBuCrE@public.gmane.org>
2008-05-20 18:17   ` Jean Delvare
     [not found]     ` <20080520201755.59b140f5-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-20 19:42       ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox