Skip to content

Commit

Permalink
sysfs: open code sysfs_attach_dentry()
Browse files Browse the repository at this point in the history
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>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Tejun Heo authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent b1fc3d6 commit d6b4fd2
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions fs/sysfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -696,8 +681,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);
Expand Down

0 comments on commit d6b4fd2

Please sign in to comment.