Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <linux@weissschuh.net>
Link: https://patch.msgid.link/20241219-sysfs-const-bin_attr-net-v2-1-93bdaece3c90@weissschuh.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Thomas Weißschuh and committed by
Jakub Kicinski
32720407 c1bc6d21

+34 -35
+34 -35
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
··· 264 264 } 265 265 266 266 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, 268 268 loff_t offset, size_t size) 269 269 { 270 270 struct device *dev = kobj_to_dev(kobj); ··· 281 281 } 282 282 283 283 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, 285 285 loff_t offset, size_t size) 286 286 { 287 287 struct device *dev = kobj_to_dev(kobj); ··· 310 310 } 311 311 312 312 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, 314 314 loff_t offset, size_t size) 315 315 { 316 316 struct device *dev = kobj_to_dev(kobj); ··· 332 332 } 333 333 334 334 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, 336 336 loff_t offset, size_t size) 337 337 { 338 338 struct device *dev = kobj_to_dev(kobj); ··· 396 396 397 397 static ssize_t qlcnic_sysfs_write_pm_config(struct file *filp, 398 398 struct kobject *kobj, 399 - struct bin_attribute *attr, 399 + const struct bin_attribute *attr, 400 400 char *buf, loff_t offset, 401 401 size_t size) 402 402 { ··· 446 446 447 447 static ssize_t qlcnic_sysfs_read_pm_config(struct file *filp, 448 448 struct kobject *kobj, 449 - struct bin_attribute *attr, 449 + const struct bin_attribute *attr, 450 450 char *buf, loff_t offset, 451 451 size_t size) 452 452 { ··· 539 539 540 540 static ssize_t qlcnic_sysfs_write_esw_config(struct file *file, 541 541 struct kobject *kobj, 542 - struct bin_attribute *attr, 542 + const struct bin_attribute *attr, 543 543 char *buf, loff_t offset, 544 544 size_t size) 545 545 { ··· 623 623 624 624 static ssize_t qlcnic_sysfs_read_esw_config(struct file *file, 625 625 struct kobject *kobj, 626 - struct bin_attribute *attr, 626 + const struct bin_attribute *attr, 627 627 char *buf, loff_t offset, 628 628 size_t size) 629 629 { ··· 675 675 676 676 static ssize_t qlcnic_sysfs_write_npar_config(struct file *file, 677 677 struct kobject *kobj, 678 - struct bin_attribute *attr, 678 + const struct bin_attribute *attr, 679 679 char *buf, loff_t offset, 680 680 size_t size) 681 681 { ··· 722 722 723 723 static ssize_t qlcnic_sysfs_read_npar_config(struct file *file, 724 724 struct kobject *kobj, 725 - struct bin_attribute *attr, 725 + const struct bin_attribute *attr, 726 726 char *buf, loff_t offset, 727 727 size_t size) 728 728 { ··· 769 769 770 770 static ssize_t qlcnic_sysfs_get_port_stats(struct file *file, 771 771 struct kobject *kobj, 772 - struct bin_attribute *attr, 772 + const struct bin_attribute *attr, 773 773 char *buf, loff_t offset, 774 774 size_t size) 775 775 { ··· 804 804 805 805 static ssize_t qlcnic_sysfs_get_esw_stats(struct file *file, 806 806 struct kobject *kobj, 807 - struct bin_attribute *attr, 807 + const struct bin_attribute *attr, 808 808 char *buf, loff_t offset, 809 809 size_t size) 810 810 { ··· 839 839 840 840 static ssize_t qlcnic_sysfs_clear_esw_stats(struct file *file, 841 841 struct kobject *kobj, 842 - struct bin_attribute *attr, 842 + const struct bin_attribute *attr, 843 843 char *buf, loff_t offset, 844 844 size_t size) 845 845 { ··· 868 868 869 869 static ssize_t qlcnic_sysfs_clear_port_stats(struct file *file, 870 870 struct kobject *kobj, 871 - struct bin_attribute *attr, 871 + const struct bin_attribute *attr, 872 872 char *buf, loff_t offset, 873 873 size_t size) 874 874 { ··· 898 898 899 899 static ssize_t qlcnic_sysfs_read_pci_config(struct file *file, 900 900 struct kobject *kobj, 901 - struct bin_attribute *attr, 901 + const struct bin_attribute *attr, 902 902 char *buf, loff_t offset, 903 903 size_t size) 904 904 { ··· 938 938 939 939 static ssize_t qlcnic_83xx_sysfs_flash_read_handler(struct file *filp, 940 940 struct kobject *kobj, 941 - struct bin_attribute *attr, 941 + const struct bin_attribute *attr, 942 942 char *buf, loff_t offset, 943 943 size_t size) 944 944 { ··· 1115 1115 1116 1116 static ssize_t qlcnic_83xx_sysfs_flash_write_handler(struct file *filp, 1117 1117 struct kobject *kobj, 1118 - struct bin_attribute *attr, 1118 + const struct bin_attribute *attr, 1119 1119 char *buf, loff_t offset, 1120 1120 size_t size) 1121 1121 { ··· 1195 1195 static const struct bin_attribute bin_attr_crb = { 1196 1196 .attr = { .name = "crb", .mode = 0644 }, 1197 1197 .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, 1200 1200 }; 1201 1201 1202 1202 static const struct bin_attribute bin_attr_mem = { 1203 1203 .attr = { .name = "mem", .mode = 0644 }, 1204 1204 .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, 1207 1207 }; 1208 1208 1209 1209 static const struct bin_attribute bin_attr_npar_config = { 1210 1210 .attr = { .name = "npar_config", .mode = 0644 }, 1211 1211 .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, 1214 1214 }; 1215 1215 1216 1216 static const struct bin_attribute bin_attr_pci_config = { 1217 1217 .attr = { .name = "pci_config", .mode = 0644 }, 1218 1218 .size = 0, 1219 - .read = qlcnic_sysfs_read_pci_config, 1220 - .write = NULL, 1219 + .read_new = qlcnic_sysfs_read_pci_config, 1221 1220 }; 1222 1221 1223 1222 static const struct bin_attribute bin_attr_port_stats = { 1224 1223 .attr = { .name = "port_stats", .mode = 0644 }, 1225 1224 .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, 1228 1227 }; 1229 1228 1230 1229 static const struct bin_attribute bin_attr_esw_stats = { 1231 1230 .attr = { .name = "esw_stats", .mode = 0644 }, 1232 1231 .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, 1235 1234 }; 1236 1235 1237 1236 static const struct bin_attribute bin_attr_esw_config = { 1238 1237 .attr = { .name = "esw_config", .mode = 0644 }, 1239 1238 .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, 1242 1241 }; 1243 1242 1244 1243 static const struct bin_attribute bin_attr_pm_config = { 1245 1244 .attr = { .name = "pm_config", .mode = 0644 }, 1246 1245 .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, 1249 1248 }; 1250 1249 1251 1250 static const struct bin_attribute bin_attr_flash = { 1252 1251 .attr = { .name = "flash", .mode = 0644 }, 1253 1252 .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, 1256 1255 }; 1257 1256 1258 1257 #ifdef CONFIG_QLCNIC_HWMON