]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
Kobject: change net/bridge to use kobject_create_and_add
authorGreg Kroah-Hartman <gregkh@suse.de>
Mon, 17 Dec 2007 19:54:39 +0000 (15:54 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Jan 2008 04:40:26 +0000 (20:40 -0800)
The kobject in the bridge code is only used for registering with sysfs,
not for any lifespan rules.  This patch changes it to be only a pointer
and use the simpler api for this kind of thing.

Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/bridge/br_if.c
net/bridge/br_private.h
net/bridge/br_sysfs_br.c
net/bridge/br_sysfs_if.c

index 935784f736b3d0f88cff37c76140a5c22a167dd2..dadec949d4fe5d9f6e9677f4684a57f4f7381497 100644 (file)
@@ -133,7 +133,7 @@ static void del_nbp(struct net_bridge_port *p)
        struct net_bridge *br = p->br;
        struct net_device *dev = p->dev;
 
-       sysfs_remove_link(&br->ifobj, dev->name);
+       sysfs_remove_link(br->ifobj, dev->name);
 
        dev_set_promiscuity(dev, -1);
 
index f666f7b28ff584d7222a9763c95288c6d63da11d..c11b554fd109d4f1b587c8b254a5352889a29b86 100644 (file)
@@ -124,7 +124,7 @@ struct net_bridge
        struct timer_list               tcn_timer;
        struct timer_list               topology_change_timer;
        struct timer_list               gc_timer;
-       struct kobject                  ifobj;
+       struct kobject                  *ifobj;
 };
 
 extern struct notifier_block br_device_notifier;
index 3312e8f2abe47b46e2af85212b93de67adf6c3de..4e7f91fafeddf44ebbd03773ca4134fb8225ec23 100644 (file)
@@ -426,16 +426,10 @@ int br_sysfs_addbr(struct net_device *dev)
                goto out2;
        }
 
-
-       kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR);
-       br->ifobj.ktype = NULL;
-       br->ifobj.kset = NULL;
-       br->ifobj.parent = brobj;
-
-       err = kobject_register(&br->ifobj);
-       if (err) {
+       br->ifobj = kobject_create_and_add(SYSFS_BRIDGE_PORT_SUBDIR, brobj);
+       if (!br->ifobj) {
                pr_info("%s: can't add kobject (directory) %s/%s\n",
-                       __FUNCTION__, dev->name, kobject_name(&br->ifobj));
+                       __FUNCTION__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
                goto out3;
        }
        return 0;
@@ -453,7 +447,7 @@ void br_sysfs_delbr(struct net_device *dev)
        struct kobject *kobj = &dev->dev.kobj;
        struct net_bridge *br = netdev_priv(dev);
 
-       kobject_unregister(&br->ifobj);
+       kobject_unregister(br->ifobj);
        sysfs_remove_bin_file(kobj, &bridge_forward);
        sysfs_remove_group(kobj, &bridge_group);
 }
index 79db51fcb4768dabb001c5afb17325c6ad00a634..02b2d50cce4da640f4b62a6652253d217e890af2 100644 (file)
@@ -229,7 +229,7 @@ int br_sysfs_addif(struct net_bridge_port *p)
                        goto out2;
        }
 
-       err= sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name);
+       err = sysfs_create_link(br->ifobj, &p->kobj, p->dev->name);
 out2:
        return err;
 }