Re: [PATCH]: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
On Wed, Jun 13, 2007 at 09:35:44PM -0400, Len Brown wrote: > I've applied this to acpi-test with an Acked-by: gregkh -- as we need it > for the acpi table patch. > > Greg, unless I hear from you, I'll assume that this is okay for 2.6.23. It's fine with me, you can add a real: Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> to it too. thanks, greg k-h - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH]: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
I've applied this to acpi-test with an Acked-by: gregkh -- as we need it for the acpi table patch. Greg, unless I hear from you, I'll assume that this is okay for 2.6.23. thanks, -Len On Saturday 09 June 2007 01:57, Zhang Rui wrote: > From: Zhang Rui <[EMAIL PROTECTED]> > > Well, first of all, I don't want to change so many files either. > > What I do: > Adding a new parameter "struct bin_attribute *" in the > .read/.write methods for the sysfs binary attributes. > > In fact, only the four lines change in fs/sysfs/bin.c and > include/linux/sysfs.h do the real work. > But I have to update all the files that use binary attributes > to make them compatible with the new .read and .write methods. > I'm not sure if I missed any. :( > > Why I do this: > For a sysfs attribute, we can get a pointer pointing to the > struct attribute in the .show/.store method, > while we can't do this for the binary attributes. > I don't know why this is different, but this does make it not > so handy to use the binary attributes as the regular ones. > So I think this patch is reasonable. :) > > Who benefits from it: > The patch that exposes ACPI tables in sysfs > requires such an improvement. > All the table binary attributes share the same .read method. > Parameter "struct bin_attribute *" is used to get > the table signature and instance number which are used to > distinguish different ACPI table binary attributes. > > Without this parameter, we need to offer different .read methods > for different ACPI table binary attributes. > This is impossible as there are various ACPI tables on different > platforms, and we don't know what they are until they are loaded. > > Signed-off-by: Zhang Rui <[EMAIL PROTECTED]> > --- > Documentation/firmware_class/firmware_sample_firmware_class.c |2 > drivers/base/firmware_class.c |4 > drivers/firmware/dcdbas.c | 10 +- > drivers/firmware/dell_rbu.c | 25 +++-- > drivers/i2c/chips/eeprom.c|3 > drivers/i2c/chips/max6875.c |5 - > drivers/pci/hotplug/acpiphp_ibm.c |6 - > drivers/pci/pci-sysfs.c | 18 ++- > drivers/pcmcia/socket_sysfs.c |8 + > drivers/rapidio/rio-sysfs.c |6 - > drivers/rtc/rtc-ds1553.c | 10 +- > drivers/rtc/rtc-ds1742.c | 10 +- > drivers/s390/cio/chp.c| 10 +- > drivers/scsi/arcmsr/arcmsr_attr.c | 15 +-- > drivers/scsi/ipr.c| 18 ++- > drivers/scsi/libsas/sas_expander.c| 16 ++- > drivers/scsi/lpfc/lpfc_attr.c | 12 +- > drivers/scsi/qla2xxx/qla_attr.c | 50 > ++ > drivers/spi/at25.c|6 - > drivers/video/aty/radeon_base.c |8 + > drivers/w1/slaves/w1_ds2433.c | 10 +- > drivers/w1/slaves/w1_therm.c |7 + > drivers/w1/w1.c | 12 +- > drivers/zorro/zorro-sysfs.c |5 - > fs/sysfs/bin.c|4 > include/linux/sysfs.h |6 - > net/bridge/br_sysfs_br.c |5 - > 27 files changed, 185 insertions(+), 106 deletions(-) > > Index: > linux-2.6.22-rc4/Documentation/firmware_class/firmware_sample_firmware_class.c > === > --- > linux-2.6.22-rc4.orig/Documentation/firmware_class/firmware_sample_firmware_class.c >2004-01-03 06:33:28.0 +0800 > +++ > linux-2.6.22-rc4/Documentation/firmware_class/firmware_sample_firmware_class.c > 2007-06-08 13:25:33.0 +0800 > @@ -78,6 +78,7 @@ static CLASS_DEVICE_ATTR(loading, 0644, >firmware_loading_show, firmware_loading_store); > > static ssize_t firmware_data_read(struct kobject *kobj, > + struct bin_attribute *bin_attr, > char *buffer, loff_t offset, size_t count) > { > struct class_device *class_dev = to_class_dev(kobj); > @@ -88,6 +89,7 @@ static ssize_t firmware_data_read(struct > return count; > } > static ssize_t firmware_data_write(struct kobject *kobj, > +struct bin_attribute *bin_attr, > char *buffer, loff_t offset, size_t count) > { > struct class_device *class_dev = to_class_
Re: [PATCH]: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
From: Zhang Rui <[EMAIL PROTECTED]> Well, first of all, I don't want to change so many files either. What I do: Adding a new parameter "struct bin_attribute *" in the .read/.write methods for the sysfs binary attributes. In fact, only the four lines change in fs/sysfs/bin.c and include/linux/sysfs.h do the real work. But I have to update all the files that use binary attributes to make them compatible with the new .read and .write methods. I'm not sure if I missed any. :( Why I do this: For a sysfs attribute, we can get a pointer pointing to the struct attribute in the .show/.store method, while we can't do this for the binary attributes. I don't know why this is different, but this does make it not so handy to use the binary attributes as the regular ones. So I think this patch is reasonable. :) Who benefits from it: The patch that exposes ACPI tables in sysfs requires such an improvement. All the table binary attributes share the same .read method. Parameter "struct bin_attribute *" is used to get the table signature and instance number which are used to distinguish different ACPI table binary attributes. Without this parameter, we need to offer different .read methods for different ACPI table binary attributes. This is impossible as there are various ACPI tables on different platforms, and we don't know what they are until they are loaded. Signed-off-by: Zhang Rui <[EMAIL PROTECTED]> --- Documentation/firmware_class/firmware_sample_firmware_class.c |2 drivers/base/firmware_class.c |4 drivers/firmware/dcdbas.c | 10 +- drivers/firmware/dell_rbu.c | 25 +++-- drivers/i2c/chips/eeprom.c|3 drivers/i2c/chips/max6875.c |5 - drivers/pci/hotplug/acpiphp_ibm.c |6 - drivers/pci/pci-sysfs.c | 18 ++- drivers/pcmcia/socket_sysfs.c |8 + drivers/rapidio/rio-sysfs.c |6 - drivers/rtc/rtc-ds1553.c | 10 +- drivers/rtc/rtc-ds1742.c | 10 +- drivers/s390/cio/chp.c| 10 +- drivers/scsi/arcmsr/arcmsr_attr.c | 15 +-- drivers/scsi/ipr.c| 18 ++- drivers/scsi/libsas/sas_expander.c| 16 ++- drivers/scsi/lpfc/lpfc_attr.c | 12 +- drivers/scsi/qla2xxx/qla_attr.c | 50 ++ drivers/spi/at25.c|6 - drivers/video/aty/radeon_base.c |8 + drivers/w1/slaves/w1_ds2433.c | 10 +- drivers/w1/slaves/w1_therm.c |7 + drivers/w1/w1.c | 12 +- drivers/zorro/zorro-sysfs.c |5 - fs/sysfs/bin.c|4 include/linux/sysfs.h |6 - net/bridge/br_sysfs_br.c |5 - 27 files changed, 185 insertions(+), 106 deletions(-) Index: linux-2.6.22-rc4/Documentation/firmware_class/firmware_sample_firmware_class.c === --- linux-2.6.22-rc4.orig/Documentation/firmware_class/firmware_sample_firmware_class.c 2004-01-03 06:33:28.0 +0800 +++ linux-2.6.22-rc4/Documentation/firmware_class/firmware_sample_firmware_class.c 2007-06-08 13:25:33.0 +0800 @@ -78,6 +78,7 @@ static CLASS_DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); static ssize_t firmware_data_read(struct kobject *kobj, + struct bin_attribute *bin_attr, char *buffer, loff_t offset, size_t count) { struct class_device *class_dev = to_class_dev(kobj); @@ -88,6 +89,7 @@ static ssize_t firmware_data_read(struct return count; } static ssize_t firmware_data_write(struct kobject *kobj, + struct bin_attribute *bin_attr, char *buffer, loff_t offset, size_t count) { struct class_device *class_dev = to_class_dev(kobj); Index: linux-2.6.22-rc4/drivers/base/firmware_class.c === --- linux-2.6.22-rc4.orig/drivers/base/firmware_class.c 2004-01-03 06:33:28.0 +0800 +++ linux-2.6.22-rc4/drivers/base/firmware_class.c 2004-01-03 06:36:47.0 +0800 @@ -175,7 +175,7 @@ static ssize_t firmware_loading_store(st static DEVICE_ATTR(loading, 0
Re: [PATCH]: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
On Fri, Jun 08, 2007 at 04:36:18PM +0800, Zhang Rui wrote: > > This is the refreshed patch. Thanks. Can you resend with the proper changelog information, like the first version you sent? thanks, greg k-h - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH]: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
From: Zhang Rui <[EMAIL PROTECTED]> > > > > Well, first of all, I don't want to change so many files either. > > > > What I do: > > Adding a new parameter "struct bin_attribute *" in the > > .read/.write methods for the sysfs binary attributes. > > > > In fact, only the four lines change in fs/sysfs/bin.c and > > include/linux/sysfs.h do the real work. > > But I have to update all the files that use binary attributes > > to make them compatible with the new .read and .write methods. > > I'm not sure if I missed any. :( > > > > Why I do this: > > For a sysfs attribute, we can get a pointer pointing to the > > struct attribute in the .show/.store method, > > while we can't do this for the binary attributes. > > I don't know why this is different, but this does make it not > > so handy to use the binary attributes as the regular ones. > > So I think this patch is reasonable. :) > > > > Who benefits from it: > > The patch that exposes ACPI tables in sysfs > > requires such an improvement. > > All the table binary attributes share the same .read method. > > Parameter "struct bin_attribute *" is used to get > > the table signature and instance number which are used to > > distinguish different ACPI table binary attributes. > > > > Without this parameter, we need to offer different .read methods > > for different ACPI table binary attributes. > > This is impossible as there are various ACPI tables on different > > platforms, and we don't know what they are until they are loaded. > > I have no objection to this patch but it failes the checkpatch.pl script > pretty badly with too long of lines. Care to fix it up and resend it? > > thanks, > > greg k-h This is the refreshed patch. Thanks. Signed-off-by: Zhang Rui <[EMAIL PROTECTED]> --- Documentation/firmware_class/firmware_sample_firmware_class.c |2 drivers/base/firmware_class.c |4 drivers/firmware/dcdbas.c | 10 +- drivers/firmware/dell_rbu.c | 25 +++-- drivers/i2c/chips/eeprom.c|3 drivers/i2c/chips/max6875.c |5 - drivers/pci/hotplug/acpiphp_ibm.c |6 - drivers/pci/pci-sysfs.c | 18 ++- drivers/pcmcia/socket_sysfs.c |8 + drivers/rapidio/rio-sysfs.c |6 - drivers/rtc/rtc-ds1553.c | 10 +- drivers/rtc/rtc-ds1742.c | 10 +- drivers/s390/cio/chp.c| 10 +- drivers/scsi/arcmsr/arcmsr_attr.c | 15 +-- drivers/scsi/ipr.c| 18 ++- drivers/scsi/libsas/sas_expander.c| 16 ++- drivers/scsi/lpfc/lpfc_attr.c | 12 +- drivers/scsi/qla2xxx/qla_attr.c | 50 ++ drivers/spi/at25.c|6 - drivers/video/aty/radeon_base.c |8 + drivers/w1/slaves/w1_ds2433.c | 10 +- drivers/w1/slaves/w1_therm.c |7 + drivers/w1/w1.c | 12 +- drivers/zorro/zorro-sysfs.c |5 - fs/sysfs/bin.c|4 include/linux/sysfs.h |6 - net/bridge/br_sysfs_br.c |5 - 27 files changed, 185 insertions(+), 106 deletions(-) Index: linux-2.6.22-rc4/Documentation/firmware_class/firmware_sample_firmware_class.c === --- linux-2.6.22-rc4.orig/Documentation/firmware_class/firmware_sample_firmware_class.c 2004-01-03 06:33:28.0 +0800 +++ linux-2.6.22-rc4/Documentation/firmware_class/firmware_sample_firmware_class.c 2007-06-08 13:25:33.0 +0800 @@ -78,6 +78,7 @@ static CLASS_DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); static ssize_t firmware_data_read(struct kobject *kobj, + struct bin_attribute *bin_attr, char *buffer, loff_t offset, size_t count) { struct class_device *class_dev = to_class_dev(kobj); @@ -88,6 +89,7 @@ static ssize_t firmware_data_read(struct return count; } static ssize_t firmware_data_write(struct kobject *kobj, + struct bin_attribute *bin_attr, char *buffer, loff_t offset, size_t count) { struct class_device *class_dev = to_class_dev(kobj); Index: linux-2.6.22-rc4/drivers/base/firmware_class
Re: [PATCH]: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
From: Zhang Rui <[EMAIL PROTECTED]> > > Well, first of all, I don't want to change so many files either. > > > > What I do: > > Adding a new parameter "struct bin_attribute *" in the > > .read/.write methods for the sysfs binary attributes. > > > > In fact, only the four lines change in fs/sysfs/bin.c and > > include/linux/sysfs.h do the real work. > > But I have to update all the files that use binary attributes > > to make them compatible with the new .read and .write methods. > > I'm not sure if I missed any. :( > > > > Why I do this: > > For a sysfs attribute, we can get a pointer pointing to the > > struct attribute in the .show/.store method, > > while we can't do this for the binary attributes. > > I don't know why this is different, but this does make it not > > so handy to use the binary attributes as the regular ones. > > So I think this patch is reasonable. :) > > > > Who benefits from it: > > The patch that exposes ACPI tables in sysfs > > requires such an improvement. > > All the table binary attributes share the same .read method. > > Parameter "struct bin_attribute *" is used to get > > the table signature and instance number which are used to > > distinguish different ACPI table binary attributes. > > > > Without this parameter, we need to offer different .read methods > > for different ACPI table binary attributes. > > This is impossible as there are various ACPI tables on different > > platforms, and we don't know what they are until they are loaded. > > I have no objection to this patch but it failes the checkpatch.pl script > pretty badly with too long of lines. Care to fix it up and resend it? > > thanks, > > greg k-h This is the refreshed version. Thanks. Signed-off-by: Zhang Rui <[EMAIL PROTECTED]> --- Documentation/firmware_class/firmware_sample_firmware_class.c |2 drivers/base/firmware_class.c |4 drivers/firmware/dcdbas.c | 10 +- drivers/firmware/dell_rbu.c | 25 +++-- drivers/i2c/chips/eeprom.c|3 drivers/i2c/chips/max6875.c |5 - drivers/pci/hotplug/acpiphp_ibm.c |6 - drivers/pci/pci-sysfs.c | 18 ++- drivers/pcmcia/socket_sysfs.c |8 + drivers/rapidio/rio-sysfs.c |6 - drivers/rtc/rtc-ds1553.c | 10 +- drivers/rtc/rtc-ds1742.c | 10 +- drivers/s390/cio/chp.c| 10 +- drivers/scsi/arcmsr/arcmsr_attr.c | 15 +-- drivers/scsi/ipr.c| 18 ++- drivers/scsi/libsas/sas_expander.c| 16 ++- drivers/scsi/lpfc/lpfc_attr.c | 12 +- drivers/scsi/qla2xxx/qla_attr.c | 50 ++ drivers/spi/at25.c|6 - drivers/video/aty/radeon_base.c |8 + drivers/w1/slaves/w1_ds2433.c | 10 +- drivers/w1/slaves/w1_therm.c |7 + drivers/w1/w1.c | 12 +- drivers/zorro/zorro-sysfs.c |5 - fs/sysfs/bin.c|4 include/linux/sysfs.h |6 - net/bridge/br_sysfs_br.c |5 - 27 files changed, 185 insertions(+), 106 deletions(-) Index: linux-2.6.22-rc4/Documentation/firmware_class/firmware_sample_firmware_class.c === --- linux-2.6.22-rc4.orig/Documentation/firmware_class/firmware_sample_firmware_class.c 2004-01-03 06:33:28.0 +0800 +++ linux-2.6.22-rc4/Documentation/firmware_class/firmware_sample_firmware_class.c 2007-06-08 13:25:33.0 +0800 @@ -78,6 +78,7 @@ static CLASS_DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); static ssize_t firmware_data_read(struct kobject *kobj, + struct bin_attribute *bin_attr, char *buffer, loff_t offset, size_t count) { struct class_device *class_dev = to_class_dev(kobj); @@ -88,6 +89,7 @@ static ssize_t firmware_data_read(struct return count; } static ssize_t firmware_data_write(struct kobject *kobj, + struct bin_attribute *bin_attr, char *buffer, loff_t offset, size_t count) { struct class_device *class_dev = to_class_dev(kobj); Index: linux-2.6.22-rc4/drivers/base/firmware_class.c
Re: [PATCH]: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
On Thu, Jun 07, 2007 at 05:31:35PM +0800, Zhang Rui wrote: > From: Zhang Rui <[EMAIL PROTECTED]> > > Well, first of all, I don't want to change so many files either. > > What I do: > Adding a new parameter "struct bin_attribute *" in the > .read/.write methods for the sysfs binary attributes. > > In fact, only the four lines change in fs/sysfs/bin.c and > include/linux/sysfs.h do the real work. > But I have to update all the files that use binary attributes > to make them compatible with the new .read and .write methods. > I'm not sure if I missed any. :( > > Why I do this: > For a sysfs attribute, we can get a pointer pointing to the > struct attribute in the .show/.store method, > while we can't do this for the binary attributes. > I don't know why this is different, but this does make it not > so handy to use the binary attributes as the regular ones. > So I think this patch is reasonable. :) > > Who benefits from it: > The patch that exposes ACPI tables in sysfs > requires such an improvement. > All the table binary attributes share the same .read method. > Parameter "struct bin_attribute *" is used to get > the table signature and instance number which are used to > distinguish different ACPI table binary attributes. > > Without this parameter, we need to offer different .read methods > for different ACPI table binary attributes. > This is impossible as there are various ACPI tables on different > platforms, and we don't know what they are until they are loaded. I have no objection to this patch but it failes the checkpatch.pl script pretty badly with too long of lines. Care to fix it up and resend it? thanks, greg k-h - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH]: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
From: Zhang Rui <[EMAIL PROTECTED]> Well, first of all, I don't want to change so many files either. What I do: Adding a new parameter "struct bin_attribute *" in the .read/.write methods for the sysfs binary attributes. In fact, only the four lines change in fs/sysfs/bin.c and include/linux/sysfs.h do the real work. But I have to update all the files that use binary attributes to make them compatible with the new .read and .write methods. I'm not sure if I missed any. :( Why I do this: For a sysfs attribute, we can get a pointer pointing to the struct attribute in the .show/.store method, while we can't do this for the binary attributes. I don't know why this is different, but this does make it not so handy to use the binary attributes as the regular ones. So I think this patch is reasonable. :) Who benefits from it: The patch that exposes ACPI tables in sysfs requires such an improvement. All the table binary attributes share the same .read method. Parameter "struct bin_attribute *" is used to get the table signature and instance number which are used to distinguish different ACPI table binary attributes. Without this parameter, we need to offer different .read methods for different ACPI table binary attributes. This is impossible as there are various ACPI tables on different platforms, and we don't know what they are until they are loaded. Signed-off-by: Zhang Rui <[EMAIL PROTECTED]> --- Documentation/firmware_class/firmware_sample_firmware_class.c |4 - drivers/base/firmware_class.c |4 - drivers/firmware/dcdbas.c |8 +- drivers/firmware/dell_rbu.c | 20 ++--- drivers/i2c/chips/eeprom.c|3 drivers/i2c/chips/max6875.c |4 - drivers/pci/hotplug/acpiphp_ibm.c |6 - drivers/pci/pci-sysfs.c | 18 +++- drivers/pcmcia/socket_sysfs.c |6 + drivers/rapidio/rio-sysfs.c |6 + drivers/rtc/rtc-ds1553.c |8 +- drivers/rtc/rtc-ds1742.c |8 +- drivers/s390/cio/chp.c| 10 +- drivers/scsi/arcmsr/arcmsr_attr.c | 12 +-- drivers/scsi/ipr.c| 15 ++- drivers/scsi/libsas/sas_expander.c| 14 ++- drivers/scsi/lpfc/lpfc_attr.c | 12 ++- drivers/scsi/qla2xxx/qla_attr.c | 40 +- drivers/spi/at25.c|6 + drivers/video/aty/radeon_base.c |6 + drivers/w1/slaves/w1_ds2433.c |8 +- drivers/w1/slaves/w1_therm.c |5 - drivers/w1/w1.c |9 +- drivers/zorro/zorro-sysfs.c |4 - fs/sysfs/bin.c|4 - include/linux/sysfs.h |4 - net/bridge/br_sysfs_br.c |4 - 27 files changed, 139 insertions(+), 109 deletions(-) Index: linux-2.6.22-rc4/Documentation/firmware_class/firmware_sample_firmware_class.c === --- linux-2.6.22-rc4.orig/Documentation/firmware_class/firmware_sample_firmware_class.c 2007-06-06 09:15:56.0 +0800 +++ linux-2.6.22-rc4/Documentation/firmware_class/firmware_sample_firmware_class.c 2004-01-03 08:55:27.0 +0800 @@ -77,7 +77,7 @@ static ssize_t firmware_loading_store(st static CLASS_DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); -static ssize_t firmware_data_read(struct kobject *kobj, +static ssize_t firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr, char *buffer, loff_t offset, size_t count) { struct class_device *class_dev = to_class_dev(kobj); @@ -87,7 +87,7 @@ static ssize_t firmware_data_read(struct return count; } -static ssize_t firmware_data_write(struct kobject *kobj, +static ssize_t firmware_data_write(struct kobject *kobj, struct bin_attribute *bin_attr, char *buffer, loff_t offset, size_t count) { struct class_device *class_dev = to_class_dev(kobj); Index: linux-2.6.22-rc4/drivers/base/firmware_class.c === --- linux-2.6.22-rc4.orig/drivers/base/firmware_class.c 2007-06-06 10:18:57.0 +0800 +++ linux-2.6.22-rc4/drivers/base/firmware_class.c 2004-01-03 08:55:27.0