aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_if.c12
-rw-r--r--net/bridge/br_private.h2
-rw-r--r--net/bridge/br_sysfs_br.c14
-rw-r--r--net/bridge/br_sysfs_if.c2
4 files changed, 10 insertions, 20 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 935784f736b3..298e0f463c56 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -133,7 +133,7 @@ static void del_nbp(struct net_bridge_port *p)
133 struct net_bridge *br = p->br; 133 struct net_bridge *br = p->br;
134 struct net_device *dev = p->dev; 134 struct net_device *dev = p->dev;
135 135
136 sysfs_remove_link(&br->ifobj, dev->name); 136 sysfs_remove_link(br->ifobj, dev->name);
137 137
138 dev_set_promiscuity(dev, -1); 138 dev_set_promiscuity(dev, -1);
139 139
@@ -258,12 +258,6 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
258 p->state = BR_STATE_DISABLED; 258 p->state = BR_STATE_DISABLED;
259 br_stp_port_timer_init(p); 259 br_stp_port_timer_init(p);
260 260
261 kobject_init(&p->kobj);
262 kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
263 p->kobj.ktype = &brport_ktype;
264 p->kobj.parent = &(dev->dev.kobj);
265 p->kobj.kset = NULL;
266
267 return p; 261 return p;
268} 262}
269 263
@@ -379,7 +373,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
379 if (IS_ERR(p)) 373 if (IS_ERR(p))
380 return PTR_ERR(p); 374 return PTR_ERR(p);
381 375
382 err = kobject_add(&p->kobj); 376 err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj),
377 SYSFS_BRIDGE_PORT_ATTR);
383 if (err) 378 if (err)
384 goto err0; 379 goto err0;
385 380
@@ -416,6 +411,7 @@ err2:
416 br_fdb_delete_by_port(br, p, 1); 411 br_fdb_delete_by_port(br, p, 1);
417err1: 412err1:
418 kobject_del(&p->kobj); 413 kobject_del(&p->kobj);
414 return err;
419err0: 415err0:
420 kobject_put(&p->kobj); 416 kobject_put(&p->kobj);
421 return err; 417 return err;
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index f666f7b28ff5..c11b554fd109 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -124,7 +124,7 @@ struct net_bridge
124 struct timer_list tcn_timer; 124 struct timer_list tcn_timer;
125 struct timer_list topology_change_timer; 125 struct timer_list topology_change_timer;
126 struct timer_list gc_timer; 126 struct timer_list gc_timer;
127 struct kobject ifobj; 127 struct kobject *ifobj;
128}; 128};
129 129
130extern struct notifier_block br_device_notifier; 130extern struct notifier_block br_device_notifier;
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 3312e8f2abe4..9cf0538d1717 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -426,16 +426,10 @@ int br_sysfs_addbr(struct net_device *dev)
426 goto out2; 426 goto out2;
427 } 427 }
428 428
429 429 br->ifobj = kobject_create_and_add(SYSFS_BRIDGE_PORT_SUBDIR, brobj);
430 kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR); 430 if (!br->ifobj) {
431 br->ifobj.ktype = NULL;
432 br->ifobj.kset = NULL;
433 br->ifobj.parent = brobj;
434
435 err = kobject_register(&br->ifobj);
436 if (err) {
437 pr_info("%s: can't add kobject (directory) %s/%s\n", 431 pr_info("%s: can't add kobject (directory) %s/%s\n",
438 __FUNCTION__, dev->name, kobject_name(&br->ifobj)); 432 __FUNCTION__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
439 goto out3; 433 goto out3;
440 } 434 }
441 return 0; 435 return 0;
@@ -453,7 +447,7 @@ void br_sysfs_delbr(struct net_device *dev)
453 struct kobject *kobj = &dev->dev.kobj; 447 struct kobject *kobj = &dev->dev.kobj;
454 struct net_bridge *br = netdev_priv(dev); 448 struct net_bridge *br = netdev_priv(dev);
455 449
456 kobject_unregister(&br->ifobj); 450 kobject_put(br->ifobj);
457 sysfs_remove_bin_file(kobj, &bridge_forward); 451 sysfs_remove_bin_file(kobj, &bridge_forward);
458 sysfs_remove_group(kobj, &bridge_group); 452 sysfs_remove_group(kobj, &bridge_group);
459} 453}
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index 79db51fcb476..02b2d50cce4d 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -229,7 +229,7 @@ int br_sysfs_addif(struct net_bridge_port *p)
229 goto out2; 229 goto out2;
230 } 230 }
231 231
232 err= sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name); 232 err = sysfs_create_link(br->ifobj, &p->kobj, p->dev->name);
233out2: 233out2:
234 return err; 234 return err;
235} 235}