aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_attr.c
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2007-06-09 01:57:22 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:09:09 -0400
commit91a6902958f052358899f58683d44e36228d85c2 (patch)
treea713792cf3bb09bdbd2ac6906aa44b3da3e49250 /drivers/scsi/qla2xxx/qla_attr.c
parent51225039f3cf9d250596d1344494b293274b9169 (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>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c50
1 files changed, 30 insertions, 20 deletions
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
13static ssize_t 13static ssize_t
14qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off, 14qla2x00_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
33static ssize_t 34static ssize_t
34qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf, loff_t off, 35qla2x00_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
82static ssize_t 84static ssize_t
83qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, 85qla2x00_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
102static ssize_t 105static ssize_t
103qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf, loff_t off, 106qla2x00_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
157static ssize_t 161static ssize_t
158qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off, 162qla2x00_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
176static ssize_t 181static ssize_t
177qla2x00_sysfs_write_optrom(struct kobject *kobj, char *buf, loff_t off, 182qla2x00_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
205static ssize_t 211static ssize_t
206qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, char *buf, loff_t off, 212qla2x00_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
284static ssize_t 291static ssize_t
285qla2x00_sysfs_read_vpd(struct kobject *kobj, char *buf, loff_t off, 292qla2x00_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
303static ssize_t 311static ssize_t
304qla2x00_sysfs_write_vpd(struct kobject *kobj, char *buf, loff_t off, 312qla2x00_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
332static ssize_t 341static ssize_t
333qla2x00_sysfs_read_sfp(struct kobject *kobj, char *buf, loff_t off, 342qla2x00_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)));