| From 3460162ad1de35498cdca4bc7b8a1109eb77afdb Mon Sep 17 00:00:00 2001 |
| From: Geert Uytterhoeven <geert+renesas@glider.be> |
| Date: Wed, 4 Oct 2017 14:16:16 +0200 |
| Subject: [PATCH 0085/1795] gpio: rcar: Use of_device_get_match_data() helper |
| |
| 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> |
| Signed-off-by: Linus Walleij <linus.walleij@linaro.org> |
| (cherry picked from commit f9f2a6fe1399d1fab38b6c1d0639928a52b67a79) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| 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 43b51045aa47..3d0a2a7dd631 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.19.0 |
| |