Skip to content

Commit 8d20ea1

Browse files
author
Fox Snowpatch
committed
1 parent 2dd0957 commit 8d20ea1

File tree

8 files changed

+42
-31
lines changed

8 files changed

+42
-31
lines changed

drivers/misc/c2port/core.c

+19-8
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ static ssize_t __c2port_read_flash_data(struct c2port_device *dev,
714714
}
715715

716716
static ssize_t c2port_read_flash_data(struct file *filp, struct kobject *kobj,
717-
struct bin_attribute *attr,
717+
const struct bin_attribute *attr,
718718
char *buffer, loff_t offset, size_t count)
719719
{
720720
struct c2port_device *c2dev = dev_get_drvdata(kobj_to_dev(kobj));
@@ -829,7 +829,7 @@ static ssize_t __c2port_write_flash_data(struct c2port_device *dev,
829829
}
830830

831831
static ssize_t c2port_write_flash_data(struct file *filp, struct kobject *kobj,
832-
struct bin_attribute *attr,
832+
const struct bin_attribute *attr,
833833
char *buffer, loff_t offset, size_t count)
834834
{
835835
struct c2port_device *c2dev = dev_get_drvdata(kobj_to_dev(kobj));
@@ -849,8 +849,8 @@ static ssize_t c2port_write_flash_data(struct file *filp, struct kobject *kobj,
849849
return ret;
850850
}
851851
/* size is computed at run-time */
852-
static BIN_ATTR(flash_data, 0644, c2port_read_flash_data,
853-
c2port_write_flash_data, 0);
852+
static const BIN_ATTR(flash_data, 0644, c2port_read_flash_data,
853+
c2port_write_flash_data, 0);
854854

855855
/*
856856
* Class attributes
@@ -869,14 +869,27 @@ static struct attribute *c2port_attrs[] = {
869869
NULL,
870870
};
871871

872-
static struct bin_attribute *c2port_bin_attrs[] = {
872+
static const struct bin_attribute *const c2port_bin_attrs[] = {
873873
&bin_attr_flash_data,
874874
NULL,
875875
};
876876

877+
static size_t c2port_bin_attr_size(struct kobject *kobj,
878+
const struct bin_attribute *attr,
879+
int i)
880+
{
881+
struct c2port_device *c2dev = dev_get_drvdata(kobj_to_dev(kobj));
882+
883+
if (attr == &bin_attr_flash_data)
884+
return c2dev->ops->blocks_num * c2dev->ops->block_size;
885+
886+
return attr->size;
887+
}
888+
877889
static const struct attribute_group c2port_group = {
878890
.attrs = c2port_attrs,
879-
.bin_attrs = c2port_bin_attrs,
891+
.bin_attrs_new = c2port_bin_attrs,
892+
.bin_size = c2port_bin_attr_size,
880893
};
881894

882895
static const struct attribute_group *c2port_groups[] = {
@@ -913,8 +926,6 @@ struct c2port_device *c2port_device_register(char *name,
913926
goto error_idr_alloc;
914927
c2dev->id = ret;
915928

916-
bin_attr_flash_data.size = ops->blocks_num * ops->block_size;
917-
918929
c2dev->dev = device_create(c2port_class, NULL, 0, c2dev,
919930
"c2port%d", c2dev->id);
920931
if (IS_ERR(c2dev->dev)) {

drivers/misc/cxl/sysfs.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ static ssize_t api_version_compatible_show(struct device *device,
444444
}
445445

446446
static ssize_t afu_eb_read(struct file *filp, struct kobject *kobj,
447-
struct bin_attribute *bin_attr, char *buf,
447+
const struct bin_attribute *bin_attr, char *buf,
448448
loff_t off, size_t count)
449449
{
450450
struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj));
@@ -538,7 +538,7 @@ static ssize_t class_show(struct kobject *kobj,
538538
}
539539

540540
static ssize_t afu_read_config(struct file *filp, struct kobject *kobj,
541-
struct bin_attribute *bin_attr, char *buf,
541+
const struct bin_attribute *bin_attr, char *buf,
542542
loff_t off, size_t count)
543543
{
544544
struct afu_config_record *cr = to_cr(kobj);
@@ -620,7 +620,7 @@ static struct afu_config_record *cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int c
620620
cr->config_attr.attr.name = "config";
621621
cr->config_attr.attr.mode = S_IRUSR;
622622
cr->config_attr.size = afu->crs_len;
623-
cr->config_attr.read = afu_read_config;
623+
cr->config_attr.read_new = afu_read_config;
624624

625625
rc = kobject_init_and_add(&cr->kobj, &afu_config_record_type,
626626
&afu->dev.kobj, "cr%i", cr->cr);
@@ -693,7 +693,7 @@ int cxl_sysfs_afu_add(struct cxl_afu *afu)
693693
afu->attr_eb.attr.name = "afu_err_buff";
694694
afu->attr_eb.attr.mode = S_IRUGO;
695695
afu->attr_eb.size = afu->eb_len;
696-
afu->attr_eb.read = afu_eb_read;
696+
afu->attr_eb.read_new = afu_eb_read;
697697

698698
rc = device_create_bin_file(&afu->dev, &afu->attr_eb);
699699
if (rc) {

drivers/misc/ds1682.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static const struct attribute_group ds1682_group = {
154154
* User data attribute
155155
*/
156156
static ssize_t ds1682_eeprom_read(struct file *filp, struct kobject *kobj,
157-
struct bin_attribute *attr,
157+
const struct bin_attribute *attr,
158158
char *buf, loff_t off, size_t count)
159159
{
160160
struct i2c_client *client = kobj_to_i2c_client(kobj);
@@ -172,7 +172,7 @@ static ssize_t ds1682_eeprom_read(struct file *filp, struct kobject *kobj,
172172
}
173173

174174
static ssize_t ds1682_eeprom_write(struct file *filp, struct kobject *kobj,
175-
struct bin_attribute *attr,
175+
const struct bin_attribute *attr,
176176
char *buf, loff_t off, size_t count)
177177
{
178178
struct i2c_client *client = kobj_to_i2c_client(kobj);
@@ -194,8 +194,8 @@ static const struct bin_attribute ds1682_eeprom_attr = {
194194
.mode = S_IRUGO | S_IWUSR,
195195
},
196196
.size = DS1682_EEPROM_SIZE,
197-
.read = ds1682_eeprom_read,
198-
.write = ds1682_eeprom_write,
197+
.read_new = ds1682_eeprom_read,
198+
.write_new = ds1682_eeprom_write,
199199
};
200200

201201
static int ds1682_nvmem_read(void *priv, unsigned int offset, void *val,

drivers/misc/eeprom/idt_89hpesx.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ static int idt_csr_read(struct idt_89hpesx_dev *pdev, u16 csraddr, u32 *data)
847847
* @count: Number of bytes to write
848848
*/
849849
static ssize_t eeprom_write(struct file *filp, struct kobject *kobj,
850-
struct bin_attribute *attr,
850+
const struct bin_attribute *attr,
851851
char *buf, loff_t off, size_t count)
852852
{
853853
struct idt_89hpesx_dev *pdev;
@@ -871,7 +871,7 @@ static ssize_t eeprom_write(struct file *filp, struct kobject *kobj,
871871
* @count: Number of bytes to write
872872
*/
873873
static ssize_t eeprom_read(struct file *filp, struct kobject *kobj,
874-
struct bin_attribute *attr,
874+
const struct bin_attribute *attr,
875875
char *buf, loff_t off, size_t count)
876876
{
877877
struct idt_89hpesx_dev *pdev;
@@ -1017,7 +1017,7 @@ static ssize_t idt_dbgfs_csr_read(struct file *filep, char __user *ubuf,
10171017
* NOTE Size will be changed in compliance with OF node. EEPROM attribute will
10181018
* be read-only as well if the corresponding flag is specified in OF node.
10191019
*/
1020-
static BIN_ATTR_RW(eeprom, EEPROM_DEF_SIZE);
1020+
static const BIN_ATTR_RW(eeprom, EEPROM_DEF_SIZE);
10211021

10221022
/*
10231023
* csr_dbgfs_ops - CSR debugfs-node read/write operations

drivers/misc/eeprom/max6875.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static void max6875_update_slice(struct i2c_client *client, int slice)
104104
}
105105

106106
static ssize_t max6875_read(struct file *filp, struct kobject *kobj,
107-
struct bin_attribute *bin_attr,
107+
const struct bin_attribute *bin_attr,
108108
char *buf, loff_t off, size_t count)
109109
{
110110
struct i2c_client *client = kobj_to_i2c_client(kobj);
@@ -127,7 +127,7 @@ static const struct bin_attribute user_eeprom_attr = {
127127
.mode = S_IRUGO,
128128
},
129129
.size = USER_EEPROM_SIZE,
130-
.read = max6875_read,
130+
.read_new = max6875_read,
131131
};
132132

133133
static int max6875_probe(struct i2c_client *client)

drivers/misc/ocxl/sysfs.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static struct device_attribute afu_attrs[] = {
9494
};
9595

9696
static ssize_t global_mmio_read(struct file *filp, struct kobject *kobj,
97-
struct bin_attribute *bin_attr, char *buf,
97+
const struct bin_attribute *bin_attr, char *buf,
9898
loff_t off, size_t count)
9999
{
100100
struct ocxl_afu *afu = to_afu(kobj_to_dev(kobj));
@@ -155,7 +155,7 @@ int ocxl_sysfs_register_afu(struct ocxl_file_info *info)
155155
info->attr_global_mmio.attr.name = "global_mmio_area";
156156
info->attr_global_mmio.attr.mode = 0600;
157157
info->attr_global_mmio.size = info->afu->config.global_mmio_size;
158-
info->attr_global_mmio.read = global_mmio_read;
158+
info->attr_global_mmio.read_new = global_mmio_read;
159159
info->attr_global_mmio.mmap = global_mmio_mmap;
160160
rc = device_create_bin_file(&info->dev, &info->attr_global_mmio);
161161
if (rc) {

drivers/misc/pch_phub.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ static int pch_phub_write_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data)
483483
}
484484

485485
static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj,
486-
struct bin_attribute *attr, char *buf,
486+
const struct bin_attribute *attr, char *buf,
487487
loff_t off, size_t count)
488488
{
489489
unsigned int rom_signature;
@@ -553,7 +553,7 @@ static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj,
553553
}
554554

555555
static ssize_t pch_phub_bin_write(struct file *filp, struct kobject *kobj,
556-
struct bin_attribute *attr,
556+
const struct bin_attribute *attr,
557557
char *buf, loff_t off, size_t count)
558558
{
559559
int err;
@@ -655,8 +655,8 @@ static const struct bin_attribute pch_bin_attr = {
655655
.mode = S_IRUGO | S_IWUSR,
656656
},
657657
.size = PCH_PHUB_OROM_SIZE + 1,
658-
.read = pch_phub_bin_read,
659-
.write = pch_phub_bin_write,
658+
.read_new = pch_phub_bin_read,
659+
.write_new = pch_phub_bin_write,
660660
};
661661

662662
static int pch_phub_probe(struct pci_dev *pdev,

drivers/misc/sram.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define SRAM_GRANULARITY 32
2424

2525
static ssize_t sram_read(struct file *filp, struct kobject *kobj,
26-
struct bin_attribute *attr,
26+
const struct bin_attribute *attr,
2727
char *buf, loff_t pos, size_t count)
2828
{
2929
struct sram_partition *part;
@@ -38,7 +38,7 @@ static ssize_t sram_read(struct file *filp, struct kobject *kobj,
3838
}
3939

4040
static ssize_t sram_write(struct file *filp, struct kobject *kobj,
41-
struct bin_attribute *attr,
41+
const struct bin_attribute *attr,
4242
char *buf, loff_t pos, size_t count)
4343
{
4444
struct sram_partition *part;
@@ -83,8 +83,8 @@ static int sram_add_export(struct sram_dev *sram, struct sram_reserve *block,
8383
return -ENOMEM;
8484

8585
part->battr.attr.mode = S_IRUSR | S_IWUSR;
86-
part->battr.read = sram_read;
87-
part->battr.write = sram_write;
86+
part->battr.read_new = sram_read;
87+
part->battr.write_new = sram_write;
8888
part->battr.size = block->size;
8989

9090
return device_create_bin_file(sram->dev, &part->battr);

0 commit comments

Comments
 (0)