Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pinctrl: spacemit: return -ENOTSUPP for unsupported pin configurations

Return -ENOTSUPP instead of -EINVAL when encountering unsupported pin
configuration parameters. This is more logical and allows the GPIO
subsystem to gracefully handle unsupported parameters via functions like
gpio_set_config_with_argument_optional(), which specifically ignores
-ENOTSUPP but treats others as failure.

Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Anand Moon <linux.amoon@gmail.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Yixun Lan <dlan@kernel.org>
Signed-off-by: Linus Walleij <linusw@kernel.org>

authored by

Junhui Liu and committed by
Linus Walleij
c3b0c06b 9ba4ef68

+12 -9
+12 -9
drivers/pinctrl/spacemit/pinctrl-k1.c
··· 674 674 arg = 0; 675 675 break; 676 676 default: 677 - return -EINVAL; 677 + return -ENOTSUPP; 678 678 } 679 679 680 680 *config = pinconf_to_config_packed(param, arg); ··· 740 740 } 741 741 break; 742 742 default: 743 - return -EINVAL; 743 + return -ENOTSUPP; 744 744 } 745 745 } 746 746 ··· 814 814 struct spacemit_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 815 815 const struct spacemit_pin *spin = spacemit_get_pin(pctrl, pin); 816 816 u32 value; 817 + int ret; 817 818 818 - if (spacemit_pinconf_generate_config(pctrl, spin, pctrl->data->dconf, 819 - configs, num_configs, &value)) 820 - return -EINVAL; 819 + ret = spacemit_pinconf_generate_config(pctrl, spin, pctrl->data->dconf, 820 + configs, num_configs, &value); 821 + if (ret) 822 + return ret; 821 823 822 824 return spacemit_pin_set_config(pctrl, pin, value); 823 825 } ··· 833 831 const struct spacemit_pin *spin; 834 832 const struct group_desc *group; 835 833 u32 value; 836 - int i; 834 + int i, ret; 837 835 838 836 group = pinctrl_generic_get_group(pctldev, gsel); 839 837 if (!group) 840 838 return -EINVAL; 841 839 842 840 spin = spacemit_get_pin(pctrl, group->grp.pins[0]); 843 - if (spacemit_pinconf_generate_config(pctrl, spin, pctrl->data->dconf, 844 - configs, num_configs, &value)) 845 - return -EINVAL; 841 + ret = spacemit_pinconf_generate_config(pctrl, spin, pctrl->data->dconf, 842 + configs, num_configs, &value); 843 + if (ret) 844 + return ret; 846 845 847 846 for (i = 0; i < group->grp.npins; i++) 848 847 spacemit_pin_set_config(pctrl, group->grp.pins[i], value);