Re: [PATCH 1/1] v4l: subdev: Serialise open and release internal ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/22/2015 06:14 PM, Sakari Ailus wrote:
> By default, serialise open and release internal ops using a mutex.
> 
> The underlying problem is that a large proportion of the drivers do use

Well, the only one I found that does this is the flash-led-class :-)

But you are correct in your reply to my comments that the lock has to be
taken in v4l2-subdev.c and not in the driver.

<snip>

> +static void subdev_open_lock(struct v4l2_subdev *sd)
> +{
> +	if (sd->flags & V4L2_SUBDEV_FL_SERIALISE_OPEN)
> +		mutex_lock(&sd->open_lock);
> +}
> +
> +static void subdev_open_unlock(struct v4l2_subdev *sd)
> +{
> +	if (sd->flags & V4L2_SUBDEV_FL_SERIALISE_OPEN)
> +		mutex_unlock(&sd->open_lock);
> +}

I really dislike this flag. Also, I think there are more problems here since
none of the ioctls are serialized so you depend on the driver to get that
right.

My suggestion would be to add a struct mutex *lock pointer to struct v4l2_subdev,
and, if non-NULL, then take that lock for both open/close and ioctls (you take
the lock in subdev_ioctl()).

This is similar to struct video_device and you don't need a flag. In addition,
drivers can provide their own lock.

Regards,

	Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux