driver core: class: mark the struct class in struct class_interface constant
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 2 Apr 2023 17:58:48 +0000 (19:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Apr 2023 19:42:48 +0000 (21:42 +0200)
The struct class pointer in struct class_interface is never modified, so
mark it as const so that no one accidentally tries to modify it in the
future.

Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/2023040249-handball-gruffly-5da7@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/class.c
include/linux/device/class.h

index 05bce79d3d1912ff09739af96d2924edb592f69f..ad8b9f163fd20b6e0d586f79656445f629a1e8a9 100644 (file)
@@ -498,7 +498,7 @@ EXPORT_SYMBOL_GPL(class_interface_register);
 void class_interface_unregister(struct class_interface *class_intf)
 {
        struct subsys_private *sp;
-       struct class *parent = class_intf->class;
+       const struct class *parent = class_intf->class;
        struct class_dev_iter iter;
        struct device *dev;
 
index 4bf46f9bbb56e15a2fbfe83ea05f662578ff2f4e..53287aa105b8e495e411db3047ffb1ee07949c75 100644 (file)
@@ -217,7 +217,7 @@ ssize_t show_class_attr_string(const struct class *class, const struct class_att
 
 struct class_interface {
        struct list_head        node;
-       struct class            *class;
+       const struct class      *class;
 
        int (*add_dev)          (struct device *, struct class_interface *);
        void (*remove_dev)      (struct device *, struct class_interface *);