[ 3.5.y.z extended stable ] Patch "drivercore: Fix ordering between deferred_probe and exiting" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Tue Feb 26 16:14:34 UTC 2013

This is a note to let you know that I have just added a patch titled

    drivercore: Fix ordering between deferred_probe and exiting

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:


If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



>From ce5dd6f6d9d809c3a048270f380fa44852a0fce5 Mon Sep 17 00:00:00 2001
From: Grant Likely <grant.likely at secretlab.ca>
Date: Thu, 14 Feb 2013 18:14:27 +0000
Subject: [PATCH] drivercore: Fix ordering between deferred_probe and exiting

commit d72cca1eee5b26e313da2a380d4862924e271031 upstream.

One of the side effects of deferred probe is that some drivers which
used to be probed before initcalls completed are now happening slightly
later. This causes two problems.
- If a console driver gets deferred, then it may not be ready when
  userspace starts. For example, if a uart depends on pinctrl, then the
  uart will get deferred and /dev/console will not be available
- __init sections will be discarded before built-in drivers are probed.
  Strictly speaking, __init functions should not be called in a drivers
  __probe path, but there are a lot of drivers (console stuff again)
  that do anyway. In the past it was perfectly safe to do so because all
  built-in drivers got probed before the end of initcalls.

This patch fixes the problem by forcing the first pass of the deferred
list to complete at late_initcall time. This is late enough to catch the
drivers that are known to have the above issues.

Signed-off-by: Grant Likely <grant.likely at secretlab.ca>
Tested-by: Haojian Zhuang <haojian.zhuang at linaro.org>
Cc: Arnd Bergmann <arnd at arndb.de>
Cc: Russell King <linux at arm.linux.org.uk>
Cc: Linus Torvalds <torvalds at linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
 drivers/base/dd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 4b01ab3..82ff801 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -161,6 +161,8 @@ static int deferred_probe_initcall(void)

 	driver_deferred_probe_enable = true;
+	/* Sort as many dependencies as possible before exiting initcalls */
+	flush_workqueue(deferred_wq);
 	return 0;

More information about the kernel-team mailing list