From 85c3eb9af8b3d0283f07719a455d503fee7892ae Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 4 Mar 2012 00:45:21 +0100 Subject: [PATCH] device: differentiate between DEV_CONFIG_APPLIED (no device up/down), and DEV_CONFIG_RESTART (device restart) --- device.c | 5 +++-- device.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/device.c b/device.c index ab9138b..1d842cf 100644 --- 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); } diff --git a/device.h b/device.h index 2b7fb13..17676b8 100644 --- 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, }; -- 2.25.1