device: differentiate between DEV_CONFIG_APPLIED (no device up/down), and DEV_CONFIG_...
authorFelix Fietkau <nbd@openwrt.org>
Sat, 3 Mar 2012 23:45:21 +0000 (00:45 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 3 Mar 2012 23:45:21 +0000 (00:45 +0100)
device.c
device.h

index ab9138b3be84f3db9adf19e81f5530c7abf790b2..1d842cf8e085fcd28081823aaa70c06cd6ae4e93 100644 (file)
--- a/device.c
+++ b/device.c
@@ -554,7 +554,7 @@ device_reload_config(struct device *dev, struct blob_attr *attr)
                                blob_data(attr), blob_len(attr));
 
                device_init_settings(dev, tb);
-               return DEV_CONFIG_APPLIED;
+               return DEV_CONFIG_RESTART;
        } else
                return DEV_CONFIG_RECREATE;
 }
@@ -634,11 +634,12 @@ device_create(const char *name, const struct device_type *type,
                odev->current_config = true;
                change = device_set_config(odev, type, config);
                switch (change) {
+               case DEV_CONFIG_RESTART:
                case DEV_CONFIG_APPLIED:
                        D(DEVICE, "Device '%s': config applied\n", odev->ifname);
                        free(odev->config);
                        odev->config = config;
-                       if (odev->present) {
+                       if (change == DEV_CONFIG_RESTART && odev->present) {
                                device_set_present(odev, false);
                                device_set_present(odev, true);
                        }
index 2b7fb13c3568e74e415e41042ec4c88127d7b9ec..17676b8994d0c17f28aa746cfde0c1bfeaa913f7 100644 (file)
--- a/device.h
+++ b/device.h
@@ -23,6 +23,7 @@ enum {
 enum dev_change_type {
        DEV_CONFIG_NO_CHANGE,
        DEV_CONFIG_APPLIED,
+       DEV_CONFIG_RESTART,
        DEV_CONFIG_RECREATE,
 };