]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
sysfs: Allow removal of symlinks in the sysfs root
authorMark Fasheh <mfasheh@suse.com>
Tue, 29 Jan 2008 22:35:18 +0000 (14:35 -0800)
committerMark Fasheh <mfasheh@suse.com>
Fri, 18 Apr 2008 15:56:10 +0000 (08:56 -0700)
Allow callers of sysfs_remove_link() to pass a NULL kobj, in which case
sysfs_root will be used as the parent directory. This allows us to tear down
top level symlinks created via sysfs_create_link(), which already has
similar handling of a NULL parent object.

Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/sysfs/symlink.c

index 5f66c446615176eff46e1864a7343f228bac19e6..817f5966edcac2c2e36033902f2ac2ce0f89f626 100644 (file)
@@ -87,7 +87,14 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char
 
 void sysfs_remove_link(struct kobject * kobj, const char * name)
 {
-       sysfs_hash_and_remove(kobj->sd, name);
+       struct sysfs_dirent *parent_sd = NULL;
+
+       if (!kobj)
+               parent_sd = &sysfs_root;
+       else
+               parent_sd = kobj->sd;
+
+       sysfs_hash_and_remove(parent_sd, name);
 }
 
 static int sysfs_get_target_path(struct sysfs_dirent *parent_sd,