diff options
author | Dong Aisheng <dong.aisheng@linaro.org> | 2012-04-25 07:38:13 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-05-01 19:14:20 -0400 |
commit | 4650b7cbea4db73f459181f67f939b510e3a17b2 (patch) | |
tree | 45f277ce5f3b79241091914be30a5c2d1288ee1f /drivers/pinctrl | |
parent | 5b3aa5f7c6287b1a0698950a91e94546888e553b (diff) |
pinctrl: support gpio request deferred probing
As pinctrl handles, it may be possible the pinctrl gpio ranges
are still not got registered when user call pinctrl_gpio_request.
Thus, add defer support for it too.
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/core.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index a6386b3a3c15..c3b331b74fa0 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -291,7 +291,8 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio) | |||
291 | * | 291 | * |
292 | * Find the pin controller handling a certain GPIO pin from the pinspace of | 292 | * Find the pin controller handling a certain GPIO pin from the pinspace of |
293 | * the GPIO subsystem, return the device and the matching GPIO range. Returns | 293 | * the GPIO subsystem, return the device and the matching GPIO range. Returns |
294 | * negative if the GPIO range could not be found in any device. | 294 | * -EPROBE_DEFER if the GPIO range could not be found in any device since it |
295 | * may still have not been registered. | ||
295 | */ | 296 | */ |
296 | static int pinctrl_get_device_gpio_range(unsigned gpio, | 297 | static int pinctrl_get_device_gpio_range(unsigned gpio, |
297 | struct pinctrl_dev **outdev, | 298 | struct pinctrl_dev **outdev, |
@@ -311,7 +312,7 @@ static int pinctrl_get_device_gpio_range(unsigned gpio, | |||
311 | } | 312 | } |
312 | } | 313 | } |
313 | 314 | ||
314 | return -EINVAL; | 315 | return -EPROBE_DEFER; |
315 | } | 316 | } |
316 | 317 | ||
317 | /** | 318 | /** |
@@ -397,7 +398,7 @@ int pinctrl_request_gpio(unsigned gpio) | |||
397 | ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range); | 398 | ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range); |
398 | if (ret) { | 399 | if (ret) { |
399 | mutex_unlock(&pinctrl_mutex); | 400 | mutex_unlock(&pinctrl_mutex); |
400 | return -EINVAL; | 401 | return ret; |
401 | } | 402 | } |
402 | 403 | ||
403 | /* Convert to the pin controllers number space */ | 404 | /* Convert to the pin controllers number space */ |