]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
driver: core: constify groups array argument in device_add_groups and device_remove_g...
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 1 Mar 2026 12:31:02 +0000 (13:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Mar 2026 09:21:31 +0000 (10:21 +0100)
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>
drivers/base/core.c
include/linux/device.h

index 791f9e444df8d31458f0c07844d9bf56172d9c73..f497b724332ad02e4aa926deb1bd77f0dbc046ec 100644 (file)
@@ -2831,14 +2831,15 @@ static ssize_t removable_show(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RO(removable);
 
-int device_add_groups(struct device *dev, const struct attribute_group **groups)
+int device_add_groups(struct device *dev,
+                     const struct attribute_group *const *groups)
 {
        return sysfs_create_groups(&dev->kobj, groups);
 }
 EXPORT_SYMBOL_GPL(device_add_groups);
 
 void device_remove_groups(struct device *dev,
-                         const struct attribute_group **groups)
+                         const struct attribute_group *const *groups)
 {
        sysfs_remove_groups(&dev->kobj, groups);
 }
index 0be95294b6e61577b43b489d84d8c5a391d73f66..48a0444ccc1eebdaed1ef416435346b8a7c3d8c9 100644 (file)
@@ -1131,9 +1131,9 @@ device_create_with_groups(const struct class *cls, struct device *parent, dev_t
 void device_destroy(const struct class *cls, dev_t devt);
 
 int __must_check device_add_groups(struct device *dev,
-                                  const struct attribute_group **groups);
+                                  const struct attribute_group *const *groups);
 void device_remove_groups(struct device *dev,
-                         const struct attribute_group **groups);
+                         const struct attribute_group *const *groups);
 
 static inline int __must_check device_add_group(struct device *dev,
                                        const struct attribute_group *grp)