]> git.karo-electronics.de Git - linux-beck.git/commitdiff
greybus: camera: Set power mode after configuring streams
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 14 Feb 2016 00:33:06 +0000 (02:33 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 15 Feb 2016 22:55:17 +0000 (14:55 -0800)
There's no need to set the power mode before configuring streams, doing
it after simplifies code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Tested-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/camera.c

index 25dbf690e1fcaaa9159b830186f24cc68f5bcd23..7eef6eceec6c61cdfd8fd0d1344f682b424f7aef 100644 (file)
@@ -192,21 +192,6 @@ static int gb_camera_configure_streams(struct gb_camera *gcam,
                goto done;
        }
 
-       /*
-        * Setup unipro link speed before actually issuing configuration
-        * to the camera module, to assure unipro network speed is set
-        * before CSI interfaces gets configured
-        */
-       if (nstreams && !(*flags & GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY)) {
-               ret = gb_camera_set_power_mode(gcam, true);
-               if (ret < 0)
-                       goto done;
-       } else if (nstreams == 0) {
-               ret = gb_camera_set_power_mode(gcam, false);
-               if (ret < 0)
-                       goto done;
-       }
-
        req->num_streams = nstreams;
        req->flags = *flags;
        req->padding = 0;
@@ -224,19 +209,19 @@ static int gb_camera_configure_streams(struct gb_camera *gcam,
                                GB_CAMERA_TYPE_CONFIGURE_STREAMS,
                                req, req_size, resp, resp_size);
        if (ret < 0)
-               goto set_unipro_slow_mode;
+               goto done;
 
        if (resp->num_streams > nstreams) {
                gcam_dbg(gcam, "got #streams %u > request %u\n",
                         resp->num_streams, nstreams);
                ret = -EIO;
-               goto set_unipro_slow_mode;
+               goto done;
        }
 
        if (resp->padding != 0) {
                gcam_dbg(gcam, "response padding != 0");
                ret = -EIO;
-               goto set_unipro_slow_mode;
+               goto done;
        }
 
        for (i = 0; i < nstreams; ++i) {
@@ -253,14 +238,25 @@ static int gb_camera_configure_streams(struct gb_camera *gcam,
                if (cfg->padding[0] || cfg->padding[1] || cfg->padding[2]) {
                        gcam_dbg(gcam, "stream #%u padding != 0", i);
                        ret = -EIO;
-                       goto set_unipro_slow_mode;
+                       goto done;
                }
        }
 
        if (nstreams && resp->flags & GB_CAMERA_CONFIGURE_STREAMS_ADJUSTED) {
                *flags = resp->flags;
                *num_streams = resp->num_streams;
-               goto set_unipro_slow_mode;
+               goto done;
+       }
+
+       /* Setup unipro link speed. */
+       if (nstreams && !(*flags & GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY)) {
+               ret = gb_camera_set_power_mode(gcam, true);
+               if (ret < 0)
+                       goto done;
+       } else if (nstreams == 0) {
+               ret = gb_camera_set_power_mode(gcam, false);
+               if (ret < 0)
+                       goto done;
        }
 
        memset(&csi_cfg, 0, sizeof(csi_cfg));
@@ -289,13 +285,6 @@ static int gb_camera_configure_streams(struct gb_camera *gcam,
        *num_streams = resp->num_streams;
        ret = 0;
 
-       kfree(req);
-       kfree(resp);
-       return ret;
-
-set_unipro_slow_mode:
-       ret = gb_camera_set_power_mode(gcam, false);
-
 done:
        kfree(req);
        kfree(resp);