aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2017-10-04 08:16:16 -0400
committerLinus Walleij <linus.walleij@linaro.org>2017-10-07 20:16:42 -0400
commitf9f2a6fe1399d1fab38b6c1d0639928a52b67a79 (patch)
tree094877d63962fed2253930ee3864134c2bcb8c67
parentd327a224ba2cbe234d82fd560ff8e5bb38b0bb4b (diff)
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>
-rw-r--r--drivers/gpio/gpio-rcar.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 1f0871553fd2..de5c010e6926 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -24,6 +24,7 @@
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/of.h> 26#include <linux/of.h>
27#include <linux/of_device.h>
27#include <linux/pinctrl/consumer.h> 28#include <linux/pinctrl/consumer.h>
28#include <linux/platform_device.h> 29#include <linux/platform_device.h>
29#include <linux/pm_runtime.h> 30#include <linux/pm_runtime.h>
@@ -393,16 +394,11 @@ MODULE_DEVICE_TABLE(of, gpio_rcar_of_table);
393static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins) 394static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
394{ 395{
395 struct device_node *np = p->pdev->dev.of_node; 396 struct device_node *np = p->pdev->dev.of_node;
396 const struct of_device_id *match;
397 const struct gpio_rcar_info *info; 397 const struct gpio_rcar_info *info;
398 struct of_phandle_args args; 398 struct of_phandle_args args;
399 int ret; 399 int ret;
400 400
401 match = of_match_node(gpio_rcar_of_table, np); 401 info = of_device_get_match_data(&p->pdev->dev);
402 if (!match)
403 return -EINVAL;
404
405 info = match->data;
406 402
407 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args); 403 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args);
408 *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK; 404 *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK;