diff options
-rw-r--r-- | drivers/pinctrl/pinconf.c | 31 | ||||
-rw-r--r-- | drivers/pinctrl/pinconf.h | 5 |
2 files changed, 16 insertions, 20 deletions
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index b74f64af1923..0c9d08d84694 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c | |||
@@ -23,7 +23,20 @@ | |||
23 | #include "core.h" | 23 | #include "core.h" |
24 | #include "pinconf.h" | 24 | #include "pinconf.h" |
25 | 25 | ||
26 | int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin, | 26 | int pinconf_check_ops(struct pinctrl_dev *pctldev) |
27 | { | ||
28 | const struct pinconf_ops *ops = pctldev->desc->confops; | ||
29 | |||
30 | /* We must be able to read out pin status */ | ||
31 | if (!ops->pin_config_get && !ops->pin_config_group_get) | ||
32 | return -EINVAL; | ||
33 | /* We have to be able to config the pins in SOME way */ | ||
34 | if (!ops->pin_config_set && !ops->pin_config_group_set) | ||
35 | return -EINVAL; | ||
36 | return 0; | ||
37 | } | ||
38 | |||
39 | static int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin, | ||
27 | unsigned long *config) | 40 | unsigned long *config) |
28 | { | 41 | { |
29 | const struct pinconf_ops *ops = pctldev->desc->confops; | 42 | const struct pinconf_ops *ops = pctldev->desc->confops; |
@@ -63,7 +76,7 @@ int pin_config_get(const char *dev_name, const char *name, | |||
63 | } | 76 | } |
64 | EXPORT_SYMBOL(pin_config_get); | 77 | EXPORT_SYMBOL(pin_config_get); |
65 | 78 | ||
66 | int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin, | 79 | static int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin, |
67 | unsigned long config) | 80 | unsigned long config) |
68 | { | 81 | { |
69 | const struct pinconf_ops *ops = pctldev->desc->confops; | 82 | const struct pinconf_ops *ops = pctldev->desc->confops; |
@@ -138,7 +151,6 @@ int pin_config_group_get(const char *dev_name, const char *pin_group, | |||
138 | } | 151 | } |
139 | EXPORT_SYMBOL(pin_config_group_get); | 152 | EXPORT_SYMBOL(pin_config_group_get); |
140 | 153 | ||
141 | |||
142 | int pin_config_group_set(const char *dev_name, const char *pin_group, | 154 | int pin_config_group_set(const char *dev_name, const char *pin_group, |
143 | unsigned long config) | 155 | unsigned long config) |
144 | { | 156 | { |
@@ -205,19 +217,6 @@ int pin_config_group_set(const char *dev_name, const char *pin_group, | |||
205 | } | 217 | } |
206 | EXPORT_SYMBOL(pin_config_group_set); | 218 | EXPORT_SYMBOL(pin_config_group_set); |
207 | 219 | ||
208 | int pinconf_check_ops(struct pinctrl_dev *pctldev) | ||
209 | { | ||
210 | const struct pinconf_ops *ops = pctldev->desc->confops; | ||
211 | |||
212 | /* We must be able to read out pin status */ | ||
213 | if (!ops->pin_config_get && !ops->pin_config_group_get) | ||
214 | return -EINVAL; | ||
215 | /* We have to be able to config the pins in SOME way */ | ||
216 | if (!ops->pin_config_set && !ops->pin_config_group_set) | ||
217 | return -EINVAL; | ||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | #ifdef CONFIG_DEBUG_FS | 220 | #ifdef CONFIG_DEBUG_FS |
222 | 221 | ||
223 | static void pinconf_dump_pin(struct pinctrl_dev *pctldev, | 222 | static void pinconf_dump_pin(struct pinctrl_dev *pctldev, |
diff --git a/drivers/pinctrl/pinconf.h b/drivers/pinctrl/pinconf.h index 006b77fa737e..1d6ea9de75fc 100644 --- a/drivers/pinctrl/pinconf.h +++ b/drivers/pinctrl/pinconf.h | |||
@@ -14,12 +14,9 @@ | |||
14 | #ifdef CONFIG_PINCONF | 14 | #ifdef CONFIG_PINCONF |
15 | 15 | ||
16 | int pinconf_check_ops(struct pinctrl_dev *pctldev); | 16 | int pinconf_check_ops(struct pinctrl_dev *pctldev); |
17 | |||
17 | void pinconf_init_device_debugfs(struct dentry *devroot, | 18 | void pinconf_init_device_debugfs(struct dentry *devroot, |
18 | struct pinctrl_dev *pctldev); | 19 | struct pinctrl_dev *pctldev); |
19 | int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin, | ||
20 | unsigned long *config); | ||
21 | int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin, | ||
22 | unsigned long config); | ||
23 | 20 | ||
24 | #else | 21 | #else |
25 | 22 | ||