summaryrefslogtreecommitdiffhomepage
path: root/device.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-05 19:52:44 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-05 19:52:44 +0200
commitcd51d94890e819e6e72fd9dc221716131e69dea7 (patch)
tree0d848495754e896bfa0ec8eac200c47089c7fd1c /device.c
parent172bb90bce0354ed9a2d1e62bbe3daee45b32058 (diff)
rename a variable for clarity
Diffstat (limited to 'device.c')
-rw-r--r--device.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/device.c b/device.c
index 91a7867..c6765b0 100644
--- a/device.c
+++ b/device.c
@@ -298,6 +298,20 @@ device_free_unused(struct device *dev)
__device_free_unused(dev);
}
+void
+device_init_pending(void)
+{
+ struct device *dev, *tmp;
+
+ avl_for_each_element_safe(&devices, dev, avl, tmp) {
+ if (!dev->config_pending)
+ continue;
+
+ dev->type->config_init(dev);
+ dev->config_pending = false;
+ }
+}
+
enum dev_change_type
device_reload_config(struct device *dev, struct blob_attr *attr)
{
@@ -379,9 +393,15 @@ device_create(const char *name, const struct device_type *type,
}
dev = type->create(config);
+ if (!dev)
+ return NULL;
+
dev->config = config;
if (odev)
device_replace(dev, odev);
+ if (!config_init && dev->config_pending)
+ type->config_init(dev);
+
return dev;
}