Commit f9f2a6fe authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Walleij

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: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent d327a224
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
...@@ -393,16 +394,11 @@ MODULE_DEVICE_TABLE(of, gpio_rcar_of_table); ...@@ -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) static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
{ {
struct device_node *np = p->pdev->dev.of_node; struct device_node *np = p->pdev->dev.of_node;
const struct of_device_id *match;
const struct gpio_rcar_info *info; const struct gpio_rcar_info *info;
struct of_phandle_args args; struct of_phandle_args args;
int ret; int ret;
match = of_match_node(gpio_rcar_of_table, np); info = of_device_get_match_data(&p->pdev->dev);
if (!match)
return -EINVAL;
info = match->data;
ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args); ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args);
*npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK; *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment