aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c4
-rw-r--r--fs/sysfs/bin.c13
-rw-r--r--fs/sysfs/inode.c11
-rw-r--r--fs/sysfs/sysfs.h2
-rw-r--r--include/linux/sysfs.h2
5 files changed, 19 insertions, 13 deletions
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 317457dd4014..d0a07d9ab30c 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -487,9 +487,7 @@ static void __exit ibm_acpiphp_exit(void)
487 if (ACPI_FAILURE(status)) 487 if (ACPI_FAILURE(status))
488 err("%s: Notification handler removal failed\n", __FUNCTION__); 488 err("%s: Notification handler removal failed\n", __FUNCTION__);
489 /* remove the /sys entries */ 489 /* remove the /sys entries */
490 if (sysfs_remove_bin_file(sysdir, &ibm_apci_table_attr)) 490 sysfs_remove_bin_file(sysdir, &ibm_apci_table_attr);
491 err("%s: removal of sysfs file apci_table failed\n",
492 __FUNCTION__);
493} 491}
494 492
495module_init(ibm_acpiphp_init); 493module_init(ibm_acpiphp_init);
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index c16a93c353c0..98022e41cda1 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/kernel.h>
13#include <linux/kobject.h> 14#include <linux/kobject.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/slab.h> 16#include <linux/slab.h>
@@ -176,7 +177,6 @@ const struct file_operations bin_fops = {
176 * sysfs_create_bin_file - create binary file for object. 177 * sysfs_create_bin_file - create binary file for object.
177 * @kobj: object. 178 * @kobj: object.
178 * @attr: attribute descriptor. 179 * @attr: attribute descriptor.
179 *
180 */ 180 */
181 181
182int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr) 182int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr)
@@ -191,13 +191,16 @@ int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr)
191 * sysfs_remove_bin_file - remove binary file for object. 191 * sysfs_remove_bin_file - remove binary file for object.
192 * @kobj: object. 192 * @kobj: object.
193 * @attr: attribute descriptor. 193 * @attr: attribute descriptor.
194 *
195 */ 194 */
196 195
197int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr) 196void sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr)
198{ 197{
199 sysfs_hash_and_remove(kobj->dentry,attr->attr.name); 198 if (sysfs_hash_and_remove(kobj->dentry, attr->attr.name) < 0) {
200 return 0; 199 printk(KERN_ERR "%s: "
200 "bad dentry or inode or no such file: \"%s\"\n",
201 __FUNCTION__, attr->attr.name);
202 dump_stack();
203 }
201} 204}
202 205
203EXPORT_SYMBOL_GPL(sysfs_create_bin_file); 206EXPORT_SYMBOL_GPL(sysfs_create_bin_file);
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
17extern struct super_block * sysfs_sb; 18extern 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
237void sysfs_hash_and_remove(struct dentry * dir, const char * name) 238int 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}
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 3651ffb5ec09..6f3d6bd52887 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -10,7 +10,7 @@ extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *,
10 umode_t, int); 10 umode_t, int);
11 11
12extern int sysfs_add_file(struct dentry *, const struct attribute *, int); 12extern int sysfs_add_file(struct dentry *, const struct attribute *, int);
13extern void sysfs_hash_and_remove(struct dentry * dir, const char * name); 13extern int sysfs_hash_and_remove(struct dentry * dir, const char * name);
14extern struct sysfs_dirent *sysfs_find(struct sysfs_dirent *dir, const char * name); 14extern struct sysfs_dirent *sysfs_find(struct sysfs_dirent *dir, const char * name);
15 15
16extern int sysfs_create_subdir(struct kobject *, const char *, struct dentry **); 16extern int sysfs_create_subdir(struct kobject *, const char *, struct dentry **);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 1ea5d3cda6ae..95f6db54d8d2 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -114,7 +114,7 @@ extern void
114sysfs_remove_link(struct kobject *, const char * name); 114sysfs_remove_link(struct kobject *, const char * name);
115 115
116int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); 116int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr);
117int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); 117void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
118 118
119int sysfs_create_group(struct kobject *, const struct attribute_group *); 119int sysfs_create_group(struct kobject *, const struct attribute_group *);
120void sysfs_remove_group(struct kobject *, const struct attribute_group *); 120void sysfs_remove_group(struct kobject *, const struct attribute_group *);