diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-18 18:18:24 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-18 18:18:24 +0200 |
commit | 39b97d17479a1767fefdf693bb41141260d9740c (patch) | |
tree | 5485a8231ddc0d3379d0f6e0464f31b1d8ff144c /device.c | |
parent | f876254b373a883499a3b15733e26c777d6f3665 (diff) |
directly pass the device name to the device create function
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -19,7 +19,6 @@ static struct avl_tree devices; static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = { [DEV_ATTR_TYPE] = { "type", BLOBMSG_TYPE_STRING }, - [DEV_ATTR_NAME] = { "name", BLOBMSG_TYPE_STRING }, [DEV_ATTR_IFNAME] = { "ifname", BLOBMSG_TYPE_ARRAY }, [DEV_ATTR_MTU] = { "mtu", BLOBMSG_TYPE_INT32 }, [DEV_ATTR_MACADDR] = { "macaddr", BLOBMSG_TYPE_STRING }, @@ -32,20 +31,12 @@ const struct config_param_list device_attr_list = { }; static struct device * -simple_device_create(struct blob_attr *attr) +simple_device_create(const char *name, struct blob_attr *attr) { struct blob_attr *tb[__DEV_ATTR_MAX]; struct device *dev = NULL; - const char *name; blobmsg_parse(dev_attrs, __DEV_ATTR_MAX, tb, blob_data(attr), blob_len(attr)); - if (!tb[DEV_ATTR_NAME]) - return NULL; - - name = blobmsg_data(tb[DEV_ATTR_NAME]); - if (!name) - return NULL; - dev = device_get(name, true); if (!dev) return NULL; @@ -455,7 +446,7 @@ device_create(const char *name, const struct device_type *type, } else D(DEVICE, "Create new device '%s' (%s)\n", name, type->name); - dev = type->create(config); + dev = type->create(name, config); if (!dev) return NULL; |