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.

driver: core: constify groups array argument in device_add_groups and device_remove_groups

Now that sysfs_create_groups() and sysfs_remove_groups() allow to
pass constant groups arrays, we can constify the groups array argument
also here.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/8ea2d6d1-0adb-4d7f-92bc-751e93ce08d6@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Heiner Kallweit and committed by
Greg Kroah-Hartman
ece52837 fe2511ad

+5 -4
+3 -2
drivers/base/core.c
··· 2831 2831 } 2832 2832 static DEVICE_ATTR_RO(removable); 2833 2833 2834 - int device_add_groups(struct device *dev, const struct attribute_group **groups) 2834 + int device_add_groups(struct device *dev, 2835 + const struct attribute_group *const *groups) 2835 2836 { 2836 2837 return sysfs_create_groups(&dev->kobj, groups); 2837 2838 } 2838 2839 EXPORT_SYMBOL_GPL(device_add_groups); 2839 2840 2840 2841 void device_remove_groups(struct device *dev, 2841 - const struct attribute_group **groups) 2842 + const struct attribute_group *const *groups) 2842 2843 { 2843 2844 sysfs_remove_groups(&dev->kobj, groups); 2844 2845 }
+2 -2
include/linux/device.h
··· 1131 1131 void device_destroy(const struct class *cls, dev_t devt); 1132 1132 1133 1133 int __must_check device_add_groups(struct device *dev, 1134 - const struct attribute_group **groups); 1134 + const struct attribute_group *const *groups); 1135 1135 void device_remove_groups(struct device *dev, 1136 - const struct attribute_group **groups); 1136 + const struct attribute_group *const *groups); 1137 1137 1138 1138 static inline int __must_check device_add_group(struct device *dev, 1139 1139 const struct attribute_group *grp)