diff mbox series

[v1,1/1] gpiolib: of: Make use of device_match_of_node()

Message ID 20221103203005.25743-1-andriy.shevchenko@linux.intel.com
State Accepted
Commit d59fdbc7164a6b2a0ed45c13387deac8efeed5a2
Headers show
Series [v1,1/1] gpiolib: of: Make use of device_match_of_node() | expand

Commit Message

Andy Shevchenko Nov. 3, 2022, 8:30 p.m. UTC
Make use of device_match_of_node() instead of open coding its
functionality.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dmitry Torokhov Nov. 3, 2022, 8:36 p.m. UTC | #1
On Thu, Nov 03, 2022 at 10:30:05PM +0200, Andy Shevchenko wrote:
> Make use of device_match_of_node() instead of open coding its
> functionality.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> ---
>  drivers/gpio/gpiolib-of.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index 52616848a37c..4b91e19366a8 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -85,7 +85,7 @@ static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, void *data)
>  {
>  	struct of_phandle_args *gpiospec = data;
>  
> -	return chip->gpiodev->dev.of_node == gpiospec->np &&
> +	return device_match_of_node(&chip->gpiodev->dev, gpiospec->np) &&
>  				chip->of_xlate &&
>  				chip->of_xlate(chip, gpiospec, NULL) >= 0;
>  }
> -- 
> 2.35.1
> 

Thanks.
Bartosz Golaszewski Nov. 4, 2022, 3:11 p.m. UTC | #2
On Thu, Nov 3, 2022 at 9:29 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Make use of device_match_of_node() instead of open coding its
> functionality.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpiolib-of.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index 52616848a37c..4b91e19366a8 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -85,7 +85,7 @@ static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, void *data)
>  {
>         struct of_phandle_args *gpiospec = data;
>
> -       return chip->gpiodev->dev.of_node == gpiospec->np &&
> +       return device_match_of_node(&chip->gpiodev->dev, gpiospec->np) &&
>                                 chip->of_xlate &&
>                                 chip->of_xlate(chip, gpiospec, NULL) >= 0;
>  }
> --
> 2.35.1
>

Applied, thanks!

Bartosz
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 52616848a37c..4b91e19366a8 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -85,7 +85,7 @@  static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, void *data)
 {
 	struct of_phandle_args *gpiospec = data;
 
-	return chip->gpiodev->dev.of_node == gpiospec->np &&
+	return device_match_of_node(&chip->gpiodev->dev, gpiospec->np) &&
 				chip->of_xlate &&
 				chip->of_xlate(chip, gpiospec, NULL) >= 0;
 }