diff options
Diffstat (limited to 'drivers/gpio/gpiolib-of.c')
-rw-r--r-- | drivers/gpio/gpiolib-of.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a71a54a3e3f7..465f4ca57e80 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -193,7 +193,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) | |||
193 | if (!np) | 193 | if (!np) |
194 | return; | 194 | return; |
195 | 195 | ||
196 | do { | 196 | for (;; index++) { |
197 | ret = of_parse_phandle_with_args(np, "gpio-ranges", | 197 | ret = of_parse_phandle_with_args(np, "gpio-ranges", |
198 | "#gpio-range-cells", index, &pinspec); | 198 | "#gpio-range-cells", index, &pinspec); |
199 | if (ret) | 199 | if (ret) |
@@ -203,27 +203,15 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) | |||
203 | if (!pctldev) | 203 | if (!pctldev) |
204 | break; | 204 | break; |
205 | 205 | ||
206 | /* | ||
207 | * This assumes that the n GPIO pins are consecutive in the | ||
208 | * GPIO number space, and that the pins are also consecutive | ||
209 | * in their local number space. Currently it is not possible | ||
210 | * to add different ranges for one and the same GPIO chip, | ||
211 | * as the code assumes that we have one consecutive range | ||
212 | * on both, mapping 1-to-1. | ||
213 | * | ||
214 | * TODO: make the OF bindings handle multiple sparse ranges | ||
215 | * on the same GPIO chip. | ||
216 | */ | ||
217 | ret = gpiochip_add_pin_range(chip, | 206 | ret = gpiochip_add_pin_range(chip, |
218 | pinctrl_dev_get_devname(pctldev), | 207 | pinctrl_dev_get_devname(pctldev), |
219 | 0, /* offset in gpiochip */ | ||
220 | pinspec.args[0], | 208 | pinspec.args[0], |
221 | pinspec.args[1]); | 209 | pinspec.args[1], |
210 | pinspec.args[2]); | ||
222 | 211 | ||
223 | if (ret) | 212 | if (ret) |
224 | break; | 213 | break; |
225 | 214 | } | |
226 | } while (index++); | ||
227 | } | 215 | } |
228 | 216 | ||
229 | #else | 217 | #else |