Move sh_pfc_add_gpiochip() to the generic helper section at the top of
the file, so it can be called from the "Function GPIOs" section later.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
 drivers/pinctrl/sh-pfc/gpio.c | 58 +++++++++++++++++++++----------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
index b8929b5e2fa26c53..30654e800580524d 100644
--- a/drivers/pinctrl/sh-pfc/gpio.c
+++ b/drivers/pinctrl/sh-pfc/gpio.c
@@ -131,6 +131,35 @@ static int gpio_setup_data_regs(struct sh_pfc_chip *chip)
        return 0;
 }
 
+static struct sh_pfc_chip *
+sh_pfc_add_gpiochip(struct sh_pfc *pfc, int(*setup)(struct sh_pfc_chip *),
+                   struct sh_pfc_window *mem)
+{
+       struct sh_pfc_chip *chip;
+       int ret;
+
+       chip = devm_kzalloc(pfc->dev, sizeof(*chip), GFP_KERNEL);
+       if (unlikely(!chip))
+               return ERR_PTR(-ENOMEM);
+
+       chip->mem = mem;
+       chip->pfc = pfc;
+
+       ret = setup(chip);
+       if (ret < 0)
+               return ERR_PTR(ret);
+
+       ret = gpiochip_add(&chip->gpio_chip);
+       if (unlikely(ret < 0))
+               return ERR_PTR(ret);
+
+       dev_info(pfc->dev, "%s handling gpio %u -> %u\n",
+                chip->gpio_chip.label, chip->gpio_chip.base,
+                chip->gpio_chip.base + chip->gpio_chip.ngpio - 1);
+
+       return chip;
+}
+
 /* 
-----------------------------------------------------------------------------
  * Pin GPIOs
  */
@@ -305,35 +334,6 @@ static int gpio_function_setup(struct sh_pfc_chip *chip)
  * Register/unregister
  */
 
-static struct sh_pfc_chip *
-sh_pfc_add_gpiochip(struct sh_pfc *pfc, int(*setup)(struct sh_pfc_chip *),
-                   struct sh_pfc_window *mem)
-{
-       struct sh_pfc_chip *chip;
-       int ret;
-
-       chip = devm_kzalloc(pfc->dev, sizeof(*chip), GFP_KERNEL);
-       if (unlikely(!chip))
-               return ERR_PTR(-ENOMEM);
-
-       chip->mem = mem;
-       chip->pfc = pfc;
-
-       ret = setup(chip);
-       if (ret < 0)
-               return ERR_PTR(ret);
-
-       ret = gpiochip_add(&chip->gpio_chip);
-       if (unlikely(ret < 0))
-               return ERR_PTR(ret);
-
-       dev_info(pfc->dev, "%s handling gpio %u -> %u\n",
-                chip->gpio_chip.label, chip->gpio_chip.base,
-                chip->gpio_chip.base + chip->gpio_chip.ngpio - 1);
-
-       return chip;
-}
-
 int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
 {
        struct sh_pfc_chip *chip;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to