2016-03-20 17:08:49

by Jann Horn

[permalink] [raw]
Subject: [PATCH] drivers: fix link order

Since commit e7223f186033 ("ppdev: use new parport device model"),
my machine panics on boot, caused by the BUG_ON(!drv->bus->p) in
drivers/base/driver.c, called via
ppdev_init() -> parport_register_driver().

The problem is that parport_bus_init(), which initializes
parport_bus_type.p, is only called in an __init method in
drivers/parport/procfs.c, which has not been called yet at the time
ppdev_init(), an __init method in drivers/char/ppdev.c, is called
if the latter is compiled into the kernel (and not a module).

Let's hope this change doesn't break any other stuff? It
works for me.

Signed-off-by: Jann Horn <[email protected]>
---
drivers/Makefile | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 8f5d076..68bc38f 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -45,6 +45,9 @@ obj-$(CONFIG_REGULATOR) += regulator/
# reset controllers early, since gpu drivers might rely on them to initialize
obj-$(CONFIG_RESET_CONTROLLER) += reset/

+# parport/ before char/ because ppdev_init() depends on parport_bus_init()
+obj-$(CONFIG_PARPORT) += parport/
+
# tty/ comes before char/ so that the VT console is the boot-time
# default.
obj-y += tty/
@@ -62,7 +65,6 @@ obj-$(CONFIG_CONNECTOR) += connector/
obj-$(CONFIG_FB_I810) += video/fbdev/i810/
obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/

-obj-$(CONFIG_PARPORT) += parport/
obj-$(CONFIG_NVM) += lightnvm/
obj-y += base/ block/ misc/ mfd/ nfc/
obj-$(CONFIG_LIBNVDIMM) += nvdimm/
--
2.1.4