From: Greg Kroah-Hartman Date: Sun, 2 Apr 2023 17:58:48 +0000 (+0200) Subject: driver core: class: mark the struct class in struct class_interface constant X-Git-Tag: v6.6.7~2982^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b0d49be81cf4f1cf30ebd079cbf4643cab0a01d;p=platform%2Fkernel%2Flinux-starfive.git driver core: class: mark the struct class in struct class_interface constant 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 Link: https://lore.kernel.org/r/2023040249-handball-gruffly-5da7@gregkh Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/base/class.c b/drivers/base/class.c index 05bce79d..ad8b9f1 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -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; diff --git a/include/linux/device/class.h b/include/linux/device/class.h index 4bf46f9..53287aa 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -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 *);