aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib-of.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/gpiolib-of.c')
-rw-r--r--drivers/gpio/gpiolib-of.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 9762dd6d99fa..9b44c49a9227 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -343,36 +343,27 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
343 343
344 desc = of_get_named_gpiod_flags(dev->of_node, prop_name, idx, 344 desc = of_get_named_gpiod_flags(dev->of_node, prop_name, idx,
345 &of_flags); 345 &of_flags);
346 /*
347 * -EPROBE_DEFER in our case means that we found a
348 * valid GPIO property, but no controller has been
349 * registered so far.
350 *
351 * This means we don't need to look any further for
352 * alternate name conventions, and we should really
353 * preserve the return code for our user to be able to
354 * retry probing later.
355 */
356 if (IS_ERR(desc) && PTR_ERR(desc) == -EPROBE_DEFER)
357 return desc;
358 346
359 if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT)) 347 if (!IS_ERR(desc) || PTR_ERR(desc) != -ENOENT)
360 break; 348 break;
361 } 349 }
362 350
363 /* Special handling for SPI GPIOs if used */ 351 if (IS_ERR(desc) && PTR_ERR(desc) == -ENOENT) {
364 if (IS_ERR(desc)) 352 /* Special handling for SPI GPIOs if used */
365 desc = of_find_spi_gpio(dev, con_id, &of_flags); 353 desc = of_find_spi_gpio(dev, con_id, &of_flags);
366 if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER) { 354 }
355
356 if (IS_ERR(desc) && PTR_ERR(desc) == -ENOENT) {
367 /* This quirk looks up flags and all */ 357 /* This quirk looks up flags and all */
368 desc = of_find_spi_cs_gpio(dev, con_id, idx, flags); 358 desc = of_find_spi_cs_gpio(dev, con_id, idx, flags);
369 if (!IS_ERR(desc)) 359 if (!IS_ERR(desc))
370 return desc; 360 return desc;
371 } 361 }
372 362
373 /* Special handling for regulator GPIOs if used */ 363 if (IS_ERR(desc) && PTR_ERR(desc) == -ENOENT) {
374 if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER) 364 /* Special handling for regulator GPIOs if used */
375 desc = of_find_regulator_gpio(dev, con_id, &of_flags); 365 desc = of_find_regulator_gpio(dev, con_id, &of_flags);
366 }
376 367
377 if (IS_ERR(desc)) 368 if (IS_ERR(desc))
378 return desc; 369 return desc;