diff options
-rw-r--r-- | drivers/base/core.c | 26 | ||||
-rw-r--r-- | include/linux/device.h | 4 |
2 files changed, 30 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 | */ | ||
327 | int 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 | } | ||
334 | EXPORT_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 | */ | ||
341 | void device_remove_bin_file(struct device *dev, struct bin_attribute *attr) | ||
342 | { | ||
343 | if (dev) | ||
344 | sysfs_remove_bin_file(&dev->kobj, attr); | ||
345 | } | ||
346 | EXPORT_SYMBOL_GPL(device_remove_bin_file); | ||
347 | |||
322 | static void klist_children_get(struct klist_node *n) | 348 | static 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); |
diff --git a/include/linux/device.h b/include/linux/device.h index e0fae0e76fa9..7d447d7271c5 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -309,6 +309,10 @@ struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) | |||
309 | 309 | ||
310 | extern int device_create_file(struct device *device, struct device_attribute * entry); | 310 | extern int device_create_file(struct device *device, struct device_attribute * entry); |
311 | extern void device_remove_file(struct device * dev, struct device_attribute * attr); | 311 | extern void device_remove_file(struct device * dev, struct device_attribute * attr); |
312 | extern int __must_check device_create_bin_file(struct device *dev, | ||
313 | struct bin_attribute *attr); | ||
314 | extern void device_remove_bin_file(struct device *dev, | ||
315 | struct bin_attribute *attr); | ||
312 | struct device { | 316 | struct device { |
313 | struct klist klist_children; | 317 | struct klist klist_children; |
314 | struct klist_node knode_parent; /* node in sibling list */ | 318 | struct klist_node knode_parent; /* node in sibling list */ |