diff options
Diffstat (limited to 'drivers/gpio/gpio-rcar.c')
-rw-r--r-- | drivers/gpio/gpio-rcar.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 1f0871553fd2..0ea998a3e357 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> |
@@ -206,7 +207,7 @@ static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id) | |||
206 | gpio_rcar_read(p, INTMSK))) { | 207 | gpio_rcar_read(p, INTMSK))) { |
207 | offset = __ffs(pending); | 208 | offset = __ffs(pending); |
208 | gpio_rcar_write(p, INTCLR, BIT(offset)); | 209 | gpio_rcar_write(p, INTCLR, BIT(offset)); |
209 | generic_handle_irq(irq_find_mapping(p->gpio_chip.irqdomain, | 210 | generic_handle_irq(irq_find_mapping(p->gpio_chip.irq.domain, |
210 | offset)); | 211 | offset)); |
211 | irqs_handled++; | 212 | irqs_handled++; |
212 | } | 213 | } |
@@ -393,16 +394,11 @@ MODULE_DEVICE_TABLE(of, gpio_rcar_of_table); | |||
393 | static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins) | 394 | static 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; |
@@ -456,19 +452,17 @@ static int gpio_rcar_probe(struct platform_device *pdev) | |||
456 | 452 | ||
457 | pm_runtime_enable(dev); | 453 | pm_runtime_enable(dev); |
458 | 454 | ||
459 | io = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
460 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 455 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
461 | 456 | if (!irq) { | |
462 | if (!io || !irq) { | 457 | dev_err(dev, "missing IRQ\n"); |
463 | dev_err(dev, "missing IRQ or IOMEM\n"); | ||
464 | ret = -EINVAL; | 458 | ret = -EINVAL; |
465 | goto err0; | 459 | goto err0; |
466 | } | 460 | } |
467 | 461 | ||
468 | p->base = devm_ioremap_nocache(dev, io->start, resource_size(io)); | 462 | io = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
469 | if (!p->base) { | 463 | p->base = devm_ioremap_resource(dev, io); |
470 | dev_err(dev, "failed to remap I/O memory\n"); | 464 | if (IS_ERR(p->base)) { |
471 | ret = -ENXIO; | 465 | ret = PTR_ERR(p->base); |
472 | goto err0; | 466 | goto err0; |
473 | } | 467 | } |
474 | 468 | ||