Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302327
b: refs/heads/master
c: d26bc49
h: refs/heads/master
i:
  302325: 53bd39a
  302323: 1f6c015
  302319: 9974518
v: v3
  • Loading branch information
Stephen Warren authored and Linus Walleij committed Apr 18, 2012
1 parent 1e52d4a commit 5c7f4e2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 22f099d0fcb33073a1f1f10402a16b28602e20f2
refs/heads/master: d26bc49fa401be2b71838b6a4b387196cd12a534
25 changes: 21 additions & 4 deletions trunk/drivers/pinctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,10 +908,6 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
const struct pinctrl_ops *ops = pctldev->desc->pctlops;
unsigned selector = 0;

/* No grouping */
if (!ops)
return 0;

mutex_lock(&pinctrl_mutex);

seq_puts(s, "registered pin groups:\n");
Expand Down Expand Up @@ -1225,6 +1221,19 @@ static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev)

#endif

static int pinctrl_check_ops(struct pinctrl_dev *pctldev)
{
const struct pinctrl_ops *ops = pctldev->desc->pctlops;

if (!ops ||
!ops->list_groups ||
!ops->get_group_name ||
!ops->get_group_pins)
return -EINVAL;

return 0;
}

/**
* pinctrl_register() - register a pin controller device
* @pctldesc: descriptor for this pin controller
Expand Down Expand Up @@ -1256,6 +1265,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
INIT_LIST_HEAD(&pctldev->gpio_ranges);
pctldev->dev = dev;

/* check core ops for sanity */
ret = pinctrl_check_ops(pctldev);
if (ret) {
pr_err("%s pinctrl ops lacks necessary functions\n",
pctldesc->name);
goto out_err;
}

/* If we're implementing pinmuxing, check the ops for sanity */
if (pctldesc->pmxops) {
ret = pinmux_check_ops(pctldev);
Expand Down

0 comments on commit 5c7f4e2

Please sign in to comment.