when specifying hotplug devices that already have existing configured devices, set...
authorFelix Fietkau <nbd@openwrt.org>
Thu, 5 Jul 2012 18:32:07 +0000 (20:32 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 5 Jul 2012 18:32:07 +0000 (20:32 +0200)
device.c

index 80881d29edd4a47e1c90bfff4da363586538de14..f0361d930f2fc1dca03c1f00cb4aa5df9aa9ea47 100644 (file)
--- a/device.c
+++ b/device.c
@@ -318,8 +318,13 @@ device_get(const char *name, int create)
                return device_alias_get(name + 1);
 
        dev = avl_find_element(&devices, name, dev, avl);
-       if (dev)
+       if (dev) {
+               if (create > 1 && !dev->external) {
+                       dev->external = true;
+                       device_set_present(dev, true);
+               }
                return dev;
+       }
 
        if (!create)
                return NULL;