gpio: mxc: use platform_get_irq_optional() to avoid an error message
Subsystems (2)
PATCH v2 1/1 gpio: mxc: use platform_get_irq_optional() to avoid an error message
From: Fugang Duan <[email protected]>
Use platform_get_irq_optional() to avoid an error message for the optional irq.
Restructuring the codes to ask for the first mandatory IRQ before the optional one.
---
v2:
- restructuring the codes per Andy Shevchenko's review
drivers/gpio/gpio-mxc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpio/gpio-mxc.c +6 -6
@@ -405,16 +405,16 @@ static int mxc_gpio_probe(struct platform_device *pdev)if (irq_count <0 )return irq_count; -if (irq_count >1 ) { - port->irq_high =platform_get_irq (pdev,1 ); -if (port->irq_high <0 ) - port->irq_high =0 ; - } - port->irq =platform_get_irq (pdev,0 );if (port->irq <0 )return port->irq; +if (irq_count >1 ) { + err =platform_get_irq_optional (pdev,1 ); +if (err >0 ) + port->irq_high = err; + } +/* the controller clock is optional */ port->clk =devm_clk_get_optional (&pdev->dev,NULL );if (IS_ERR (port->clk))
--
2.34.1
Quoted 5 lines · Shenwei Wang
From: Fugang Duan <[email protected]>
Use
platform_get_irq_optional()to avoid an error message for the optional irq.
Looking into the code more, this won't happen as the first operation is to check how many IRQs the device already has. So, you may go further and kill that irq_count variable completely with your suggestion.
Quoted 4 lines
Restructuring the codes to ask for the first mandatory IRQ before the optional one.
Fixes 7723f4c5ecdb ("driver core: platform: Add an error message to platform_get_irq*()")
Hmm...
With the above, the proposed change does not fix anything, I believe. And I'm not sure that this commit is what we want to actually fix.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 34 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Tuesday, May 9, 2023 11:09 AM
To: Shenwei Wang <[email protected]>
Cc: Linus Walleij <[email protected]>; Bartosz Golaszewski <[email protected]>; Stephen Boyd <[email protected]>; Greg Kroah- Hartman <[email protected]>; Rafael J. Wysocki <[email protected]>; [email protected]; [email protected]; dl-linux-imx <[email protected]>; Fugang Duan <[email protected]>
Subject: [EXT] Re: [PATCH v2 1/1] gpio: mxc: useplatform_get_irq_optional()to avoid an 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 5 lines · Shenwei Wang
From: Fugang Duan <[email protected]>
Use
platform_get_irq_optional()to avoid an error message for the optional irq.Looking into the code more, this won't happen as the first operation is to check how many IRQs the device already has. So, you may go further and kill that
irq_countvariable completely with your suggestion.Quoted 3 lines
Restructuring the codes to ask for the first mandatory IRQ before the optional one.
Quoted 7 lines
Quoted 2 lines
Fixes 7723f4c5ecdb ("driver core: platform: Add an error message toplatform_get_irq*()")
Hmm...
With the above, the proposed change does not fix anything, I believe. And I'm not sure that this commit is what we want to actually fix.
After re-thinking the logic here, I think you are right. As it has already checked the irqcount before asking for the irq, this patch doesn't fix anything.
Thanks,
Shenwei
Quoted 3 lines
--
With Best Regards,
Andy Shevchenko