linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
To: David Lechner <david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: <khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	<linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] spi: davinci: Allow device tree devices to use DMA
Date: Mon, 21 Nov 2016 14:07:53 +0530	[thread overview]
Message-ID: <fd697f3b-dba1-1e5f-c12c-45f71c0c07a1@ti.com> (raw)
In-Reply-To: <946d60bc-ac14-7934-c1b3-e2de03831459-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>

On Sunday 20 November 2016 10:31 PM, David Lechner wrote:

> On 11/20/2016 06:59 AM, Sekhar Nori wrote:

>> On Saturday 19 November 2016 10:11 AM, David Lechner wrote:

>>> @@ -400,6 +401,9 @@ static int davinci_spi_of_setup(struct spi_device
>>> *spi)
>>>          if (!of_property_read_u32(np, "ti,spi-wdelay", &prop))
>>>              spicfg->wdelay = (u8)prop;
>>>          spi->controller_data = spicfg;
>>> +        /* Use DMA for device if master supports it */
>>> +        if (dspi->dma_rx)
>>
>> This should be
>>
>>         if (!(IS_ERR(dpsi->dma_rx) || IS_ERR(dspi->dma_tx))
> 
> 
> There is the following code in davinci_spi_probe():
> 
>     ret = davinci_spi_request_dma(dspi);
>     if (ret == -EPROBE_DEFER) {
>         goto free_clk;
>     } else if (ret) {
>         dev_info(&pdev->dev, "DMA is not supported (%d)\n", ret);
>         dspi->dma_rx = NULL;
>         dspi->dma_tx = NULL;
>     }
> 
> So, I does not look like it is possible to get anything other than NULL
> or a valid pointer for dpsi->dma_rx and that checking dpsi->dma_tx is
> not necessary.
> 
> So, I think if (dspi->dma_rx) is sufficient. In fact the same check is
> used during unwinding if the probe function fails.

You are right, I see it now. Setting dma_rx to NULL overriding the error
value is confusing since dma_request_chan() itself does not use NULL as
an error value.

I think it is better to fix the existing code to remove the NULL
overwrite and use IS_ERR() instead. You should probably wait for some
feedback from the SPI maintainer though.

Thanks,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-11-21  8:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-19  4:41 [PATCH] spi: davinci: Allow device tree devices to use DMA David Lechner
     [not found] ` <1479530464-12538-1-git-send-email-david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>
2016-11-20 12:59   ` Sekhar Nori
     [not found]     ` <79f186b5-ac71-189f-c19f-977670395043-l0cyMroinI0@public.gmane.org>
2016-11-20 17:01       ` David Lechner
     [not found]         ` <946d60bc-ac14-7934-c1b3-e2de03831459-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>
2016-11-21  8:37           ` Sekhar Nori [this message]
     [not found]             ` <fd697f3b-dba1-1e5f-c12c-45f71c0c07a1-l0cyMroinI0@public.gmane.org>
2016-12-07  2:28               ` David Lechner

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=fd697f3b-dba1-1e5f-c12c-45f71c0c07a1@ti.com \
    --to=nsekhar-l0cymroini0@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org \
    --cc=khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).