pinctrl: get_group_pins() const fixes

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>
This commit is contained in:
Stephen Warren 2011-10-19 16:19:25 -06:00 committed by Linus Walleij
parent 393daa814f
commit a5818a8bd0
5 changed files with 11 additions and 11 deletions

View File

@ -329,7 +329,7 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
seq_puts(s, "registered pin groups:\n"); seq_puts(s, "registered pin groups:\n");
while (ops->list_groups(pctldev, selector) >= 0) { while (ops->list_groups(pctldev, selector) >= 0) {
unsigned *pins; const unsigned *pins;
unsigned num_pins; unsigned num_pins;
const char *gname = ops->get_group_name(pctldev, selector); const char *gname = ops->get_group_name(pctldev, selector);
int ret; int ret;

View 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, static int sirfsoc_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
unsigned ** const pins, const unsigned **pins,
unsigned * const num_pins) const unsigned *num_pins)
{ {
if (selector >= ARRAY_SIZE(sirfsoc_pin_groups)) if (selector >= ARRAY_SIZE(sirfsoc_pin_groups))
return -EINVAL; return -EINVAL;
*pins = (unsigned *) sirfsoc_pin_groups[selector].pins; *pins = sirfsoc_pin_groups[selector].pins;
*num_pins = sirfsoc_pin_groups[selector].num_pins; *num_pins = sirfsoc_pin_groups[selector].num_pins;
return 0; return 0;
} }

View 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, static int u300_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
unsigned ** const pins, const unsigned **pins,
unsigned * const num_pins) unsigned *num_pins)
{ {
if (selector >= ARRAY_SIZE(u300_pin_groups)) if (selector >= ARRAY_SIZE(u300_pin_groups))
return -EINVAL; return -EINVAL;
*pins = (unsigned *) u300_pin_groups[selector].pins; *pins = u300_pin_groups[selector].pins;
*num_pins = u300_pin_groups[selector].num_pins; *num_pins = u300_pin_groups[selector].num_pins;
return 0; return 0;
} }

View File

@ -326,7 +326,7 @@ static int acquire_pins(struct pinctrl_dev *pctldev,
const struct pinmux_ops *pmxops = pctldev->desc->pmxops; const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
const char *func = pmxops->get_function_name(pctldev, const char *func = pmxops->get_function_name(pctldev,
func_selector); func_selector);
unsigned *pins; const unsigned *pins;
unsigned num_pins; unsigned num_pins;
int ret; int ret;
int i; int i;
@ -367,7 +367,7 @@ static void release_pins(struct pinctrl_dev *pctldev,
unsigned group_selector) unsigned group_selector)
{ {
const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
unsigned *pins; const unsigned *pins;
unsigned num_pins; unsigned num_pins;
int ret; int ret;
int i; int i;

View File

@ -75,8 +75,8 @@ struct pinctrl_ops {
unsigned selector); unsigned selector);
int (*get_group_pins) (struct pinctrl_dev *pctldev, int (*get_group_pins) (struct pinctrl_dev *pctldev,
unsigned selector, unsigned selector,
unsigned ** const pins, const unsigned **pins,
unsigned * const num_pins); unsigned *num_pins);
void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s, void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s,
unsigned offset); unsigned offset);
}; };