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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Subject: [PATCH 5/6] driver core: make driver_detach() take a const *
Date: Tue, 11 Jun 2024 15:01:08 +0200	[thread overview]
Message-ID: <20240611130103.3262749-11-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20240611130103.3262749-7-gregkh@linuxfoundation.org>

driver_detach() does not modify the driver itself, so make the pointer
constant.  In doing so, the function driver_allows_async_probing() also
needs to be changed so that the pointer type passes through to that
function properly.

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

diff --git a/drivers/base/base.h b/drivers/base/base.h
index d332b87cde9e..9df8028c3201 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -158,7 +158,7 @@ void bus_remove_driver(struct device_driver *drv);
 void device_release_driver_internal(struct device *dev, const struct device_driver *drv,
 				    struct device *parent);
 
-void driver_detach(struct device_driver *drv);
+void driver_detach(const struct device_driver *drv);
 void driver_deferred_probe_del(struct device *dev);
 void device_set_deferred_probe_reason(const struct device *dev, struct va_format *vaf);
 static inline int driver_match_device(struct device_driver *drv,
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index c24eca917d41..76b26096b033 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -863,7 +863,7 @@ static int __init save_async_options(char *buf)
 }
 __setup("driver_async_probe=", save_async_options);
 
-static bool driver_allows_async_probing(struct device_driver *drv)
+static bool driver_allows_async_probing(const struct device_driver *drv)
 {
 	switch (drv->probe_type) {
 	case PROBE_PREFER_ASYNCHRONOUS:
@@ -1333,7 +1333,7 @@ void device_driver_detach(struct device *dev)
  * driver_detach - detach driver from all devices it controls.
  * @drv: driver.
  */
-void driver_detach(struct device_driver *drv)
+void driver_detach(const struct device_driver *drv)
 {
 	struct device_private *dev_prv;
 	struct device *dev;
-- 
2.45.2


  parent reply	other threads:[~2024-06-11 13:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 13:01 [PATCH 1/6] auxbus: make to_auxiliary_drv accept and return a constant pointer Greg Kroah-Hartman
2024-06-11 13:01 ` [PATCH 2/6] driver core: platform: fix ups for constant struct device_driver Greg Kroah-Hartman
2024-06-11 13:01 ` [PATCH 3/6] driver core: driver: mark driver_add/remove_groups constant Greg Kroah-Hartman
2024-06-11 13:01 ` [PATCH 4/6] driver core: make device_release_driver_internal() take a const * Greg Kroah-Hartman
2024-06-11 13:01 ` Greg Kroah-Hartman [this message]
2024-06-11 13:01 ` [PATCH 6/6] driver core: mark async_driver as " Greg Kroah-Hartman
2024-06-11 13:22 ` [PATCH 1/6] auxbus: make to_auxiliary_drv accept and return a constant pointer Mark Brown
2024-06-11 13:56   ` Greg Kroah-Hartman
2024-06-11 13:44 ` Sakari Ailus
2024-06-11 13:56   ` Greg Kroah-Hartman
2024-06-11 13:50 ` Przemek Kitszel
2024-06-12  8:20   ` Greg Kroah-Hartman
2024-06-12  8:15 ` Martin Habets

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=20240611130103.3262749-11-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