[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101130205533.GA7057@kroah.com>
Date: Tue, 30 Nov 2010 12:55:33 -0800
From: Greg KH <greg@...ah.com>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@....de>,
Jonathan Corbet <corbet@....net>, linux-kernel@...r.kernel.org,
Linux Media Mailing List <linux-media@...r.kernel.org>
Subject: Re: [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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists