allow struct bin_attributes in class devices
PATCH 1/1 allow struct bin_attributes in class devices
This small patch adds routines to create and remove bin_attribute files for class devices. One intended use is for binary files corresponding to PCI busses, like bus legacy I/O ports or ISA memory.
drivers/base/class.c | 16 ++++++++++++++++ include/linux/device.h | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-)
Thanks,
Jesse
===== drivers/base/class.c 1.56 vs edited =====
drivers/base/class.c +16 -0
@@ -179,6 +179,22 @@sysfs_remove_file (&class_dev->kobj, &attr->attr); } +int class_device_create_bin_file (struct class_device *class_dev, +struct bin_attribute *attr) +{ +int error = -EINVAL ; +if (class_dev) + error =sysfs_create_bin_file (&class_dev->kobj, attr); +return error; +} + +void class_device_remove_bin_file (struct class_device *class_dev, +struct bin_attribute *attr) +{ +if (class_dev) +sysfs_remove_bin_file (&class_dev->kobj, attr); +} +static int class_device_dev_link (struct class_device * class_dev) {if (class_dev->dev)
===== include/linux/device.h 1.133 vs edited =====
include/linux/device.h +4 -1
@@ -228,7 +228,10 @@ const struct class_device_attribute *);extern void class_device_remove_file (struct class_device *,const struct class_device_attribute *); - +extern int class_device_create_bin_file (struct class_device *, +struct bin_attribute *); +extern void class_device_remove_bin_file (struct class_device *, +struct bin_attribute *);struct class_interface {struct list_head node;
Quoted 9 lines · Jesse Barnes
This small patch adds routines to create and remove
bin_attributefiles for class devices. One intended use is for binary files corresponding to PCI busses, like bus legacy I/O ports or ISA memory.drivers/base/class.c | 16 ++++++++++++++++ include/linux/device.h | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-)Signed-off-by Jesse Barnes <[email protected]>
Ugh, we'll get this eventually... You forgot a EXPORT_SYMBOL_GPL() so that modules can use these functions :)
Third time's a charm :)
thanks,
greg k-h
Quoted 9 lines · Greg KH
Quoted 8 lines · Jesse Barnes
This small patch adds routines to create and remove
bin_attributefiles for class devices. One intended use is for binary files corresponding to PCI busses, like bus legacy I/O ports or ISA memory.drivers/base/class.c | 16 ++++++++++++++++ include/linux/device.h | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-)
Quoted 6 lines
Quoted 1 line
Signed-off-by Jesse Barnes <[email protected]>Ugh, we'll get this eventually... You forgot a
EXPORT_SYMBOL_GPL()so that modules can use these functions :)Third time's a charm :)
Doh! Here you go.
Jesse
===== drivers/base/class.c 1.56 vs edited =====
drivers/base/class.c +18 -0
@@ -179,6 +179,22 @@sysfs_remove_file (&class_dev->kobj, &attr->attr); } +int class_device_create_bin_file (struct class_device *class_dev, +struct bin_attribute *attr) +{ +int error = -EINVAL ; +if (class_dev) + error =sysfs_create_bin_file (&class_dev->kobj, attr); +return error; +} + +void class_device_remove_bin_file (struct class_device *class_dev, +struct bin_attribute *attr) +{ +if (class_dev) +sysfs_remove_bin_file (&class_dev->kobj, attr); +} +static int class_device_dev_link (struct class_device * class_dev) {if (class_dev->dev)
@@ -576,6 +592,8 @@EXPORT_SYMBOL_GPL (class_device_put);EXPORT_SYMBOL_GPL (class_device_create_file);EXPORT_SYMBOL_GPL (class_device_remove_file); +EXPORT_SYMBOL_GPL (class_device_create_bin_file); +EXPORT_SYMBOL_GPL (class_device_remove_bin_file);EXPORT_SYMBOL_GPL (class_interface_register);EXPORT_SYMBOL_GPL (class_interface_unregister);
===== include/linux/device.h 1.133 vs edited =====
include/linux/device.h +4 -1
@@ -228,7 +228,10 @@ const struct class_device_attribute *);extern void class_device_remove_file (struct class_device *,const struct class_device_attribute *); - +extern int class_device_create_bin_file (struct class_device *, +struct bin_attribute *); +extern void class_device_remove_bin_file (struct class_device *, +struct bin_attribute *);struct class_interface {struct list_head node;
Greg KH
AppliedQuoted 10 lines · Jesse Barnes
Quoted 9 lines · Greg KH
Quoted 8 lines · Jesse Barnes
This small patch adds routines to create and remove
bin_attributefiles for class devices. One intended use is for binary files corresponding to PCI busses, like bus legacy I/O ports or ISA memory.drivers/base/class.c | 16 ++++++++++++++++ include/linux/device.h | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-)
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Jesse Barnes <[email protected]>Ugh, we'll get this eventually... You forgot a
EXPORT_SYMBOL_GPL()so that modules can use these functions :)Third time's a charm :)
Doh! Here you go.
Applied, thanks.
greg k-h