Re: [PATCH v2] parport: register driver later

From: Sudip Mukherjee
Date: Tue Apr 05 2016 - 07:55:17 EST


On Mon, Apr 04, 2016 at 11:13:12PM -0700, Linus Torvalds wrote:
> On Mar 6, 2016 7:10 AM, "Sudip Mukherjee" <sudipm.mukherjee@xxxxxxxxx>
> wrote:
>
> >
> > Hi Ross,
> > Can you please test this patch in your setup. This is a respin of the
> > previous patch in another way.
>
> This seems to have the exact same problem as the previous solution: it
> avoids the oops by simply failing the parport registration.
>
> Yes, that gets rid of the oops, but it also means the driver that tries to
> register with the parport subsystem doesn't actually get registered.
>
> What am I missing? Why would that
>
> return -EAGAIN;
>
> be OK, when it historically just worked?

Hi Linus,
It really is an honour that you have taken time to reply to my mail.

It historically used to work because it never used the device model. In
device model we will get a stackdump if some device tries to register
with a bus when the bus itself is not yet registered.

If pardev tried to register with parallel port before parallel port
has actually registered then parport code used to call
get_lowlevel_driver() and even after that if portlist was empty then
pardev used to get NULL when it tried parport_find_number() and it
used to print a warning about "no associated port" and exit. There was
no stackdump.

This fix is actually not ok. This is a temporary fix and the actual fix
should be to implement deffered probe. And I have mentioned that in
https://lkml.org/lkml/2016/3/4/306
"We should actually have some deferred probe here. But considering that
you will be closing your trees soon so a quick fix to solve the problem
for now. We will revisit this when we remove the old api (hopefully v4.7)."


regards
sudip