diff options
| author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-03-28 16:29:51 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-03-28 16:29:51 -0400 |
| commit | ed40d0c472b136682b2fcba05f89762859c7374f (patch) | |
| tree | 076b83a26bcd63d6158463735dd34c10bbc591dc /fs/sysfs/inode.c | |
| parent | 9e495834e59ca9b29f1a1f63b9f5533bb022ac49 (diff) | |
| parent | 5d80f8e5a9dc9c9a94d4aeaa567e219a808b8a4a (diff) | |
Merge branch 'origin' into devel
Conflicts:
sound/soc/pxa/pxa2xx-i2s.c
Diffstat (limited to 'fs/sysfs/inode.c')
| -rw-r--r-- | fs/sysfs/inode.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index dfa3d94cfc74..555f0ff988df 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
| @@ -147,6 +147,7 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode) | |||
| 147 | { | 147 | { |
| 148 | struct bin_attribute *bin_attr; | 148 | struct bin_attribute *bin_attr; |
| 149 | 149 | ||
| 150 | inode->i_private = sysfs_get(sd); | ||
| 150 | inode->i_mapping->a_ops = &sysfs_aops; | 151 | inode->i_mapping->a_ops = &sysfs_aops; |
| 151 | inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; | 152 | inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; |
| 152 | inode->i_op = &sysfs_inode_operations; | 153 | inode->i_op = &sysfs_inode_operations; |
| @@ -214,6 +215,22 @@ struct inode * sysfs_get_inode(struct sysfs_dirent *sd) | |||
| 214 | return inode; | 215 | return inode; |
| 215 | } | 216 | } |
| 216 | 217 | ||
| 218 | /* | ||
| 219 | * The sysfs_dirent serves as both an inode and a directory entry for sysfs. | ||
| 220 | * To prevent the sysfs inode numbers from being freed prematurely we take a | ||
| 221 | * reference to sysfs_dirent from the sysfs inode. A | ||
| 222 | * super_operations.delete_inode() implementation is needed to drop that | ||
| 223 | * reference upon inode destruction. | ||
| 224 | */ | ||
| 225 | void sysfs_delete_inode(struct inode *inode) | ||
| 226 | { | ||
| 227 | struct sysfs_dirent *sd = inode->i_private; | ||
| 228 | |||
| 229 | truncate_inode_pages(&inode->i_data, 0); | ||
| 230 | clear_inode(inode); | ||
| 231 | sysfs_put(sd); | ||
| 232 | } | ||
| 233 | |||
| 217 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name) | 234 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name) |
| 218 | { | 235 | { |
| 219 | struct sysfs_addrm_cxt acxt; | 236 | struct sysfs_addrm_cxt acxt; |
