public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] parport: register driver later
Date: Sun, 6 Mar 2016 17:12:25 -0800	[thread overview]
Message-ID: <20160307011225.GA6588@kroah.com> (raw)
In-Reply-To: <20160306175612.GA10487@sudip-laptop>

On Sun, Mar 06, 2016 at 11:26:29PM +0530, Sudip Mukherjee wrote:
> On Sat, Mar 05, 2016 at 12:19:32PM -0800, Greg KH wrote:
> > On Fri, Mar 04, 2016 at 04:20:59PM +0530, Sudip Mukherjee wrote:
> > > If the parport bus is not yet registered and any device using parallel
> > > port tries to register with the bus we get a stackdump with a message
> > > of Kernel bug.
> > > 
> > > Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> > > Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > > Cc: <stable@vger.kernel.org> # 4.2+ 
> > > Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> > > ---
> > > 
> > > 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).
> > > 
> > >  drivers/parport/share.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/drivers/parport/share.c b/drivers/parport/share.c
> > > index 3308427..176b2b6 100644
> > > --- a/drivers/parport/share.c
> > > +++ b/drivers/parport/share.c
> > > @@ -273,6 +273,9 @@ int __parport_register_driver(struct parport_driver *drv, struct module *owner,
> > >  		/* using device model */
> > >  		int ret;
> > >  
> > > +		if (!parport_bus_type.p)
> > > +			return -EAGAIN;
> > 
> > I really don't like it when busses poke into the driver-core
> > internal-only structures like this.  Why can't you have your own "have
> > been registered" flag instead if you really need it?  Don't rely on the
> > driver core here to be doing this always this way, perhaps p could be
> > NULL and it only is created later on somehow?
> 
> I saw that in i2c and spmi and followed. Sent you v2 for your review. I
> will send a patch to remove the use of 'p' in those places.

Thanks, that would be great.

> > I need to rename 'p' to "do_not_touch_you_have_been_warned" or something
> > else...
> 
> something like this (compile tested) ?
> (do you want me to send a proper patch?):

Heh, no, it was kind of a joke, there's probably a better way to do it
without making the driver core look like a mess...

thanks,

greg k-h

      reply	other threads:[~2016-03-07  1:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04 10:50 [PATCH] parport: register driver later Sudip Mukherjee
2016-03-05 20:19 ` Greg KH
2016-03-06 17:56   ` Sudip Mukherjee
2016-03-07  1:12     ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160307011225.GA6588@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox