lkml.org 
[lkml]   [2010]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH/RFC] core: add a function to safely try to get device driver owner
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


\
 
 \ /
  Last update: 2010-11-30 22:07    [W:0.174 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site