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.

sysfs: constify macro BIN_ATTRIBUTE_GROUPS()

As there is only one in-tree user, avoid a transition phase and switch
that user in the same commit. As there are some interdependencies
between the constness of the different symbols in the s390 driver,
covert the whole driver at once.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241205-sysfs-const-bin_attr-groups_macro-v1-1-ac5e855031e8@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thomas Weißschuh and committed by
Greg Kroah-Hartman
92d6254f 7c9bf030

+15 -15
+14 -14
drivers/s390/cio/chp.c
··· 128 128 * Channel measurement related functions 129 129 */ 130 130 static ssize_t measurement_chars_read(struct file *filp, struct kobject *kobj, 131 - struct bin_attribute *bin_attr, 131 + const struct bin_attribute *bin_attr, 132 132 char *buf, loff_t off, size_t count) 133 133 { 134 134 struct channel_path *chp; ··· 142 142 return memory_read_from_buffer(buf, count, &off, &chp->cmg_chars, 143 143 sizeof(chp->cmg_chars)); 144 144 } 145 - static BIN_ATTR_ADMIN_RO(measurement_chars, sizeof(struct cmg_chars)); 145 + static const BIN_ATTR_ADMIN_RO(measurement_chars, sizeof(struct cmg_chars)); 146 146 147 147 static ssize_t measurement_chars_full_read(struct file *filp, 148 148 struct kobject *kobj, 149 - struct bin_attribute *bin_attr, 149 + const struct bin_attribute *bin_attr, 150 150 char *buf, loff_t off, size_t count) 151 151 { 152 152 struct channel_path *chp = to_channelpath(kobj_to_dev(kobj)); ··· 196 196 } 197 197 198 198 static ssize_t measurement_read(struct file *filp, struct kobject *kobj, 199 - struct bin_attribute *bin_attr, 199 + const struct bin_attribute *bin_attr, 200 200 char *buf, loff_t off, size_t count) 201 201 { 202 202 return chp_measurement_copy_block(buf, off, count, kobj, false); 203 203 } 204 - static BIN_ATTR_ADMIN_RO(measurement, sizeof(struct cmg_entry)); 204 + static const BIN_ATTR_ADMIN_RO(measurement, sizeof(struct cmg_entry)); 205 205 206 206 static ssize_t ext_measurement_read(struct file *filp, struct kobject *kobj, 207 - struct bin_attribute *bin_attr, 207 + const struct bin_attribute *bin_attr, 208 208 char *buf, loff_t off, size_t count) 209 209 { 210 210 return chp_measurement_copy_block(buf, off, count, kobj, true); 211 211 } 212 - static BIN_ATTR_ADMIN_RO(ext_measurement, sizeof(struct cmg_ext_entry)); 212 + static const BIN_ATTR_ADMIN_RO(ext_measurement, sizeof(struct cmg_ext_entry)); 213 213 214 - static struct bin_attribute *measurement_attrs[] = { 214 + static const struct bin_attribute *measurement_attrs[] = { 215 215 &bin_attr_measurement_chars, 216 216 &bin_attr_measurement_chars_full, 217 217 &bin_attr_measurement, ··· 435 435 static DEVICE_ATTR_RO(speed_bps); 436 436 437 437 static ssize_t util_string_read(struct file *filp, struct kobject *kobj, 438 - struct bin_attribute *attr, char *buf, 438 + const struct bin_attribute *attr, char *buf, 439 439 loff_t off, size_t count) 440 440 { 441 441 struct channel_path *chp = to_channelpath(kobj_to_dev(kobj)); ··· 448 448 449 449 return rc; 450 450 } 451 - static BIN_ATTR_RO(util_string, 452 - sizeof(((struct channel_path_desc_fmt3 *)0)->util_str)); 451 + static const BIN_ATTR_RO(util_string, 452 + sizeof(((struct channel_path_desc_fmt3 *)0)->util_str)); 453 453 454 - static struct bin_attribute *chp_bin_attrs[] = { 454 + static const struct bin_attribute *const chp_bin_attrs[] = { 455 455 &bin_attr_util_string, 456 456 NULL, 457 457 }; ··· 468 468 &dev_attr_speed_bps.attr, 469 469 NULL, 470 470 }; 471 - static struct attribute_group chp_attr_group = { 471 + static const struct attribute_group chp_attr_group = { 472 472 .attrs = chp_attrs, 473 - .bin_attrs = chp_bin_attrs, 473 + .bin_attrs_new = chp_bin_attrs, 474 474 }; 475 475 static const struct attribute_group *chp_attr_groups[] = { 476 476 &chp_attr_group,
+1 -1
include/linux/sysfs.h
··· 293 293 294 294 #define BIN_ATTRIBUTE_GROUPS(_name) \ 295 295 static const struct attribute_group _name##_group = { \ 296 - .bin_attrs = _name##_attrs, \ 296 + .bin_attrs_new = _name##_attrs, \ 297 297 }; \ 298 298 __ATTRIBUTE_GROUPS(_name) 299 299