aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysfs')
-rw-r--r--fs/sysfs/dir.c12
-rw-r--r--fs/sysfs/sysfs.h13
2 files changed, 13 insertions, 12 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index c4342a019972..2544aae6f583 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -15,6 +15,18 @@
15DECLARE_RWSEM(sysfs_rename_sem); 15DECLARE_RWSEM(sysfs_rename_sem);
16spinlock_t sysfs_lock = SPIN_LOCK_UNLOCKED; 16spinlock_t sysfs_lock = SPIN_LOCK_UNLOCKED;
17 17
18void release_sysfs_dirent(struct sysfs_dirent * sd)
19{
20 if (sd->s_type & SYSFS_KOBJ_LINK) {
21 struct sysfs_symlink * sl = sd->s_element;
22 kfree(sl->link_name);
23 kobject_put(sl->target_kobj);
24 kfree(sl);
25 }
26 kfree(sd->s_iattr);
27 kmem_cache_free(sysfs_dir_cachep, sd);
28}
29
18static void sysfs_d_iput(struct dentry * dentry, struct inode * inode) 30static void sysfs_d_iput(struct dentry * dentry, struct inode * inode)
19{ 31{
20 struct sysfs_dirent * sd = dentry->d_fsdata; 32 struct sysfs_dirent * sd = dentry->d_fsdata;
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 502c949c402d..687d959f606d 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -18,6 +18,7 @@ extern void sysfs_delete_inode(struct inode *inode);
18extern struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent *); 18extern struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent *);
19extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *)); 19extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *));
20 20
21extern void release_sysfs_dirent(struct sysfs_dirent * sd);
21extern int sysfs_dirent_exist(struct sysfs_dirent *, const unsigned char *); 22extern int sysfs_dirent_exist(struct sysfs_dirent *, const unsigned char *);
22extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *, 23extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *,
23 umode_t, int); 24 umode_t, int);
@@ -99,18 +100,6 @@ static inline struct kobject *sysfs_get_kobject(struct dentry *dentry)
99 return kobj; 100 return kobj;
100} 101}
101 102
102static inline void release_sysfs_dirent(struct sysfs_dirent * sd)
103{
104 if (sd->s_type & SYSFS_KOBJ_LINK) {
105 struct sysfs_symlink * sl = sd->s_element;
106 kfree(sl->link_name);
107 kobject_put(sl->target_kobj);
108 kfree(sl);
109 }
110 kfree(sd->s_iattr);
111 kmem_cache_free(sysfs_dir_cachep, sd);
112}
113
114static inline struct sysfs_dirent * sysfs_get(struct sysfs_dirent * sd) 103static inline struct sysfs_dirent * sysfs_get(struct sysfs_dirent * sd)
115{ 104{
116 if (sd) { 105 if (sd) {