From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Rob Herring <robherring2@gmail.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Grant Likely" <grant.likely@linaro.org>,
"Wolfram Sang" <wsa@the-dreams.de>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Sekhar Nori" <nsekhar@ti.com>,
"Kevin Hilman" <khilman@deeprootsystems.com>,
"Santosh Shilimkar" <ssantosh@kernel.org>,
"Murali Karicheri" <m-karicheri2@ti.com>
Subject: Re: [1/5] i2c: i2c-davinci: switch to use platform_get_irq
Date: Fri, 21 Nov 2014 16:59:19 +0200 [thread overview]
Message-ID: <546F5347.7010600@ti.com> (raw)
In-Reply-To: <CAL_JsqJKhtzx9NKQ9R=m_4ReCUM9FP71mE7oRkScxPE7k881AA@mail.gmail.com>
On 11/21/2014 04:03 PM, Rob Herring wrote:
> On Fri, Nov 21, 2014 at 5:01 AM, Grygorii Strashko
> <grygorii.strashko@ti.com> wrote:
>> On 11/20/2014 11:48 PM, Uwe Kleine-König wrote:
>>> Hello Grygorii,
>>>
>>> On Thu, Nov 20, 2014 at 12:03:04PM +0200, Grygorii Strashko wrote:
>>>> Switch Davinci I2C driver to use platform_get_irq(), because
>>>> - it is not recommened to use
>>>> platform_get_resource(pdev, IORESOURCE_IRQ, ..) for requesting IRQ's
>>>> resources any more, as they can be not ready yet in case of DT-booting.
>>>> - it makes code simpler
>>>>
>>>> CC: Sekhar Nori <nsekhar@ti.com>
>>>> CC: Kevin Hilman <khilman@deeprootsystems.com>
>>>> CC: Santosh Shilimkar <ssantosh@kernel.org>
>>>> CC: Murali Karicheri <m-karicheri2@ti.com>
>>>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
>>>> ---
>>>> drivers/i2c/busses/i2c-davinci.c | 14 +++++++-------
>>>> 1 file changed, 7 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
>>>> index 4d96147..9bbfb8f 100644
>>>> --- a/drivers/i2c/busses/i2c-davinci.c
>>>> +++ b/drivers/i2c/busses/i2c-davinci.c
>>>> @@ -640,13 +640,13 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>>>> {
>>>> struct davinci_i2c_dev *dev;
>>>> struct i2c_adapter *adap;
>>>> - struct resource *mem, *irq;
>>>> - int r;
>>>> + struct resource *mem;
>>>> + int r, irq;
>>>>
>>>> - irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>>>> - if (!irq) {
>>>> - dev_err(&pdev->dev, "no irq resource?\n");
>>>> - return -ENODEV;
>>>> + irq = platform_get_irq(pdev, 0);
>>> One bad thing about platform_get_irq is its unusual handling of irq=0.
>>> I'm pretty sure you don't want to use this value, so adding something
>>> like:
>>>
>>> if (!irq)
>>> irq = -ENXIO
I'll add this check in driver.
>>>
>>> would be welcome because the usual value for "invalid irq" is 0 and not
>>> -ESOMETHING. platform_get_irq is one of the very few functions that
>>> don't adhere to this convention. With handling <= 0 as error your code
>>> is immune to changes in this area. Although I notice that
>>> platform_get_irq got worse in this respect to handle -EPROBE_DEFER. hmm.
>>>
>>> Apart from your change I wonder if platform_get_irq should handle
>>> of_irq_get returning 0 as an error.
>>
>> I think you are right and It seems like, the check for !irq should
>> be added/restored for OF case in platform_get_irq() too.
>
> Changing the return values of platform_get_irq is tricky as it would
> potentially break drivers because NO_IRQ can be 0 or -1 depending on
> the arch. Drivers checking against specific values of NO_IRQ would
> break. We've done some clean-up in this area, but I suspect more is
> needed.
Thanks for your comment.
regards,
-grygorii
next prev parent reply other threads:[~2014-11-21 14:59 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-20 10:03 [PATCH 0/5] i2c: davinci improvements and fixes Grygorii Strashko
2014-11-20 10:03 ` Grygorii Strashko
2014-11-20 10:03 ` [PATCH 1/5] i2c: i2c-davinci: switch to use platform_get_irq Grygorii Strashko
2014-11-20 10:03 ` Grygorii Strashko
2014-11-20 21:48 ` [1/5] " Uwe Kleine-König
[not found] ` <20141120214838.GA346-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-21 11:01 ` Grygorii Strashko
2014-11-21 11:01 ` Grygorii Strashko
[not found] ` <546F1B7D.1020209-l0cyMroinI0@public.gmane.org>
2014-11-21 14:03 ` Rob Herring
2014-11-21 14:03 ` Rob Herring
2014-11-21 14:59 ` Grygorii Strashko [this message]
[not found] ` <1416477788-5544-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-11-20 10:03 ` [PATCH 2/5] i2c: davinci: query STP always when NACK is received Grygorii Strashko
2014-11-20 10:03 ` Grygorii Strashko
[not found] ` <1416477788-5544-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-11-20 22:19 ` [2/5] " Uwe Kleine-König
2014-11-20 22:19 ` Uwe Kleine-König
[not found] ` <20141120221953.GI27002-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-21 12:48 ` Grygorii Strashko
2014-11-21 12:48 ` Grygorii Strashko
[not found] ` <546F34B9.1000206-l0cyMroinI0@public.gmane.org>
2014-11-21 13:10 ` Uwe Kleine-König
2014-11-21 13:10 ` Uwe Kleine-König
2014-11-21 15:33 ` Grygorii Strashko
2014-11-21 15:33 ` Grygorii Strashko
[not found] ` <546F5B51.1030006-l0cyMroinI0@public.gmane.org>
2014-11-23 20:33 ` Uwe Kleine-König
2014-11-23 20:33 ` Uwe Kleine-König
[not found] ` <20141123203314.GF4431-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-24 13:34 ` Grygorii Strashko
2014-11-24 13:34 ` Grygorii Strashko
[not found] ` <547333EB.5050403-l0cyMroinI0@public.gmane.org>
2014-11-24 20:02 ` Uwe Kleine-König
2014-11-24 20:02 ` Uwe Kleine-König
2014-11-20 10:03 ` [PATCH 3/5] i2c: recovery: change input parameter to i2c_adapter for prepare/unprepare_recovery Grygorii Strashko
2014-11-20 10:03 ` Grygorii Strashko
[not found] ` <1416477788-5544-4-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-11-21 18:49 ` [3/5] " Uwe Kleine-König
2014-11-21 18:49 ` Uwe Kleine-König
2014-11-20 10:03 ` [PATCH 4/5] i2c: davinci: use bus recovery infrastructure Grygorii Strashko
2014-11-20 10:03 ` Grygorii Strashko
[not found] ` <1416477788-5544-5-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-11-21 19:07 ` [4/5] " Uwe Kleine-König
2014-11-21 19:07 ` Uwe Kleine-König
[not found] ` <20141121190744.GB4431-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-21 19:33 ` Grygorii Strashko
2014-11-21 19:33 ` Grygorii Strashko
[not found] ` <546F9382.40102-l0cyMroinI0@public.gmane.org>
2014-11-23 20:36 ` Uwe Kleine-König
2014-11-23 20:36 ` Uwe Kleine-König
2014-11-24 13:26 ` Grygorii Strashko
2014-11-24 13:26 ` Grygorii Strashko
[not found] ` <547331F2.3000006-l0cyMroinI0@public.gmane.org>
2014-11-24 20:07 ` Uwe Kleine-König
2014-11-24 20:07 ` Uwe Kleine-König
2014-11-20 10:03 ` [PATCH 5/5] i2c: davinci: use ICPFUNC to toggle I2C as gpio for bus recovery Grygorii Strashko
2014-11-20 10:03 ` Grygorii Strashko
[not found] ` <1416477788-5544-6-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-11-23 17:04 ` [5/5] " Uwe Kleine-König
2014-11-23 17:04 ` Uwe Kleine-König
[not found] ` <20141123170400.GC4431-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-24 13:15 ` Grygorii Strashko
2014-11-24 13:15 ` Grygorii Strashko
[not found] ` <54732F8E.4080105-l0cyMroinI0@public.gmane.org>
2014-11-24 18:13 ` Mike Looijmans
2014-11-24 18:13 ` Mike Looijmans
[not found] ` <54737532.1050808-KQxf8TFvCoAi8rCdYzckzA@public.gmane.org>
2014-11-24 19:22 ` Grygorii Strashko
2014-11-24 19:22 ` Grygorii Strashko
2014-11-24 19:45 ` Uwe Kleine-König
2014-11-24 19:45 ` Uwe Kleine-König
[not found] ` <20141124194533.GU4431-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-25 13:04 ` Grygorii Strashko
2014-11-25 13:04 ` Grygorii Strashko
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=546F5347.7010600@ti.com \
--to=grygorii.strashko@ti.com \
--cc=grant.likely@linaro.org \
--cc=khilman@deeprootsystems.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m-karicheri2@ti.com \
--cc=nsekhar@ti.com \
--cc=robherring2@gmail.com \
--cc=ssantosh@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wsa@the-dreams.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.