Skip to contentSkip to conversation

gpiolib: of: Make use of device_match_of_node()

PATCH Applied Andy Shevchenko 3 participants 3 messages Nov 3, 2022 – Nov 4, 2022 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: of: Make use of device_match_of_node()

Make use of device_match_of_node() instead of open coding its functionality.

---
 drivers/gpio/gpiolib-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib-of.c +1 -1
index 52616848a37c..4b91e19366a8 100644
@@ -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;
 }
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andy Shevchenko

Make use of device_match_of_node() instead of open coding its functionality.

Quoted 20 lines
---
 drivers/gpio/gpiolib-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib-of.c +1 -1
index 52616848a37c..4b91e19366a8 100644
@@ -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;
 }
Signature · 1 line
2.35.1

Thanks.

Signature · 1 line
Dmitry
#2 lore raw
In reply to Andy Shevchenko
Quoted 23 lines · Andy Shevchenko

Make use of device_match_of_node() instead of open coding its functionality.

---
 drivers/gpio/gpiolib-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib-of.c +1 -2
index 52616848a37c..4b91e19366a8 100644
@@ -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;
 }
--
Quoted 2 lines

2.35.1

Applied, thanks!

Bartosz