[PATCH 17/19] init: factor out root device lookup into lookup_root_device()

From: Vincent Mailhol

Date: Mon Jun 15 2026 - 12:24:15 EST


DPS root detection will also need to work if root_wait is set, meaning
that wait_for_root() needs to handle the DPS logic.

Move early_lookup_bdev() out of wait_for_root() into the new
lookup_root_device() so later changes can extend the lookup policy
without duplicating the retry logic.

Signed-off-by: Vincent Mailhol <mailhol@xxxxxxxxxx>
---
init/do_mounts.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 95e0b3a0f711..5fb5aeb88da9 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -402,6 +402,11 @@ void __init mount_root(char *root_device_name)
}
}

+static int __init lookup_root_device(char *root_device_name)
+{
+ return early_lookup_bdev(root_device_name, &ROOT_DEV);
+}
+
/* wait for any asynchronous scanning to complete */
static void __init wait_for_root(char *root_device_name)
{
@@ -415,7 +420,7 @@ static void __init wait_for_root(char *root_device_name)
end = ktime_add_ms(ktime_get_raw(), root_wait);

while (!driver_probe_done() ||
- early_lookup_bdev(root_device_name, &ROOT_DEV) < 0) {
+ lookup_root_device(root_device_name) < 0) {
msleep(5);
if (root_wait > 0 && ktime_after(ktime_get_raw(), end))
break;

--
2.53.0