On 17-02-22, 20:51, Dmitry Baryshkov wrote: > On Mon, 31 Jan 2022 at 15:04, Vinod Koul <vkoul@xxxxxxxxxx> wrote: > > +static int geni_i2c_fifo_xfer(struct geni_i2c_dev *gi2c, > > + struct i2c_msg msgs[], int num) > > +{ > > + int i, ret = 0; > > + > > + for (i = 0; i < num; i++) { > > + u32 m_param = i < (num - 1) ? STOP_STRETCH : 0; > > + > > + m_param |= ((msgs[i].addr << SLV_ADDR_SHFT) & SLV_ADDR_MSK); > > + > > + gi2c->cur = &msgs[i]; > > + if (msgs[i].flags & I2C_M_RD) > > + ret = geni_i2c_rx_one_msg(gi2c, &msgs[i], m_param); > > + else > > + ret = geni_i2c_tx_one_msg(gi2c, &msgs[i], m_param); > > + > > + if (ret) > > + break; > > I'd suggest to 'return ret' here and change the return line to 'return num'. Done > > static int geni_i2c_xfer(struct i2c_adapter *adap, > > struct i2c_msg msgs[], > > int num) > > { > > struct geni_i2c_dev *gi2c = i2c_get_adapdata(adap); > > - int i, ret; > > + int ret; > > > > gi2c->err = 0; > > reinit_completion(&gi2c->done); > > @@ -475,22 +670,11 @@ static int geni_i2c_xfer(struct i2c_adapter *adap, > > } > > > > qcom_geni_i2c_conf(gi2c); > > - for (i = 0; i < num; i++) { > > - u32 m_param = i < (num - 1) ? STOP_STRETCH : 0; > > - > > - m_param |= ((msgs[i].addr << SLV_ADDR_SHFT) & SLV_ADDR_MSK); > > - > > - gi2c->cur = &msgs[i]; > > - if (msgs[i].flags & I2C_M_RD) > > - ret = geni_i2c_rx_one_msg(gi2c, &msgs[i], m_param); > > - else > > - ret = geni_i2c_tx_one_msg(gi2c, &msgs[i], m_param); > > > > - if (ret) > > - break; > > - } > > - if (ret == 0) > > - ret = num; > > + if (gi2c->gpi_mode) > > + ret = geni_i2c_gpi_xfer(gi2c, msgs, num); > > + else > > + ret = geni_i2c_fifo_xfer(gi2c, msgs, num); > > We should return num if ret is 0 here (or in > geni_i2c_fifo_xfer()/geni_i2c_gpi_xfer()). I have picked your fix for that! -- ~Vinod