diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-20 15:28:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-20 15:28:06 -0400 |
commit | 3b422e9c2c020a1137349c614da7f9c9761a0922 (patch) | |
tree | 0bbcfa6ca3cbee25b1ef624d908704c2773d24dc /drivers | |
parent | 3a5374303923a543ff3e5f491030b21836d288f5 (diff) | |
parent | f84cc342b1999db11ece939e1d2bf0743eb4578b (diff) |
Merge tag 'for-torvalds-20120418' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pinctrl fixes from Linus Walleij:
- Fixed compilation errors and warnings
- Stricter checks on the ops vtable
* tag 'for-torvalds-20120418' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
pinctrl: implement pinctrl_check_ops
pinctrl: include <linux/bug.h> to prevent compile errors
pinctrl: fix compile error if not select PINMUX support
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pinctrl/core.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index ec3b8cc188af..df6296c5f47b 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -908,10 +908,6 @@ static int pinctrl_groups_show(struct seq_file *s, void *what) | |||
908 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; | 908 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; |
909 | unsigned selector = 0; | 909 | unsigned selector = 0; |
910 | 910 | ||
911 | /* No grouping */ | ||
912 | if (!ops) | ||
913 | return 0; | ||
914 | |||
915 | mutex_lock(&pinctrl_mutex); | 911 | mutex_lock(&pinctrl_mutex); |
916 | 912 | ||
917 | seq_puts(s, "registered pin groups:\n"); | 913 | seq_puts(s, "registered pin groups:\n"); |
@@ -1225,6 +1221,19 @@ static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev) | |||
1225 | 1221 | ||
1226 | #endif | 1222 | #endif |
1227 | 1223 | ||
1224 | static int pinctrl_check_ops(struct pinctrl_dev *pctldev) | ||
1225 | { | ||
1226 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; | ||
1227 | |||
1228 | if (!ops || | ||
1229 | !ops->list_groups || | ||
1230 | !ops->get_group_name || | ||
1231 | !ops->get_group_pins) | ||
1232 | return -EINVAL; | ||
1233 | |||
1234 | return 0; | ||
1235 | } | ||
1236 | |||
1228 | /** | 1237 | /** |
1229 | * pinctrl_register() - register a pin controller device | 1238 | * pinctrl_register() - register a pin controller device |
1230 | * @pctldesc: descriptor for this pin controller | 1239 | * @pctldesc: descriptor for this pin controller |
@@ -1256,6 +1265,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, | |||
1256 | INIT_LIST_HEAD(&pctldev->gpio_ranges); | 1265 | INIT_LIST_HEAD(&pctldev->gpio_ranges); |
1257 | pctldev->dev = dev; | 1266 | pctldev->dev = dev; |
1258 | 1267 | ||
1268 | /* check core ops for sanity */ | ||
1269 | ret = pinctrl_check_ops(pctldev); | ||
1270 | if (ret) { | ||
1271 | pr_err("%s pinctrl ops lacks necessary functions\n", | ||
1272 | pctldesc->name); | ||
1273 | goto out_err; | ||
1274 | } | ||
1275 | |||
1259 | /* If we're implementing pinmuxing, check the ops for sanity */ | 1276 | /* If we're implementing pinmuxing, check the ops for sanity */ |
1260 | if (pctldesc->pmxops) { | 1277 | if (pctldesc->pmxops) { |
1261 | ret = pinmux_check_ops(pctldev); | 1278 | ret = pinmux_check_ops(pctldev); |