The patch number 9894 was added via Andy Walls <awa...@radix.net>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        v4l-dvb-maintai...@linuxtv.org

------

From: Andy Walls  <awa...@radix.net>
cx18: Use a known open task handle when setting stream CX2341x parameters


cx18: Use a known open task handle when setting stream CX2341x parameters
Sometimes, we might only have VBI or YUV stream open instead of an MPEG stream.
Let's make sure we use a valid task handle to perform the CX2341x control
settings.

Priority: normal

Signed-off-by: Andy Walls <awa...@radix.net>


---

 linux/drivers/media/video/cx18/cx18-controls.c |    5 ++++-
 linux/drivers/media/video/cx18/cx18-mailbox.c  |    5 +++--
 linux/drivers/media/video/cx18/cx18-mailbox.h  |    7 +++++++
 linux/drivers/media/video/cx18/cx18-streams.c  |    6 +++++-
 4 files changed, 19 insertions(+), 4 deletions(-)

diff -r 2956b92f54ea -r 3f10a9018d56 
linux/drivers/media/video/cx18/cx18-controls.c
--- a/linux/drivers/media/video/cx18/cx18-controls.c    Sun Dec 14 19:05:36 
2008 -0500
+++ b/linux/drivers/media/video/cx18/cx18-controls.c    Sun Nov 23 17:16:44 
2008 -0500
@@ -259,6 +259,7 @@ int cx18_s_ext_ctrls(struct file *file, 
                return err;
        }
        if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
+               struct cx18_api_func_private priv;
                struct cx2341x_mpeg_params p = cx->params;
                int err = cx2341x_ext_ctrls(&p, atomic_read(&cx->ana_capturing),
                                                c, VIDIOC_S_EXT_CTRLS);
@@ -278,7 +279,9 @@ int cx18_s_ext_ctrls(struct file *file, 
                        fmt.fmt.pix.height = cx->params.height;
                        cx18_av_cmd(cx, VIDIOC_S_FMT, &fmt);
                }
-               err = cx2341x_update(cx, cx18_api_func, &cx->params, &p);
+               priv.cx = cx;
+               priv.s = &cx->streams[id->type];
+               err = cx2341x_update(&priv, cx18_api_func, &cx->params, &p);
                if (!err && cx->params.stream_vbi_fmt != p.stream_vbi_fmt)
                        err = cx18_setup_vbi_fmt(cx, p.stream_vbi_fmt);
                cx->params = p;
diff -r 2956b92f54ea -r 3f10a9018d56 
linux/drivers/media/video/cx18/cx18-mailbox.c
--- a/linux/drivers/media/video/cx18/cx18-mailbox.c     Sun Dec 14 19:05:36 
2008 -0500
+++ b/linux/drivers/media/video/cx18/cx18-mailbox.c     Sun Nov 23 17:16:44 
2008 -0500
@@ -612,8 +612,9 @@ int cx18_api_func(void *priv, u32 cmd, i
 int cx18_api_func(void *priv, u32 cmd, int in, int out,
                u32 data[CX2341X_MBOX_MAX_DATA])
 {
-       struct cx18 *cx = priv;
-       struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_MPG];
+       struct cx18_api_func_private *api_priv = priv;
+       struct cx18 *cx = api_priv->cx;
+       struct cx18_stream *s = api_priv->s;
 
        switch (cmd) {
        case CX2341X_ENC_SET_OUTPUT_PORT:
diff -r 2956b92f54ea -r 3f10a9018d56 
linux/drivers/media/video/cx18/cx18-mailbox.h
--- a/linux/drivers/media/video/cx18/cx18-mailbox.h     Sun Dec 14 19:05:36 
2008 -0500
+++ b/linux/drivers/media/video/cx18/cx18-mailbox.h     Sun Nov 23 17:16:44 
2008 -0500
@@ -79,6 +79,13 @@ struct cx18_mailbox {
     u32       error;
 };
 
+struct cx18_stream;
+
+struct cx18_api_func_private {
+       struct cx18 *cx;
+       struct cx18_stream *s;
+};
+
 int cx18_api(struct cx18 *cx, u32 cmd, int args, u32 data[]);
 int cx18_vapi_result(struct cx18 *cx, u32 data[MAX_MB_ARGUMENTS], u32 cmd,
                int args, ...);
diff -r 2956b92f54ea -r 3f10a9018d56 
linux/drivers/media/video/cx18/cx18-streams.c
--- a/linux/drivers/media/video/cx18/cx18-streams.c     Sun Dec 14 19:05:36 
2008 -0500
+++ b/linux/drivers/media/video/cx18/cx18-streams.c     Sun Nov 23 17:16:44 
2008 -0500
@@ -494,6 +494,8 @@ int cx18_start_v4l2_encode_stream(struct
        cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype);
 
        if (atomic_read(&cx->ana_capturing) == 0 && !ts) {
+               struct cx18_api_func_private priv;
+
                /* Stuff from Windows, we don't know what it is */
                cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0);
                cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1);
@@ -513,7 +515,9 @@ int cx18_start_v4l2_encode_stream(struct
                cx18_vapi_result(cx, data, CX18_CPU_SET_INDEXTABLE, 1, 0);
 
                /* Setup API for Stream */
-               cx2341x_update(cx, cx18_api_func, NULL, &cx->params);
+               priv.cx = cx;
+               priv.s = s;
+               cx2341x_update(&priv, cx18_api_func, NULL, &cx->params);
        }
 
        if (atomic_read(&cx->tot_capturing) == 0) {


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/3f10a9018d563bc30fbdefd7c62da40875f46e32

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to