aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinconf.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2013-12-09 05:38:29 -0500
committerLinus Walleij <linus.walleij@linaro.org>2013-12-12 13:11:07 -0500
commitc420619d5177ac8f4a624a2ec6d0ed00b8b64ddb (patch)
tree175236d03ab00136798e9a26fec057e16e498f45 /drivers/pinctrl/pinconf.c
parent1292e6936658af72c2e585ee8df0b478b4a8c28a (diff)
pinctrl: pinconf: remove checks on ops->pin_config_get
ops->pin_config_get() is only used in one specific path that will only be taken for generic pinconf drivers (ops->is_generic == true) when dumping the pinconf by using debugfs. By removing the check in pinconf_check_ops(), let's stop pressuring people to write a pin_config_get() function that will never be used and so will probably never be tested. Removing the check in pinconf_pins_show() allows driver to not implement pin_config_get() but still get a dump of the pinconf in debugfs by implementing pin_config_dbg_show(). Finally, not implementing pin_config_get() now results in returning -ENOTSUPP instead of -EINVAL. While this doesn't have any real impact for now, this feels more right. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinconf.c')
-rw-r--r--drivers/pinctrl/pinconf.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index b8fcc38c0d11..4187fe58794d 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -28,12 +28,6 @@ int pinconf_check_ops(struct pinctrl_dev *pctldev)
28{ 28{
29 const struct pinconf_ops *ops = pctldev->desc->confops; 29 const struct pinconf_ops *ops = pctldev->desc->confops;
30 30
31 /* We must be able to read out pin status */
32 if (!ops->pin_config_get && !ops->pin_config_group_get) {
33 dev_err(pctldev->dev,
34 "pinconf must be able to read out pin status\n");
35 return -EINVAL;
36 }
37 /* We have to be able to config the pins in SOME way */ 31 /* We have to be able to config the pins in SOME way */
38 if (!ops->pin_config_set && !ops->pin_config_group_set) { 32 if (!ops->pin_config_set && !ops->pin_config_group_set) {
39 dev_err(pctldev->dev, 33 dev_err(pctldev->dev,
@@ -67,9 +61,9 @@ int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
67 const struct pinconf_ops *ops = pctldev->desc->confops; 61 const struct pinconf_ops *ops = pctldev->desc->confops;
68 62
69 if (!ops || !ops->pin_config_get) { 63 if (!ops || !ops->pin_config_get) {
70 dev_err(pctldev->dev, "cannot get pin configuration, missing " 64 dev_dbg(pctldev->dev, "cannot get pin configuration, missing "
71 "pin_config_get() function in driver\n"); 65 "pin_config_get() function in driver\n");
72 return -EINVAL; 66 return -ENOTSUPP;
73 } 67 }
74 68
75 return ops->pin_config_get(pctldev, pin, config); 69 return ops->pin_config_get(pctldev, pin, config);
@@ -93,10 +87,10 @@ int pin_config_group_get(const char *dev_name, const char *pin_group,
93 ops = pctldev->desc->confops; 87 ops = pctldev->desc->confops;
94 88
95 if (!ops || !ops->pin_config_group_get) { 89 if (!ops || !ops->pin_config_group_get) {
96 dev_err(pctldev->dev, "cannot get configuration for pin " 90 dev_dbg(pctldev->dev, "cannot get configuration for pin "
97 "group, missing group config get function in " 91 "group, missing group config get function in "
98 "driver\n"); 92 "driver\n");
99 ret = -EINVAL; 93 ret = -ENOTSUPP;
100 goto unlock; 94 goto unlock;
101 } 95 }
102 96
@@ -305,9 +299,6 @@ static int pinconf_pins_show(struct seq_file *s, void *what)
305 const struct pinconf_ops *ops = pctldev->desc->confops; 299 const struct pinconf_ops *ops = pctldev->desc->confops;
306 unsigned i, pin; 300 unsigned i, pin;
307 301
308 if (!ops || !ops->pin_config_get)
309 return 0;
310
311 seq_puts(s, "Pin config settings per pin\n"); 302 seq_puts(s, "Pin config settings per pin\n");
312 seq_puts(s, "Format: pin (name): configs\n"); 303 seq_puts(s, "Format: pin (name): configs\n");
313 304
@@ -356,9 +347,6 @@ static int pinconf_groups_show(struct seq_file *s, void *what)
356 unsigned ngroups = pctlops->get_groups_count(pctldev); 347 unsigned ngroups = pctlops->get_groups_count(pctldev);
357 unsigned selector = 0; 348 unsigned selector = 0;
358 349
359 if (!ops || !ops->pin_config_group_get)
360 return 0;
361
362 seq_puts(s, "Pin config settings per pin group\n"); 350 seq_puts(s, "Pin config settings per pin group\n");
363 seq_puts(s, "Format: group (name): configs\n"); 351 seq_puts(s, "Format: group (name): configs\n");
364 352