From: Tejun Heo <[email protected]> With the previous sysfs_add_one() update, there is only one user of the return value of sysfs_addrm_finish() and the user can switch to testing @sd easily. Make sysfs_addrm_finish() return void for cleaner semantics as suggested by Satyam Sharma. This patch doesn't introduce any noticeable behavior change. Signed-off-by: Tejun Heo <[email protected]> Cc: Satyam Sharma <[email protected]> Acked-by: Cornelia Huck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> --- fs/sysfs/dir.c | 7 +------ fs/sysfs/inode.c | 7 +++++-- fs/sysfs/sysfs.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 6206032..a0da2b0 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -609,11 +609,8 @@ static void sysfs_drop_dentry(struct sysfs_dirent *sd) * * LOCKING: * All mutexes acquired by sysfs_addrm_start() are released. - * - * RETURNS: - * Number of added/removed sysfs_dirents since sysfs_addrm_start(). */ -int sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) +void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) { /* release resources acquired by sysfs_addrm_start() */ mutex_unlock(&sysfs_mutex); @@ -639,8 +636,6 @@ int sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) sysfs_deactivate(sd); sysfs_put(sd); } - - return acxt->cnt; } /** diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index efb4062..e22db6c 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c @@ -200,7 +200,10 @@ int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name) if (sd) sysfs_remove_one(&acxt, sd); - if (sysfs_addrm_finish(&acxt)) + sysfs_addrm_finish(&acxt); + + if (sd) return 0; - return -ENOENT; + else + return -ENOENT; } diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index bb3f0c9..0436754 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h @@ -66,7 +66,7 @@ extern int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); extern void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); -extern int sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); +extern void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); extern struct inode * sysfs_get_inode(struct sysfs_dirent *sd); extern void sysfs_instantiate(struct dentry *dentry, struct inode *inode); -- 1.5.3.4 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- [PATCH 26/75] dmi-id: Use dynamic sysfs attributes
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 26/75] dmi-id: Use dynamic sysfs attributes
- References:
- [PATCH 01/75] platform: prefix MODALIAS with "platform:"
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 02/75] HOWTO: update ja_JP/HOWTO with latest changes
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 03/75] Driver core: make sysfs uevent-attributes static
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 04/75] Driver core: change add_uevent_var to use a struct
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 05/75] Driver core: add CONFIG_UEVENT_HELPER_PATH
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 06/75] Driver core: remove subsys_set_kset
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 07/75] Driver core: remove kset_set_kset_s
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 08/75] Driver core: remove subsys_put()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 09/75] Driver core: remove subsys_get()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 10/75] Driver core: remove put_bus()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 11/75] Driver core: remove get_bus()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 12/75] kobjects: fix up improper use of the kobject name field
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 13/75] cdev: remove unneeded setting of cdev names
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 14/75] Drivers: clean up direct setting of the name of a kset
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 15/75] kobject: remove the static array for the name
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 16/75] Driver core: clean up removed functions from the documentation
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 17/75] debugfs: helper for decimal challenged
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 18/75] sysfs/file.c - use mutex instead of semaphore
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 19/75] sysfs: cleanup semaphore.h
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 20/75] sysfs: Remove first pass at shadow directory support
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 21/75] sysfs: cosmetic changes in sysfs_lookup()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 22/75] sysfs: simplify sysfs_rename_dir()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 23/75] sysfs: make sysfs_add/remove_one() call link/unlink_sibling() implictly
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 24/75] sysfs: make sysfs_add_one() automatically check for duplicate entry
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 01/75] platform: prefix MODALIAS with "platform:"
- Prev by Date: [PATCH 24/75] sysfs: make sysfs_add_one() automatically check for duplicate entry
- Next by Date: [PATCH 26/75] dmi-id: Use dynamic sysfs attributes
- Previous by thread: [PATCH 24/75] sysfs: make sysfs_add_one() automatically check for duplicate entry
- Next by thread: [PATCH 26/75] dmi-id: Use dynamic sysfs attributes
- Index(es):