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>
This commit is contained in:
Zhang Rui 2007-06-09 13:57:22 +08:00 committed by Greg Kroah-Hartman
parent 51225039f3
commit 91a6902958
27 changed files with 185 additions and 106 deletions

View File

@ -78,6 +78,7 @@ static CLASS_DEVICE_ATTR(loading, 0644,
firmware_loading_show, firmware_loading_store); 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) char *buffer, loff_t offset, size_t count)
{ {
struct class_device *class_dev = to_class_dev(kobj); struct class_device *class_dev = to_class_dev(kobj);
@ -88,6 +89,7 @@ static ssize_t firmware_data_read(struct kobject *kobj,
return count; 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) char *buffer, loff_t offset, size_t count)
{ {
struct class_device *class_dev = to_class_dev(kobj); struct class_device *class_dev = to_class_dev(kobj);

View File

@ -175,7 +175,7 @@ static ssize_t firmware_loading_store(struct device *dev,
static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store);
static ssize_t static ssize_t
firmware_data_read(struct kobject *kobj, firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buffer, loff_t offset, size_t count) char *buffer, loff_t offset, size_t count)
{ {
struct device *dev = to_dev(kobj); struct device *dev = to_dev(kobj);
@ -240,7 +240,7 @@ fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
* the driver as a firmware image. * the driver as a firmware image.
**/ **/
static ssize_t static ssize_t
firmware_data_write(struct kobject *kobj, firmware_data_write(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buffer, loff_t offset, size_t count) char *buffer, loff_t offset, size_t count)
{ {
struct device *dev = to_dev(kobj); struct device *dev = to_dev(kobj);

View File

@ -149,8 +149,9 @@ static ssize_t smi_data_buf_size_store(struct device *dev,
return count; return count;
} }
static ssize_t smi_data_read(struct kobject *kobj, char *buf, loff_t pos, static ssize_t smi_data_read(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t count)
{ {
size_t max_read; size_t max_read;
ssize_t ret; ssize_t ret;
@ -170,8 +171,9 @@ out:
return ret; return ret;
} }
static ssize_t smi_data_write(struct kobject *kobj, char *buf, loff_t pos, static ssize_t smi_data_write(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t count)
{ {
ssize_t ret; ssize_t ret;

View File

@ -543,8 +543,9 @@ static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
return ret_count; return ret_count;
} }
static ssize_t read_rbu_data(struct kobject *kobj, char *buffer, static ssize_t read_rbu_data(struct kobject *kobj,
loff_t pos, size_t count) struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t count)
{ {
ssize_t ret_count = 0; ssize_t ret_count = 0;
@ -591,8 +592,9 @@ static void callbackfn_rbu(const struct firmware *fw, void *context)
spin_unlock(&rbu_data.lock); spin_unlock(&rbu_data.lock);
} }
static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, static ssize_t read_rbu_image_type(struct kobject *kobj,
loff_t pos, size_t count) struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t count)
{ {
int size = 0; int size = 0;
if (!pos) if (!pos)
@ -600,8 +602,9 @@ static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer,
return size; return size;
} }
static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, static ssize_t write_rbu_image_type(struct kobject *kobj,
loff_t pos, size_t count) struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t count)
{ {
int rc = count; int rc = count;
int req_firm_rc = 0; int req_firm_rc = 0;
@ -660,8 +663,9 @@ static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer,
return rc; return rc;
} }
static ssize_t read_rbu_packet_size(struct kobject *kobj, char *buffer, static ssize_t read_rbu_packet_size(struct kobject *kobj,
loff_t pos, size_t count) struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t count)
{ {
int size = 0; int size = 0;
if (!pos) { if (!pos) {
@ -672,8 +676,9 @@ static ssize_t read_rbu_packet_size(struct kobject *kobj, char *buffer,
return size; return size;
} }
static ssize_t write_rbu_packet_size(struct kobject *kobj, char *buffer, static ssize_t write_rbu_packet_size(struct kobject *kobj,
loff_t pos, size_t count) struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t count)
{ {
unsigned long temp; unsigned long temp;
spin_lock(&rbu_data.lock); spin_lock(&rbu_data.lock);

View File

@ -110,7 +110,8 @@ exit:
mutex_unlock(&data->update_lock); mutex_unlock(&data->update_lock);
} }
static ssize_t eeprom_read(struct kobject *kobj, char *buf, loff_t off, size_t count) static ssize_t eeprom_read(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj));
struct eeprom_data *data = i2c_get_clientdata(client); struct eeprom_data *data = i2c_get_clientdata(client);

View File

@ -125,8 +125,9 @@ exit_up:
mutex_unlock(&data->update_lock); mutex_unlock(&data->update_lock);
} }
static ssize_t max6875_read(struct kobject *kobj, char *buf, loff_t off, static ssize_t max6875_read(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct i2c_client *client = kobj_to_i2c_client(kobj); struct i2c_client *client = kobj_to_i2c_client(kobj);
struct max6875_data *data = i2c_get_clientdata(client); struct max6875_data *data = i2c_get_clientdata(client);

View File

@ -106,7 +106,8 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status);
static void ibm_handle_events(acpi_handle handle, u32 event, void *context); static void ibm_handle_events(acpi_handle handle, u32 event, void *context);
static int ibm_get_table_from_acpi(char **bufp); static int ibm_get_table_from_acpi(char **bufp);
static ssize_t ibm_read_apci_table(struct kobject *kobj, static ssize_t ibm_read_apci_table(struct kobject *kobj,
char *buffer, loff_t pos, size_t size); struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t size);
static acpi_status __init ibm_find_acpi_device(acpi_handle handle, static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
u32 lvl, void *context, void **rv); u32 lvl, void *context, void **rv);
static int __init ibm_acpiphp_init(void); static int __init ibm_acpiphp_init(void);
@ -357,7 +358,8 @@ read_table_done:
* our solution is to only allow reading the table in all at once * our solution is to only allow reading the table in all at once
**/ **/
static ssize_t ibm_read_apci_table(struct kobject *kobj, static ssize_t ibm_read_apci_table(struct kobject *kobj,
char *buffer, loff_t pos, size_t size) struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t size)
{ {
int bytes_read = -EINVAL; int bytes_read = -EINVAL;
char *table = NULL; char *table = NULL;

View File

@ -213,7 +213,8 @@ struct device_attribute pci_dev_attrs[] = {
}; };
static ssize_t static ssize_t
pci_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) pci_read_config(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj));
unsigned int size = 64; unsigned int size = 64;
@ -285,7 +286,8 @@ pci_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count)
} }
static ssize_t static ssize_t
pci_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) pci_write_config(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj));
unsigned int size = count; unsigned int size = count;
@ -352,7 +354,8 @@ pci_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count)
* callback routine (pci_legacy_read). * callback routine (pci_legacy_read).
*/ */
ssize_t ssize_t
pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off, size_t count) pci_read_legacy_io(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct pci_bus *bus = to_pci_bus(container_of(kobj, struct pci_bus *bus = to_pci_bus(container_of(kobj,
struct class_device, struct class_device,
@ -376,7 +379,8 @@ pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off, size_t count)
* callback routine (pci_legacy_write). * callback routine (pci_legacy_write).
*/ */
ssize_t ssize_t
pci_write_legacy_io(struct kobject *kobj, char *buf, loff_t off, size_t count) pci_write_legacy_io(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct pci_bus *bus = to_pci_bus(container_of(kobj, struct pci_bus *bus = to_pci_bus(container_of(kobj,
struct class_device, struct class_device,
@ -528,7 +532,8 @@ static inline void pci_remove_resource_files(struct pci_dev *dev) { return; }
* writing anything except 0 enables it * writing anything except 0 enables it
*/ */
static ssize_t static ssize_t
pci_write_rom(struct kobject *kobj, char *buf, loff_t off, size_t count) pci_write_rom(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
@ -551,7 +556,8 @@ pci_write_rom(struct kobject *kobj, char *buf, loff_t off, size_t count)
* device corresponding to @kobj. * device corresponding to @kobj.
*/ */
static ssize_t static ssize_t
pci_read_rom(struct kobject *kobj, char *buf, loff_t off, size_t count) pci_read_rom(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
void __iomem *rom; void __iomem *rom;

View File

@ -283,7 +283,9 @@ static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, loff_t off
return (ret); return (ret);
} }
static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) static ssize_t pccard_show_cis(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
unsigned int size = 0x200; unsigned int size = 0x200;
@ -311,7 +313,9 @@ static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size
return (count); return (count);
} }
static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) static ssize_t pccard_store_cis(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct pcmcia_socket *s = to_socket(container_of(kobj, struct device, kobj)); struct pcmcia_socket *s = to_socket(container_of(kobj, struct device, kobj));
cisdump_t *cis; cisdump_t *cis;

View File

@ -67,7 +67,8 @@ struct device_attribute rio_dev_attrs[] = {
}; };
static ssize_t static ssize_t
rio_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) rio_read_config(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct rio_dev *dev = struct rio_dev *dev =
to_rio_dev(container_of(kobj, struct device, kobj)); 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)
} }
static ssize_t static ssize_t
rio_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) rio_write_config(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct rio_dev *dev = struct rio_dev *dev =
to_rio_dev(container_of(kobj, struct device, kobj)); to_rio_dev(container_of(kobj, struct device, kobj));

View File

@ -258,8 +258,9 @@ static const struct rtc_class_ops ds1553_rtc_ops = {
.ioctl = ds1553_rtc_ioctl, .ioctl = ds1553_rtc_ioctl,
}; };
static ssize_t ds1553_nvram_read(struct kobject *kobj, char *buf, static ssize_t ds1553_nvram_read(struct kobject *kobj,
loff_t pos, size_t size) struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t size)
{ {
struct platform_device *pdev = struct platform_device *pdev =
to_platform_device(container_of(kobj, struct device, kobj)); to_platform_device(container_of(kobj, struct device, kobj));
@ -272,8 +273,9 @@ static ssize_t ds1553_nvram_read(struct kobject *kobj, char *buf,
return count; return count;
} }
static ssize_t ds1553_nvram_write(struct kobject *kobj, char *buf, static ssize_t ds1553_nvram_write(struct kobject *kobj,
loff_t pos, size_t size) struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t size)
{ {
struct platform_device *pdev = struct platform_device *pdev =
to_platform_device(container_of(kobj, struct device, kobj)); to_platform_device(container_of(kobj, struct device, kobj));

View File

@ -127,8 +127,9 @@ static const struct rtc_class_ops ds1742_rtc_ops = {
.set_time = ds1742_rtc_set_time, .set_time = ds1742_rtc_set_time,
}; };
static ssize_t ds1742_nvram_read(struct kobject *kobj, char *buf, static ssize_t ds1742_nvram_read(struct kobject *kobj,
loff_t pos, size_t size) struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t size)
{ {
struct platform_device *pdev = struct platform_device *pdev =
to_platform_device(container_of(kobj, struct device, kobj)); to_platform_device(container_of(kobj, struct device, kobj));
@ -141,8 +142,9 @@ static ssize_t ds1742_nvram_read(struct kobject *kobj, char *buf,
return count; return count;
} }
static ssize_t ds1742_nvram_write(struct kobject *kobj, char *buf, static ssize_t ds1742_nvram_write(struct kobject *kobj,
loff_t pos, size_t size) struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t size)
{ {
struct platform_device *pdev = struct platform_device *pdev =
to_platform_device(container_of(kobj, struct device, kobj)); to_platform_device(container_of(kobj, struct device, kobj));

View File

@ -141,8 +141,9 @@ static int s390_vary_chpid(struct chp_id chpid, int on)
/* /*
* Channel measurement related functions * Channel measurement related functions
*/ */
static ssize_t chp_measurement_chars_read(struct kobject *kobj, char *buf, static ssize_t chp_measurement_chars_read(struct kobject *kobj,
loff_t off, size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct channel_path *chp; struct channel_path *chp;
unsigned int size; unsigned int size;
@ -192,8 +193,9 @@ static void chp_measurement_copy_block(struct cmg_entry *buf,
} while (reference_buf.values[0] != buf->values[0]); } while (reference_buf.values[0] != buf->values[0]);
} }
static ssize_t chp_measurement_read(struct kobject *kobj, char *buf, static ssize_t chp_measurement_read(struct kobject *kobj,
loff_t off, size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct channel_path *chp; struct channel_path *chp;
struct channel_subsystem *css; struct channel_subsystem *css;

View File

@ -59,8 +59,9 @@
struct class_device_attribute *arcmsr_host_attrs[]; struct class_device_attribute *arcmsr_host_attrs[];
static ssize_t static ssize_t
arcmsr_sysfs_iop_message_read(struct kobject *kobj, char *buf, loff_t off, arcmsr_sysfs_iop_message_read(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct class_device *cdev = container_of(kobj,struct class_device,kobj); struct class_device *cdev = container_of(kobj,struct class_device,kobj);
struct Scsi_Host *host = class_to_shost(cdev); 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,
} }
static ssize_t static ssize_t
arcmsr_sysfs_iop_message_write(struct kobject *kobj, char *buf, loff_t off, arcmsr_sysfs_iop_message_write(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct class_device *cdev = container_of(kobj,struct class_device,kobj); struct class_device *cdev = container_of(kobj,struct class_device,kobj);
struct Scsi_Host *host = class_to_shost(cdev); 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,
} }
static ssize_t static ssize_t
arcmsr_sysfs_iop_message_clear(struct kobject *kobj, char *buf, loff_t off, arcmsr_sysfs_iop_message_clear(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct class_device *cdev = container_of(kobj,struct class_device,kobj); struct class_device *cdev = container_of(kobj,struct class_device,kobj);
struct Scsi_Host *host = class_to_shost(cdev); struct Scsi_Host *host = class_to_shost(cdev);

View File

@ -2465,6 +2465,7 @@ restart:
/** /**
* ipr_read_trace - Dump the adapter trace * ipr_read_trace - Dump the adapter trace
* @kobj: kobject struct * @kobj: kobject struct
* @bin_attr: bin_attribute struct
* @buf: buffer * @buf: buffer
* @off: offset * @off: offset
* @count: buffer size * @count: buffer size
@ -2472,8 +2473,9 @@ restart:
* Return value: * Return value:
* number of bytes printed to buffer * number of bytes printed to buffer
**/ **/
static ssize_t ipr_read_trace(struct kobject *kobj, char *buf, static ssize_t ipr_read_trace(struct kobject *kobj,
loff_t off, size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct class_device *cdev = container_of(kobj,struct class_device,kobj); struct class_device *cdev = container_of(kobj,struct class_device,kobj);
struct Scsi_Host *shost = class_to_shost(cdev); struct Scsi_Host *shost = class_to_shost(cdev);
@ -3166,6 +3168,7 @@ static struct class_device_attribute *ipr_ioa_attrs[] = {
/** /**
* ipr_read_dump - Dump the adapter * ipr_read_dump - Dump the adapter
* @kobj: kobject struct * @kobj: kobject struct
* @bin_attr: bin_attribute struct
* @buf: buffer * @buf: buffer
* @off: offset * @off: offset
* @count: buffer size * @count: buffer size
@ -3173,8 +3176,9 @@ static struct class_device_attribute *ipr_ioa_attrs[] = {
* Return value: * Return value:
* number of bytes printed to buffer * number of bytes printed to buffer
**/ **/
static ssize_t ipr_read_dump(struct kobject *kobj, char *buf, static ssize_t ipr_read_dump(struct kobject *kobj,
loff_t off, size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct class_device *cdev = container_of(kobj,struct class_device,kobj); struct class_device *cdev = container_of(kobj,struct class_device,kobj);
struct Scsi_Host *shost = class_to_shost(cdev); struct Scsi_Host *shost = class_to_shost(cdev);
@ -3327,6 +3331,7 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg)
/** /**
* ipr_write_dump - Setup dump state of adapter * ipr_write_dump - Setup dump state of adapter
* @kobj: kobject struct * @kobj: kobject struct
* @bin_attr: bin_attribute struct
* @buf: buffer * @buf: buffer
* @off: offset * @off: offset
* @count: buffer size * @count: buffer size
@ -3334,8 +3339,9 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg)
* Return value: * Return value:
* number of bytes printed to buffer * number of bytes printed to buffer
**/ **/
static ssize_t ipr_write_dump(struct kobject *kobj, char *buf, static ssize_t ipr_write_dump(struct kobject *kobj,
loff_t off, size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct class_device *cdev = container_of(kobj,struct class_device,kobj); struct class_device *cdev = container_of(kobj,struct class_device,kobj);
struct Scsi_Host *shost = class_to_shost(cdev); struct Scsi_Host *shost = class_to_shost(cdev);

View File

@ -38,8 +38,10 @@ static int sas_disable_routing(struct domain_device *dev, u8 *sas_addr);
#if 0 #if 0
/* FIXME: smp needs to migrate into the sas class */ /* FIXME: smp needs to migrate into the sas class */
static ssize_t smp_portal_read(struct kobject *, char *, loff_t, size_t); static ssize_t smp_portal_read(struct kobject *, struct bin_attribute *,
static ssize_t smp_portal_write(struct kobject *, char *, loff_t, size_t); char *, loff_t, size_t);
static ssize_t smp_portal_write(struct kobject *, struct bin_attribute *,
char *, loff_t, size_t);
#endif #endif
/* ---------- SMP task management ---------- */ /* ---------- SMP task management ---------- */
@ -1845,8 +1847,9 @@ out:
#if 0 #if 0
/* ---------- SMP portal ---------- */ /* ---------- SMP portal ---------- */
static ssize_t smp_portal_write(struct kobject *kobj, char *buf, loff_t offs, static ssize_t smp_portal_write(struct kobject *kobj,
size_t size) struct bin_attribute *bin_attr,
char *buf, loff_t offs, size_t size)
{ {
struct domain_device *dev = to_dom_device(kobj); struct domain_device *dev = to_dom_device(kobj);
struct expander_device *ex = &dev->ex_dev; 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,
return size; return size;
} }
static ssize_t smp_portal_read(struct kobject *kobj, char *buf, loff_t offs, static ssize_t smp_portal_read(struct kobject *kobj,
size_t size) struct bin_attribute *bin_attr,
char *buf, loff_t offs, size_t size)
{ {
struct domain_device *dev = to_dom_device(kobj); struct domain_device *dev = to_dom_device(kobj);
struct expander_device *ex = &dev->ex_dev; struct expander_device *ex = &dev->ex_dev;

View File

@ -1133,7 +1133,8 @@ struct class_device_attribute *lpfc_host_attrs[] = {
}; };
static ssize_t static ssize_t
sysfs_ctlreg_write(struct kobject *kobj, char *buf, loff_t off, size_t count) sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
size_t buf_off; size_t buf_off;
struct Scsi_Host *host = class_to_shost(container_of(kobj, 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)
} }
static ssize_t static ssize_t
sysfs_ctlreg_read(struct kobject *kobj, char *buf, loff_t off, size_t count) sysfs_ctlreg_read(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
size_t buf_off; size_t buf_off;
uint32_t * tmp_ptr; uint32_t * tmp_ptr;
@ -1221,7 +1223,8 @@ sysfs_mbox_idle (struct lpfc_hba * phba)
} }
static ssize_t static ssize_t
sysfs_mbox_write(struct kobject *kobj, char *buf, loff_t off, size_t count) sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct Scsi_Host * host = struct Scsi_Host * host =
class_to_shost(container_of(kobj, struct class_device, kobj)); 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)
} }
static ssize_t static ssize_t
sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct Scsi_Host *host = struct Scsi_Host *host =
class_to_shost(container_of(kobj, struct class_device, class_to_shost(container_of(kobj, struct class_device,

View File

@ -11,8 +11,9 @@
/* SYSFS attributes --------------------------------------------------------- */ /* SYSFS attributes --------------------------------------------------------- */
static ssize_t static ssize_t
qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off, qla2x00_sysfs_read_fw_dump(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj))); struct device, kobj)));
@ -31,8 +32,9 @@ qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off,
} }
static ssize_t static ssize_t
qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf, loff_t off, qla2x00_sysfs_write_fw_dump(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj))); struct device, kobj)));
@ -80,8 +82,9 @@ static struct bin_attribute sysfs_fw_dump_attr = {
}; };
static ssize_t static ssize_t
qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, qla2x00_sysfs_read_nvram(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj))); struct device, kobj)));
@ -100,8 +103,9 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off,
} }
static ssize_t static ssize_t
qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf, loff_t off, qla2x00_sysfs_write_nvram(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj))); struct device, kobj)));
@ -155,8 +159,9 @@ static struct bin_attribute sysfs_nvram_attr = {
}; };
static ssize_t static ssize_t
qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off, qla2x00_sysfs_read_optrom(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj))); struct device, kobj)));
@ -174,8 +179,9 @@ qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off,
} }
static ssize_t static ssize_t
qla2x00_sysfs_write_optrom(struct kobject *kobj, char *buf, loff_t off, qla2x00_sysfs_write_optrom(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj))); struct device, kobj)));
@ -203,8 +209,9 @@ static struct bin_attribute sysfs_optrom_attr = {
}; };
static ssize_t static ssize_t
qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, char *buf, loff_t off, qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj))); struct device, kobj)));
@ -282,8 +289,9 @@ static struct bin_attribute sysfs_optrom_ctl_attr = {
}; };
static ssize_t static ssize_t
qla2x00_sysfs_read_vpd(struct kobject *kobj, char *buf, loff_t off, qla2x00_sysfs_read_vpd(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj))); struct device, kobj)));
@ -301,8 +309,9 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj, char *buf, loff_t off,
} }
static ssize_t static ssize_t
qla2x00_sysfs_write_vpd(struct kobject *kobj, char *buf, loff_t off, qla2x00_sysfs_write_vpd(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj))); struct device, kobj)));
@ -330,8 +339,9 @@ static struct bin_attribute sysfs_vpd_attr = {
}; };
static ssize_t static ssize_t
qla2x00_sysfs_read_sfp(struct kobject *kobj, char *buf, loff_t off, qla2x00_sysfs_read_sfp(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj))); struct device, kobj)));

View File

@ -111,7 +111,8 @@ at25_ee_read(
} }
static ssize_t static ssize_t
at25_bin_read(struct kobject *kobj, char *buf, loff_t off, size_t count) at25_bin_read(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct device *dev; struct device *dev;
struct at25_data *at25; struct at25_data *at25;
@ -236,7 +237,8 @@ at25_ee_write(struct at25_data *at25, char *buf, loff_t off, size_t count)
} }
static ssize_t static ssize_t
at25_bin_write(struct kobject *kobj, char *buf, loff_t off, size_t count) at25_bin_write(struct kobject *kobj, struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct device *dev; struct device *dev;
struct at25_data *at25; struct at25_data *at25;

View File

@ -2102,7 +2102,9 @@ static ssize_t radeon_show_one_edid(char *buf, loff_t off, size_t count, const u
} }
static ssize_t radeon_show_edid1(struct kobject *kobj, char *buf, loff_t off, size_t count) static ssize_t radeon_show_edid1(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct device *dev = container_of(kobj, struct device, kobj); struct device *dev = container_of(kobj, struct device, kobj);
struct pci_dev *pdev = to_pci_dev(dev); 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
} }
static ssize_t radeon_show_edid2(struct kobject *kobj, char *buf, loff_t off, size_t count) static ssize_t radeon_show_edid2(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct device *dev = container_of(kobj, struct device, kobj); struct device *dev = container_of(kobj, struct device, kobj);
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);

