From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Subject: [PATCH] driver core: bus: constify class_unregister/destroy()
Date: Sat, 25 Mar 2023 09:45:26 +0100 [thread overview]
Message-ID: <20230325084526.3622123-1-gregkh@linuxfoundation.org> (raw)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/class.c | 8 ++++----
include/linux/device/class.h | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/base/class.c b/drivers/base/class.c
index dbaeb79ae917..41a6a10da8dd 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -142,13 +142,13 @@ static void klist_class_dev_put(struct klist_node *n)
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)
{
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)
{
return sysfs_remove_groups(&cls->p->subsys.kobj, groups);
@@ -206,7 +206,7 @@ int class_register(struct class *cls)
}
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);
class_remove_groups(cls, cls->class_groups);
@@ -266,7 +266,7 @@ EXPORT_SYMBOL_GPL(class_create);
* Note, the pointer to be destroyed must have been created with a call
* to class_create().
*/
-void class_destroy(struct class *cls)
+void class_destroy(const struct class *cls)
{
if (IS_ERR_OR_NULL(cls))
return;
diff --git a/include/linux/device/class.h b/include/linux/device/class.h
index 1dc7706cb42d..59af129f77e1 100644
--- a/include/linux/device/class.h
+++ b/include/linux/device/class.h
@@ -84,7 +84,7 @@ extern struct kobject *sysfs_dev_block_kobj;
extern struct kobject *sysfs_dev_char_kobj;
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 *class_compat_register(const char *name);
@@ -232,6 +232,6 @@ int __must_check class_interface_register(struct class_interface *);
void class_interface_unregister(struct class_interface *);
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_ */
--
2.40.0
reply other threads:[~2023-03-25 8:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230325084526.3622123-1-gregkh@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox