Hi Greg,
On Tuesday 30 November 2010 18:15:09 Greg KH wrote:
wrote:
[snip]
It depends on your definition of rude. I would consider the kernel even more
rude if it accepted my unload request and then crashed.
I've recently run into a problem similar to Guennadi's with the OMAP3 ISP
driver. The driver instantiates several V4L2 I2C sub-devices for the camera
sensors and the lens and flash controllers. The sub-device drivers get
platform data when they're probed, and receive callbacks to the board code to
turn power on/off and configure clocks (it's a bit more complex than just
that, but you get the idea). The board code callbacks then call to the OMAP3
ISP driver to configure clocks, because the sensor clock is provided by the
OMAP3 ISP.
Now, when the user opens the sensor's subdev device node (/dev/v4l-subdev*),
the subdev open function will turn the sensor clock on. To do that it will
call the OMAP3 ISP driver through board code. If the OMAP3 ISP driver is
unloaded at that point things will go pretty bad.
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.
We need to lock the module in place if its code can be called from another
driver. Coming up with a lock-free way to handle this would be similar to
removing the try_module_get() call from cdev_get(). Maybe it could be done,
but I'm not sure it should.
--
Regards,
Laurent Pinchart
--