Skip to content

Commit c420619

Browse files
alexandrebellonilinusw
authored andcommitted
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 1292e69 commit c420619

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

drivers/pinctrl/pinconf.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ int pinconf_check_ops(struct pinctrl_dev *pctldev)
2828
{
2929
const struct pinconf_ops *ops = pctldev->desc->confops;
3030

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-
}
3731
/* We have to be able to config the pins in SOME way */
3832
if (!ops->pin_config_set && !ops->pin_config_group_set) {
3933
dev_err(pctldev->dev,
@@ -67,9 +61,9 @@ int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
6761
const struct pinconf_ops *ops = pctldev->desc->confops;
6862

6963
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 "
7165
"pin_config_get() function in driver\n");
72-
return -EINVAL;
66+
return -ENOTSUPP;
7367
}
7468

7569
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,
9387
ops = pctldev->desc->confops;
9488

9589
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 "
9791
"group, missing group config get function in "
9892
"driver\n");
99-
ret = -EINVAL;
93+
ret = -ENOTSUPP;
10094
goto unlock;
10195
}
10296

@@ -305,9 +299,6 @@ static int pinconf_pins_show(struct seq_file *s, void *what)
305299
const struct pinconf_ops *ops = pctldev->desc->confops;
306300
unsigned i, pin;
307301

308-
if (!ops || !ops->pin_config_get)
309-
return 0;
310-
311302
seq_puts(s, "Pin config settings per pin\n");
312303
seq_puts(s, "Format: pin (name): configs\n");
313304

@@ -356,9 +347,6 @@ static int pinconf_groups_show(struct seq_file *s, void *what)
356347
unsigned ngroups = pctlops->get_groups_count(pctldev);
357348
unsigned selector = 0;
358349

359-
if (!ops || !ops->pin_config_group_get)
360-
return 0;
361-
362350
seq_puts(s, "Pin config settings per pin group\n");
363351
seq_puts(s, "Format: group (name): configs\n");
364352

0 commit comments

Comments
 (0)