[PATCH] parport: daisy: do not try to load lowlevel driver

From: Sudip Mukherjee
Date: Mon Mar 25 2019 - 17:13:33 EST


Some distros like Suse has an alias for "parport_lowlevel" and that
alias points to "parport_pc". Now when the parport bus registers, it
also initialises the daisy driver as the daisy driver is needed to
check the port when the port is first found. Due to the new device
model daisy driver will now try to find the parallel ports while trying
to register its driver so that it can bind with them. Now, since daisy
driver is loaded while parport bus is initialising the list of parport
is still empty and it tries to load the lowlevel driver, which has an
alias set to parport_pc, now causes a deadlock.

We do not need to search for ports and bind the initial list of ports
to daisy driver as daisy driver is always the first driver to use the
new found parport and we know when the parport bus is registering the
list of parport will always be empty. So, proceed with the daisy_drv
registration even if the list of parport is empty.

Fixes: 1aec4211204d ("parport: daisy: use new parport device model")
Reported-by: Michal Kubecek <mkubecek@xxxxxxx>
Reported-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Tested-by: Michal Kubecek <mkubecek@xxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>
---
drivers/parport/share.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 0171b8dbcdcd..f87948fbfc34 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -274,7 +274,7 @@ static int port_check(struct device *dev, void *dev_drv)
int __parport_register_driver(struct parport_driver *drv, struct module *owner,
const char *mod_name)
{
- if (list_empty(&portlist))
+ if (list_empty(&portlist) && strcmp(drv->name, "daisy_drv"))
get_lowlevel_driver();

if (drv->devmodel) {
--
2.11.0