From: Dmitry Osipenko <digetx@gmail.com>
To: Sowjanya Komatineni <skomatineni@nvidia.com>,
"thierry.reding@gmail.com" <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Mantravadi Karthik <mkarthik@nvidia.com>,
Shardar Mohammed <smohammed@nvidia.com>,
Timo Alho <talho@nvidia.com>
Cc: "linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH V9 3/5] i2c: tegra: Add DMA support
Date: Sat, 2 Feb 2019 17:13:56 +0300 [thread overview]
Message-ID: <f667ab55-c7c7-4ac1-100a-7f7ade87708d@gmail.com> (raw)
In-Reply-To: <6150de70-6ca8-944a-780a-4574ff2b21c7@gmail.com>
01.02.2019 22:22, Dmitry Osipenko пишет:
> 01.02.2019 22:20, Sowjanya Komatineni пишет:
>>
>>>> +static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev) {
>>>> + struct dma_chan *dma_chan;
>>>> + u32 *dma_buf;
>>>> + dma_addr_t dma_phys;
>>>> + int err = 0;
>>>> +
>>>> + if (!IS_ENABLED(CONFIG_TEGRA20_APB_DMA))
>>>> + return -ENODEV;
>>>
>>> Driver shall not fail to probe if DMA driver is disabled, but to continue with the PIO-only mode available.
>>>
>>> Should be:
>>>
>>> if (!IS_ENABLED(CONFIG_TEGRA20_APB_DMA))
>>> return 0;
>>>
>> Except EPROBE_DEFER, anything else returned from tegra_i2c_init_dma (ENODEV/ENOMEM) is ignored in i2c_probe
>> DMA mode decision is based on xfer size and availability of dma channel or can be changed based on valid dma buf to shorten the line.
>>
>
> Ah, sorry. I missed that, seems good then.
>
BTW, it may be worthwhile to move out the error code handling into tegra_i2c_init_dma() for clarity. It also won't hurt to not ignore errors other than -ENODEV.
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 32d5744bce45..684a0689ac8d 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -397,7 +397,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
int err = 0;
if (!IS_ENABLED(CONFIG_TEGRA20_APB_DMA))
- return -ENODEV;
+ return 0;
dma_chan = dma_request_slave_channel_reason(i2c_dev->dev, "rx");
if (IS_ERR(dma_chan))
@@ -434,6 +434,13 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
if (i2c_dev->rx_dma_chan)
dma_release_channel(i2c_dev->rx_dma_chan);
+ /*
+ * -ENODEV is likely due to a missing "dmas" property, driver falls
+ * back to PIO in this case.
+ */
+ if (err == -ENODEV)
+ return 0;
+
return err;
}
@@ -1553,7 +1560,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
}
ret = tegra_i2c_init_dma(i2c_dev);
- if (ret == -EPROBE_DEFER)
+ if (ret)
goto disable_div_clk;
ret = tegra_i2c_init(i2c_dev, false);
next prev parent reply other threads:[~2019-02-02 14:13 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-01 17:07 [PATCH V9 1/5] i2c: tegra: sort all the include headers alphabetically Sowjanya Komatineni
2019-02-01 17:07 ` [PATCH V9 2/5] i2c: tegra: add bus clear master support Sowjanya Komatineni
2019-02-01 19:06 ` Dmitry Osipenko
2019-02-01 17:07 ` [PATCH V9 3/5] i2c: tegra: Add DMA support Sowjanya Komatineni
2019-02-01 18:57 ` Dmitry Osipenko
2019-02-01 19:20 ` Sowjanya Komatineni
2019-02-01 19:22 ` Dmitry Osipenko
2019-02-02 14:13 ` Dmitry Osipenko [this message]
2019-02-02 18:43 ` Sowjanya Komatineni
2019-02-03 16:42 ` Dmitry Osipenko
2019-02-01 20:21 ` Sowjanya Komatineni
2019-02-01 20:30 ` Dmitry Osipenko
2019-02-01 21:36 ` Sowjanya Komatineni
2019-02-01 21:45 ` Dmitry Osipenko
2019-02-02 14:01 ` Dmitry Osipenko
2019-02-02 18:32 ` Sowjanya Komatineni
2019-02-03 16:48 ` Dmitry Osipenko
2019-02-04 8:18 ` Thierry Reding
2019-02-03 14:19 ` Dmitry Osipenko
2019-02-03 14:47 ` Dmitry Osipenko
2019-02-03 15:27 ` Dmitry Osipenko
2019-02-04 12:57 ` Dmitry Osipenko
2019-02-05 1:37 ` Sowjanya Komatineni
2019-02-05 6:20 ` Dmitry Osipenko
2019-02-04 8:04 ` Thierry Reding
2019-02-01 17:07 ` [PATCH V9 4/5] i2c: tegra: update transfer timeout Sowjanya Komatineni
2019-02-01 19:16 ` Dmitry Osipenko
2019-02-01 19:37 ` Sowjanya Komatineni
2019-02-01 19:41 ` Dmitry Osipenko
2019-02-04 7:54 ` Thierry Reding
2019-02-01 17:07 ` [PATCH V9 5/5] i2c: tegra: add i2c interface timing support Sowjanya Komatineni
2019-02-01 19:05 ` [PATCH V9 1/5] i2c: tegra: sort all the include headers alphabetically Dmitry Osipenko
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=f667ab55-c7c7-4ac1-100a-7f7ade87708d@gmail.com \
--to=digetx@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mkarthik@nvidia.com \
--cc=skomatineni@nvidia.com \
--cc=smohammed@nvidia.com \
--cc=talho@nvidia.com \
--cc=thierry.reding@gmail.com \
/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).