From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: gregkh@linuxfoundation.org, davem@davemloft.net,
linus.walleij@linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] driver-core: platform: Avoid to return IRQ 0 in platform_get_irq()
Date: Tue, 5 Dec 2017 10:20:03 -0800 [thread overview]
Message-ID: <20171205182003.oto6qnus3e3vy64f@dtor-ws> (raw)
In-Reply-To: <fd6dac9b18d2ce37998901dc074c61b94e523969.1512497067.git.arvind.yadav.cs@gmail.com>
On Tue, Dec 05, 2017 at 11:41:52PM +0530, Arvind Yadav wrote:
> Function platform_get_irq() can return 0. Which means NO_IRQ.
> So this change will not allow to return 0.
>
> This change is help to use platform_get_irq() without this,
>
> val = platform_get_irq();
> if (val <= 0)
> ret = val ? val : -ENODEV;
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
You need to audit the drivers and make sure you are not breaking them
with this. I believe at least i2c designware controller on certain
boards has DEFINE_RES_IRQ(0) which will be broken by this patch.
> ---
> drivers/base/platform.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index c203fb9..7b3079c 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -127,7 +127,7 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
> irqd_set_trigger_type(irqd, r->flags & IORESOURCE_BITS);
> }
>
> - return r ? r->start : -ENXIO;
> + return r && r->start ? r->start : -ENXIO;
> #endif
> }
> EXPORT_SYMBOL_GPL(platform_get_irq);
> --
> 2.7.4
>
Thanks.
--
Dmitry
next prev parent reply other threads:[~2017-12-05 18:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 18:11 Arvind Yadav
2017-12-05 18:20 ` Dmitry Torokhov [this message]
2017-12-06 6:28 ` Arvind Yadav
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=20171205182003.oto6qnus3e3vy64f@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=arvind.yadav.cs@gmail.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®