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 group arrays in function arguments

Constify the groups array argument where applicable. This allows to
pass constant arrays as arguments.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/17035265-8882-4101-b7a7-16b3eb94f8b5@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Heiner Kallweit and committed by
Greg Kroah-Hartman
fe2511ad 15949f15

+13 -13
+5 -5
fs/sysfs/group.c
··· 217 217 EXPORT_SYMBOL_GPL(sysfs_create_group); 218 218 219 219 static int internal_create_groups(struct kobject *kobj, int update, 220 - const struct attribute_group **groups) 220 + const struct attribute_group *const *groups) 221 221 { 222 222 int error = 0; 223 223 int i; ··· 250 250 * Returns 0 on success or error code from sysfs_create_group on failure. 251 251 */ 252 252 int sysfs_create_groups(struct kobject *kobj, 253 - const struct attribute_group **groups) 253 + const struct attribute_group *const *groups) 254 254 { 255 255 return internal_create_groups(kobj, 0, groups); 256 256 } ··· 268 268 * Returns 0 on success or error code from sysfs_update_group on failure. 269 269 */ 270 270 int sysfs_update_groups(struct kobject *kobj, 271 - const struct attribute_group **groups) 271 + const struct attribute_group *const *groups) 272 272 { 273 273 return internal_create_groups(kobj, 1, groups); 274 274 } ··· 342 342 * If groups is not NULL, remove the specified groups from the kobject. 343 343 */ 344 344 void sysfs_remove_groups(struct kobject *kobj, 345 - const struct attribute_group **groups) 345 + const struct attribute_group *const *groups) 346 346 { 347 347 int i; 348 348 ··· 613 613 * Returns 0 on success or error code on failure. 614 614 */ 615 615 int sysfs_groups_change_owner(struct kobject *kobj, 616 - const struct attribute_group **groups, 616 + const struct attribute_group *const *groups, 617 617 kuid_t kuid, kgid_t kgid) 618 618 { 619 619 int error = 0, i;
+8 -8
include/linux/sysfs.h
··· 445 445 int __must_check sysfs_create_group(struct kobject *kobj, 446 446 const struct attribute_group *grp); 447 447 int __must_check sysfs_create_groups(struct kobject *kobj, 448 - const struct attribute_group **groups); 448 + const struct attribute_group *const *groups); 449 449 int __must_check sysfs_update_groups(struct kobject *kobj, 450 - const struct attribute_group **groups); 450 + const struct attribute_group *const *groups); 451 451 int sysfs_update_group(struct kobject *kobj, 452 452 const struct attribute_group *grp); 453 453 void sysfs_remove_group(struct kobject *kobj, 454 454 const struct attribute_group *grp); 455 455 void sysfs_remove_groups(struct kobject *kobj, 456 - const struct attribute_group **groups); 456 + const struct attribute_group *const *groups); 457 457 int sysfs_add_file_to_group(struct kobject *kobj, 458 458 const struct attribute *attr, const char *group); 459 459 void sysfs_remove_file_from_group(struct kobject *kobj, ··· 486 486 int sysfs_link_change_owner(struct kobject *kobj, struct kobject *targ, 487 487 const char *name, kuid_t kuid, kgid_t kgid); 488 488 int sysfs_groups_change_owner(struct kobject *kobj, 489 - const struct attribute_group **groups, 489 + const struct attribute_group *const *groups, 490 490 kuid_t kuid, kgid_t kgid); 491 491 int sysfs_group_change_owner(struct kobject *kobj, 492 492 const struct attribute_group *groups, kuid_t kuid, ··· 629 629 } 630 630 631 631 static inline int sysfs_create_groups(struct kobject *kobj, 632 - const struct attribute_group **groups) 632 + const struct attribute_group *const *groups) 633 633 { 634 634 return 0; 635 635 } 636 636 637 637 static inline int sysfs_update_groups(struct kobject *kobj, 638 - const struct attribute_group **groups) 638 + const struct attribute_group *const *groups) 639 639 { 640 640 return 0; 641 641 } ··· 652 652 } 653 653 654 654 static inline void sysfs_remove_groups(struct kobject *kobj, 655 - const struct attribute_group **groups) 655 + const struct attribute_group *const *groups) 656 656 { 657 657 } 658 658 ··· 733 733 } 734 734 735 735 static inline int sysfs_groups_change_owner(struct kobject *kobj, 736 - const struct attribute_group **groups, 736 + const struct attribute_group *const *groups, 737 737 kuid_t kuid, kgid_t kgid) 738 738 { 739 739 return 0;