summaryrefslogtreecommitdiffhomepage
path: root/bridge.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 /bridge.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 'bridge.c')
-rw-r--r--bridge.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bridge.c b/bridge.c
index 1c163cd..0c538ba 100644
--- a/bridge.c
+++ b/bridge.c
@@ -72,15 +72,16 @@ static const struct uci_blob_param_list bridge_attr_list = {
.next = { &device_attr_list },
};
-static struct device *bridge_create(const char *name, struct blob_attr *attr);
+static struct device *bridge_create(const char *name, struct device_type *devtype,
+ 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);
enum dev_change_type
bridge_reload(struct device *dev, struct blob_attr *attr);
-const struct device_type bridge_device_type = {
- .name = "Bridge",
+struct device_type bridge_device_type = {
+ .name = "bridge",
.config_params = &bridge_attr_list,
.create = bridge_create,
@@ -699,7 +700,8 @@ bridge_retry_members(struct uloop_timeout *timeout)
}
static struct device *
-bridge_create(const char *name, struct blob_attr *attr)
+bridge_create(const char *name, struct device_type *devtype,
+ struct blob_attr *attr)
{
struct bridge_state *bst;
struct device *dev = NULL;
@@ -709,7 +711,7 @@ bridge_create(const char *name, struct blob_attr *attr)
return NULL;
dev = &bst->dev;
- device_init(dev, &bridge_device_type, name);
+ device_init(dev, devtype, name);
dev->config_pending = true;
bst->retry.cb = bridge_retry_members;