[PATCH 11/15] sysfs: open code sysfs_attach_dentry()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <ebiederm@...>, <cornelia.huck@...>, <greg@...>, <stern@...>, <kay.sievers@...>, <linux-kernel@...>, <htejun@...>
Cc: Tejun Heo <htejun@...>
Date: Thursday, September 20, 2007 - 3:05 am

sysfs_attach_dentry() now has only one caller and isn't doing much
other than obfuscating the code.  Open code and kill it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
 fs/sysfs/dir.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 942d8e3..7500407 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -332,21 +332,6 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type)
 	return NULL;
 }
 
-/**
- *	sysfs_attach_dentry - associate sysfs_dirent with dentry
- *	@sd: target sysfs_dirent
- *	@dentry: dentry to associate
- *
- *	LOCKING:
- *	mutex_lock(sysfs_mutex)
- */
-static void sysfs_attach_dentry(struct sysfs_dirent *sd, struct dentry *dentry)
-{
-	dentry->d_op = &sysfs_dentry_ops;
-	dentry->d_fsdata = sysfs_get(sd);
-	d_rehash(dentry);
-}
-
 static int sysfs_ilookup_test(struct inode *inode, void *arg)
 {
 	struct sysfs_dirent *sd = arg;
@@ -692,8 +677,11 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
 		goto out_unlock;
 	}
 
+	/* instantiate and hash dentry */
+	dentry->d_op = &sysfs_dentry_ops;
+	dentry->d_fsdata = sysfs_get(sd);
 	d_instantiate(dentry, inode);
-	sysfs_attach_dentry(sd, dentry);
+	d_rehash(dentry);
 
  out_unlock:
 	mutex_unlock(&sysfs_mutex);
-- 
1.5.0.3


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

Messages in current thread:
[PATCHSET 1/4] sysfs: misc updates, Tejun Heo, (Thu Sep 20, 3:05 am)
Re: [PATCHSET 1/4] sysfs: misc updates, Cornelia Huck, (Wed Sep 26, 7:04 am)
Re: [PATCHSET 1/4] sysfs: misc updates, Greg KH, (Wed Sep 26, 11:19 am)
[PATCH 14/15] sysfs: implement sysfs_open_dirent, Tejun Heo, (Thu Sep 20, 3:05 am)
[PATCH 11/15] sysfs: open code sysfs_attach_dentry(), Tejun Heo, (Thu Sep 20, 3:05 am)
[PATCH 10/15] sysfs: make s_elem an anonymous union, Tejun Heo, (Thu Sep 20, 3:05 am)
[PATCH 05/15] sysfs: kill sysfs_update_file(), Tejun Heo, (Thu Sep 20, 3:05 am)
[PATCH 04/15] sysfs: clean up header files, Tejun Heo, (Thu Sep 20, 3:05 am)
[PATCH 01/15] sysfs: kill SYSFS_FLAG_REMOVED, Tejun Heo, (Thu Sep 20, 3:05 am)
Re: [PATCH 01/15] sysfs: kill SYSFS_FLAG_REMOVED, Greg KH, (Tue Sep 25, 5:32 pm)