diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-12-23 04:54:58 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-12-24 12:51:26 -0500 |
commit | d46329a708c1a3301e272a029266b69339c0877f (patch) | |
tree | 45f8061af6706f1eadd9d4d9854e8ec2c9bfac42 | |
parent | a25461659050b913e114d282bf58823682eb56b6 (diff) |
Input: gpio_keys_polled - defer probing if GPIO probing is deferred
If GPIO probing is deferred, the driver tries to claim an invalid GPIO line
which leads to an error message like this:
gpio-keys-polled buttons.2: unable to claim gpio 4294966779, err=-22
gpio-keys-polled: probe of buttons.2 failed with error -22
We should make sure that error code returned by of_get_gpio_flags (including
-EPROBE_DEFER) is propagated up the stack.
Cc: stable@vger.kernel.org
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/keyboard/gpio_keys_polled.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index f686fd970553..21147164874d 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c | |||
@@ -135,6 +135,7 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct | |||
135 | 135 | ||
136 | i = 0; | 136 | i = 0; |
137 | for_each_child_of_node(node, pp) { | 137 | for_each_child_of_node(node, pp) { |
138 | int gpio; | ||
138 | enum of_gpio_flags flags; | 139 | enum of_gpio_flags flags; |
139 | 140 | ||
140 | if (!of_find_property(pp, "gpios", NULL)) { | 141 | if (!of_find_property(pp, "gpios", NULL)) { |
@@ -143,9 +144,19 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct | |||
143 | continue; | 144 | continue; |
144 | } | 145 | } |
145 | 146 | ||
147 | gpio = of_get_gpio_flags(pp, 0, &flags); | ||
148 | if (gpio < 0) { | ||
149 | error = gpio; | ||
150 | if (error != -EPROBE_DEFER) | ||
151 | dev_err(dev, | ||
152 | "Failed to get gpio flags, error: %d\n", | ||
153 | error); | ||
154 | goto err_free_pdata; | ||
155 | } | ||
156 | |||
146 | button = &pdata->buttons[i++]; | 157 | button = &pdata->buttons[i++]; |
147 | 158 | ||
148 | button->gpio = of_get_gpio_flags(pp, 0, &flags); | 159 | button->gpio = gpio; |
149 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; | 160 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; |
150 | 161 | ||
151 | if (of_property_read_u32(pp, "linux,code", &button->code)) { | 162 | if (of_property_read_u32(pp, "linux,code", &button->code)) { |