summaryrefslogtreecommitdiffhomepage
path: root/alias.c
diff options
context:
space:
mode:
authorArne Kappen <akappen@inet.tu-berlin.de>2016-08-18 11:35:28 +0200
committerFelix Fietkau <nbd@nbd.name>2016-08-26 10:38:46 +0200
commitf56a7fbaa6f155c654e7d01b5c4c0594f21239d6 (patch)
tree08e2b400aa2d70cf9655274c5f7885623acdcf40 /alias.c
parent61e5fa84eca4176bc5b4f9769a5af79d85cf11c6 (diff)
device: prepare for adding device handlers dynamically
- remove const from device handler struct - pass device handler type to create function Signed-off-by: Arne Kappen <akappen@inet.tu-berlin.de> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup]
Diffstat (limited to 'alias.c')
-rw-r--r--alias.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/alias.c b/alias.c
index 56420c7..f95c9f5 100644
--- a/alias.c
+++ b/alias.c
@@ -30,7 +30,7 @@ struct alias_device {
char name[];
};
-static const struct device_type alias_device_type;
+static struct device_type alias_device_type;
static void alias_set_device(struct alias_device *alias, struct device *dev)
{
@@ -113,7 +113,8 @@ static void alias_device_cb(struct device_user *dep, enum device_event ev)
}
static struct device *
-alias_device_create(const char *name, struct blob_attr *attr)
+alias_device_create(const char *name, struct device_type *devtype,
+ struct blob_attr *attr)
{
struct alias_device *alias;
@@ -124,7 +125,7 @@ alias_device_create(const char *name, struct blob_attr *attr)
strcpy(alias->name, name);
alias->dev.set_state = alias_device_set_state;
alias->dev.hidden = true;
- device_init_virtual(&alias->dev, &alias_device_type, NULL);
+ device_init_virtual(&alias->dev, devtype, NULL);
alias->avl.key = alias->name;
avl_insert(&aliases, &alias->avl);
alias->dep.alias = true;
@@ -162,7 +163,7 @@ static int alias_check_state(struct device *dev)
return 0;
}
-static const struct device_type alias_device_type = {
+static struct device_type alias_device_type = {
.name = "Network alias",
.create = alias_device_create,
.free = alias_device_free,
@@ -192,7 +193,7 @@ device_alias_get(const char *name)
if (alias)
return &alias->dev;
- return alias_device_create(name, NULL);
+ return alias_device_create(name, &alias_device_type, NULL);
}
static void __init alias_init(void)