]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
driver core: constify group arrays arguments in driver_add_groups and driver_remove_g...
authorHeiner Kallweit <hkallweit1@gmail.com>
Mon, 16 Mar 2026 22:09:37 +0000 (23:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 May 2026 11:32:05 +0000 (13:32 +0200)
Constify the groups array argument in driver_add_groups and
driver_remove_groups. This allows to pass constant arrays as
arguments.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/21a1e5f1-c6a0-4f6f-aa86-1e6abd25f9c6@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/base.h
drivers/base/driver.c

index 483b99b4fa3d70fb3d7356659518e56929653cb3..a5b7abc10ff02c79d5305e6473d855fcba8cab45 100644 (file)
@@ -194,8 +194,10 @@ static inline void dev_sync_state(struct device *dev)
                dev->driver->sync_state(dev);
 }
 
-int driver_add_groups(const struct device_driver *drv, const struct attribute_group **groups);
-void driver_remove_groups(const struct device_driver *drv, const struct attribute_group **groups);
+int driver_add_groups(const struct device_driver *drv,
+                     const struct attribute_group *const *groups);
+void driver_remove_groups(const struct device_driver *drv,
+                         const struct attribute_group *const *groups);
 void device_driver_detach(struct device *dev);
 
 static inline void device_set_driver(struct device *dev, const struct device_driver *drv)
index 8ab010ddf709a2b173cfd0c18610a122e58a2f4c..c5ebf1fdad7580a2ea16f148a852da4f727ac766 100644 (file)
@@ -203,13 +203,13 @@ void driver_remove_file(const struct device_driver *drv,
 EXPORT_SYMBOL_GPL(driver_remove_file);
 
 int driver_add_groups(const struct device_driver *drv,
-                     const struct attribute_group **groups)
+                     const struct attribute_group *const *groups)
 {
        return sysfs_create_groups(&drv->p->kobj, groups);
 }
 
 void driver_remove_groups(const struct device_driver *drv,
-                         const struct attribute_group **groups)
+                         const struct attribute_group *const *groups)
 {
        sysfs_remove_groups(&drv->p->kobj, groups);
 }