From htejun@gmail.com Thu Sep 20 00:05:29 2007 From: Tejun Heo Date: Thu, 20 Sep 2007 16:05:11 +0900 Subject: sysfs: open code sysfs_attach_dentry() To: ebiederm@xmission.com, cornelia.huck@de.ibm.com, greg@kroah.com, stern@rowland.harvard.edu, kay.sievers@vrfy.org, linux-kernel@vger.kernel.org, htejun@gmail.com Cc: Tejun Heo Message-ID: <1190271911189-git-send-email-htejun@gmail.com> 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 Acked-by: Cornelia Huck Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/dir.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -332,21 +332,6 @@ struct sysfs_dirent *sysfs_new_dirent(co 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; @@ -696,8 +681,11 @@ static struct dentry * sysfs_lookup(stru 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);