diff mbox series

[01/24] driver core: return bool from driver_probe_done

Message ID 20230531125535.676098-2-hch@lst.de
State Accepted
Commit aa5f6ed8c21ec1aa5fd688118d8d5cd87c5ffc1d
Headers show
Series [01/24] driver core: return bool from driver_probe_done | expand

Commit Message

Christoph Hellwig May 31, 2023, 12:55 p.m. UTC
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>
---
 drivers/base/dd.c             | 6 ++----
 include/linux/device/driver.h | 2 +-
 init/do_mounts.c              | 2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)

Comments

Jens Axboe June 5, 2023, 5:22 p.m. UTC | #1
On Wed, 31 May 2023 14:55:12 +0200, Christoph Hellwig wrote:
> 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.
> 
> 

Applied, thanks!

[01/24] driver core: return bool from driver_probe_done
        commit: aa5f6ed8c21ec1aa5fd688118d8d5cd87c5ffc1d
[02/24] PM: hibernate: factor out a helper to find the resume device
        commit: 02b42d58f3898134b900ff3030561099e38adb32
[03/24] PM: hibernate: remove the global snapshot_test variable
        commit: d6545e687271ab27472eebff770f2de6a5f1a464
[04/24] PM: hibernate: move finding the resume device out of software_resume
        commit: cc89c63e2fe37d476357c82390dfb12edcd41cdd
[05/24] init: remove pointless Root_* values
        commit: f5524c3fadba35c075a5131bad74e3041507a694
[06/24] init: rename mount_block_root to mount_root_generic
        commit: e3102722ffe77094ba9e7e46380792b3dd8a7abd
[07/24] init: refactor mount_root
        commit: a6a41d39c2d91ff2543d31b6cc6070f3957e3aea
[08/24] init: pass root_device_name explicitly
        commit: c8643c72bc42781fc169c6498a3902bec447099e
[09/24] init: don't remove the /dev/ prefix from error messages
        commit: 73231b58b1b496d631fa0ecf9fa7f64f5a07c6e3
[10/24] init: handle ubi/mtd root mounting like all other root types
        commit: 07d63cbb67cdb5e2a7720fdd8579b3be979c2d66
[11/24] init: factor the root_wait logic in prepare_namespace into a helper
        commit: 3701c600a3e735b9fbac6f7a73e4c086090c97ca
[12/24] init: move the nfs/cifs/ram special cases out of name_to_dev_t
        commit: c0c1a7dcb6f5db4500e6574294674213bc24940c
[13/24] init: improve the name_to_dev_t interface
        commit: cf056a43121559d3642419917d405c3237ded90a
[14/24] init: clear root_wait on all invalid root= strings
        commit: 079caa35f7863cd9958b4555ae873ea4d352a502
[15/24] block: move the code to do early boot lookup of block devices to block/
        commit: 702f3189e454b3c3c2f3c99dbf30acf41aab707c
[16/24] block: move more code to early-lookup.c
        commit: 7cadcaf1d82618852745e7206fffa2c72c17ce4b
[17/24] dm-snap: simplify the origin_dev == cow_dev check in snapshot_ctr
        commit: 26110d5afe8117d1b505fe735ac709bdf063f4da
[18/24] dm: open code dm_get_dev_t in dm_init_init
        commit: 49177377e910a8fd5cd1388c966d8fbb51075c3c
[19/24] dm: remove dm_get_dev_t
        commit: d4a28d7defe79006e59293a4b43d518ba8483fb0
[20/24] dm: only call early_lookup_bdev from early boot context
        commit: 7a126d5bf975f082281fb9b45d110cd49b7c3ee4
[21/24] PM: hibernate: don't use early_lookup_bdev in resume_store
        commit: 1e8c813b083c4122dfeaa5c3b11028331026e85d
[22/24] mtd: block2mtd: factor the early block device open logic into a helper
        commit: b2baa57475e3a24bb9ad27bb9047ea3be94627f5
[23/24] mtd: block2mtd: don't call early_lookup_bdev after the system is running
        commit: 8d03187ee7328af8e18ef1782289e0b034e75485
[24/24] block: mark early_lookup_bdev as __init
        commit: 2577f53f42947d8ca01666e3444bb7307319ea38

Best regards,
diff mbox series

Patch

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 9c09ca5c4ab68e..878aa7646b37e4 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -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;
 }
 
 /**
diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h
index c244267a67443e..7738f458995fba 100644
--- a/include/linux/device/driver.h
+++ b/include/linux/device/driver.h
@@ -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);
 
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 811e94daf0a84a..2fe7901b5bcfaf 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -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();