On 18.12.2024 02:16, Prabhakar wrote: > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> > > Implement bus recovery by reinitializing the hardware to reset the bus > state and generating 9 clock cycles (and a stop condition) to release > the SDA line. > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> > --- > v1->v2 > - Used single register read to check SDA/SCL lines > --- > drivers/i2c/busses/i2c-riic.c | 100 ++++++++++++++++++++++++++++++---- > 1 file changed, 90 insertions(+), 10 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c > index 586092454bb2..d93c371a22de 100644 > --- a/drivers/i2c/busses/i2c-riic.c > +++ b/drivers/i2c/busses/i2c-riic.c > @@ -50,6 +50,7 @@ > [ ... ] > +static int riic_recover_bus(struct i2c_adapter *adap) > +{ > + struct riic_dev *riic = i2c_get_adapdata(adap); > + struct device *dev = riic->adapter.dev.parent; > + int ret; > + u8 val; > + > + ret = riic_init_hw(riic, true); > + if (ret) > + return -EINVAL; Any reason for not returning directly the ret? It is true the riic_init_hw() can, ATM, return only -EINVAL in case of failure. Thank you, Claudiu