driver core: return bool from driver_probe_done
authorChristoph Hellwig <hch@lst.de>
Wed, 31 May 2023 12:55:12 +0000 (14:55 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 5 Jun 2023 16:55:20 +0000 (10:55 -0600)
bool is the most sensible return value for a yes/no return.  Also
add __init as this funtion is only called from the early boot code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230531125535.676098-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/base/dd.c
include/linux/device/driver.h
init/do_mounts.c

index 9c09ca5..878aa76 100644 (file)
@@ -751,14 +751,12 @@ static int really_probe_debug(struct device *dev, struct device_driver *drv)
  *
  * Should somehow figure out how to use a semaphore, not an atomic variable...
  */
-int driver_probe_done(void)
+bool __init driver_probe_done(void)
 {
        int local_probe_count = atomic_read(&probe_count);
 
        pr_debug("%s: probe_count = %d\n", __func__, local_probe_count);
-       if (local_probe_count)
-               return -EBUSY;
-       return 0;
+       return !local_probe_count;
 }
 
 /**
index c244267..7738f45 100644 (file)
@@ -126,7 +126,7 @@ int __must_check driver_register(struct device_driver *drv);
 void driver_unregister(struct device_driver *drv);
 
 struct device_driver *driver_find(const char *name, const struct bus_type *bus);
-int driver_probe_done(void);
+bool __init driver_probe_done(void);
 void wait_for_device_probe(void);
 void __init wait_for_init_devices_probe(void);
 
index 811e94d..2fe7901 100644 (file)
@@ -635,7 +635,7 @@ void __init prepare_namespace(void)
        if ((ROOT_DEV == 0) && root_wait) {
                printk(KERN_INFO "Waiting for root device %s...\n",
                        saved_root_name);
-               while (driver_probe_done() != 0 ||
+               while (!driver_probe_done() ||
                        (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0)
                        msleep(5);
                async_synchronize_full();