* [PATCH 1/2] i2c: i.MX: Use better error code when bus recovery failed
@ 2023-01-25 7:37 Sascha Hauer
2023-01-25 7:37 ` [PATCH 2/2] i2c: Make i2c_recover_bus() to return -EBUSY if bus recovery unimplemented Sascha Hauer
2023-01-25 9:21 ` [PATCH 1/2] i2c: i.MX: Use better error code when bus recovery failed Marco Felsch
0 siblings, 2 replies; 5+ messages in thread
From: Sascha Hauer @ 2023-01-25 7:37 UTC (permalink / raw)
To: Barebox List
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/i2c/busses/i2c-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index e4b04327ee..3be3b158c7 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -235,7 +235,7 @@ static int i2c_fsl_start(struct i2c_adapter *adapter)
if (result) {
result = i2c_recover_bus(&i2c_fsl->adapter);
if (result)
- return result;
+ return -EIO;
return -EAGAIN;
}
--
2.30.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] i2c: Make i2c_recover_bus() to return -EBUSY if bus recovery unimplemented
2023-01-25 7:37 [PATCH 1/2] i2c: i.MX: Use better error code when bus recovery failed Sascha Hauer
@ 2023-01-25 7:37 ` Sascha Hauer
2023-01-25 9:21 ` Marco Felsch
2023-01-25 9:21 ` [PATCH 1/2] i2c: i.MX: Use better error code when bus recovery failed Marco Felsch
1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2023-01-25 7:37 UTC (permalink / raw)
To: Barebox List
Based on the corresponding Kernel commit c126f7c3b8c4:
The i2c_recover_bus() returns -EOPNOTSUPP if bus recovery isn't wired up
by the bus driver, which the case for Tegra I2C driver for example. This
error code is then propagated to I2C client and might be confusing, thus
make i2c_recover_bus() to return -EBUSY instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/i2c/i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
index 7e1cea49f3..f3efb62087 100644
--- a/drivers/i2c/i2c.c
+++ b/drivers/i2c/i2c.c
@@ -353,7 +353,7 @@ int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
int i2c_recover_bus(struct i2c_adapter *adap)
{
if (!adap->bus_recovery_info)
- return -EOPNOTSUPP;
+ return -EBUSY;
dev_dbg(&adap->dev, "Trying i2c bus recovery\n");
return adap->bus_recovery_info->recover_bus(adap);
--
2.30.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] i2c: Make i2c_recover_bus() to return -EBUSY if bus recovery unimplemented
2023-01-25 7:37 ` [PATCH 2/2] i2c: Make i2c_recover_bus() to return -EBUSY if bus recovery unimplemented Sascha Hauer
@ 2023-01-25 9:21 ` Marco Felsch
0 siblings, 0 replies; 5+ messages in thread
From: Marco Felsch @ 2023-01-25 9:21 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List
On 23-01-25, Sascha Hauer wrote:
> Based on the corresponding Kernel commit c126f7c3b8c4:
>
> The i2c_recover_bus() returns -EOPNOTSUPP if bus recovery isn't wired up
> by the bus driver, which the case for Tegra I2C driver for example. This
> error code is then propagated to I2C client and might be confusing, thus
> make i2c_recover_bus() to return -EBUSY instead.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> drivers/i2c/i2c.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
> index 7e1cea49f3..f3efb62087 100644
> --- a/drivers/i2c/i2c.c
> +++ b/drivers/i2c/i2c.c
> @@ -353,7 +353,7 @@ int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
> int i2c_recover_bus(struct i2c_adapter *adap)
> {
> if (!adap->bus_recovery_info)
> - return -EOPNOTSUPP;
> + return -EBUSY;
>
> dev_dbg(&adap->dev, "Trying i2c bus recovery\n");
> return adap->bus_recovery_info->recover_bus(adap);
> --
> 2.30.2
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] i2c: i.MX: Use better error code when bus recovery failed
2023-01-25 7:37 [PATCH 1/2] i2c: i.MX: Use better error code when bus recovery failed Sascha Hauer
2023-01-25 7:37 ` [PATCH 2/2] i2c: Make i2c_recover_bus() to return -EBUSY if bus recovery unimplemented Sascha Hauer
@ 2023-01-25 9:21 ` Marco Felsch
2023-01-25 9:41 ` Sascha Hauer
1 sibling, 1 reply; 5+ messages in thread
From: Marco Felsch @ 2023-01-25 9:21 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List
On 23-01-25, Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/i2c/busses/i2c-imx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index e4b04327ee..3be3b158c7 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -235,7 +235,7 @@ static int i2c_fsl_start(struct i2c_adapter *adapter)
> if (result) {
> result = i2c_recover_bus(&i2c_fsl->adapter);
> if (result)
> - return result;
> + return -EIO;
This would also reinterpret adap->bus_recovery_info->recover_bus()
errors. I didn't checked the possible error codes for this but I think
to say it's an IO error is fine.
Acked-by: Marco Felsch <m.felsch@pengutronix.de>
Regards,
Marco
> return -EAGAIN;
> }
>
> --
> 2.30.2
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] i2c: i.MX: Use better error code when bus recovery failed
2023-01-25 9:21 ` [PATCH 1/2] i2c: i.MX: Use better error code when bus recovery failed Marco Felsch
@ 2023-01-25 9:41 ` Sascha Hauer
0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2023-01-25 9:41 UTC (permalink / raw)
To: Marco Felsch; +Cc: Barebox List
On Wed, Jan 25, 2023 at 10:21:29AM +0100, Marco Felsch wrote:
> On 23-01-25, Sascha Hauer wrote:
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > drivers/i2c/busses/i2c-imx.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> > index e4b04327ee..3be3b158c7 100644
> > --- a/drivers/i2c/busses/i2c-imx.c
> > +++ b/drivers/i2c/busses/i2c-imx.c
> > @@ -235,7 +235,7 @@ static int i2c_fsl_start(struct i2c_adapter *adapter)
> > if (result) {
> > result = i2c_recover_bus(&i2c_fsl->adapter);
> > if (result)
> > - return result;
> > + return -EIO;
>
> This would also reinterpret adap->bus_recovery_info->recover_bus()
> errors. I didn't checked the possible error codes for this but I think
> to say it's an IO error is fine.
Nah, forget about this, I have sent the wrong patches. Changing the i.MX
driver was my first approach until I saw that Linux returns a less
confusing error code from i2c_recover_bus().
Instead of this one I ought to send "i2c: i.MX: Use initialized dev for
dev_dbg()" which I have done now.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-25 9:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25 7:37 [PATCH 1/2] i2c: i.MX: Use better error code when bus recovery failed Sascha Hauer
2023-01-25 7:37 ` [PATCH 2/2] i2c: Make i2c_recover_bus() to return -EBUSY if bus recovery unimplemented Sascha Hauer
2023-01-25 9:21 ` Marco Felsch
2023-01-25 9:21 ` [PATCH 1/2] i2c: i.MX: Use better error code when bus recovery failed Marco Felsch
2023-01-25 9:41 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox