aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-09-19 12:39:19 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-26 00:08:39 -0400
commit2589f1887b0bf9f08ec3d7f3c5705ccb7c628076 (patch)
tree172fcb59cf5a8b500aafe905a690ea4b439277c4 /drivers/base
parentc47ed219ba81632595e9f02e27318151fec16c9e (diff)
Driver core: add ability for devices to create and remove bin files
Makes it easier for devices to create and remove binary attribute files so they don't have to call directly into sysfs. This is needed to help with the conversion from struct class_device to struct device. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 1d3d3582fcca..bc9f35c81691 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -319,6 +319,32 @@ void device_remove_file(struct device * dev, struct device_attribute * attr)
319 } 319 }
320} 320}
321 321
322/**
323 * device_create_bin_file - create sysfs binary attribute file for device.
324 * @dev: device.
325 * @attr: device binary attribute descriptor.
326 */
327int device_create_bin_file(struct device *dev, struct bin_attribute *attr)
328{
329 int error = -EINVAL;
330 if (dev)
331 error = sysfs_create_bin_file(&dev->kobj, attr);
332 return error;
333}
334EXPORT_SYMBOL_GPL(device_create_bin_file);
335
336/**
337 * device_remove_bin_file - remove sysfs binary attribute file
338 * @dev: device.
339 * @attr: device binary attribute descriptor.
340 */
341void device_remove_bin_file(struct device *dev, struct bin_attribute *attr)
342{
343 if (dev)
344 sysfs_remove_bin_file(&dev->kobj, attr);
345}
346EXPORT_SYMBOL_GPL(device_remove_bin_file);
347
322static void klist_children_get(struct klist_node *n) 348static void klist_children_get(struct klist_node *n)
323{ 349{
324 struct device *dev = container_of(n, struct device, knode_parent); 350 struct device *dev = container_of(n, struct device, knode_parent);