pinctrl: sh-pfc: Get rid of CONFIG_ARCH_SHMOBILE_LEGACY
[firefly-linux-kernel-4.4.55.git] / drivers / pinctrl / sh-pfc / gpio.c
index e46439030914ad13bdc25f30c242d119a63deedc..a917c62f07124b0be3d5ecd378e987f886f76db3 100644 (file)
@@ -261,6 +261,7 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip)
  * Function GPIOs
  */
 
+#ifdef CONFIG_SUPERH
 static int gpio_function_request(struct gpio_chip *gc, unsigned offset)
 {
        static bool __print_once;
@@ -300,6 +301,7 @@ static int gpio_function_setup(struct sh_pfc_chip *chip)
 
        return 0;
 }
+#endif
 
 /* -----------------------------------------------------------------------------
  * Register/unregister
@@ -339,7 +341,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;
@@ -377,26 +378,25 @@ 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;
        }
 
        /* Register the function GPIOs chip. */
@@ -408,6 +408,7 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
                return PTR_ERR(chip);
 
        pfc->func = chip;
+#endif /* CONFIG_SUPERH */
 
        return 0;
 }
@@ -415,7 +416,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
 int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc)
 {
        gpiochip_remove(&pfc->gpio->gpio_chip);
+#ifdef CONFIG_SUPERH
        gpiochip_remove(&pfc->func->gpio_chip);
-
+#endif
        return 0;
 }