]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/pinctrl/sh-pfc/gpio.c
Merge remote-tracking branch 'arm-soc/for-next'
[karo-tx-linux.git] / drivers / pinctrl / sh-pfc / gpio.c
index 685b3c24627daf03e6f049dc0a9e38ffa74419ff..db3f09aa8993cdda59a2cec8369d2d13047a230e 100644 (file)
@@ -219,10 +219,7 @@ static int gpio_pin_to_irq(struct gpio_chip *gc, unsigned offset)
        return -ENOSYS;
 
 found:
-       if (pfc->num_irqs)
-               return pfc->irqs[i];
-       else
-               return pfc->info->gpio_irq[i].irq;
+       return pfc->irqs[i];
 }
 
 static int gpio_pin_setup(struct sh_pfc_chip *chip)
@@ -341,7 +338,6 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
        struct sh_pfc_chip *chip;
        phys_addr_t address;
        unsigned int i;
-       int ret;
 
        if (pfc->info->data_regs == NULL)
                return 0;
@@ -364,7 +360,7 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
                return 0;
 
        /* If we have IRQ resources make sure their number is correct. */
-       if (pfc->num_irqs && pfc->num_irqs != pfc->info->gpio_irq_size) {
+       if (pfc->num_irqs != pfc->info->gpio_irq_size) {
                dev_err(pfc->dev, "invalid number of IRQ resources\n");
                return -EINVAL;
        }
@@ -379,29 +375,27 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
        if (IS_ENABLED(CONFIG_OF) && pfc->dev->of_node)
                return 0;
 
-       if (IS_ENABLED(CONFIG_SUPERH) ||
-           IS_ENABLED(CONFIG_ARCH_SHMOBILE_LEGACY)) {
-               /*
-                * Register the GPIO to pin mappings. As pins with GPIO ports
-                * must come first in the ranges, skip the pins without GPIO
-                * ports by stopping at the first range that contains such a
-                * pin.
-                */
-               for (i = 0; i < pfc->nr_ranges; ++i) {
-                       const struct sh_pfc_pin_range *range = &pfc->ranges[i];
-
-                       if (range->start >= pfc->nr_gpio_pins)
-                               break;
-
-                       ret = gpiochip_add_pin_range(&chip->gpio_chip,
-                               dev_name(pfc->dev), range->start, range->start,
-                               range->end - range->start + 1);
-                       if (ret < 0)
-                               return ret;
-               }
+#ifdef CONFIG_SUPERH
+       /*
+        * Register the GPIO to pin mappings. As pins with GPIO ports
+        * must come first in the ranges, skip the pins without GPIO
+        * ports by stopping at the first range that contains such a
+        * pin.
+        */
+       for (i = 0; i < pfc->nr_ranges; ++i) {
+               const struct sh_pfc_pin_range *range = &pfc->ranges[i];
+               int ret;
+
+               if (range->start >= pfc->nr_gpio_pins)
+                       break;
+
+               ret = gpiochip_add_pin_range(&chip->gpio_chip,
+                       dev_name(pfc->dev), range->start, range->start,
+                       range->end - range->start + 1);
+               if (ret < 0)
+                       return ret;
        }
 
-#ifdef CONFIG_SUPERH
        /* Register the function GPIOs chip. */
        if (pfc->info->nr_func_gpios == 0)
                return 0;