public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Wolfram Sang <wsa@kernel.org>,
	linux-arm-msm@vger.kernel.org, Andy Gross <agross@kernel.org>,
	Douglas Anderson <dianders@chromium.org>,
	Matthias Kaehlcke <mka@chromium.org>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alexey Minnekhanov <alexeymin@postmarketos.org>
Subject: Re: [PATCH v5] i2c: qcom-geni: Add support for GPI DMA
Date: Fri, 18 Feb 2022 12:36:22 +0530	[thread overview]
Message-ID: <Yg9Fbh//iSe+VAiT@matsya> (raw)
In-Reply-To: <CAA8EJpoqCJbYgOUpEhcoae3=Mivp8c7PZU8XO78EMZMR+NQQKw@mail.gmail.com>

On 17-02-22, 20:51, Dmitry Baryshkov wrote:
> On Mon, 31 Jan 2022 at 15:04, Vinod Koul <vkoul@kernel.org> 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

      reply	other threads:[~2022-02-18  7:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31 12:04 [PATCH v5] i2c: qcom-geni: Add support for GPI DMA Vinod Koul
2022-02-17 17:35 ` Bjorn Andersson
2022-02-18  6:33   ` Vinod Koul
2022-02-17 17:51 ` Dmitry Baryshkov
2022-02-18  7:06   ` Vinod Koul [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yg9Fbh//iSe+VAiT@matsya \
    --to=vkoul@kernel.org \
    --cc=agross@kernel.org \
    --cc=alexeymin@postmarketos.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox