summaryrefslogtreecommitdiffstats
path: root/fs/sysfs/file.c
diff options
context:
space:
mode:
authorTejun Heo2007-08-02 14:38:03 +0200
committerGreg Kroah-Hartman2007-10-12 23:51:03 +0200
commit41fc1c27452e041a18e5141b8203ee0ea72bc483 (patch)
treefc81138ca37182c25931818681630c90b018b127 /fs/sysfs/file.c
parentsysfs: simplify sysfs_rename_dir() (diff)
downloadkernel-qcow2-linux-41fc1c27452e041a18e5141b8203ee0ea72bc483.tar.gz
kernel-qcow2-linux-41fc1c27452e041a18e5141b8203ee0ea72bc483.tar.xz
kernel-qcow2-linux-41fc1c27452e041a18e5141b8203ee0ea72bc483.zip
sysfs: make sysfs_add/remove_one() call link/unlink_sibling() implictly
When adding or removing a sysfs_dirent, the user used to be required to call link/unlink separately. It was for two reasons - code looked like that before sysfs_addrm_cxt conversion and to avoid looping through parent_sd->children list twice during removal. Performance optimization during removal just isn't worth it. Make sysfs_add/remove_one() call sysfs_link/unlink_sibing() implicitly. This makes code simpler albeit slightly less efficient. This change doesn't introduce any noticeable behavior change. Signed-off-by: Tejun Heo <htejun@gmail.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/file.c')
-rw-r--r--fs/sysfs/file.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index b21d11b46754..ea0e494d7d58 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -405,10 +405,8 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr,
sysfs_addrm_start(&acxt, dir_sd);
- if (!sysfs_find_dirent(dir_sd, attr->name)) {
+ if (!sysfs_find_dirent(dir_sd, attr->name))
sysfs_add_one(&acxt, sd);
- sysfs_link_sibling(sd);
- }
if (!sysfs_addrm_finish(&acxt)) {
sysfs_put(sd);