linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: rcar: Use of_device_get_match_data() helper
@ 2017-10-04 12:16 Geert Uytterhoeven
  2017-10-05  9:15 ` Simon Horman
  2017-10-08  0:17 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2017-10-04 12:16 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-renesas-soc, Geert Uytterhoeven

Use the of_device_get_match_data() helper instead of open coding.
Note that the gpio-rcar driver is used with DT only, so there's always a
valid match.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpio/gpio-rcar.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 1f0871553fd20d0f..de5c010e69266264 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -24,6 +24,7 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
@@ -393,16 +394,11 @@ MODULE_DEVICE_TABLE(of, gpio_rcar_of_table);
 static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
 {
 	struct device_node *np = p->pdev->dev.of_node;
-	const struct of_device_id *match;
 	const struct gpio_rcar_info *info;
 	struct of_phandle_args args;
 	int ret;
 
-	match = of_match_node(gpio_rcar_of_table, np);
-	if (!match)
-		return -EINVAL;
-
-	info = match->data;
+	info = of_device_get_match_data(&p->pdev->dev);
 
 	ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args);
 	*npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: rcar: Use of_device_get_match_data() helper
  2017-10-04 12:16 [PATCH] gpio: rcar: Use of_device_get_match_data() helper Geert Uytterhoeven
@ 2017-10-05  9:15 ` Simon Horman
  2017-10-08  0:17 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2017-10-05  9:15 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linus Walleij, linux-gpio, linux-renesas-soc

On Wed, Oct 04, 2017 at 02:16:16PM +0200, Geert Uytterhoeven wrote:
> Use the of_device_get_match_data() helper instead of open coding.
> Note that the gpio-rcar driver is used with DT only, so there's always a
> valid match.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: rcar: Use of_device_get_match_data() helper
  2017-10-04 12:16 [PATCH] gpio: rcar: Use of_device_get_match_data() helper Geert Uytterhoeven
  2017-10-05  9:15 ` Simon Horman
@ 2017-10-08  0:17 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2017-10-08  0:17 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-gpio@vger.kernel.org, Linux-Renesas

On Wed, Oct 4, 2017 at 2:16 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:

> Use the of_device_get_match_data() helper instead of open coding.
> Note that the gpio-rcar driver is used with DT only, so there's always a
> valid match.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Patch applied with Simon's tag.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-08  0:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-04 12:16 [PATCH] gpio: rcar: Use of_device_get_match_data() helper Geert Uytterhoeven
2017-10-05  9:15 ` Simon Horman
2017-10-08  0:17 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).