diff options
author | Tejun Heo <htejun@gmail.com> | 2007-08-02 08:38:03 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:51:03 -0400 |
commit | 41fc1c27452e041a18e5141b8203ee0ea72bc483 (patch) | |
tree | fc81138ca37182c25931818681630c90b018b127 /fs/sysfs/symlink.c | |
parent | ff869de7bf5e76adffebd3a176c1c73bca7eddb7 (diff) |
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/symlink.c')
-rw-r--r-- | fs/sysfs/symlink.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index 90484533801e..c129f307936a 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
@@ -92,10 +92,8 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char | |||
92 | 92 | ||
93 | sysfs_addrm_start(&acxt, parent_sd); | 93 | sysfs_addrm_start(&acxt, parent_sd); |
94 | 94 | ||
95 | if (!sysfs_find_dirent(parent_sd, name)) { | 95 | if (!sysfs_find_dirent(parent_sd, name)) |
96 | sysfs_add_one(&acxt, sd); | 96 | sysfs_add_one(&acxt, sd); |
97 | sysfs_link_sibling(sd); | ||
98 | } | ||
99 | 97 | ||
100 | if (!sysfs_addrm_finish(&acxt)) { | 98 | if (!sysfs_addrm_finish(&acxt)) { |
101 | error = -EEXIST; | 99 | error = -EEXIST; |