Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

driver core: return bool from driver_probe_done

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>

authored by

Christoph Hellwig and committed by
Jens Axboe
aa5f6ed8 dd2e31af

+4 -6
+2 -4
drivers/base/dd.c
··· 751 751 * 752 752 * Should somehow figure out how to use a semaphore, not an atomic variable... 753 753 */ 754 - int driver_probe_done(void) 754 + bool __init driver_probe_done(void) 755 755 { 756 756 int local_probe_count = atomic_read(&probe_count); 757 757 758 758 pr_debug("%s: probe_count = %d\n", __func__, local_probe_count); 759 - if (local_probe_count) 760 - return -EBUSY; 761 - return 0; 759 + return !local_probe_count; 762 760 } 763 761 764 762 /**
+1 -1
include/linux/device/driver.h
··· 126 126 void driver_unregister(struct device_driver *drv); 127 127 128 128 struct device_driver *driver_find(const char *name, const struct bus_type *bus); 129 - int driver_probe_done(void); 129 + bool __init driver_probe_done(void); 130 130 void wait_for_device_probe(void); 131 131 void __init wait_for_init_devices_probe(void); 132 132
+1 -1
init/do_mounts.c
··· 635 635 if ((ROOT_DEV == 0) && root_wait) { 636 636 printk(KERN_INFO "Waiting for root device %s...\n", 637 637 saved_root_name); 638 - while (driver_probe_done() != 0 || 638 + while (!driver_probe_done() || 639 639 (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0) 640 640 msleep(5); 641 641 async_synchronize_full();