diff mbox series

[v1,1/4] gpio: dwapb: avoid error message for optional IRQ

Message ID 20200512184513.86883-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,1/4] gpio: dwapb: avoid error message for optional IRQ | expand

Commit Message

Andy Shevchenko May 12, 2020, 6:45 p.m. UTC
platform_get_irq() will generate an error message if the requested IRQ
is not present. Use platform_get_irq_optional() to avoid the error message
being generated.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Serge Semin <fancer.lancer@gmail.com>
---
 drivers/gpio/gpio-dwapb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andy Shevchenko May 13, 2020, 2:43 p.m. UTC | #1
On Tue, May 12, 2020 at 09:45:10PM +0300, Andy Shevchenko wrote:
> platform_get_irq() will generate an error message if the requested IRQ
> is not present. Use platform_get_irq_optional() to avoid the error message
> being generated.

I will wait for Serge and others to comment before I'll send v2 with a fix to
the last patch.
Serge Semin May 14, 2020, 11:59 a.m. UTC | #2
Hello Andy

On Wed, May 13, 2020 at 05:43:49PM +0300, Andy Shevchenko wrote:
> On Tue, May 12, 2020 at 09:45:10PM +0300, Andy Shevchenko wrote:
> > platform_get_irq() will generate an error message if the requested IRQ
> > is not present. Use platform_get_irq_optional() to avoid the error message
> > being generated.
> 
> I will wait for Serge and others to comment before I'll send v2 with a fix to
> the last patch.

Thanks for the patchset. I'll have it reviewed it in a few days.

-Sergey

> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
>
Serge Semin May 17, 2020, 12:22 p.m. UTC | #3
Hello Andy,

Thanks for sending this cleanup series. By comments are below and inlined in the
individual patches further in the patchset.

On Tue, May 12, 2020 at 09:45:10PM +0300, Andy Shevchenko wrote:
> platform_get_irq() will generate an error message if the requested IRQ
> is not present. Use platform_get_irq_optional() to avoid the error message
> being generated.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Serge Semin <fancer.lancer@gmail.com>
> ---
>  drivers/gpio/gpio-dwapb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index 8639c4a7f46974..5bc5057f071f37 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -542,7 +542,7 @@ static void dwapb_get_irq(struct device *dev, struct fwnode_handle *fwnode,
>  		if (np)
>  			pp->irq[j] = of_irq_get(np, j);
>  		else if (has_acpi_companion(dev))
> -			pp->irq[j] = platform_get_irq(to_platform_device(dev), j);
> +			pp->irq[j] = platform_get_irq_optional(to_platform_device(dev), j);

If only we didn't have sub-nodes describing the GPIO ports, we could have used
the platform_get_irq_optional() here for both DT and ACPI based devices...
Since we do, there is no way but to have the "if (np) else if(has_acpi_companion())"
conditional statement here. Thanks for sending this patch.

Reviewed-by: Serge Semin <fancer.lancer@gmail.com>

-Sergey

>  
>  		if (pp->irq[j] >= 0)
>  			pp->has_irq = true;
> -- 
> 2.26.2
>
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 8639c4a7f46974..5bc5057f071f37 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -542,7 +542,7 @@  static void dwapb_get_irq(struct device *dev, struct fwnode_handle *fwnode,
 		if (np)
 			pp->irq[j] = of_irq_get(np, j);
 		else if (has_acpi_companion(dev))
-			pp->irq[j] = platform_get_irq(to_platform_device(dev), j);
+			pp->irq[j] = platform_get_irq_optional(to_platform_device(dev), j);
 
 		if (pp->irq[j] >= 0)
 			pp->has_irq = true;