parport: daisy: do not try to load lowlevel driver
Sudip Mukherjee
maintainerPATCH 1/1 parport: daisy: do not try to load lowlevel driver
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.
--- drivers/parport/share.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parport/share.c +1 -1
@@ -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) {
Signature · 1 line
2.11.0
Quoted 6 lines · Sudip Mukherjee
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_drvregistration even if the list of parport is empty.
This is completely hacky and senseless.
The problem as far as I can tell is that the daisy driver shouldn't register early at all, and shouldn't be a subsys initcall. It should just be a driver initcall, and happen naturally after the parport subsystem has been initialized.
This patch just makes the code even *less* understandable.
I'm going to revert that problematic commit.
If you can get it working without that incorrect and senseless tie-in of the daisy driver registration with the regular partport init sequence, we can revisit this.
Linus
Sudip Mukherjee
maintainerHi Linus,
Quoted 11 lines · Linus Torvalds
Quoted 6 lines · Sudip Mukherjee
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_drvregistration even if the list of parport is empty.This is completely hacky and senseless.
I admit its hacky. :(
Quoted 5 lines
The problem as far as I can tell is that the daisy driver shouldn't register early at all, and shouldn't be a subsys initcall. It should just be a driver initcall, and happen naturally after the parport subsystem has been initialized.
yes, but the daisy driver has to be the first one to register even before any of the ports have actually registered and then it will try to load the lowlevel driver. In x86, parport_pc will register the port and then announce it. When the port is announced daisy_driver should check that port and this happens even before the port is added to the list. So, we will always be in this situation that when daisy driver registers the port list is empty.
Quoted 8 lines
This patch just makes the code even *less* understandable.
I'm going to revert that problematic commit.
If you can get it working without that incorrect and senseless tie-in of the daisy driver registration with the regular partport init sequence, we can revisit this.
I will find a better way to do this.
Signature · 2 lines
Regards Sudip
Quoted 16 lines · On Mon, 25 Mar 2019 21:13:25 +0000 Sudip Mukherjee…
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 toparport_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_drvregistration even if the list of parport is empty.
Quoted 6 lines
Fixes 1aec4211204d ("parport: daisy: use new parport device model")Reported-by Michal Kubecek <[email protected]>Reported-by Steven Rostedt <[email protected]>Tested-by Michal Kubecek <[email protected]>Cc Linus Torvalds <[email protected]>Signed-off-by Sudip Mukherjee <[email protected]>
-- Steve