Skip to content

Commit 3272040

Browse files
t-8chkuba-moo
authored andcommitted
qlcnic: use const 'struct bin_attribute' callbacks
The sysfs core now provides callback variants that explicitly take a const pointer. Use them so the non-const variants can be removed. Signed-off-by: Thomas Weißschuh <[email protected]> Link: https://patch.msgid.link/20241219-sysfs-const-bin_attr-net-v2-1-93bdaece3c90@weissschuh.net Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c1bc6d2 commit 3272040

File tree

1 file changed

+34
-35
lines changed

1 file changed

+34
-35
lines changed

drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static int qlcnic_sysfs_validate_crb(struct qlcnic_adapter *adapter,
264264
}
265265

266266
static ssize_t qlcnic_sysfs_read_crb(struct file *filp, struct kobject *kobj,
267-
struct bin_attribute *attr, char *buf,
267+
const struct bin_attribute *attr, char *buf,
268268
loff_t offset, size_t size)
269269
{
270270
struct device *dev = kobj_to_dev(kobj);
@@ -281,7 +281,7 @@ static ssize_t qlcnic_sysfs_read_crb(struct file *filp, struct kobject *kobj,
281281
}
282282

283283
static ssize_t qlcnic_sysfs_write_crb(struct file *filp, struct kobject *kobj,
284-
struct bin_attribute *attr, char *buf,
284+
const struct bin_attribute *attr, char *buf,
285285
loff_t offset, size_t size)
286286
{
287287
struct device *dev = kobj_to_dev(kobj);
@@ -310,7 +310,7 @@ static int qlcnic_sysfs_validate_mem(struct qlcnic_adapter *adapter,
310310
}
311311

312312
static ssize_t qlcnic_sysfs_read_mem(struct file *filp, struct kobject *kobj,
313-
struct bin_attribute *attr, char *buf,
313+
const struct bin_attribute *attr, char *buf,
314314
loff_t offset, size_t size)
315315
{
316316
struct device *dev = kobj_to_dev(kobj);
@@ -332,7 +332,7 @@ static ssize_t qlcnic_sysfs_read_mem(struct file *filp, struct kobject *kobj,
332332
}
333333

334334
static ssize_t qlcnic_sysfs_write_mem(struct file *filp, struct kobject *kobj,
335-
struct bin_attribute *attr, char *buf,
335+
const struct bin_attribute *attr, char *buf,
336336
loff_t offset, size_t size)
337337
{
338338
struct device *dev = kobj_to_dev(kobj);
@@ -396,7 +396,7 @@ static int validate_pm_config(struct qlcnic_adapter *adapter,
396396

397397
static ssize_t qlcnic_sysfs_write_pm_config(struct file *filp,
398398
struct kobject *kobj,
399-
struct bin_attribute *attr,
399+
const struct bin_attribute *attr,
400400
char *buf, loff_t offset,
401401
size_t size)
402402
{
@@ -446,7 +446,7 @@ static ssize_t qlcnic_sysfs_write_pm_config(struct file *filp,
446446

447447
static ssize_t qlcnic_sysfs_read_pm_config(struct file *filp,
448448
struct kobject *kobj,
449-
struct bin_attribute *attr,
449+
const struct bin_attribute *attr,
450450
char *buf, loff_t offset,
451451
size_t size)
452452
{
@@ -539,7 +539,7 @@ static int validate_esw_config(struct qlcnic_adapter *adapter,
539539

540540
static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
541541
struct kobject *kobj,
542-
struct bin_attribute *attr,
542+
const struct bin_attribute *attr,
543543
char *buf, loff_t offset,
544544
size_t size)
545545
{
@@ -623,7 +623,7 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
623623

624624
static ssize_t qlcnic_sysfs_read_esw_config(struct file *file,
625625
struct kobject *kobj,
626-
struct bin_attribute *attr,
626+
const struct bin_attribute *attr,
627627
char *buf, loff_t offset,
628628
size_t size)
629629
{
@@ -675,7 +675,7 @@ static int validate_npar_config(struct qlcnic_adapter *adapter,
675675

676676
static ssize_t qlcnic_sysfs_write_npar_config(struct file *file,
677677
struct kobject *kobj,
678-
struct bin_attribute *attr,
678+
const struct bin_attribute *attr,
679679
char *buf, loff_t offset,
680680
size_t size)
681681
{
@@ -722,7 +722,7 @@ static ssize_t qlcnic_sysfs_write_npar_config(struct file *file,
722722

723723
static ssize_t qlcnic_sysfs_read_npar_config(struct file *file,
724724
struct kobject *kobj,
725-
struct bin_attribute *attr,
725+
const struct bin_attribute *attr,
726726
char *buf, loff_t offset,
727727
size_t size)
728728
{
@@ -769,7 +769,7 @@ static ssize_t qlcnic_sysfs_read_npar_config(struct file *file,
769769

770770
static ssize_t qlcnic_sysfs_get_port_stats(struct file *file,
771771
struct kobject *kobj,
772-
struct bin_attribute *attr,
772+
const struct bin_attribute *attr,
773773
char *buf, loff_t offset,
774774
size_t size)
775775
{
@@ -804,7 +804,7 @@ static ssize_t qlcnic_sysfs_get_port_stats(struct file *file,
804804

805805
static ssize_t qlcnic_sysfs_get_esw_stats(struct file *file,
806806
struct kobject *kobj,
807-
struct bin_attribute *attr,
807+
const struct bin_attribute *attr,
808808
char *buf, loff_t offset,
809809
size_t size)
810810
{
@@ -839,7 +839,7 @@ static ssize_t qlcnic_sysfs_get_esw_stats(struct file *file,
839839

840840
static ssize_t qlcnic_sysfs_clear_esw_stats(struct file *file,
841841
struct kobject *kobj,
842-
struct bin_attribute *attr,
842+
const struct bin_attribute *attr,
843843
char *buf, loff_t offset,
844844
size_t size)
845845
{
@@ -868,7 +868,7 @@ static ssize_t qlcnic_sysfs_clear_esw_stats(struct file *file,
868868

869869
static ssize_t qlcnic_sysfs_clear_port_stats(struct file *file,
870870
struct kobject *kobj,
871-
struct bin_attribute *attr,
871+
const struct bin_attribute *attr,
872872
char *buf, loff_t offset,
873873
size_t size)
874874
{
@@ -898,7 +898,7 @@ static ssize_t qlcnic_sysfs_clear_port_stats(struct file *file,
898898

899899
static ssize_t qlcnic_sysfs_read_pci_config(struct file *file,
900900
struct kobject *kobj,
901-
struct bin_attribute *attr,
901+
const struct bin_attribute *attr,
902902
char *buf, loff_t offset,
903903
size_t size)
904904
{
@@ -938,7 +938,7 @@ static ssize_t qlcnic_sysfs_read_pci_config(struct file *file,
938938

939939
static ssize_t qlcnic_83xx_sysfs_flash_read_handler(struct file *filp,
940940
struct kobject *kobj,
941-
struct bin_attribute *attr,
941+
const struct bin_attribute *attr,
942942
char *buf, loff_t offset,
943943
size_t size)
944944
{
@@ -1115,7 +1115,7 @@ static int qlcnic_83xx_sysfs_flash_write(struct qlcnic_adapter *adapter,
11151115

11161116
static ssize_t qlcnic_83xx_sysfs_flash_write_handler(struct file *filp,
11171117
struct kobject *kobj,
1118-
struct bin_attribute *attr,
1118+
const struct bin_attribute *attr,
11191119
char *buf, loff_t offset,
11201120
size_t size)
11211121
{
@@ -1195,64 +1195,63 @@ static const struct device_attribute dev_attr_beacon = {
11951195
static const struct bin_attribute bin_attr_crb = {
11961196
.attr = { .name = "crb", .mode = 0644 },
11971197
.size = 0,
1198-
.read = qlcnic_sysfs_read_crb,
1199-
.write = qlcnic_sysfs_write_crb,
1198+
.read_new = qlcnic_sysfs_read_crb,
1199+
.write_new = qlcnic_sysfs_write_crb,
12001200
};
12011201

12021202
static const struct bin_attribute bin_attr_mem = {
12031203
.attr = { .name = "mem", .mode = 0644 },
12041204
.size = 0,
1205-
.read = qlcnic_sysfs_read_mem,
1206-
.write = qlcnic_sysfs_write_mem,
1205+
.read_new = qlcnic_sysfs_read_mem,
1206+
.write_new = qlcnic_sysfs_write_mem,
12071207
};
12081208

12091209
static const struct bin_attribute bin_attr_npar_config = {
12101210
.attr = { .name = "npar_config", .mode = 0644 },
12111211
.size = 0,
1212-
.read = qlcnic_sysfs_read_npar_config,
1213-
.write = qlcnic_sysfs_write_npar_config,
1212+
.read_new = qlcnic_sysfs_read_npar_config,
1213+
.write_new = qlcnic_sysfs_write_npar_config,
12141214
};
12151215

12161216
static const struct bin_attribute bin_attr_pci_config = {
12171217
.attr = { .name = "pci_config", .mode = 0644 },
12181218
.size = 0,
1219-
.read = qlcnic_sysfs_read_pci_config,
1220-
.write = NULL,
1219+
.read_new = qlcnic_sysfs_read_pci_config,
12211220
};
12221221

12231222
static const struct bin_attribute bin_attr_port_stats = {
12241223
.attr = { .name = "port_stats", .mode = 0644 },
12251224
.size = 0,
1226-
.read = qlcnic_sysfs_get_port_stats,
1227-
.write = qlcnic_sysfs_clear_port_stats,
1225+
.read_new = qlcnic_sysfs_get_port_stats,
1226+
.write_new = qlcnic_sysfs_clear_port_stats,
12281227
};
12291228

12301229
static const struct bin_attribute bin_attr_esw_stats = {
12311230
.attr = { .name = "esw_stats", .mode = 0644 },
12321231
.size = 0,
1233-
.read = qlcnic_sysfs_get_esw_stats,
1234-
.write = qlcnic_sysfs_clear_esw_stats,
1232+
.read_new = qlcnic_sysfs_get_esw_stats,
1233+
.write_new = qlcnic_sysfs_clear_esw_stats,
12351234
};
12361235

12371236
static const struct bin_attribute bin_attr_esw_config = {
12381237
.attr = { .name = "esw_config", .mode = 0644 },
12391238
.size = 0,
1240-
.read = qlcnic_sysfs_read_esw_config,
1241-
.write = qlcnic_sysfs_write_esw_config,
1239+
.read_new = qlcnic_sysfs_read_esw_config,
1240+
.write_new = qlcnic_sysfs_write_esw_config,
12421241
};
12431242

12441243
static const struct bin_attribute bin_attr_pm_config = {
12451244
.attr = { .name = "pm_config", .mode = 0644 },
12461245
.size = 0,
1247-
.read = qlcnic_sysfs_read_pm_config,
1248-
.write = qlcnic_sysfs_write_pm_config,
1246+
.read_new = qlcnic_sysfs_read_pm_config,
1247+
.write_new = qlcnic_sysfs_write_pm_config,
12491248
};
12501249

12511250
static const struct bin_attribute bin_attr_flash = {
12521251
.attr = { .name = "flash", .mode = 0644 },
12531252
.size = 0,
1254-
.read = qlcnic_83xx_sysfs_flash_read_handler,
1255-
.write = qlcnic_83xx_sysfs_flash_write_handler,
1253+
.read_new = qlcnic_83xx_sysfs_flash_read_handler,
1254+
.write_new = qlcnic_83xx_sysfs_flash_write_handler,
12561255
};
12571256

12581257
#ifdef CONFIG_QLCNIC_HWMON

0 commit comments

Comments
 (0)