This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] ov772x: try_fmt must not default to the current format
Author:  Laurent Pinchart <[email protected]>
Date:    Wed Jul 18 10:58:21 2012 -0300

If the requested format isn't supported, return a fixed default format
instead of the current format.

Signed-off-by: Laurent Pinchart <[email protected]>
Signed-off-by: Guennadi Liakhovetski <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/i2c/soc_camera/ov772x.c |   36 ++++++--------------------------
 1 files changed, 7 insertions(+), 29 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=9f717e9022d60fb653bad47a320bf0499c6fb549

diff --git a/drivers/media/i2c/soc_camera/ov772x.c 
b/drivers/media/i2c/soc_camera/ov772x.c
index c7bb988..c02676b 100644
--- a/drivers/media/i2c/soc_camera/ov772x.c
+++ b/drivers/media/i2c/soc_camera/ov772x.c
@@ -919,38 +919,16 @@ static int ov772x_s_fmt(struct v4l2_subdev *sd, struct 
v4l2_mbus_framefmt *mf)
 static int ov772x_try_fmt(struct v4l2_subdev *sd,
                          struct v4l2_mbus_framefmt *mf)
 {
-       struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
+       const struct ov772x_color_format *cfmt;
        const struct ov772x_win_size *win;
-       int i;
-
-       /*
-        * select suitable win
-        */
-       win = ov772x_select_win(mf->width, mf->height);
 
-       mf->width       = win->width;
-       mf->height      = win->height;
-       mf->field       = V4L2_FIELD_NONE;
-
-       for (i = 0; i < ARRAY_SIZE(ov772x_cfmts); i++)
-               if (mf->code == ov772x_cfmts[i].code)
-                       break;
+       ov772x_select_params(mf, &cfmt, &win);
 
-       if (i == ARRAY_SIZE(ov772x_cfmts)) {
-               /* Unsupported format requested. Propose either */
-               if (priv->cfmt) {
-                       /* the current one or */
-                       mf->colorspace = priv->cfmt->colorspace;
-                       mf->code = priv->cfmt->code;
-               } else {
-                       /* the default one */
-                       mf->colorspace = ov772x_cfmts[0].colorspace;
-                       mf->code = ov772x_cfmts[0].code;
-               }
-       } else {
-               /* Also return the colorspace */
-               mf->colorspace  = ov772x_cfmts[i].colorspace;
-       }
+       mf->code = cfmt->code;
+       mf->width = win->width;
+       mf->height = win->height;
+       mf->field = V4L2_FIELD_NONE;
+       mf->colorspace = cfmt->colorspace;
 
        return 0;
 }

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to