diff options
Diffstat (limited to 'drivers/input/keyboard/gpio_keys_polled.c')
-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)) { |