View File

@ -91,8 +91,9 @@ static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data,
} }
#endif /* CONFIG_W1_SLAVE_DS2433_CRC */ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, static ssize_t w1_f23_read_bin(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct w1_slave *sl = kobj_to_w1_slave(kobj); struct w1_slave *sl = kobj_to_w1_slave(kobj);
#ifdef CONFIG_W1_SLAVE_DS2433_CRC #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)
return 0; return 0;
} }
static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, static ssize_t w1_f23_write_bin(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct w1_slave *sl = kobj_to_w1_slave(kobj); struct w1_slave *sl = kobj_to_w1_slave(kobj);
int addr, len, idx; int addr, len, idx;

View File

@ -42,7 +42,8 @@ static u8 bad_roms[][9] = {
{} {}
}; };
static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t); static ssize_t w1_therm_read_bin(struct kobject *, struct bin_attribute *,
char *, loff_t, size_t);
static struct bin_attribute w1_therm_bin_attr = { static struct bin_attribute w1_therm_bin_attr = {
.attr = { .attr = {
@ -158,7 +159,9 @@ static int w1_therm_check_rom(u8 rom[9])
return 0; return 0;
} }
static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count) static ssize_t w1_therm_read_bin(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct w1_slave *sl = kobj_to_w1_slave(kobj); struct w1_slave *sl = kobj_to_w1_slave(kobj);
struct w1_master *dev = sl->master; struct w1_master *dev = sl->master;

View File

@ -105,7 +105,9 @@ static ssize_t w1_slave_read_name(struct device *dev, struct device_attribute *a
return sprintf(buf, "%s\n", sl->name); return sprintf(buf, "%s\n", sl->name);
} }
static ssize_t w1_slave_read_id(struct kobject *kobj, char *buf, loff_t off, size_t count) static ssize_t w1_slave_read_id(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct w1_slave *sl = kobj_to_w1_slave(kobj); struct w1_slave *sl = kobj_to_w1_slave(kobj);
@ -135,7 +137,9 @@ static struct bin_attribute w1_slave_attr_bin_id = {
/* Default family */ /* Default family */
static ssize_t w1_default_write(struct kobject *kobj, char *buf, loff_t off, size_t count) static ssize_t w1_default_write(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct w1_slave *sl = kobj_to_w1_slave(kobj); struct w1_slave *sl = kobj_to_w1_slave(kobj);
@ -152,7 +156,9 @@ out_up:
return count; return count;
} }
static ssize_t w1_default_read(struct kobject *kobj, char *buf, loff_t off, size_t count) static ssize_t w1_default_read(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct w1_slave *sl = kobj_to_w1_slave(kobj); struct w1_slave *sl = kobj_to_w1_slave(kobj);

View File

@ -49,8 +49,9 @@ static ssize_t zorro_show_resource(struct device *dev, struct device_attribute *
static DEVICE_ATTR(resource, S_IRUGO, zorro_show_resource, NULL); static DEVICE_ATTR(resource, S_IRUGO, zorro_show_resource, NULL);
static ssize_t zorro_read_config(struct kobject *kobj, char *buf, loff_t off, static ssize_t zorro_read_config(struct kobject *kobj,
size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device,
kobj)); kobj));

View File

@ -40,7 +40,7 @@ fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count)
rc = -EIO; rc = -EIO;
if (attr->read) if (attr->read)
rc = attr->read(kobj, buffer, off, count); rc = attr->read(kobj, attr, buffer, off, count);
sysfs_put_active_two(attr_sd); sysfs_put_active_two(attr_sd);
@ -97,7 +97,7 @@ flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count)
rc = -EIO; rc = -EIO;
if (attr->write) if (attr->write)
rc = attr->write(kobj, buffer, offset, count); rc = attr->write(kobj, attr, buffer, offset, count);
sysfs_put_active_two(attr_sd); sysfs_put_active_two(attr_sd);

View File

@ -64,8 +64,10 @@ struct bin_attribute {
struct attribute attr; struct attribute attr;
size_t size; size_t size;
void *private; void *private;
ssize_t (*read)(struct kobject *, char *, loff_t, size_t); ssize_t (*read)(struct kobject *, struct bin_attribute *,
ssize_t (*write)(struct kobject *, char *, loff_t, size_t); char *, loff_t, size_t);
ssize_t (*write)(struct kobject *, struct bin_attribute *,
char *, loff_t, size_t);
int (*mmap)(struct kobject *, struct bin_attribute *attr, int (*mmap)(struct kobject *, struct bin_attribute *attr,
struct vm_area_struct *vma); struct vm_area_struct *vma);
}; };

View File

@ -360,8 +360,9 @@ static struct attribute_group bridge_group = {
* *
* Returns the number of bytes read. * Returns the number of bytes read.
*/ */
static ssize_t brforward_read(struct kobject *kobj, char *buf, static ssize_t brforward_read(struct kobject *kobj,
loff_t off, size_t count) struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{ {
struct device *dev = to_dev(kobj); struct device *dev = to_dev(kobj);
struct net_bridge *br = to_bridge(dev); struct net_bridge *br = to_bridge(dev);