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 05/12] driver core: class: make class_dev_iter_init() options const
Date: Mon, 13 Mar 2023 19:18:36 +0100	[thread overview]
Message-ID: <20230313181843.1207845-5-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20230313181843.1207845-1-gregkh@linuxfoundation.org>

class_dev_iter_init() does not modify the struct class or the struct
device passed into it, so mark them as const * to enforce that.

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

diff --git a/drivers/base/class.c b/drivers/base/class.c
index 9439c6c7466f..5a60e8895165 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -284,8 +284,8 @@ EXPORT_SYMBOL_GPL(class_destroy);
  * otherwise if it is NULL, the iteration starts at the beginning of
  * the list.
  */
-void class_dev_iter_init(struct class_dev_iter *iter, struct class *class,
-			 struct device *start, const struct device_type *type)
+void class_dev_iter_init(struct class_dev_iter *iter, const struct class *class,
+			 const struct device *start, const struct device_type *type)
 {
 	struct klist_node *start_knode = NULL;
 
diff --git a/include/linux/device/class.h b/include/linux/device/class.h
index cda598fc5fa0..1f5cfae8db88 100644
--- a/include/linux/device/class.h
+++ b/include/linux/device/class.h
@@ -103,8 +103,8 @@ void class_compat_remove_link(struct class_compat *cls, struct device *dev,
 			      struct device *device_link);
 
 extern void class_dev_iter_init(struct class_dev_iter *iter,
-				struct class *class,
-				struct device *start,
+				const struct class *class,
+				const struct device *start,
 				const struct device_type *type);
 extern struct device *class_dev_iter_next(struct class_dev_iter *iter);
 extern void class_dev_iter_exit(struct class_dev_iter *iter);
-- 
2.39.2


  parent reply	other threads:[~2023-03-13 18:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 18:18 [PATCH 01/12] driver core: class: specify the module owner in __class_register() Greg Kroah-Hartman
2023-03-13 18:18 ` [PATCH 02/12] drivers: remove struct module * setting from struct class Greg Kroah-Hartman
2023-03-13 18:18 ` [PATCH 03/12] driver core: class: remove struct module owner out of " Greg Kroah-Hartman
2023-03-13 18:18 ` [PATCH 04/12] driver core: class: remove module * from class_create() Greg Kroah-Hartman
2023-03-15  8:34   ` Benjamin Tissoires
2023-03-13 18:18 ` Greg Kroah-Hartman [this message]
2023-03-13 18:18 ` [PATCH 06/12] driver core: class: make class_for_each_device() options const Greg Kroah-Hartman
2023-03-13 18:18 ` [PATCH 07/12] driver core: class: make class_find_device*() " Greg Kroah-Hartman
2023-03-13 18:18 ` [PATCH 08/12] driver core: class: make class_create/remove_file*() " Greg Kroah-Hartman
2023-03-13 18:18 ` [PATCH 09/12] driver core: device: make device_destroy() take a const class * Greg Kroah-Hartman
2023-03-13 18:18 ` [PATCH 10/12] tpm: fix up the tpm_class shutdown_pre pointer when created Greg Kroah-Hartman
2023-03-14 11:09   ` Jarkko Sakkinen
2023-03-14 12:53     ` Greg Kroah-Hartman
2023-03-14 12:57       ` Jarkko Sakkinen
2023-03-13 18:18 ` [PATCH 11/12] driver core: device: mark struct class in struct device as constant Greg Kroah-Hartman
2023-03-13 18:18 ` [PATCH 12/12] driver core: device: make device_create*() take a const struct class * Greg Kroah-Hartman

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=20230313181843.1207845-5-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