driver core: make driver_detach() take a const *
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jun 2024 13:01:08 +0000 (15:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Jun 2024 14:43:54 +0000 (16:43 +0200)
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>
Link: https://lore.kernel.org/r/20240611130103.3262749-11-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/base.h
drivers/base/dd.c

index d332b87cde9eb67e5b68c135755a4a70563a73a2..9df8028c32019ffebe0cf8eabd8f909b5780deb2 100644 (file)
@@ -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,
index c24eca917d413fdcdc168218d7c46d9716c0be9d..76b26096b033c338c9079cad4fc6668b1c43cad4 100644 (file)
@@ -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;