diff options
author | Zhang Rui <rui.zhang@intel.com> | 2007-06-09 01:57:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-11 19:09:09 -0400 |
commit | 91a6902958f052358899f58683d44e36228d85c2 (patch) | |
tree | a713792cf3bb09bdbd2ac6906aa44b3da3e49250 | |
parent | 51225039f3cf9d250596d1344494b293274b9169 (diff) |
sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
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 <rui.zhang@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
27 files changed, 185 insertions, 106 deletions
diff --git a/Documentation/firmware_class/firmware_sample_firmware_class.c b/Documentation/firmware_class/firmware_sample_firmware_class.c index 4994f1f28f8c..fba943aacf93 100644 --- a/Documentation/firmware_class/firmware_sample_firmware_class.c +++ b/Documentation/firmware_class/firmware_sample_firmware_class.c | |||
@@ -78,6 +78,7 @@ static CLASS_DEVICE_ATTR(loading, 0644, | |||
78 | firmware_loading_show, firmware_loading_store); | 78 | firmware_loading_show, firmware_loading_store); |
79 | 79 | ||
80 | static ssize_t firmware_data_read(struct kobject *kobj, | 80 | static ssize_t firmware_data_read(struct kobject *kobj, |
81 | struct bin_attribute *bin_attr, | ||
81 | char *buffer, loff_t offset, size_t count) | 82 | char *buffer, loff_t offset, size_t count) |
82 | { | 83 | { |
83 | struct class_device *class_dev = to_class_dev(kobj); | 84 | struct class_device *class_dev = to_class_dev(kobj); |
@@ -88,6 +89,7 @@ static ssize_t firmware_data_read(struct kobject *kobj, | |||
88 | return count; | 89 | return count; |
89 | } | 90 | } |
90 | static ssize_t firmware_data_write(struct kobject *kobj, | 91 | static ssize_t firmware_data_write(struct kobject *kobj, |
92 | struct bin_attribute *bin_attr, | ||
91 | char *buffer, loff_t offset, size_t count) | 93 | char *buffer, loff_t offset, size_t count) |
92 | { | 94 | { |
93 | struct class_device *class_dev = to_class_dev(kobj); | 95 | struct class_device *class_dev = to_class_dev(kobj); |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 0e511485d2e6..53f0ee6f3016 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -175,7 +175,7 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
175 | static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); | 175 | static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); |
176 | 176 | ||
177 | static ssize_t | 177 | static ssize_t |
178 | firmware_data_read(struct kobject *kobj, | 178 | firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
179 | char *buffer, loff_t offset, size_t count) | 179 | char *buffer, loff_t offset, size_t count) |
180 | { | 180 | { |
181 | struct device *dev = to_dev(kobj); | 181 | struct device *dev = to_dev(kobj); |
@@ -240,7 +240,7 @@ fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size) | |||
240 | * the driver as a firmware image. | 240 | * the driver as a firmware image. |
241 | **/ | 241 | **/ |
242 | static ssize_t | 242 | static ssize_t |
243 | firmware_data_write(struct kobject *kobj, | 243 | firmware_data_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
244 | char *buffer, loff_t offset, size_t count) | 244 | char *buffer, loff_t offset, size_t count) |
245 | { | 245 | { |
246 | struct device *dev = to_dev(kobj); | 246 | struct device *dev = to_dev(kobj); |
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c index 1865b56fb141..18cdcb3ae1ca 100644 --- a/drivers/firmware/dcdbas.c +++ b/drivers/firmware/dcdbas.c | |||
@@ -149,8 +149,9 @@ static ssize_t smi_data_buf_size_store(struct device *dev, | |||
149 | return count; | 149 | return count; |
150 | } | 150 | } |
151 | 151 | ||
152 | static ssize_t smi_data_read(struct kobject *kobj, char *buf, loff_t pos, | 152 | static ssize_t smi_data_read(struct kobject *kobj, |
153 | size_t count) | 153 | struct bin_attribute *bin_attr, |
154 | char *buf, loff_t pos, size_t count) | ||
154 | { | 155 | { |
155 | size_t max_read; | 156 | size_t max_read; |
156 | ssize_t ret; | 157 | ssize_t ret; |
@@ -170,8 +171,9 @@ out: | |||
170 | return ret; | 171 | return ret; |
171 | } | 172 | } |
172 | 173 | ||
173 | static ssize_t smi_data_write(struct kobject *kobj, char *buf, loff_t pos, | 174 | static ssize_t smi_data_write(struct kobject *kobj, |
174 | size_t count) | 175 | struct bin_attribute *bin_attr, |
176 | char *buf, loff_t pos, size_t count) | ||
175 | { | 177 | { |
176 | ssize_t ret; | 178 | ssize_t ret; |
177 | 179 | ||
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c index f8afecb7d0cf..477a3d0e3caf 100644 --- a/drivers/firmware/dell_rbu.c +++ b/drivers/firmware/dell_rbu.c | |||
@@ -543,8 +543,9 @@ static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count) | |||
543 | return ret_count; | 543 | return ret_count; |
544 | } | 544 | } |
545 | 545 | ||
546 | static ssize_t read_rbu_data(struct kobject *kobj, char *buffer, | 546 | static ssize_t read_rbu_data(struct kobject *kobj, |
547 | loff_t pos, size_t count) | 547 | struct bin_attribute *bin_attr, |
548 | char *buffer, loff_t pos, size_t count) | ||
548 | { | 549 | { |
549 | ssize_t ret_count = 0; | 550 | ssize_t ret_count = 0; |
550 | 551 | ||
@@ -591,8 +592,9 @@ static void callbackfn_rbu(const struct firmware *fw, void *context) | |||
591 | spin_unlock(&rbu_data.lock); | 592 | spin_unlock(&rbu_data.lock); |
592 | } | 593 | } |
593 | 594 | ||
594 | static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, | 595 | static ssize_t read_rbu_image_type(struct kobject *kobj, |
595 | loff_t pos, size_t count) | 596 | struct bin_attribute *bin_attr, |
597 | char *buffer, loff_t pos, size_t count) | ||
596 | { | 598 | { |
597 | int size = 0; | 599 | int size = 0; |
598 | if (!pos) | 600 | if (!pos) |
@@ -600,8 +602,9 @@ static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, | |||
600 | return size; | 602 | return size; |
601 | } | 603 | } |
602 | 604 | ||
603 | static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, | 605 | static ssize_t write_rbu_image_type(struct kobject *kobj, |
604 | loff_t pos, size_t count) | 606 | struct bin_attribute *bin_attr, |
607 | char *buffer, loff_t pos, size_t count) | ||
605 | { | 608 | { |
606 | int rc = count; | 609 | int rc = count; |
607 | int req_firm_rc = 0; | 610 | int req_firm_rc = 0; |
@@ -660,8 +663,9 @@ static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, | |||
660 | return rc; | 663 | return rc; |
661 | } | 664 | } |
662 | 665 | ||
663 | static ssize_t read_rbu_packet_size(struct kobject *kobj, char *buffer, | 666 | static ssize_t read_rbu_packet_size(struct kobject *kobj, |
664 | loff_t pos, size_t count) | 667 | struct bin_attribute *bin_attr, |
668 | char *buffer, loff_t pos, size_t count) | ||
665 | { | 669 | { |
666 | int size = 0; | 670 | int size = 0; |
667 | if (!pos) { | 671 | if (!pos) { |
@@ -672,8 +676,9 @@ static ssize_t read_rbu_packet_size(struct kobject *kobj, char *buffer, | |||
672 | return size; | 676 | return size; |
673 | } | 677 | } |
674 | 678 | ||
675 | static ssize_t write_rbu_packet_size(struct kobject *kobj, char *buffer, | 679 | static ssize_t write_rbu_packet_size(struct kobject *kobj, |
676 | loff_t pos, size_t count) | 680 | struct bin_attribute *bin_attr, |
681 | char *buffer, loff_t pos, size_t count) | ||
677 | { | 682 | { |
678 | unsigned long temp; | 683 | unsigned long temp; |
679 | spin_lock(&rbu_data.lock); | 684 | spin_lock(&rbu_data.lock); |
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index 5990dd5fc773..332816431105 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c | |||
@@ -110,7 +110,8 @@ exit: | |||
110 | mutex_unlock(&data->update_lock); | 110 | mutex_unlock(&data->update_lock); |
111 | } | 111 | } |
112 | 112 | ||
113 | static ssize_t eeprom_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 113 | static ssize_t eeprom_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
114 | char *buf, loff_t off, size_t count) | ||
114 | { | 115 | { |
115 | struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); | 116 | struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); |
116 | struct eeprom_data *data = i2c_get_clientdata(client); | 117 | struct eeprom_data *data = i2c_get_clientdata(client); |
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index 1405ce5b236c..4e238c0a7ca3 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c | |||
@@ -125,8 +125,9 @@ exit_up: | |||
125 | mutex_unlock(&data->update_lock); | 125 | mutex_unlock(&data->update_lock); |
126 | } | 126 | } |
127 | 127 | ||
128 | static ssize_t max6875_read(struct kobject *kobj, char *buf, loff_t off, | 128 | static ssize_t max6875_read(struct kobject *kobj, |
129 | size_t count) | 129 | struct bin_attribute *bin_attr, |
130 | char *buf, loff_t off, size_t count) | ||
130 | { | 131 | { |
131 | struct i2c_client *client = kobj_to_i2c_client(kobj); | 132 | struct i2c_client *client = kobj_to_i2c_client(kobj); |
132 | struct max6875_data *data = i2c_get_clientdata(client); | 133 | struct max6875_data *data = i2c_get_clientdata(client); |
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index 74556ec31a5b..70db38c0ced9 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -106,7 +106,8 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status); | |||
106 | static void ibm_handle_events(acpi_handle handle, u32 event, void *context); | 106 | static void ibm_handle_events(acpi_handle handle, u32 event, void *context); |
107 | static int ibm_get_table_from_acpi(char **bufp); | 107 | static int ibm_get_table_from_acpi(char **bufp); |
108 | static ssize_t ibm_read_apci_table(struct kobject *kobj, | 108 | static ssize_t ibm_read_apci_table(struct kobject *kobj, |
109 | char *buffer, loff_t pos, size_t size); | 109 | struct bin_attribute *bin_attr, |
110 | char *buffer, loff_t pos, size_t size); | ||
110 | static acpi_status __init ibm_find_acpi_device(acpi_handle handle, | 111 | static acpi_status __init ibm_find_acpi_device(acpi_handle handle, |
111 | u32 lvl, void *context, void **rv); | 112 | u32 lvl, void *context, void **rv); |
112 | static int __init ibm_acpiphp_init(void); | 113 | static int __init ibm_acpiphp_init(void); |
@@ -357,7 +358,8 @@ read_table_done: | |||
357 | * our solution is to only allow reading the table in all at once | 358 | * our solution is to only allow reading the table in all at once |
358 | **/ | 359 | **/ |
359 | static ssize_t ibm_read_apci_table(struct kobject *kobj, | 360 | static ssize_t ibm_read_apci_table(struct kobject *kobj, |
360 | char *buffer, loff_t pos, size_t size) | 361 | struct bin_attribute *bin_attr, |
362 | char *buffer, loff_t pos, size_t size) | ||
361 | { | 363 | { |
362 | int bytes_read = -EINVAL; | 364 | int bytes_read = -EINVAL; |
363 | char *table = NULL; | 365 | char *table = NULL; |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index d448f8df8613..6543cbe83be5 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -213,7 +213,8 @@ struct device_attribute pci_dev_attrs[] = { | |||
213 | }; | 213 | }; |
214 | 214 | ||
215 | static ssize_t | 215 | static ssize_t |
216 | pci_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | 216 | pci_read_config(struct kobject *kobj, struct bin_attribute *bin_attr, |
217 | char *buf, loff_t off, size_t count) | ||
217 | { | 218 | { |
218 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); | 219 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); |
219 | unsigned int size = 64; | 220 | unsigned int size = 64; |
@@ -285,7 +286,8 @@ pci_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
285 | } | 286 | } |
286 | 287 | ||
287 | static ssize_t | 288 | static ssize_t |
288 | pci_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | 289 | pci_write_config(struct kobject *kobj, struct bin_attribute *bin_attr, |
290 | char *buf, loff_t off, size_t count) | ||
289 | { | 291 | { |
290 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); | 292 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); |
291 | unsigned int size = count; | 293 | unsigned int size = count; |
@@ -352,7 +354,8 @@ pci_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
352 | * callback routine (pci_legacy_read). | 354 | * callback routine (pci_legacy_read). |
353 | */ | 355 | */ |
354 | ssize_t | 356 | ssize_t |
355 | pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off, size_t count) | 357 | pci_read_legacy_io(struct kobject *kobj, struct bin_attribute *bin_attr, |
358 | char *buf, loff_t off, size_t count) | ||
356 | { | 359 | { |
357 | struct pci_bus *bus = to_pci_bus(container_of(kobj, | 360 | struct pci_bus *bus = to_pci_bus(container_of(kobj, |
358 | struct class_device, | 361 | struct class_device, |
@@ -376,7 +379,8 @@ pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
376 | * callback routine (pci_legacy_write). | 379 | * callback routine (pci_legacy_write). |
377 | */ | 380 | */ |
378 | ssize_t | 381 | ssize_t |
379 | pci_write_legacy_io(struct kobject *kobj, char *buf, loff_t off, size_t count) | 382 | pci_write_legacy_io(struct kobject *kobj, struct bin_attribute *bin_attr, |
383 | char *buf, loff_t off, size_t count) | ||
380 | { | 384 | { |
381 | struct pci_bus *bus = to_pci_bus(container_of(kobj, | 385 | struct pci_bus *bus = to_pci_bus(container_of(kobj, |
382 | struct class_device, | 386 | struct class_device, |
@@ -528,7 +532,8 @@ static inline void pci_remove_resource_files(struct pci_dev *dev) { return; } | |||
528 | * writing anything except 0 enables it | 532 | * writing anything except 0 enables it |
529 | */ | 533 | */ |
530 | static ssize_t | 534 | static ssize_t |
531 | pci_write_rom(struct kobject *kobj, char *buf, loff_t off, size_t count) | 535 | pci_write_rom(struct kobject *kobj, struct bin_attribute *bin_attr, |
536 | char *buf, loff_t off, size_t count) | ||
532 | { | 537 | { |
533 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); | 538 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); |
534 | 539 | ||
@@ -551,7 +556,8 @@ pci_write_rom(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
551 | * device corresponding to @kobj. | 556 | * device corresponding to @kobj. |
552 | */ | 557 | */ |
553 | static ssize_t | 558 | static ssize_t |
554 | pci_read_rom(struct kobject *kobj, char *buf, loff_t off, size_t count) | 559 | pci_read_rom(struct kobject *kobj, struct bin_attribute *bin_attr, |
560 | char *buf, loff_t off, size_t count) | ||
555 | { | 561 | { |
556 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); | 562 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); |
557 | void __iomem *rom; | 563 | void __iomem *rom; |
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index dbfbe65779e5..b4409002b7f8 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -283,7 +283,9 @@ static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, loff_t off | |||
283 | return (ret); | 283 | return (ret); |
284 | } | 284 | } |
285 | 285 | ||
286 | static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) | 286 | static ssize_t pccard_show_cis(struct kobject *kobj, |
287 | struct bin_attribute *bin_attr, | ||
288 | char *buf, loff_t off, size_t count) | ||
287 | { | 289 | { |
288 | unsigned int size = 0x200; | 290 | unsigned int size = 0x200; |
289 | 291 | ||
@@ -311,7 +313,9 @@ static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size | |||
311 | return (count); | 313 | return (count); |
312 | } | 314 | } |
313 | 315 | ||
314 | static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) | 316 | static ssize_t pccard_store_cis(struct kobject *kobj, |
317 | struct bin_attribute *bin_attr, | ||
318 | char *buf, loff_t off, size_t count) | ||
315 | { | 319 | { |
316 | struct pcmcia_socket *s = to_socket(container_of(kobj, struct device, kobj)); | 320 | struct pcmcia_socket *s = to_socket(container_of(kobj, struct device, kobj)); |
317 | cisdump_t *cis; | 321 | cisdump_t *cis; |
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c index a3972b9f96e6..659e31164cf0 100644 --- a/drivers/rapidio/rio-sysfs.c +++ b/drivers/rapidio/rio-sysfs.c | |||
@@ -67,7 +67,8 @@ struct device_attribute rio_dev_attrs[] = { | |||
67 | }; | 67 | }; |
68 | 68 | ||
69 | static ssize_t | 69 | static ssize_t |
70 | rio_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | 70 | rio_read_config(struct kobject *kobj, struct bin_attribute *bin_attr, |
71 | char *buf, loff_t off, size_t count) | ||
71 | { | 72 | { |
72 | struct rio_dev *dev = | 73 | struct rio_dev *dev = |
73 | to_rio_dev(container_of(kobj, struct device, kobj)); | 74 | to_rio_dev(container_of(kobj, struct device, kobj)); |
@@ -137,7 +138,8 @@ rio_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
137 | } | 138 | } |
138 | 139 | ||
139 | static ssize_t | 140 | static ssize_t |
140 | rio_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | 141 | rio_write_config(struct kobject *kobj, struct bin_attribute *bin_attr, |
142 | char *buf, loff_t off, size_t count) | ||
141 | { | 143 | { |
142 | struct rio_dev *dev = | 144 | struct rio_dev *dev = |
143 | to_rio_dev(container_of(kobj, struct device, kobj)); | 145 | to_rio_dev(container_of(kobj, struct device, kobj)); |
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index b024cfb558f4..f98a83a11aae 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c | |||
@@ -258,8 +258,9 @@ static const struct rtc_class_ops ds1553_rtc_ops = { | |||
258 | .ioctl = ds1553_rtc_ioctl, | 258 | .ioctl = ds1553_rtc_ioctl, |
259 | }; | 259 | }; |
260 | 260 | ||
261 | static ssize_t ds1553_nvram_read(struct kobject *kobj, char *buf, | 261 | static ssize_t ds1553_nvram_read(struct kobject *kobj, |
262 | loff_t pos, size_t size) | 262 | struct bin_attribute *bin_attr, |
263 | char *buf, loff_t pos, size_t size) | ||
263 | { | 264 | { |
264 | struct platform_device *pdev = | 265 | struct platform_device *pdev = |
265 | to_platform_device(container_of(kobj, struct device, kobj)); | 266 | to_platform_device(container_of(kobj, struct device, kobj)); |
@@ -272,8 +273,9 @@ static ssize_t ds1553_nvram_read(struct kobject *kobj, char *buf, | |||
272 | return count; | 273 | return count; |
273 | } | 274 | } |
274 | 275 | ||
275 | static ssize_t ds1553_nvram_write(struct kobject *kobj, char *buf, | 276 | static ssize_t ds1553_nvram_write(struct kobject *kobj, |
276 | loff_t pos, size_t size) | 277 | struct bin_attribute *bin_attr, |
278 | char *buf, loff_t pos, size_t size) | ||
277 | { | 279 | { |
278 | struct platform_device *pdev = | 280 | struct platform_device *pdev = |
279 | to_platform_device(container_of(kobj, struct device, kobj)); | 281 | to_platform_device(container_of(kobj, struct device, kobj)); |
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index 1638acdbc913..d1778ae8bca5 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c | |||
@@ -127,8 +127,9 @@ static const struct rtc_class_ops ds1742_rtc_ops = { | |||
127 | .set_time = ds1742_rtc_set_time, | 127 | .set_time = ds1742_rtc_set_time, |
128 | }; | 128 | }; |
129 | 129 | ||
130 | static ssize_t ds1742_nvram_read(struct kobject *kobj, char *buf, | 130 | static ssize_t ds1742_nvram_read(struct kobject *kobj, |
131 | loff_t pos, size_t size) | 131 | struct bin_attribute *bin_attr, |
132 | char *buf, loff_t pos, size_t size) | ||
132 | { | 133 | { |
133 | struct platform_device *pdev = | 134 | struct platform_device *pdev = |
134 | to_platform_device(container_of(kobj, struct device, kobj)); | 135 | to_platform_device(container_of(kobj, struct device, kobj)); |
@@ -141,8 +142,9 @@ static ssize_t ds1742_nvram_read(struct kobject *kobj, char *buf, | |||
141 | return count; | 142 | return count; |
142 | } | 143 | } |
143 | 144 | ||
144 | static ssize_t ds1742_nvram_write(struct kobject *kobj, char *buf, | 145 | static ssize_t ds1742_nvram_write(struct kobject *kobj, |
145 | loff_t pos, size_t size) | 146 | struct bin_attribute *bin_attr, |
147 | char *buf, loff_t pos, size_t size) | ||
146 | { | 148 | { |
147 | struct platform_device *pdev = | 149 | struct platform_device *pdev = |
148 | to_platform_device(container_of(kobj, struct device, kobj)); | 150 | to_platform_device(container_of(kobj, struct device, kobj)); |
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c index 96a8a72a6083..b57d93d986c0 100644 --- a/drivers/s390/cio/chp.c +++ b/drivers/s390/cio/chp.c | |||
@@ -141,8 +141,9 @@ static int s390_vary_chpid(struct chp_id chpid, int on) | |||
141 | /* | 141 | /* |
142 | * Channel measurement related functions | 142 | * Channel measurement related functions |
143 | */ | 143 | */ |
144 | static ssize_t chp_measurement_chars_read(struct kobject *kobj, char *buf, | 144 | static ssize_t chp_measurement_chars_read(struct kobject *kobj, |
145 | loff_t off, size_t count) | 145 | struct bin_attribute *bin_attr, |
146 | char *buf, loff_t off, size_t count) | ||
146 | { | 147 | { |
147 | struct channel_path *chp; | 148 | struct channel_path *chp; |
148 | unsigned int size; | 149 | unsigned int size; |
@@ -192,8 +193,9 @@ static void chp_measurement_copy_block(struct cmg_entry *buf, | |||
192 | } while (reference_buf.values[0] != buf->values[0]); | 193 | } while (reference_buf.values[0] != buf->values[0]); |
193 | } | 194 | } |
194 | 195 | ||
195 | static ssize_t chp_measurement_read(struct kobject *kobj, char *buf, | 196 | static ssize_t chp_measurement_read(struct kobject *kobj, |
196 | loff_t off, size_t count) | 197 | struct bin_attribute *bin_attr, |
198 | char *buf, loff_t off, size_t count) | ||
197 | { | 199 | { |
198 | struct channel_path *chp; | 200 | struct channel_path *chp; |
199 | struct channel_subsystem *css; | 201 | struct channel_subsystem *css; |
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c index 8908228bc134..06c0dce3b839 100644 --- a/drivers/scsi/arcmsr/arcmsr_attr.c +++ b/drivers/scsi/arcmsr/arcmsr_attr.c | |||
@@ -59,8 +59,9 @@ | |||
59 | struct class_device_attribute *arcmsr_host_attrs[]; | 59 | struct class_device_attribute *arcmsr_host_attrs[]; |
60 | 60 | ||
61 | static ssize_t | 61 | static ssize_t |
62 | arcmsr_sysfs_iop_message_read(struct kobject *kobj, char *buf, loff_t off, | 62 | arcmsr_sysfs_iop_message_read(struct kobject *kobj, |
63 | size_t count) | 63 | struct bin_attribute *bin_attr, |
64 | char *buf, loff_t off, size_t count) | ||
64 | { | 65 | { |
65 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 66 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
66 | struct Scsi_Host *host = class_to_shost(cdev); | 67 | struct Scsi_Host *host = class_to_shost(cdev); |
@@ -105,8 +106,9 @@ arcmsr_sysfs_iop_message_read(struct kobject *kobj, char *buf, loff_t off, | |||
105 | } | 106 | } |
106 | 107 | ||
107 | static ssize_t | 108 | static ssize_t |
108 | arcmsr_sysfs_iop_message_write(struct kobject *kobj, char *buf, loff_t off, | 109 | arcmsr_sysfs_iop_message_write(struct kobject *kobj, |
109 | size_t count) | 110 | struct bin_attribute *bin_attr, |
111 | char *buf, loff_t off, size_t count) | ||
110 | { | 112 | { |
111 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 113 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
112 | struct Scsi_Host *host = class_to_shost(cdev); | 114 | struct Scsi_Host *host = class_to_shost(cdev); |
@@ -152,8 +154,9 @@ arcmsr_sysfs_iop_message_write(struct kobject *kobj, char *buf, loff_t off, | |||
152 | } | 154 | } |
153 | 155 | ||
154 | static ssize_t | 156 | static ssize_t |
155 | arcmsr_sysfs_iop_message_clear(struct kobject *kobj, char *buf, loff_t off, | 157 | arcmsr_sysfs_iop_message_clear(struct kobject *kobj, |
156 | size_t count) | 158 | struct bin_attribute *bin_attr, |
159 | char *buf, loff_t off, size_t count) | ||
157 | { | 160 | { |
158 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 161 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
159 | struct Scsi_Host *host = class_to_shost(cdev); | 162 | struct Scsi_Host *host = class_to_shost(cdev); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index fa6ff295e568..4a3083ea59d5 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -2465,6 +2465,7 @@ restart: | |||
2465 | /** | 2465 | /** |
2466 | * ipr_read_trace - Dump the adapter trace | 2466 | * ipr_read_trace - Dump the adapter trace |
2467 | * @kobj: kobject struct | 2467 | * @kobj: kobject struct |
2468 | * @bin_attr: bin_attribute struct | ||
2468 | * @buf: buffer | 2469 | * @buf: buffer |
2469 | * @off: offset | 2470 | * @off: offset |
2470 | * @count: buffer size | 2471 | * @count: buffer size |
@@ -2472,8 +2473,9 @@ restart: | |||
2472 | * Return value: | 2473 | * Return value: |
2473 | * number of bytes printed to buffer | 2474 | * number of bytes printed to buffer |
2474 | **/ | 2475 | **/ |
2475 | static ssize_t ipr_read_trace(struct kobject *kobj, char *buf, | 2476 | static ssize_t ipr_read_trace(struct kobject *kobj, |
2476 | loff_t off, size_t count) | 2477 | struct bin_attribute *bin_attr, |
2478 | char *buf, loff_t off, size_t count) | ||
2477 | { | 2479 | { |
2478 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 2480 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
2479 | struct Scsi_Host *shost = class_to_shost(cdev); | 2481 | struct Scsi_Host *shost = class_to_shost(cdev); |
@@ -3166,6 +3168,7 @@ static struct class_device_attribute *ipr_ioa_attrs[] = { | |||
3166 | /** | 3168 | /** |
3167 | * ipr_read_dump - Dump the adapter | 3169 | * ipr_read_dump - Dump the adapter |
3168 | * @kobj: kobject struct | 3170 | * @kobj: kobject struct |
3171 | * @bin_attr: bin_attribute struct | ||
3169 | * @buf: buffer | 3172 | * @buf: buffer |
3170 | * @off: offset | 3173 | * @off: offset |
3171 | * @count: buffer size | 3174 | * @count: buffer size |
@@ -3173,8 +3176,9 @@ static struct class_device_attribute *ipr_ioa_attrs[] = { | |||
3173 | * Return value: | 3176 | * Return value: |
3174 | * number of bytes printed to buffer | 3177 | * number of bytes printed to buffer |
3175 | **/ | 3178 | **/ |
3176 | static ssize_t ipr_read_dump(struct kobject *kobj, char *buf, | 3179 | static ssize_t ipr_read_dump(struct kobject *kobj, |
3177 | loff_t off, size_t count) | 3180 | struct bin_attribute *bin_attr, |
3181 | char *buf, loff_t off, size_t count) | ||
3178 | { | 3182 | { |
3179 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 3183 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
3180 | struct Scsi_Host *shost = class_to_shost(cdev); | 3184 | struct Scsi_Host *shost = class_to_shost(cdev); |
@@ -3327,6 +3331,7 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) | |||
3327 | /** | 3331 | /** |
3328 | * ipr_write_dump - Setup dump state of adapter | 3332 | * ipr_write_dump - Setup dump state of adapter |
3329 | * @kobj: kobject struct | 3333 | * @kobj: kobject struct |
3334 | * @bin_attr: bin_attribute struct | ||
3330 | * @buf: buffer | 3335 | * @buf: buffer |
3331 | * @off: offset | 3336 | * @off: offset |
3332 | * @count: buffer size | 3337 | * @count: buffer size |
@@ -3334,8 +3339,9 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) | |||
3334 | * Return value: | 3339 | * Return value: |
3335 | * number of bytes printed to buffer | 3340 | * number of bytes printed to buffer |
3336 | **/ | 3341 | **/ |
3337 | static ssize_t ipr_write_dump(struct kobject *kobj, char *buf, | 3342 | static ssize_t ipr_write_dump(struct kobject *kobj, |
3338 | loff_t off, size_t count) | 3343 | struct bin_attribute *bin_attr, |
3344 | char *buf, loff_t off, size_t count) | ||
3339 | { | 3345 | { |
3340 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 3346 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
3341 | struct Scsi_Host *shost = class_to_shost(cdev); | 3347 | struct Scsi_Host *shost = class_to_shost(cdev); |
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 578ed79f4148..23e90c5f8f35 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -38,8 +38,10 @@ static int sas_disable_routing(struct domain_device *dev, u8 *sas_addr); | |||
38 | 38 | ||
39 | #if 0 | 39 | #if 0 |
40 | /* FIXME: smp needs to migrate into the sas class */ | 40 | /* FIXME: smp needs to migrate into the sas class */ |
41 | static ssize_t smp_portal_read(struct kobject *, char *, loff_t, size_t); | 41 | static ssize_t smp_portal_read(struct kobject *, struct bin_attribute *, |
42 | static ssize_t smp_portal_write(struct kobject *, char *, loff_t, size_t); | 42 | char *, loff_t, size_t); |
43 | static ssize_t smp_portal_write(struct kobject *, struct bin_attribute *, | ||
44 | char *, loff_t, size_t); | ||
43 | #endif | 45 | #endif |
44 | 46 | ||
45 | /* ---------- SMP task management ---------- */ | 47 | /* ---------- SMP task management ---------- */ |
@@ -1845,8 +1847,9 @@ out: | |||
1845 | #if 0 | 1847 | #if 0 |
1846 | /* ---------- SMP portal ---------- */ | 1848 | /* ---------- SMP portal ---------- */ |
1847 | 1849 | ||
1848 | static ssize_t smp_portal_write(struct kobject *kobj, char *buf, loff_t offs, | 1850 | static ssize_t smp_portal_write(struct kobject *kobj, |
1849 | size_t size) | 1851 | struct bin_attribute *bin_attr, |
1852 | char *buf, loff_t offs, size_t size) | ||
1850 | { | 1853 | { |
1851 | struct domain_device *dev = to_dom_device(kobj); | 1854 | struct domain_device *dev = to_dom_device(kobj); |
1852 | struct expander_device *ex = &dev->ex_dev; | 1855 | struct expander_device *ex = &dev->ex_dev; |
@@ -1872,8 +1875,9 @@ static ssize_t smp_portal_write(struct kobject *kobj, char *buf, loff_t offs, | |||
1872 | return size; | 1875 | return size; |
1873 | } | 1876 | } |
1874 | 1877 | ||
1875 | static ssize_t smp_portal_read(struct kobject *kobj, char *buf, loff_t offs, | 1878 | static ssize_t smp_portal_read(struct kobject *kobj, |
1876 | size_t size) | 1879 | struct bin_attribute *bin_attr, |
1880 | char *buf, loff_t offs, size_t size) | ||
1877 | { | 1881 | { |
1878 | struct domain_device *dev = to_dom_device(kobj); | 1882 | struct domain_device *dev = to_dom_device(kobj); |
1879 | struct expander_device *ex = &dev->ex_dev; | 1883 | struct expander_device *ex = &dev->ex_dev; |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index f81fe501a4a1..5dfda9778c80 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -1133,7 +1133,8 @@ struct class_device_attribute *lpfc_host_attrs[] = { | |||
1133 | }; | 1133 | }; |
1134 | 1134 | ||
1135 | static ssize_t | 1135 | static ssize_t |
1136 | sysfs_ctlreg_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | 1136 | sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
1137 | char *buf, loff_t off, size_t count) | ||
1137 | { | 1138 | { |
1138 | size_t buf_off; | 1139 | size_t buf_off; |
1139 | struct Scsi_Host *host = class_to_shost(container_of(kobj, | 1140 | struct Scsi_Host *host = class_to_shost(container_of(kobj, |
@@ -1165,7 +1166,8 @@ sysfs_ctlreg_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1165 | } | 1166 | } |
1166 | 1167 | ||
1167 | static ssize_t | 1168 | static ssize_t |
1168 | sysfs_ctlreg_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 1169 | sysfs_ctlreg_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
1170 | char *buf, loff_t off, size_t count) | ||
1169 | { | 1171 | { |
1170 | size_t buf_off; | 1172 | size_t buf_off; |
1171 | uint32_t * tmp_ptr; | 1173 | uint32_t * tmp_ptr; |
@@ -1221,7 +1223,8 @@ sysfs_mbox_idle (struct lpfc_hba * phba) | |||
1221 | } | 1223 | } |
1222 | 1224 | ||
1223 | static ssize_t | 1225 | static ssize_t |
1224 | sysfs_mbox_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | 1226 | sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
1227 | char *buf, loff_t off, size_t count) | ||
1225 | { | 1228 | { |
1226 | struct Scsi_Host * host = | 1229 | struct Scsi_Host * host = |
1227 | class_to_shost(container_of(kobj, struct class_device, kobj)); | 1230 | class_to_shost(container_of(kobj, struct class_device, kobj)); |
@@ -1273,7 +1276,8 @@ sysfs_mbox_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1273 | } | 1276 | } |
1274 | 1277 | ||
1275 | static ssize_t | 1278 | static ssize_t |
1276 | sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 1279 | sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
1280 | char *buf, loff_t off, size_t count) | ||
1277 | { | 1281 | { |
1278 | struct Scsi_Host *host = | 1282 | struct Scsi_Host *host = |
1279 | class_to_shost(container_of(kobj, struct class_device, | 1283 | class_to_shost(container_of(kobj, struct class_device, |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 96587253bfa9..942db9de785e 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -11,8 +11,9 @@ | |||
11 | /* SYSFS attributes --------------------------------------------------------- */ | 11 | /* SYSFS attributes --------------------------------------------------------- */ |
12 | 12 | ||
13 | static ssize_t | 13 | static ssize_t |
14 | qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off, | 14 | qla2x00_sysfs_read_fw_dump(struct kobject *kobj, |
15 | size_t count) | 15 | struct bin_attribute *bin_attr, |
16 | char *buf, loff_t off, size_t count) | ||
16 | { | 17 | { |
17 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 18 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
18 | struct device, kobj))); | 19 | struct device, kobj))); |
@@ -31,8 +32,9 @@ qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off, | |||
31 | } | 32 | } |
32 | 33 | ||
33 | static ssize_t | 34 | static ssize_t |
34 | qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf, loff_t off, | 35 | qla2x00_sysfs_write_fw_dump(struct kobject *kobj, |
35 | size_t count) | 36 | struct bin_attribute *bin_attr, |
37 | char *buf, loff_t off, size_t count) | ||
36 | { | 38 | { |
37 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 39 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
38 | struct device, kobj))); | 40 | struct device, kobj))); |
@@ -80,8 +82,9 @@ static struct bin_attribute sysfs_fw_dump_attr = { | |||
80 | }; | 82 | }; |
81 | 83 | ||
82 | static ssize_t | 84 | static ssize_t |
83 | qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, | 85 | qla2x00_sysfs_read_nvram(struct kobject *kobj, |
84 | size_t count) | 86 | struct bin_attribute *bin_attr, |
87 | char *buf, loff_t off, size_t count) | ||
85 | { | 88 | { |
86 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 89 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
87 | struct device, kobj))); | 90 | struct device, kobj))); |
@@ -100,8 +103,9 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, | |||
100 | } | 103 | } |
101 | 104 | ||
102 | static ssize_t | 105 | static ssize_t |
103 | qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf, loff_t off, | 106 | qla2x00_sysfs_write_nvram(struct kobject *kobj, |
104 | size_t count) | 107 | struct bin_attribute *bin_attr, |
108 | char *buf, loff_t off, size_t count) | ||
105 | { | 109 | { |
106 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 110 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
107 | struct device, kobj))); | 111 | struct device, kobj))); |
@@ -155,8 +159,9 @@ static struct bin_attribute sysfs_nvram_attr = { | |||
155 | }; | 159 | }; |
156 | 160 | ||
157 | static ssize_t | 161 | static ssize_t |
158 | qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off, | 162 | qla2x00_sysfs_read_optrom(struct kobject *kobj, |
159 | size_t count) | 163 | struct bin_attribute *bin_attr, |
164 | char *buf, loff_t off, size_t count) | ||
160 | { | 165 | { |
161 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 166 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
162 | struct device, kobj))); | 167 | struct device, kobj))); |
@@ -174,8 +179,9 @@ qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off, | |||
174 | } | 179 | } |
175 | 180 | ||
176 | static ssize_t | 181 | static ssize_t |
177 | qla2x00_sysfs_write_optrom(struct kobject *kobj, char *buf, loff_t off, | 182 | qla2x00_sysfs_write_optrom(struct kobject *kobj, |
178 | size_t count) | 183 | struct bin_attribute *bin_attr, |
184 | char *buf, loff_t off, size_t count) | ||
179 | { | 185 | { |
180 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 186 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
181 | struct device, kobj))); | 187 | struct device, kobj))); |
@@ -203,8 +209,9 @@ static struct bin_attribute sysfs_optrom_attr = { | |||
203 | }; | 209 | }; |
204 | 210 | ||
205 | static ssize_t | 211 | static ssize_t |
206 | qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, char *buf, loff_t off, | 212 | qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, |
207 | size_t count) | 213 | struct bin_attribute *bin_attr, |
214 | char *buf, loff_t off, size_t count) | ||
208 | { | 215 | { |
209 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 216 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
210 | struct device, kobj))); | 217 | struct device, kobj))); |
@@ -282,8 +289,9 @@ static struct bin_attribute sysfs_optrom_ctl_attr = { | |||
282 | }; | 289 | }; |
283 | 290 | ||
284 | static ssize_t | 291 | static ssize_t |
285 | qla2x00_sysfs_read_vpd(struct kobject *kobj, char *buf, loff_t off, | 292 | qla2x00_sysfs_read_vpd(struct kobject *kobj, |
286 | size_t count) | 293 | struct bin_attribute *bin_attr, |
294 | char *buf, loff_t off, size_t count) | ||
287 | { | 295 | { |
288 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 296 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
289 | struct device, kobj))); | 297 | struct device, kobj))); |
@@ -301,8 +309,9 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj, char *buf, loff_t off, | |||
301 | } | 309 | } |
302 | 310 | ||
303 | static ssize_t | 311 | static ssize_t |
304 | qla2x00_sysfs_write_vpd(struct kobject *kobj, char *buf, loff_t off, | 312 | qla2x00_sysfs_write_vpd(struct kobject *kobj, |
305 | size_t count) | 313 | struct bin_attribute *bin_attr, |
314 | char *buf, loff_t off, size_t count) | ||
306 | { | 315 | { |
307 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 316 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
308 | struct device, kobj))); | 317 | struct device, kobj))); |
@@ -330,8 +339,9 @@ static struct bin_attribute sysfs_vpd_attr = { | |||
330 | }; | 339 | }; |
331 | 340 | ||
332 | static ssize_t | 341 | static ssize_t |
333 | qla2x00_sysfs_read_sfp(struct kobject *kobj, char *buf, loff_t off, | 342 | qla2x00_sysfs_read_sfp(struct kobject *kobj, |
334 | size_t count) | 343 | struct bin_attribute *bin_attr, |
344 | char *buf, loff_t off, size_t count) | ||
335 | { | 345 | { |
336 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 346 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
337 | struct device, kobj))); | 347 | struct device, kobj))); |
diff --git a/drivers/spi/at25.c b/drivers/spi/at25.c index fde1dededba3..e007833cca59 100644 --- a/drivers/spi/at25.c +++ b/drivers/spi/at25.c | |||
@@ -111,7 +111,8 @@ at25_ee_read( | |||
111 | } | 111 | } |
112 | 112 | ||
113 | static ssize_t | 113 | static ssize_t |
114 | at25_bin_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 114 | at25_bin_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
115 | char *buf, loff_t off, size_t count) | ||
115 | { | 116 | { |
116 | struct device *dev; | 117 | struct device *dev; |
117 | struct at25_data *at25; | 118 | struct at25_data *at25; |
@@ -236,7 +237,8 @@ at25_ee_write(struct at25_data *at25, char *buf, loff_t off, size_t count) | |||
236 | } | 237 | } |
237 | 238 | ||
238 | static ssize_t | 239 | static ssize_t |
239 | at25_bin_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | 240 | at25_bin_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
241 | char *buf, loff_t off, size_t count) | ||
240 | { | 242 | { |
241 | struct device *dev; | 243 | struct device *dev; |
242 | struct at25_data *at25; | 244 | struct at25_data *at25; |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 3b3c6571f583..2349e71b0083 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -2102,7 +2102,9 @@ static ssize_t radeon_show_one_edid(char *buf, loff_t off, size_t count, const u | |||
2102 | } | 2102 | } |
2103 | 2103 | ||
2104 | 2104 | ||
2105 | static ssize_t radeon_show_edid1(struct kobject *kobj, char *buf, loff_t off, size_t count) | 2105 | static ssize_t radeon_show_edid1(struct kobject *kobj, |
2106 | struct bin_attribute *bin_attr, | ||
2107 | char *buf, loff_t off, size_t count) | ||
2106 | { | 2108 | { |
2107 | struct device *dev = container_of(kobj, struct device, kobj); | 2109 | struct device *dev = container_of(kobj, struct device, kobj); |
2108 | struct pci_dev *pdev = to_pci_dev(dev); | 2110 | struct pci_dev *pdev = to_pci_dev(dev); |
@@ -2113,7 +2115,9 @@ static ssize_t radeon_show_edid1(struct kobject *kobj, char *buf, loff_t off, si | |||
2113 | } | 2115 | } |
2114 | 2116 | ||
2115 | 2117 | ||
2116 | static ssize_t radeon_show_edid2(struct kobject *kobj, char *buf, loff_t off, size_t count) | 2118 | static ssize_t radeon_show_edid2(struct kobject *kobj, |
2119 | struct bin_attribute *bin_attr, | ||
2120 | char *buf, loff_t off, size_t count) | ||
2117 | { | 2121 | { |
2118 | struct device *dev = container_of(kobj, struct device, kobj); | 2122 | struct device *dev = container_of(kobj, struct device, kobj); |
2119 | struct pci_dev *pdev = to_pci_dev(dev); | 2123 | struct pci_dev *pdev = to_pci_dev(dev); |
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c index 4e13aa71adea..cab56005dd49 100644 --- a/drivers/w1/slaves/w1_ds2433.c +++ b/drivers/w1/slaves/w1_ds2433.c | |||
@@ -91,8 +91,9 @@ static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data, | |||
91 | } | 91 | } |
92 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ | 92 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
93 | 93 | ||
94 | static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | 94 | static ssize_t w1_f23_read_bin(struct kobject *kobj, |
95 | size_t count) | 95 | struct bin_attribute *bin_attr, |
96 | char *buf, loff_t off, size_t count) | ||
96 | { | 97 | { |
97 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 98 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
98 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC | 99 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
@@ -199,8 +200,9 @@ static int w1_f23_write(struct w1_slave *sl, int addr, int len, const u8 *data) | |||
199 | return 0; | 200 | return 0; |
200 | } | 201 | } |
201 | 202 | ||
202 | static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, | 203 | static ssize_t w1_f23_write_bin(struct kobject *kobj, |
203 | size_t count) | 204 | struct bin_attribute *bin_attr, |
205 | char *buf, loff_t off, size_t count) | ||
204 | { | 206 | { |
205 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 207 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
206 | int addr, len, idx; | 208 | int addr, len, idx; |
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index 8ba4e572e09c..4318935678c5 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c | |||
@@ -42,7 +42,8 @@ static u8 bad_roms[][9] = { | |||
42 | {} | 42 | {} |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t); | 45 | static ssize_t w1_therm_read_bin(struct kobject *, struct bin_attribute *, |
46 | char *, loff_t, size_t); | ||
46 | 47 | ||
47 | static struct bin_attribute w1_therm_bin_attr = { | 48 | static struct bin_attribute w1_therm_bin_attr = { |
48 | .attr = { | 49 | .attr = { |
@@ -158,7 +159,9 @@ static int w1_therm_check_rom(u8 rom[9]) | |||
158 | return 0; | 159 | return 0; |
159 | } | 160 | } |
160 | 161 | ||
161 | static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count) | 162 | static ssize_t w1_therm_read_bin(struct kobject *kobj, |
163 | struct bin_attribute *bin_attr, | ||
164 | char *buf, loff_t off, size_t count) | ||
162 | { | 165 | { |
163 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 166 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
164 | struct w1_master *dev = sl->master; | 167 | struct w1_master *dev = sl->master; |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 1838cb29b646..f5c5b760ed7b 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -105,7 +105,9 @@ static ssize_t w1_slave_read_name(struct device *dev, struct device_attribute *a | |||
105 | return sprintf(buf, "%s\n", sl->name); | 105 | return sprintf(buf, "%s\n", sl->name); |
106 | } | 106 | } |
107 | 107 | ||
108 | static ssize_t w1_slave_read_id(struct kobject *kobj, char *buf, loff_t off, size_t count) | 108 | static ssize_t w1_slave_read_id(struct kobject *kobj, |
109 | struct bin_attribute *bin_attr, | ||
110 | char *buf, loff_t off, size_t count) | ||
109 | { | 111 | { |
110 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 112 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
111 | 113 | ||
@@ -135,7 +137,9 @@ static struct bin_attribute w1_slave_attr_bin_id = { | |||
135 | 137 | ||
136 | /* Default family */ | 138 | /* Default family */ |
137 | 139 | ||
138 | static ssize_t w1_default_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | 140 | static ssize_t w1_default_write(struct kobject *kobj, |
141 | struct bin_attribute *bin_attr, | ||
142 | char *buf, loff_t off, size_t count) | ||
139 | { | 143 | { |
140 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 144 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
141 | 145 | ||
@@ -152,7 +156,9 @@ out_up: | |||
152 | return count; | 156 | return count; |
153 | } | 157 | } |
154 | 158 | ||
155 | static ssize_t w1_default_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 159 | static ssize_t w1_default_read(struct kobject *kobj, |
160 | struct bin_attribute *bin_attr, | ||
161 | char *buf, loff_t off, size_t count) | ||
156 | { | 162 | { |
157 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 163 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
158 | 164 | ||
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c index 7e03cc68b182..9130f1c12c26 100644 --- a/drivers/zorro/zorro-sysfs.c +++ b/drivers/zorro/zorro-sysfs.c | |||
@@ -49,8 +49,9 @@ static ssize_t zorro_show_resource(struct device *dev, struct device_attribute * | |||
49 | 49 | ||
50 | static DEVICE_ATTR(resource, S_IRUGO, zorro_show_resource, NULL); | 50 | static DEVICE_ATTR(resource, S_IRUGO, zorro_show_resource, NULL); |
51 | 51 | ||
52 | static ssize_t zorro_read_config(struct kobject *kobj, char *buf, loff_t off, | 52 | static ssize_t zorro_read_config(struct kobject *kobj, |
53 | size_t count) | 53 | struct bin_attribute *bin_attr, |
54 | char *buf, loff_t off, size_t count) | ||
54 | { | 55 | { |
55 | struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, | 56 | struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, |
56 | kobj)); | 57 | kobj)); |
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index 55796bdacd3d..135353f8a296 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
@@ -40,7 +40,7 @@ fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count) | |||
40 | 40 | ||
41 | rc = -EIO; | 41 | rc = -EIO; |
42 | if (attr->read) | 42 | if (attr->read) |
43 | rc = attr->read(kobj, buffer, off, count); | 43 | rc = attr->read(kobj, attr, buffer, off, count); |
44 | 44 | ||
45 | sysfs_put_active_two(attr_sd); | 45 | sysfs_put_active_two(attr_sd); |
46 | 46 | ||
@@ -97,7 +97,7 @@ flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count) | |||
97 | 97 | ||
98 | rc = -EIO; | 98 | rc = -EIO; |
99 | if (attr->write) | 99 | if (attr->write) |
100 | rc = attr->write(kobj, buffer, offset, count); | 100 | rc = attr->write(kobj, attr, buffer, offset, count); |
101 | 101 | ||
102 | sysfs_put_active_two(attr_sd); | 102 | sysfs_put_active_two(attr_sd); |
103 | 103 | ||
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 2f58ca1af770..be8228e50a27 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -64,8 +64,10 @@ struct bin_attribute { | |||
64 | struct attribute attr; | 64 | struct attribute attr; |
65 | size_t size; | 65 | size_t size; |
66 | void *private; | 66 | void *private; |
67 | ssize_t (*read)(struct kobject *, char *, loff_t, size_t); | 67 | ssize_t (*read)(struct kobject *, struct bin_attribute *, |
68 | ssize_t (*write)(struct kobject *, char *, loff_t, size_t); | 68 | char *, loff_t, size_t); |
69 | ssize_t (*write)(struct kobject *, struct bin_attribute *, | ||
70 | char *, loff_t, size_t); | ||
69 | int (*mmap)(struct kobject *, struct bin_attribute *attr, | 71 | int (*mmap)(struct kobject *, struct bin_attribute *attr, |
70 | struct vm_area_struct *vma); | 72 | struct vm_area_struct *vma); |
71 | }; | 73 | }; |
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c index 31ace23a0914..4f42263e0a8a 100644 --- a/net/bridge/br_sysfs_br.c +++ b/net/bridge/br_sysfs_br.c | |||
@@ -360,8 +360,9 @@ static struct attribute_group bridge_group = { | |||
360 | * | 360 | * |
361 | * Returns the number of bytes read. | 361 | * Returns the number of bytes read. |
362 | */ | 362 | */ |
363 | static ssize_t brforward_read(struct kobject *kobj, char *buf, | 363 | static ssize_t brforward_read(struct kobject *kobj, |
364 | loff_t off, size_t count) | 364 | struct bin_attribute *bin_attr, |
365 | char *buf, loff_t off, size_t count) | ||
365 | { | 366 | { |
366 | struct device *dev = to_dev(kobj); | 367 | struct device *dev = to_dev(kobj); |
367 | struct net_bridge *br = to_bridge(dev); | 368 | struct net_bridge *br = to_bridge(dev); |