]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
pinctrl: move group lookup to core
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 19 Oct 2011 15:07:16 +0000 (17:07 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 30 Nov 2011 15:18:48 +0000 (16:18 +0100)
Now also the core needs to look up pin groups so move the lookup
function there and expose it in the internal header.

Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/core.c
drivers/pinctrl/core.h
drivers/pinctrl/pinmux.c

index eadef9e191ea59d5f59b9453894a1d3d1824b4bf..9970590006d15e7276fc58fb929e15c21ab1de8b 100644 (file)
@@ -284,6 +284,37 @@ void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev,
        mutex_unlock(&pctldev->gpio_ranges_lock);
 }
 
+/**
+ * pinctrl_get_group_selector() - returns the group selector for a group
+ * @pctldev: the pin controller handling the group
+ * @pin_group: the pin group to look up
+ */
+int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
+                              const char *pin_group)
+{
+       const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
+       unsigned group_selector = 0;
+
+       while (pctlops->list_groups(pctldev, group_selector) >= 0) {
+               const char *gname = pctlops->get_group_name(pctldev,
+                                                           group_selector);
+               if (!strcmp(gname, pin_group)) {
+                       dev_dbg(&pctldev->dev,
+                               "found group selector %u for %s\n",
+                               group_selector,
+                               pin_group);
+                       return group_selector;
+               }
+
+               group_selector++;
+       }
+
+       dev_err(&pctldev->dev, "does not have pin group %s\n",
+               pin_group);
+
+       return -EINVAL;
+}
+
 #ifdef CONFIG_DEBUG_FS
 
 static int pinctrl_pins_show(struct seq_file *s, void *what)
index 472fa1341cc0c3f9f7a59446d4a625c727ce4d7f..dcc6d687b6530e3523b0c690a9a157618b0e71a5 100644 (file)
@@ -69,3 +69,5 @@ struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev, int pin);
 int pinctrl_get_device_gpio_range(unsigned gpio,
                                  struct pinctrl_dev **outdev,
                                  struct pinctrl_gpio_range **outrange);
+int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
+                              const char *pin_group);
index a5467f8709e9a72087ab272e6206f7e8ae1625d0..5c4b7828608ef2f7cafb0e37b4c9df96a975bb5f 100644 (file)
@@ -393,37 +393,6 @@ static void release_pins(struct pinctrl_dev *pctldev,
                pin_free(pctldev, pins[i], false);
 }
 
-/**
- * pinmux_get_group_selector() - returns the group selector for a group
- * @pctldev: the pin controller handling the group
- * @pin_group: the pin group to look up
- */
-static int pinmux_get_group_selector(struct pinctrl_dev *pctldev,
-                                    const char *pin_group)
-{
-       const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
-       unsigned group_selector = 0;
-
-       while (pctlops->list_groups(pctldev, group_selector) >= 0) {
-               const char *gname = pctlops->get_group_name(pctldev,
-                                                           group_selector);
-               if (!strcmp(gname, pin_group)) {
-                       dev_dbg(&pctldev->dev,
-                               "found group selector %u for %s\n",
-                               group_selector,
-                               pin_group);
-                       return group_selector;
-               }
-
-               group_selector++;
-       }
-
-       dev_err(&pctldev->dev, "does not have pin group %s\n",
-               pin_group);
-
-       return -EINVAL;
-}
-
 /**
  * pinmux_check_pin_group() - check function and pin group combo
  * @pctldev: device to check the pin group vs function for
@@ -465,7 +434,7 @@ static int pinmux_check_pin_group(struct pinctrl_dev *pctldev,
                        return ret;
                if (num_groups < 1)
                        return -EINVAL;
-               ret = pinmux_get_group_selector(pctldev, groups[0]);
+               ret = pinctrl_get_group_selector(pctldev, groups[0]);
                if (ret < 0) {
                        dev_err(&pctldev->dev,
                                "function %s wants group %s but the pin "
@@ -490,7 +459,7 @@ static int pinmux_check_pin_group(struct pinctrl_dev *pctldev,
                "check if we have pin group %s on controller %s\n",
                pin_group, pinctrl_dev_get_name(pctldev));
 
-       ret = pinmux_get_group_selector(pctldev, pin_group);
+       ret = pinctrl_get_group_selector(pctldev, pin_group);
        if (ret < 0) {
                dev_dbg(&pctldev->dev,
                        "%s does not support pin group %s with function %s\n",