summaryrefslogtreecommitdiffstats
path: root/sys/dev/gpio/ofw_gpiobus.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/gpio/ofw_gpiobus.c')
-rw-r--r--sys/dev/gpio/ofw_gpiobus.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/gpio/ofw_gpiobus.c b/sys/dev/gpio/ofw_gpiobus.c
index 6646b7d..1dbb526 100644
--- a/sys/dev/gpio/ofw_gpiobus.c
+++ b/sys/dev/gpio/ofw_gpiobus.c
@@ -56,6 +56,14 @@ ofw_gpiobus_add_fdt_child(device_t bus, const char *drvname, phandle_t child)
struct ofw_gpiobus_devinfo *dinfo;
/*
+ * Check to see if we already have a child for @p child, and if so
+ * return it.
+ */
+ childdev = ofw_bus_find_child_device_by_phandle(bus, child);
+ if (childdev != NULL)
+ return (childdev);
+
+ /*
* Set up the GPIO child and OFW bus layer devinfo and add it to bus.
*/
childdev = device_add_child(bus, drvname, -1);
OpenPOWER on IntegriCloud