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>
This commit is contained in:
Tejun Heo
2007-08-02 21:38:03 +09:00
committed by Greg Kroah-Hartman
parent ff869de7bf
commit 41fc1c2745
5 changed files with 16 additions and 32 deletions

View File

@@ -92,10 +92,8 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char
sysfs_addrm_start(&acxt, parent_sd);
if (!sysfs_find_dirent(parent_sd, name)) {
if (!sysfs_find_dirent(parent_sd, name))
sysfs_add_one(&acxt, sd);
sysfs_link_sibling(sd);
}
if (!sysfs_addrm_finish(&acxt)) {
error = -EEXIST;