From: Greg KH <greg@kroah.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org,
Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH/RFC] core: add a function to safely try to get device driver owner
Date: Tue, 30 Nov 2010 12:55:33 -0800 [thread overview]
Message-ID: <20101130205533.GA7057@kroah.com> (raw)
In-Reply-To: <201011302143.09966.laurent.pinchart@ideasonboard.com>
On Tue, Nov 30, 2010 at 09:43:09PM +0100, Laurent Pinchart wrote:
> > > The way we deal with this is to try_module_get() on the OMAP3 ISP driver
> > > in the subdev open() handlers. I'm of course opened to alternatives.
> >
> > Do it like the rest of the kernel does it, lock the module in place with
> > the module pointer it passed to you before calling open in that module.
> > Nothing new here at all.
>
> That doesn't work in this case, because we have two modules. Module A is the
> master and instantiates an I2C device handled by module B. Module B creates a
> character device and sets itself as the owner. When the corresponding device
> node is opened, module B's refcount is incremented, but module A refcount
> isn't, even though module B can call to module A through board code using
> function pointers provided in the platform data.
Again, this is something we have been doing for years just fine. Look
at the usb-serial core. It "owns" the device node yet the child drivers
are the ones actually handling the data.
Just never call the function pointer unless the module is loaded, it's
that simple. If you need to add proper module ownership to the platform
data pointers, so be it.
thanks,
greg k-h
next prev parent reply other threads:[~2010-11-30 21:05 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
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 [this message]
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=20101130205533.GA7057@kroah.com \
--to=greg@kroah.com \
--cc=corbet@lwn.net \
--cc=g.liakhovetski@gmx.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@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