From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Subject: [PATCH 4/6] omap3isp: Disable streaming at driver unbind time
Date: Mon, 20 Feb 2017 17:22:20 +0200 [thread overview]
Message-ID: <1487604142-27610-5-git-send-email-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <1487604142-27610-1-git-send-email-sakari.ailus@linux.intel.com>
Once the driver is unbound accessing the hardware is not allowed anymore.
Due to this, disable streaming when the device driver is unbound. The
states of the associated objects related to Media controller and videobuf2
frameworks are updated as well, just like if the application disabled
streaming explicitly.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/platform/omap3isp/ispvideo.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index a3ca2a4..c04d357 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -1191,22 +1191,17 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
}
static int
-isp_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
+__isp_video_streamoff(struct isp_video *video)
{
- struct isp_video_fh *vfh = to_isp_video_fh(fh);
- struct isp_video *video = video_drvdata(file);
struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity);
enum isp_pipeline_state state;
unsigned int streaming;
unsigned long flags;
- if (type != video->type)
- return -EINVAL;
-
mutex_lock(&video->stream_lock);
mutex_lock(&video->queue_lock);
- streaming = vb2_is_streaming(&vfh->queue);
+ streaming = video->queue && vb2_is_streaming(video->queue);
mutex_unlock(&video->queue_lock);
if (!streaming)
@@ -1229,7 +1224,7 @@ isp_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
omap3isp_video_cancel_stream(video);
mutex_lock(&video->queue_lock);
- vb2_streamoff(&vfh->queue, type);
+ vb2_streamoff(video->queue, video->queue->type);
mutex_unlock(&video->queue_lock);
video->queue = NULL;
video->error = false;
@@ -1245,6 +1240,17 @@ isp_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
}
static int
+isp_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
+{
+ struct isp_video *video = video_drvdata(file);
+
+ if (type != video->type)
+ return -EINVAL;
+
+ return __isp_video_streamoff(video);
+}
+
+static int
isp_video_enum_input(struct file *file, void *fh, struct v4l2_input *input)
{
if (input->index > 0)
@@ -1494,5 +1500,6 @@ int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev)
void omap3isp_video_unregister(struct isp_video *video)
{
+ __isp_video_streamoff(video);
video_unregister_device(&video->video);
}
--
2.1.4
next prev parent reply other threads:[~2017-02-20 15:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 15:22 [PATCH 0/6] Media controller and omap3isp cleanups Sakari Ailus
2017-02-20 15:22 ` [PATCH 1/6] omap3isp: Don't rely on devm for memory resource management Sakari Ailus
2017-02-28 13:12 ` Laurent Pinchart
2017-02-28 13:21 ` Sakari Ailus
2017-02-20 15:22 ` [PATCH 2/6] omap3isp: Call video_unregister_device() unconditionally Sakari Ailus
2017-02-28 13:42 ` Laurent Pinchart
2017-02-20 15:22 ` [PATCH 3/6] omap3isp: Remove misleading comment Sakari Ailus
2017-02-28 13:42 ` Laurent Pinchart
2017-02-20 15:22 ` Sakari Ailus [this message]
2017-02-28 13:51 ` [PATCH 4/6] omap3isp: Disable streaming at driver unbind time Laurent Pinchart
2017-02-28 14:00 ` Sakari Ailus
2017-02-28 14:53 ` Laurent Pinchart
2017-02-24 13:13 ` Sakari Ailus
2017-02-20 15:22 ` [PATCH 5/6] media: Remove useless curly braces and parentheses Sakari Ailus
2017-02-28 13:42 ` Laurent Pinchart
2017-02-20 15:22 ` [PATCH 6/6] media: devnode: Rename mdev argument as devnode Sakari Ailus
2017-02-28 13:42 ` Laurent Pinchart
2017-02-20 20:37 ` [PATCH 0/6] Media controller and omap3isp cleanups Hans Verkuil
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=1487604142-27610-5-git-send-email-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=linux-media@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).