X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=device.c;h=4d0de677ec0bad93b95248cc57c1771548956dd2;hp=092a8edc652253ba55d4679c0b8ab2a2f1af0efd;hb=6dfd44e127c153e721a398f22b510be1a5e9d0b0;hpb=d64c608820ddb4817ef7dff1f993a5801ff99ca2 diff --git a/device.c b/device.c index 092a8ed..4d0de67 100644 --- a/device.c +++ b/device.c @@ -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;