From 39b97d17479a1767fefdf693bb41141260d9740c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 18 Oct 2011 18:18:24 +0200 Subject: directly pass the device name to the device create function --- bridge.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'bridge.c') diff --git a/bridge.c b/bridge.c index 5ac5cfe..fe4b477 100644 --- a/bridge.c +++ b/bridge.c @@ -41,7 +41,7 @@ static const struct config_param_list bridge_attr_list = { .next = { &device_attr_list }, }; -static struct device *bridge_create(struct blob_attr *attr); +static struct device *bridge_create(const char *name, struct blob_attr *attr); static void bridge_config_init(struct device *dev); static void bridge_free(struct device *dev); static void bridge_dump_info(struct device *dev, struct blob_buf *b); @@ -364,27 +364,21 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb) } static struct device * -bridge_create(struct blob_attr *attr) +bridge_create(const char *name, struct blob_attr *attr) { struct blob_attr *tb_dev[__DEV_ATTR_MAX]; struct blob_attr *tb_br[__BRIDGE_ATTR_MAX]; struct bridge_state *bst; struct device *dev = NULL; - const char *name; blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, tb_dev, blob_data(attr), blob_len(attr)); blobmsg_parse(bridge_attrs, __BRIDGE_ATTR_MAX, tb_br, blob_data(attr), blob_len(attr)); - if (!tb_dev[DEV_ATTR_NAME]) - return NULL; - if (!tb_br[BRIDGE_ATTR_IFNAME]) return NULL; - name = blobmsg_data(tb_dev[DEV_ATTR_NAME]); - bst = calloc(1, sizeof(*bst)); if (!bst) return NULL; -- cgit v1.2.3