From: Hans Verkuil <hverkuil@xs4all.nl>
To: Sakari Ailus <sakari.ailus@linux.intel.com>, linux-media@vger.kernel.org
Cc: j.anaszewski@samsung.com
Subject: Re: [PATCH 1/1] v4l: subdev: Serialise open and release internal ops
Date: Tue, 28 Jul 2015 12:05:08 +0200 [thread overview]
Message-ID: <55B753D4.2080008@xs4all.nl> (raw)
In-Reply-To: <1437581650-1422-1-git-send-email-sakari.ailus@linux.intel.com>
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
prev parent reply other threads:[~2015-07-28 10:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 16:14 [PATCH 1/1] v4l: subdev: Serialise open and release internal ops Sakari Ailus
2015-07-24 9:08 ` Hans Verkuil
2015-07-25 22:12 ` Sakari Ailus
2015-07-28 10:05 ` Hans Verkuil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55B753D4.2080008@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=j.anaszewski@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox