Hi folks, While access to the V4L2 device nodes was conveniently serialised for devices the drivers of which used the V4L2 framework, this was no the case for sub-devices that also may be called from other drivers. Instead acquire the lock to the v4l2_subdev_call macro. This set adds the capability to the framework and makes smiapp use it. This is a big change. I'm still not posting this as RFC as the feature is entirely optional. Albeit I'd expect new drivers to use it in the future: quite a bit of code was removed from the smiapp driver as a result (there were other cleanups, too). Generally drivers that handle multiple sub-devices need to take special care when making nested calls (hopefully as few as possible, but starting streaming comes to mind). We may need an unlocked variant of the macro as well. Sakari Ailus (6): v4l: subdev: Set sd->devnode before registering the subdev v4l: subdev: Provide a locking scheme for subdev operations smiapp: Error handling cleanups and fixes smiapp: Rely on V4L2 sub-device framework to do the locking smiapp: Remove the active field from sensor's struct smiapp: Avoid fall-through in switch drivers/media/i2c/smiapp/smiapp-core.c | 203 ++++++++----------------- drivers/media/i2c/smiapp/smiapp-regs.c | 3 - drivers/media/i2c/smiapp/smiapp.h | 1 - drivers/media/v4l2-core/v4l2-device.c | 3 +- include/media/v4l2-subdev.h | 25 ++- 5 files changed, 86 insertions(+), 149 deletions(-) -- 2.20.1