diff mbox series

[v2,3/3] gpiolib: acpi: Replace custom code with device_match_acpi_handle()

Message ID 20211006173125.84423-3-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v2,1/3] driver core: Provide device_match_acpi_handle() helper | expand

Commit Message

Andy Shevchenko Oct. 6, 2021, 5:31 p.m. UTC
Since driver core provides a generic device_match_acpi_handle()
we may replace the custom code with it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 drivers/gpio/gpiolib-acpi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Rafael J. Wysocki Oct. 7, 2021, 4:50 p.m. UTC | #1
On Wed, Oct 6, 2021 at 7:31 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Since driver core provides a generic device_match_acpi_handle()
> we may replace the custom code with it.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: no changes
>  drivers/gpio/gpiolib-acpi.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index 47712b6903b5..32f1f720b94b 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -95,10 +95,7 @@ static bool acpi_gpio_deferred_req_irqs_done;
>
>  static int acpi_gpiochip_find(struct gpio_chip *gc, void *data)
>  {
> -       if (!gc->parent)
> -               return false;
> -
> -       return ACPI_HANDLE(gc->parent) == data;
> +       return gc->parent ? device_match_acpi_handle(gc->parent, data) : false;

return gc->parent && device_match_acpi_handle(gc->parent, data);

would work too if I'm not mistaken.

>  }
>
>  /**
> --
Andy Shevchenko Oct. 7, 2021, 5:01 p.m. UTC | #2
On Thu, Oct 07, 2021 at 06:50:46PM +0200, Rafael J. Wysocki wrote:
> On Wed, Oct 6, 2021 at 7:31 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:

...

> > +       return gc->parent ? device_match_acpi_handle(gc->parent, data) : false;
> 
> return gc->parent && device_match_acpi_handle(gc->parent, data);
> 
> would work too if I'm not mistaken.

Seems so.

Thanks for review, I will update for v3.
Any other comments to the series?
Rafael J. Wysocki Oct. 7, 2021, 5:07 p.m. UTC | #3
On Thu, Oct 7, 2021 at 7:02 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Oct 07, 2021 at 06:50:46PM +0200, Rafael J. Wysocki wrote:
> > On Wed, Oct 6, 2021 at 7:31 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
>
> ...
>
> > > +       return gc->parent ? device_match_acpi_handle(gc->parent, data) : false;
> >
> > return gc->parent && device_match_acpi_handle(gc->parent, data);
> >
> > would work too if I'm not mistaken.
>
> Seems so.
>
> Thanks for review, I will update for v3.
> Any other comments to the series?

Not really.  Patch [2/3] is correct AFAICS.
Andy Shevchenko Oct. 7, 2021, 5:18 p.m. UTC | #4
On Thu, Oct 07, 2021 at 07:07:19PM +0200, Rafael J. Wysocki wrote:
> On Thu, Oct 7, 2021 at 7:02 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Oct 07, 2021 at 06:50:46PM +0200, Rafael J. Wysocki wrote:

...

> > Thanks for review, I will update for v3.
> > Any other comments to the series?
> 
> Not really.  Patch [2/3] is correct AFAICS.

v3 on its way!
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 47712b6903b5..32f1f720b94b 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -95,10 +95,7 @@  static bool acpi_gpio_deferred_req_irqs_done;
 
 static int acpi_gpiochip_find(struct gpio_chip *gc, void *data)
 {
-	if (!gc->parent)
-		return false;
-
-	return ACPI_HANDLE(gc->parent) == data;
+	return gc->parent ? device_match_acpi_handle(gc->parent, data) : false;
 }
 
 /**