public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: rafael@kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH 1/5] driver core: class: mark class_release() as taking a const *
Date: Sun,  2 Apr 2023 19:58:46 +0200	[thread overview]
Message-ID: <2023040248-outrage-obsolete-5a9a@gregkh> (raw)
In-Reply-To: <2023040244-duffel-pushpin-f738@gregkh>

The struct class callback, class_release(), is only called in 2 places,
the pcmcia cardservices code, and in the class driver core code.  Both
places it is safe to mark the structure as a const *, to allow us to
in the future mark all struct class usages as constant and move into
read-only memory.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/class.c         | 2 +-
 drivers/pcmcia/cs.c          | 2 +-
 include/linux/device/class.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/class.c b/drivers/base/class.c
index 65502bd7d5c5..53fc7052340c 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -235,7 +235,7 @@ void class_unregister(const struct class *cls)
 }
 EXPORT_SYMBOL_GPL(class_unregister);
 
-static void class_create_release(struct class *cls)
+static void class_create_release(const struct class *cls)
 {
 	pr_debug("%s called for %s\n", __func__, cls->name);
 	kfree(cls);
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index e3224e49c43f..5658745c398f 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -824,7 +824,7 @@ static int pcmcia_socket_uevent(const struct device *dev,
 
 static struct completion pcmcia_unload;
 
-static void pcmcia_release_socket_class(struct class *data)
+static void pcmcia_release_socket_class(const struct class *data)
 {
 	complete(&pcmcia_unload);
 }
diff --git a/include/linux/device/class.h b/include/linux/device/class.h
index 7e4a1a6329f4..f3c418fa129a 100644
--- a/include/linux/device/class.h
+++ b/include/linux/device/class.h
@@ -58,7 +58,7 @@ struct class {
 	int (*dev_uevent)(const struct device *dev, struct kobj_uevent_env *env);
 	char *(*devnode)(const struct device *dev, umode_t *mode);
 
-	void (*class_release)(struct class *class);
+	void (*class_release)(const struct class *class);
 	void (*dev_release)(struct device *dev);
 
 	int (*shutdown_pre)(struct device *dev);
-- 
2.40.0


  reply	other threads:[~2023-04-02 17:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-02 17:58 [PATCH 0/5] driver core: class: allow struct class to be static Greg Kroah-Hartman
2023-04-02 17:58 ` Greg Kroah-Hartman [this message]
2023-04-03 17:55   ` [PATCH 1/5] driver core: class: mark class_release() as taking a const * Rafael J. Wysocki
2023-04-02 17:58 ` [PATCH 2/5] driver core: class: make class_register() take " Greg Kroah-Hartman
2023-04-03 17:57   ` Rafael J. Wysocki
2023-04-02 17:58 ` [PATCH 3/5] driver core: class: mark the struct class in struct class_interface constant Greg Kroah-Hartman
2023-04-03 17:57   ` Rafael J. Wysocki
2023-04-02 17:58 ` [PATCH 4/5] driver core: class: remove struct class_interface * from callbacks Greg Kroah-Hartman
2023-04-03 15:43   ` Logan Gunthorpe
2023-04-03 17:59   ` Rafael J. Wysocki
2023-04-04 13:57   ` Guenter Roeck
2023-04-02 17:58 ` [PATCH 5/5] tty: make tty_class a static const structure Greg Kroah-Hartman
2023-04-03  5:47   ` Jiri Slaby

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=2023040248-outrage-obsolete-5a9a@gregkh \
    --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