public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: 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:03:36 +0530	[thread overview]
Message-ID: <Yg89wEi9I4LpcPus@matsya> (raw)
In-Reply-To: <Yg6Hc2pT8DFKS2dT@ripper>

On 17-02-22, 09:35, Bjorn Andersson wrote:

> > +static void i2c_gpi_cb_result(void *cb, const struct dmaengine_result *result)
> > +{
> > +	struct geni_i2c_dev *gi2c = cb;
> > +
> > +	if (result->result != DMA_TRANS_NOERROR) {
> > +		dev_err(gi2c->se.dev, "DMA txn failed:%d\n", result->result);
> 
> Iiuc the API the expectation is that if we get !NOERROR we shouldn't
> expect to get NOERROR after that.
>
> If so we're just returning here and leaving geni_i2c_gpi_xfer() to just
> timeout in a HZ or so. Given that xfer happens under the adaptor lock,
> how about carrying an error in geni_i2c_dev and complete(&done) here as
> well?

Yes we should call complete for errors too, will add that

> > +static int setup_gpi_dma(struct geni_i2c_dev *gi2c)
> > +{
> > +	int ret;
> > +
> > +	geni_se_select_mode(&gi2c->se, GENI_GPI_DMA);
> > +	gi2c->tx_c = dma_request_chan(gi2c->se.dev, "tx");
> > +	if (IS_ERR(gi2c->tx_c)) {
> > +		ret = dev_err_probe(gi2c->se.dev, PTR_ERR(gi2c->tx_c),
> > +				    "Failed to get tx DMA ch\n");
> > +		if (ret < 0)
> > +			goto err_tx;
> > +	}
> > +
> > +	gi2c->rx_c = dma_request_chan(gi2c->se.dev, "rx");
> > +	if (IS_ERR(gi2c->rx_c)) {
> > +		ret = dev_err_probe(gi2c->se.dev, PTR_ERR(gi2c->rx_c),
> > +				    "Failed to get rx DMA ch\n");
> > +		if (ret < 0)
> > +			goto err_rx;
> > +	}
> > +
> > +	dev_dbg(gi2c->se.dev, "Grabbed GPI dma channels\n");
> > +	return 0;
> > +
> > +err_rx:
> > +	dma_release_channel(gi2c->tx_c);
> > +	gi2c->tx_c = NULL;
> 
> You're not accessing tx_c or rx_c again when returning an error here. So
> I don't think there's a reason to clear them.

Will drop that

> >  static int geni_i2c_remove(struct platform_device *pdev)
> >  {
> >  	struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev);
> >  
> > +	release_gpi_dma(gi2c);
> 
> Your i2c devices aren't torn down until i2c_del_adapter(), so you might
> still end up trying to use the two channels here, after releasing them.
> 
> In other words, I think you should reorder these.

Agreed it should be other way round!

Thanks
-- 
~Vinod

  reply	other threads:[~2022-02-18  6:34 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 [this message]
2022-02-17 17:51 ` Dmitry Baryshkov
2022-02-18  7:06   ` Vinod Koul

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=Yg89wEi9I4LpcPus@matsya \
    --to=vkoul@kernel.org \
    --cc=agross@kernel.org \
    --cc=alexeymin@postmarketos.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dianders@chromium.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