Commit 517d4927 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

driver core: bus: constify class_unregister/destroy()

The class_unregister() and class_destroy() function should be taking a
const * to struct class, not just a *, so fix that up.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Link: https://lore.kernel.org/r/20230325084526.3622123-1-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2f9e87f5
...@@ -142,13 +142,13 @@ static void klist_class_dev_put(struct klist_node *n) ...@@ -142,13 +142,13 @@ static void klist_class_dev_put(struct klist_node *n)
put_device(dev); put_device(dev);
} }
static int class_add_groups(struct class *cls, static int class_add_groups(const struct class *cls,
const struct attribute_group **groups) const struct attribute_group **groups)
{ {
return sysfs_create_groups(&cls->p->subsys.kobj, groups); return sysfs_create_groups(&cls->p->subsys.kobj, groups);
} }
static void class_remove_groups(struct class *cls, static void class_remove_groups(const struct class *cls,
const struct attribute_group **groups) const struct attribute_group **groups)
{ {
return sysfs_remove_groups(&cls->p->subsys.kobj, groups); return sysfs_remove_groups(&cls->p->subsys.kobj, groups);
...@@ -206,7 +206,7 @@ int class_register(struct class *cls) ...@@ -206,7 +206,7 @@ int class_register(struct class *cls)
} }
EXPORT_SYMBOL_GPL(class_register); EXPORT_SYMBOL_GPL(class_register);
void class_unregister(struct class *cls) void class_unregister(const struct class *cls)
{ {
pr_debug("device class '%s': unregistering\n", cls->name); pr_debug("device class '%s': unregistering\n", cls->name);
class_remove_groups(cls, cls->class_groups); class_remove_groups(cls, cls->class_groups);
...@@ -265,7 +265,7 @@ EXPORT_SYMBOL_GPL(class_create); ...@@ -265,7 +265,7 @@ EXPORT_SYMBOL_GPL(class_create);
* Note, the pointer to be destroyed must have been created with a call * Note, the pointer to be destroyed must have been created with a call
* to class_create(). * to class_create().
*/ */
void class_destroy(struct class *cls) void class_destroy(const struct class *cls)
{ {
if (IS_ERR_OR_NULL(cls)) if (IS_ERR_OR_NULL(cls))
return; return;
......
...@@ -83,7 +83,7 @@ struct class_dev_iter { ...@@ -83,7 +83,7 @@ struct class_dev_iter {
extern struct kobject *sysfs_dev_block_kobj; extern struct kobject *sysfs_dev_block_kobj;
int __must_check class_register(struct class *class); int __must_check class_register(struct class *class);
void class_unregister(struct class *class); void class_unregister(const struct class *class);
struct class_compat; struct class_compat;
struct class_compat *class_compat_register(const char *name); struct class_compat *class_compat_register(const char *name);
...@@ -231,6 +231,6 @@ int __must_check class_interface_register(struct class_interface *); ...@@ -231,6 +231,6 @@ int __must_check class_interface_register(struct class_interface *);
void class_interface_unregister(struct class_interface *); void class_interface_unregister(struct class_interface *);
struct class * __must_check class_create(const char *name); struct class * __must_check class_create(const char *name);
void class_destroy(struct class *cls); void class_destroy(const struct class *cls);
#endif /* _DEVICE_CLASS_H_ */ #endif /* _DEVICE_CLASS_H_ */
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