diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-02-11 18:02:04 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-11 18:02:04 -0500 |
commit | 1cb9d721d9df9182a42d1ff59427a100c6522efc (patch) | |
tree | 3c7d47828f89853de49e979f97ffe78fd1dba7d6 /net/bridge/br_sysfs_if.c | |
parent | ca7d5e42d783e54f0057317c9226262d68ab7717 (diff) | |
parent | bef4a456b8dc8b3638f4d49a25a89e1467da9483 (diff) |
Merge branch 'upstream'
Diffstat (limited to 'net/bridge/br_sysfs_if.c')
-rw-r--r-- | net/bridge/br_sysfs_if.c | 50 |
1 files changed, 3 insertions, 47 deletions
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c index 0ac0355d16dd..c51c9e42aeb3 100644 --- a/net/bridge/br_sysfs_if.c +++ b/net/bridge/br_sysfs_if.c | |||
@@ -195,23 +195,11 @@ static ssize_t brport_store(struct kobject * kobj, | |||
195 | return ret; | 195 | return ret; |
196 | } | 196 | } |
197 | 197 | ||
198 | /* called from kobject_put when port ref count goes to zero. */ | 198 | struct sysfs_ops brport_sysfs_ops = { |
199 | static void brport_release(struct kobject *kobj) | ||
200 | { | ||
201 | kfree(container_of(kobj, struct net_bridge_port, kobj)); | ||
202 | } | ||
203 | |||
204 | static struct sysfs_ops brport_sysfs_ops = { | ||
205 | .show = brport_show, | 199 | .show = brport_show, |
206 | .store = brport_store, | 200 | .store = brport_store, |
207 | }; | 201 | }; |
208 | 202 | ||
209 | static struct kobj_type brport_ktype = { | ||
210 | .sysfs_ops = &brport_sysfs_ops, | ||
211 | .release = brport_release, | ||
212 | }; | ||
213 | |||
214 | |||
215 | /* | 203 | /* |
216 | * Add sysfs entries to ethernet device added to a bridge. | 204 | * Add sysfs entries to ethernet device added to a bridge. |
217 | * Creates a brport subdirectory with bridge attributes. | 205 | * Creates a brport subdirectory with bridge attributes. |
@@ -223,17 +211,6 @@ int br_sysfs_addif(struct net_bridge_port *p) | |||
223 | struct brport_attribute **a; | 211 | struct brport_attribute **a; |
224 | int err; | 212 | int err; |
225 | 213 | ||
226 | ASSERT_RTNL(); | ||
227 | |||
228 | kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR); | ||
229 | p->kobj.ktype = &brport_ktype; | ||
230 | p->kobj.parent = &(p->dev->class_dev.kobj); | ||
231 | p->kobj.kset = NULL; | ||
232 | |||
233 | err = kobject_add(&p->kobj); | ||
234 | if(err) | ||
235 | goto out1; | ||
236 | |||
237 | err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj, | 214 | err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj, |
238 | SYSFS_BRIDGE_PORT_LINK); | 215 | SYSFS_BRIDGE_PORT_LINK); |
239 | if (err) | 216 | if (err) |
@@ -245,28 +222,7 @@ int br_sysfs_addif(struct net_bridge_port *p) | |||
245 | goto out2; | 222 | goto out2; |
246 | } | 223 | } |
247 | 224 | ||
248 | err = sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name); | 225 | err= sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name); |
249 | if (err) | 226 | out2: |
250 | goto out2; | ||
251 | |||
252 | kobject_uevent(&p->kobj, KOBJ_ADD); | ||
253 | return 0; | ||
254 | out2: | ||
255 | kobject_del(&p->kobj); | ||
256 | out1: | ||
257 | return err; | 227 | return err; |
258 | } | 228 | } |
259 | |||
260 | void br_sysfs_removeif(struct net_bridge_port *p) | ||
261 | { | ||
262 | pr_debug("br_sysfs_removeif\n"); | ||
263 | sysfs_remove_link(&p->br->ifobj, p->dev->name); | ||
264 | kobject_uevent(&p->kobj, KOBJ_REMOVE); | ||
265 | kobject_del(&p->kobj); | ||
266 | } | ||
267 | |||
268 | void br_sysfs_freeif(struct net_bridge_port *p) | ||
269 | { | ||
270 | pr_debug("br_sysfs_freeif\n"); | ||
271 | kobject_put(&p->kobj); | ||
272 | } | ||