Module: xenomai-3
Branch: wip/drivers
Commit: 64bbd2a22ab26aef0bfd1cf099d80af320785d8c
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=64bbd2a22ab26aef0bfd1cf099d80af320785d8c

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Jun 18 12:20:43 2016 +0200

drivers/gpio: return ENODEV on failed device detection

---

 kernel/drivers/gpio/gpio-core.c |   11 ++++++++---
 kernel/drivers/gpio/gpio-core.h |    2 ++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/kernel/drivers/gpio/gpio-core.c b/kernel/drivers/gpio/gpio-core.c
index 319d5c7..e8a7ba1 100644
--- a/kernel/drivers/gpio/gpio-core.c
+++ b/kernel/drivers/gpio/gpio-core.c
@@ -22,7 +22,6 @@
 #include <linux/irq.h>
 #include <linux/slab.h>
 #include <linux/err.h>
-#include <linux/of_platform.h>
 #include "gpio-core.h"
 
 struct rtdm_gpio_pin {
@@ -329,13 +328,17 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc,
 }
 EXPORT_SYMBOL_GPL(rtdm_gpiochip_add_by_name);
 
+#ifdef CONFIG_OF
+
+#include <linux/of_platform.h>
+
 int rtdm_gpiochip_scan_of(struct device_node *from, const char *compat,
                          int (*match)(struct gpio_chip *gc))
 {
        struct device_node *np = from;
        struct platform_device *pdev;
-       int ret = -EPROBE_DEFER;
        struct gpio_chip *gc;
+       int ret = -ENODEV;
 
        for (;;) {
                np = of_find_compatible_node(np, NULL, compat);
@@ -344,7 +347,7 @@ int rtdm_gpiochip_scan_of(struct device_node *from, const 
char *compat,
                pdev = of_find_device_by_node(np);
                of_node_put(np);
                if (pdev == NULL)
-                       return -ENODEV;
+                       break;
                gc = find_chip_by_name(dev_name(&pdev->dev));
                if (gc) {
                        ret = match(gc);
@@ -356,3 +359,5 @@ int rtdm_gpiochip_scan_of(struct device_node *from, const 
char *compat,
        return ret;
 }
 EXPORT_SYMBOL_GPL(rtdm_gpiochip_scan_of);
+
+#endif /* CONFIG_OF */
diff --git a/kernel/drivers/gpio/gpio-core.h b/kernel/drivers/gpio/gpio-core.h
index d4dd28a..c0eac32 100644
--- a/kernel/drivers/gpio/gpio-core.h
+++ b/kernel/drivers/gpio/gpio-core.h
@@ -43,7 +43,9 @@ void rtdm_gpiochip_remove(struct rtdm_gpio_chip *rgc);
 int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc,
                              const char *label, int gpio_subclass);
 
+#ifdef CONFIG_OF
 int rtdm_gpiochip_scan_of(struct device_node *from, const char *compat,
                          int (*match)(struct gpio_chip *gc));
+#endif
 
 #endif /* !_RTDM_GPIO_CORE_H */


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to