linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] gpio: mxc: use platform_get_irq_optional() to avoid error message
@ 2023-05-08 19:45 Shenwei Wang
  2023-05-09  9:11 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Shenwei Wang @ 2023-05-08 19:45 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: Andy Shevchenko, Greg Kroah-Hartman, Stephen Boyd,
	Rafael J. Wysocki, linux-gpio, imx, linux-imx, Fugang Duan,
	Shenwei Wang

From: Fugang Duan <fugang.duan@nxp.com>

Use platform_get_irq_optional() to avoid error message for the
optional irq.

Fixes: 7723f4c5ecdb ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
 drivers/gpio/gpio-mxc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 9d0cec4b82a3..aa5a9c25e415 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -406,7 +406,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
 		return irq_count;
 
 	if (irq_count > 1) {
-		port->irq_high = platform_get_irq(pdev, 1);
+		port->irq_high = platform_get_irq_optional(pdev, 1);
 		if (port->irq_high < 0)
 			port->irq_high = 0;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] gpio: mxc: use platform_get_irq_optional() to avoid error message
  2023-05-08 19:45 [PATCH 1/1] gpio: mxc: use platform_get_irq_optional() to avoid error message Shenwei Wang
@ 2023-05-09  9:11 ` Andy Shevchenko
  2023-05-09 15:31   ` [EXT] " Shenwei Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2023-05-09  9:11 UTC (permalink / raw)
  To: Shenwei Wang
  Cc: Linus Walleij, Bartosz Golaszewski, Greg Kroah-Hartman,
	Stephen Boyd, Rafael J. Wysocki, linux-gpio, imx, linux-imx,
	Fugang Duan

On Mon, May 8, 2023 at 10:46 PM Shenwei Wang <shenwei.wang@nxp.com> wrote:
>
> From: Fugang Duan <fugang.duan@nxp.com>
>
> Use platform_get_irq_optional() to avoid error message for the

an error

> optional irq.

...

>         if (irq_count > 1) {
> -               port->irq_high = platform_get_irq(pdev, 1);
> +               port->irq_high = platform_get_irq_optional(pdev, 1);
>                 if (port->irq_high < 0)
>                         port->irq_high = 0;

I would rather do

  err = platform_get_irq_optional(pdev, 1);
  if (err >= 0)
    port->irq_high = err;

>         }

And looking into the code the above piece makes more sense after
asking for the first (mandatory) IRQ.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [EXT] Re: [PATCH 1/1] gpio: mxc: use platform_get_irq_optional() to avoid error message
  2023-05-09  9:11 ` Andy Shevchenko
@ 2023-05-09 15:31   ` Shenwei Wang
  2023-05-09 15:41     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Shenwei Wang @ 2023-05-09 15:31 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Bartosz Golaszewski, Greg Kroah-Hartman,
	Stephen Boyd, Rafael J. Wysocki, linux-gpio@vger.kernel.org,
	imx@lists.linux.dev, dl-linux-imx, Fugang Duan



> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> Sent: Tuesday, May 9, 2023 4:12 AM
> To: Shenwei Wang <shenwei.wang@nxp.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>; Bartosz Golaszewski
> <brgl@bgdev.pl>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Stephen
> Boyd <swboyd@chromium.org>; Rafael J. Wysocki
> <rafael.j.wysocki@intel.com>; linux-gpio@vger.kernel.org; imx@lists.linux.dev;
> dl-linux-imx <linux-imx@nxp.com>; Fugang Duan <fugang.duan@nxp.com>
> Subject: [EXT] Re: [PATCH 1/1] gpio: mxc: use platform_get_irq_optional() to
> avoid error message
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report this
> email' button
> 
> 
> On Mon, May 8, 2023 at 10:46 PM Shenwei Wang <shenwei.wang@nxp.com>
> wrote:
> >
> > From: Fugang Duan <fugang.duan@nxp.com>
> >
> > Use platform_get_irq_optional() to avoid error message for the
> 
> an error
> 
> > optional irq.
> 
> ...
> 
> >         if (irq_count > 1) {
> > -               port->irq_high = platform_get_irq(pdev, 1);
> > +               port->irq_high = platform_get_irq_optional(pdev, 1);
> >                 if (port->irq_high < 0)
> >                         port->irq_high = 0;
> 
> I would rather do
> 
>   err = platform_get_irq_optional(pdev, 1);
>   if (err >= 0)

Should be "if (err > 0)", right? As the platform_get_irq_optional() return non-zero
IRQ number on success.

Regards,
Shenwei

>     port->irq_high = err;
> 
> >         }
> 
> And looking into the code the above piece makes more sense after asking for
> the first (mandatory) IRQ.
> 
> --
> With Best Regards,
> Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [EXT] Re: [PATCH 1/1] gpio: mxc: use platform_get_irq_optional() to avoid error message
  2023-05-09 15:31   ` [EXT] " Shenwei Wang
@ 2023-05-09 15:41     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2023-05-09 15:41 UTC (permalink / raw)
  To: Shenwei Wang
  Cc: Linus Walleij, Bartosz Golaszewski, Greg Kroah-Hartman,
	Stephen Boyd, Rafael J. Wysocki, linux-gpio@vger.kernel.org,
	imx@lists.linux.dev, dl-linux-imx, Fugang Duan

On Tue, May 9, 2023 at 6:31 PM Shenwei Wang <shenwei.wang@nxp.com> wrote:
> > From: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Sent: Tuesday, May 9, 2023 4:12 AM
> > On Mon, May 8, 2023 at 10:46 PM Shenwei Wang <shenwei.wang@nxp.com>
> > wrote:

...

> > >         if (irq_count > 1) {
> > > -               port->irq_high = platform_get_irq(pdev, 1);
> > > +               port->irq_high = platform_get_irq_optional(pdev, 1);
> > >                 if (port->irq_high < 0)
> > >                         port->irq_high = 0;
> >
> > I would rather do
> >
> >   err = platform_get_irq_optional(pdev, 1);
> >   if (err >= 0)
>
> Should be "if (err > 0)", right? As the platform_get_irq_optional() return non-zero
> IRQ number on success.

Either way will work, but your proposal is better.

> >     port->irq_high = err;
> >
> > >         }
> >
> > And looking into the code the above piece makes more sense after asking for
> > the first (mandatory) IRQ.


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-09 15:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-08 19:45 [PATCH 1/1] gpio: mxc: use platform_get_irq_optional() to avoid error message Shenwei Wang
2023-05-09  9:11 ` Andy Shevchenko
2023-05-09 15:31   ` [EXT] " Shenwei Wang
2023-05-09 15:41     ` Andy Shevchenko

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).