Commit 7bbb89b4 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

driver core: change to_subsys_private() to use container_of_const()

The macro to_subsys_private() needs to switch to using
container_of_const() as it turned out to being incorrectly casting a
const pointer to a non-const one.  Make this change and fix up the one
offending user to be correctly handling a const pointer properly.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Reviewed-by: default avatarRafael J. Wysocki <rafael@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230111093327.3955063-1-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3bb2a01c
...@@ -53,7 +53,7 @@ struct subsys_private { ...@@ -53,7 +53,7 @@ struct subsys_private {
struct kset glue_dirs; struct kset glue_dirs;
struct class *class; struct class *class;
}; };
#define to_subsys_private(obj) container_of(obj, struct subsys_private, subsys.kobj) #define to_subsys_private(obj) container_of_const(obj, struct subsys_private, subsys.kobj)
struct driver_private { struct driver_private {
struct kobject kobj; struct kobject kobj;
......
...@@ -64,7 +64,7 @@ static void class_release(struct kobject *kobj) ...@@ -64,7 +64,7 @@ static void class_release(struct kobject *kobj)
static const struct kobj_ns_type_operations *class_child_ns_type(const struct kobject *kobj) static const struct kobj_ns_type_operations *class_child_ns_type(const struct kobject *kobj)
{ {
struct subsys_private *cp = to_subsys_private(kobj); const struct subsys_private *cp = to_subsys_private(kobj);
struct class *class = cp->class; struct class *class = cp->class;
return class->ns_type; return class->ns_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment