gpio: mxc: use platform_get_irq_optional() to avoid error message
Subsystems (2)
PATCH 1/1 gpio: mxc: use platform_get_irq_optional() to avoid error message
From: Fugang Duan <[email protected]>
Use platform_get_irq_optional() to avoid error message for the optional irq.
--- drivers/gpio/gpio-mxc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-mxc.c +1 -1
@@ -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 ; }
Signature · 1 line
2.34.1
Quoted 4 lines · Shenwei Wang
From: Fugang Duan <[email protected]>
Use
platform_get_irq_optional()to avoid error message for the
an error
Quoted 1 line
optional irq.
...
drivers/gpio/gpio-mxc.c static int mxc_gpio_probe(struct platform_device *pdev) · line 411
Quoted 5 lines
if (irq_count > 1) {drivers/gpio/gpio-mxc.c +1
-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;Quoted 1 line
}
And looking into the code the above piece makes more sense after asking for the first (mandatory) IRQ.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 38 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Tuesday, May 9, 2023 4:12 AM
To: Shenwei Wang <[email protected]>
Cc: Linus Walleij <[email protected]>; Bartosz Golaszewski <[email protected]>; Greg Kroah-Hartman <[email protected]>; Stephen Boyd <[email protected]>; Rafael J. Wysocki <[email protected]>; [email protected]; [email protected]; dl-linux-imx <[email protected]>; Fugang Duan <[email protected]>
Subject: [EXT] Re: [PATCH 1/1] gpio: mxc: useplatform_get_irq_optional()to avoid error messageCaution: 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
Quoted 4 lines · Shenwei Wang
From: Fugang Duan <[email protected]>
Use
platform_get_irq_optional()to avoid error message for thean error
Quoted 1 line
optional irq.
...
drivers/gpio/gpio-mxc.c static int mxc_gpio_probe(struct platform_device *pdev) · line 411
Quoted 5 lines
if (irq_count > 1) {drivers/gpio/gpio-mxc.c +1
-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 ;
Quoted 4 lines
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
Quoted 10 lines
port->irq_high = err;Quoted 1 line
}And looking into the code the above piece makes more sense after asking for the first (mandatory) IRQ.
--
With Best Regards,
Andy Shevchenko
Quoted 4 lines · Shenwei Wang
Quoted 4 lines
From: Andy Shevchenko <[email protected]>
Sent: Tuesday, May 9, 2023 4:12 AM
On Mon, May 8, 2023 at 10:46 PM Shenwei Wang <[email protected]> wrote:
...
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
if (irq_count > 1) {drivers/gpio/gpio-mxc.c +1
-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 ;
Quoted 7 lines
Quoted 4 lines
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.
Quoted 6 lines
Quoted 6 lines
port->irq_high = err;Quoted 1 line
}And looking into the code the above piece makes more sense after asking for the first (mandatory) IRQ.
Signature · 2 lines
With Best Regards, Andy Shevchenko