public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Jonathan Corbet <corbet@lwn.net>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH/RFC] core: add a function to safely try to get device driver owner
Date: Tue, 30 Nov 2010 08:56:14 -0800	[thread overview]
Message-ID: <20101130165614.GA18564@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1011300009500.27962@axis700.grange>

On Tue, Nov 30, 2010 at 12:11:42AM +0100, Guennadi Liakhovetski wrote:
> On Mon, 29 Nov 2010, Greg KH wrote:
> 
> > On Mon, Nov 29, 2010 at 11:10:50PM +0100, Guennadi Liakhovetski wrote:
> > > On Mon, 29 Nov 2010, Greg KH wrote:
> > > 
> > > > On Mon, Nov 29, 2010 at 09:54:10PM +0100, Guennadi Liakhovetski wrote:
> > > > > Hi Jon
> > > > > 
> > > > > On Mon, 29 Nov 2010, Jonathan Corbet wrote:
> > > > > 
> > > > > > On Mon, 29 Nov 2010 20:43:28 +0100 (CET)
> > > > > > Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:
> > > > > > 
> > > > > > > When two drivers interoperate without an explicit dependency, it is often
> > > > > > > required to prevent one of them from being unloaded safely by dereferencing
> > > > > > > dev->driver->owner. This patch provides a generic function to do this in a
> > > > > > > race-free way.
> > > > > > 
> > > > > > I must ask: why not, instead, make the dependency explicit?  In
> > > > > > particular, this looks like an application for the proposed media
> > > > > > controller code, which is meant to model the connections between otherwise
> > > > > > independent devices.  The fact that your example comes from V4L2 (which is
> > > > > > the current domain of the media controller) also argues that way.
> > > > > 
> > > > > Sorry, don't see a good way to do this. This function is for a general 
> > > > > dependency, where you don't have that driver, we are checking for register 
> > > > > with us, so, the only way to get to it is via dev->driver->owner.
> > > > 
> > > > Wait, what?  The device is already bound to a driver, right, so why
> > > > would you care about "locking" the module into memory?  What could this
> > > > possibly be used for?
> > > 
> > > To protect against rmmod -> driver_unregister -> dev->driver = NULL?
> > 
> > But again, why would some other driver ever care about what some random
> > dev->driver would be?
> 
> It's not a random one, call it a "companion device."

Ok, but again go back to Jon's original proposal to just call the
functions in that driver from yours, causing the implicit module
ordering issue to be automatically resolved.

thanks,

greg k-h

  reply	other threads:[~2010-11-30 16:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29 19:43 [PATCH/RFC] core: add a function to safely try to get device driver owner Guennadi Liakhovetski
2010-11-29 19:56 ` Greg KH
2010-11-29 20:11   ` Guennadi Liakhovetski
2010-11-29 20:17 ` Jonathan Corbet
2010-11-29 20:54   ` Guennadi Liakhovetski
2010-11-29 21:41     ` Greg KH
2010-11-29 22:10       ` Guennadi Liakhovetski
2010-11-29 22:28         ` Jonathan Corbet
2010-11-30  7:18           ` Guennadi Liakhovetski
2010-11-29 22:32         ` Greg KH
2010-11-29 23:11           ` Guennadi Liakhovetski
2010-11-30 16:56             ` Greg KH [this message]
2010-11-30 17:09               ` Guennadi Liakhovetski
2010-11-30 17:15                 ` Greg KH
2010-11-30 17:55                   ` Laurent Pinchart
2010-11-30 18:32                     ` Greg KH
2010-11-30 20:43                       ` Laurent Pinchart
2010-11-30 20:55                         ` Greg KH
2010-11-30 22:19                         ` Hans Verkuil

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=20101130165614.GA18564@kroah.com \
    --to=greg@kroah.com \
    --cc=corbet@lwn.net \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    /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