pinctrl: get_group_pins() const fixes
authorStephen Warren <swarren@nvidia.com>
Wed, 19 Oct 2011 22:19:25 +0000 (16:19 -0600)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 20 Oct 2011 09:41:49 +0000 (11:41 +0200)
get_group_pins() "returns" a pointer to an array of const objects, through
a pointer parameter. Fix the prototype so what's pointed at by the returned
pointer is const, rather than the function parameter being const.

This also allows the removal of a cast in each of the two current pinmux
drivers.

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

index b2eaf8d4412a4c66901bb52c7fc8a43b54ac67c4..ceb63275c7fe3ca1eff3c74c008a3fda6b07ce7d 100644 (file)
@@ -329,7 +329,7 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
 
        seq_puts(s, "registered pin groups:\n");
        while (ops->list_groups(pctldev, selector) >= 0) {
-               unsigned *pins;
+               const unsigned *pins;
                unsigned num_pins;
                const char *gname = ops->get_group_name(pctldev, selector);
                int ret;
index c48c5634201e7372411f1d83812c48e942d8e000..ddcea1820935b29aa99e4abc8c0d1b3e805a3826 100644 (file)
@@ -869,12 +869,12 @@ static const char *sirfsoc_get_group_name(struct pinctrl_dev *pctldev,
 }
 
 static int sirfsoc_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
-                              unsigned ** const pins,
-                              unsigned * const num_pins)
+                              const unsigned **pins,
+                              const unsigned *num_pins)
 {
        if (selector >= ARRAY_SIZE(sirfsoc_pin_groups))
                return -EINVAL;
-       *pins = (unsigned *) sirfsoc_pin_groups[selector].pins;
+       *pins = sirfsoc_pin_groups[selector].pins;
        *num_pins = sirfsoc_pin_groups[selector].num_pins;
        return 0;
 }
index f9db1cebff00ce7f6ebb644ad8d231e78f83b5db..71d23b736ff578de07779faa1ec6d66f868151a0 100644 (file)
@@ -849,12 +849,12 @@ static const char *u300_get_group_name(struct pinctrl_dev *pctldev,
 }
 
 static int u300_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
-                              unsigned ** const pins,
-                              unsigned * const num_pins)
+                              const unsigned **pins,
+                              unsigned *num_pins)
 {
        if (selector >= ARRAY_SIZE(u300_pin_groups))
                return -EINVAL;
-       *pins = (unsigned *) u300_pin_groups[selector].pins;
+       *pins = u300_pin_groups[selector].pins;
        *num_pins = u300_pin_groups[selector].num_pins;
        return 0;
 }
index 6544d98b2cf8ad818d33b96964ff4de901245afa..90fb00d9a8a2b9936893340bc9564ead825e57e0 100644 (file)
@@ -326,7 +326,7 @@ static int acquire_pins(struct pinctrl_dev *pctldev,
        const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
        const char *func = pmxops->get_function_name(pctldev,
                                                     func_selector);
-       unsigned *pins;
+       const unsigned *pins;
        unsigned num_pins;
        int ret;
        int i;
@@ -367,7 +367,7 @@ static void release_pins(struct pinctrl_dev *pctldev,
                         unsigned group_selector)
 {
        const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
-       unsigned *pins;
+       const unsigned *pins;
        unsigned num_pins;
        int ret;
        int i;
index 4f8d2089acceb91ec0e0560f3e5b7e64e5db175e..3605e947fa90db9258363d5ca638082f9512dfbd 100644 (file)
@@ -75,8 +75,8 @@ struct pinctrl_ops {
                                       unsigned selector);
        int (*get_group_pins) (struct pinctrl_dev *pctldev,
                               unsigned selector,
-                              unsigned ** const pins,
-                              unsigned * const num_pins);
+                              const unsigned **pins,
+                              unsigned *num_pins);
        void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s,
                          unsigned offset);
 };