aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pinctrl
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-11-06 10:03:35 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-11-11 13:06:07 -0500
commit1e63d7b9363f0c57d00991f9f2e0af374dfc591a (patch)
tree6bea7bfdd9dbfbe21433629b3f2a9758c92447be /include/linux/pinctrl
parent9ef0d6f7628bdcb5cc3c11623930f2527a3881a0 (diff)
gpiolib: separation of pin concerns
The fact that of_gpiochip_add_pin_range() and gpiochip_add_pin_range() share too much code is fragile and will invariably mean that bugs need to be fixed in two places instead of one. So separate the concerns of gpiolib.c and gpiolib-of.c and have the latter call the former as back-end. This is necessary also when going forward with other device descriptions such as ACPI. This is done by: - Adding a return code to gpiochip_add_pin_range() so we can reliably check whether this succeeds. - Get rid of the custom of_pinctrl_add_gpio_range() from pinctrl. Instead create of_pinctrl_get() to just retrive the pin controller per se from an OF node. This composite function was just begging to be deleted, it was way to purpose-specific. - Use pinctrl_dev_get_name() to get the name of the retrieved pin controller and use that to call back into the generic gpiochip_add_pin_range(). Now the pin range is only allocated and tied to a pin controller from the core implementation in gpiolib.c. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/pinctrl')
-rw-r--r--include/linux/pinctrl/pinctrl.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 434e5a94e131..4a58428bc793 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -141,16 +141,13 @@ extern struct pinctrl_dev *find_pinctrl_and_add_gpio_range(const char *devname,
141 struct pinctrl_gpio_range *range); 141 struct pinctrl_gpio_range *range);
142 142
143#ifdef CONFIG_OF 143#ifdef CONFIG_OF
144extern struct pinctrl_dev *of_pinctrl_add_gpio_range(struct device_node *np, 144extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
145 struct pinctrl_gpio_range *range);
146#else 145#else
147static inline 146static inline
148struct pinctrl_dev *of_pinctrl_add_gpio_range(struct device_node *np, 147struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
149 struct pinctrl_gpio_range *range)
150{ 148{
151 return NULL; 149 return NULL;
152} 150}
153
154#endif /* CONFIG_OF */ 151#endif /* CONFIG_OF */
155 152
156extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev); 153extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev);