diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 14:49:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 14:49:46 -0400 |
commit | dd77a4ee0f3981693d4229aa1d57cea9e526ff47 (patch) | |
tree | cb486be20b950201103a03636cbb1e1d180f0098 /fs/sysfs/inode.c | |
parent | e8216dee838c09776680a6f1a2e54d81f3cdfa14 (diff) | |
parent | 7e9f4b2d3e21e87c26025810413ef1592834e63b (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (47 commits)
Driver core: Don't call put methods while holding a spinlock
Driver core: Remove unneeded routines from driver core
Driver core: Fix potential deadlock in driver core
PCI: enable driver multi-threaded probe
Driver Core: add ability for drivers to do a threaded probe
sysfs: add proper sysfs_init() prototype
drivers/base: check errors
drivers/base: Platform notify needs to occur before drivers attach to the device
v4l-dev2: handle __must_check
add CONFIG_ENABLE_MUST_CHECK
add __must_check to device management code
Driver core: fixed add_bind_files() definition
Driver core: fix comments in drivers/base/power/resume.c
sysfs_remove_bin_file: no return value, dump_stack on error
kobject: must_check fixes
Driver core: add ability for devices to create and remove bin files
Class: add support for class interfaces for devices
Driver core: create devices/virtual/ tree
Driver core: add device_rename function
Driver core: add ability for classes to handle devices properly
...
Diffstat (limited to 'fs/sysfs/inode.c')
-rw-r--r-- | fs/sysfs/inode.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 9889e54e1f13..fd7cd5f843d2 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/namei.h> | 12 | #include <linux/namei.h> |
13 | #include <linux/backing-dev.h> | 13 | #include <linux/backing-dev.h> |
14 | #include <linux/capability.h> | 14 | #include <linux/capability.h> |
15 | #include <linux/errno.h> | ||
15 | #include "sysfs.h" | 16 | #include "sysfs.h" |
16 | 17 | ||
17 | extern struct super_block * sysfs_sb; | 18 | extern struct super_block * sysfs_sb; |
@@ -234,17 +235,18 @@ void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent) | |||
234 | } | 235 | } |
235 | } | 236 | } |
236 | 237 | ||
237 | void sysfs_hash_and_remove(struct dentry * dir, const char * name) | 238 | int sysfs_hash_and_remove(struct dentry * dir, const char * name) |
238 | { | 239 | { |
239 | struct sysfs_dirent * sd; | 240 | struct sysfs_dirent * sd; |
240 | struct sysfs_dirent * parent_sd; | 241 | struct sysfs_dirent * parent_sd; |
242 | int found = 0; | ||
241 | 243 | ||
242 | if (!dir) | 244 | if (!dir) |
243 | return; | 245 | return -ENOENT; |
244 | 246 | ||
245 | if (dir->d_inode == NULL) | 247 | if (dir->d_inode == NULL) |
246 | /* no inode means this hasn't been made visible yet */ | 248 | /* no inode means this hasn't been made visible yet */ |
247 | return; | 249 | return -ENOENT; |
248 | 250 | ||
249 | parent_sd = dir->d_fsdata; | 251 | parent_sd = dir->d_fsdata; |
250 | mutex_lock(&dir->d_inode->i_mutex); | 252 | mutex_lock(&dir->d_inode->i_mutex); |
@@ -255,8 +257,11 @@ void sysfs_hash_and_remove(struct dentry * dir, const char * name) | |||
255 | list_del_init(&sd->s_sibling); | 257 | list_del_init(&sd->s_sibling); |
256 | sysfs_drop_dentry(sd, dir); | 258 | sysfs_drop_dentry(sd, dir); |
257 | sysfs_put(sd); | 259 | sysfs_put(sd); |
260 | found = 1; | ||
258 | break; | 261 | break; |
259 | } | 262 | } |
260 | } | 263 | } |
261 | mutex_unlock(&dir->d_inode->i_mutex); | 264 | mutex_unlock(&dir->d_inode->i_mutex); |
265 | |||
266 | return found ? 0 : -ENOENT; | ||
262 | } | 267 | } |