[PATCH 5/5] sysfs: make sysfs_addrm_finish() return void

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Tejun Heo
Date: Thursday, August 2, 2007 - 5:38 am

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 <htejun@gmail.com>
Cc: Satyam Sharma <satyam.sharma@gmail.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 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 91934e1..3e5acc4 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 f05cda9..e74224e 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -201,7 +201,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.0.3


-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/5] sysfs: simplify sysfs_rename_dir(), Tejun Heo, (Thu Aug 2, 5:38 am)
[PATCH 5/5] sysfs: make sysfs_addrm_finish() return void, Tejun Heo, (Thu Aug 2, 5:38 am)
[PATCH 0/25] Sysfs cleanups &amp; tagged directory support, Eric W. Biederman, (Tue Aug 7, 2:06 pm)
[PATCH 02/25] sysfs: Remove sysfs_instantiate, Eric W. Biederman, (Tue Aug 7, 2:08 pm)
[PATCH 03/25] sysfs: Use kill_anon_super, Eric W. Biederman, (Tue Aug 7, 2:10 pm)
[PATCH 04/25] sysfs: Make sysfs_mount static, Eric W. Biederman, (Tue Aug 7, 2:11 pm)
[PATCH 06/25] sysfs: Simplify readdir., Eric W. Biederman, (Tue Aug 7, 2:13 pm)
[PATCH 07/25] sysfs: Rewrite sysfs_drop_dentry., Eric W. Biederman, (Tue Aug 7, 2:14 pm)
[PATCH 08/25] sysfs: Implement __sysfs_get_dentry, Eric W. Biederman, (Tue Aug 7, 2:16 pm)
[PATCH 10/25] sysfs: Rewrite sysfs_get_dentry in terms of ..., Eric W. Biederman, (Tue Aug 7, 2:18 pm)
[PATCH 11/25] sysfs: Remove s_dentry, Eric W. Biederman, (Tue Aug 7, 2:19 pm)
[PATCH 12/25] sysfs: Introduce sysfs_rename_mutex, Eric W. Biederman, (Tue Aug 7, 2:21 pm)
[PATCH 13/25] sysfs: Simply sysfs_get_dentry, Eric W. Biederman, (Tue Aug 7, 2:22 pm)
[PATCH 14/25] sysfs: Don't use lookup_one_len_kern, Eric W. Biederman, (Tue Aug 7, 2:23 pm)
[PATCH 15/25] vfs: Remove lookup_one_len_kern, Eric W. Biederman, (Tue Aug 7, 2:25 pm)
[PATCH 16/25] sysfs: Support for preventing unmounts., Eric W. Biederman, (Tue Aug 7, 2:26 pm)
[PATCH 17/25] sysfs: Rewrite rename in terms of sysfs dirents, Eric W. Biederman, (Tue Aug 7, 2:27 pm)
[PATCH 19/25] sysfs: sysfs_get_dentry add a sb parameter, Eric W. Biederman, (Tue Aug 7, 2:29 pm)
[PATCH 20/25] sysfs: Rename Support multiple superblocks, Eric W. Biederman, (Tue Aug 7, 2:31 pm)
Re: [PATCH 02/25] sysfs: Remove sysfs_instantiate, Tejun Heo, (Tue Aug 7, 11:37 pm)
Re: [PATCH 03/25] sysfs: Use kill_anon_super, Tejun Heo, (Tue Aug 7, 11:50 pm)
Re: [PATCH 04/25] sysfs: Make sysfs_mount static, Tejun Heo, (Tue Aug 7, 11:51 pm)
Re: [PATCH 06/25] sysfs: Simplify readdir., Tejun Heo, (Wed Aug 8, 12:12 am)
Re: [PATCH 07/25] sysfs: Rewrite sysfs_drop_dentry., Tejun Heo, (Wed Aug 8, 12:35 am)
Re: [PATCH 11/25] sysfs: Remove s_dentry, Tejun Heo, (Wed Aug 8, 12:46 am)
Re: [PATCH 0/25] Sysfs cleanups &amp; tagged directory support, Eric W. Biederman, (Wed Aug 8, 12:47 am)
Re: [PATCH 0/25] Sysfs cleanups &amp; tagged directory support, Eric W. Biederman, (Wed Aug 8, 12:57 am)
Re: [PATCH 13/25] sysfs: Simply sysfs_get_dentry, Tejun Heo, (Wed Aug 8, 1:24 am)
Re: [PATCH 12/25] sysfs: Introduce sysfs_rename_mutex, Eric W. Biederman, (Wed Aug 8, 1:28 am)
Re: [PATCH 15/25] vfs: Remove lookup_one_len_kern, Tejun Heo, (Wed Aug 8, 1:39 am)
Re: [PATCH 14/25] sysfs: Don't use lookup_one_len_kern, Eric W. Biederman, (Wed Aug 8, 8:26 am)
Re: [PATCH 17/25] sysfs: Rewrite rename in terms of sysfs ..., Eric W. Biederman, (Wed Aug 8, 8:32 am)
Re: [PATCH 19/25] sysfs: sysfs_get_dentry add a sb parameter, Eric W. Biederman, (Wed Aug 8, 8:34 am)
Re: [PATCH 20/25] sysfs: Rename Support multiple superblocks, Eric W. Biederman, (Wed Aug 8, 8:45 am)
Re: alternative approached at tagged nodes, Tejun Heo, (Wed Aug 8, 9:31 am)
Re: [PATCH 20/25] sysfs: Rename Support multiple superblocks, Eric W. Biederman, (Wed Aug 8, 9:35 am)
Re: [PATCH 20/25] sysfs: Rename Support multiple superblocks, Eric W. Biederman, (Wed Aug 8, 9:55 am)