summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuxi Sun <b36102@freescale.com>2012-03-27 14:15:39 +0800
committerYuxi Sun <b36102@freescale.com>2012-03-28 15:22:03 +0800
commit34621b4c0014e7b44c57f56f825ce5fe450e8d70 (patch)
treef9a7f0d7a6a5f32c30dab3c5eddef02fc767c387
parent0fa1ff4cc96330800640f32f1d825b2ba1b270ec (diff)
ENGR00178052 v4l2_capture:Correct multi-sensor uninstallationrel_imx_3.0.15_12.03.00
Point the current sensor to the right existent camera, and remove the detached one Signed-off-by: Yuxi Sun <b36102@freescale.com>
-rw-r--r--drivers/media/video/mxc/capture/mxc_v4l2_capture.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c
index e3af2f8..9d5fd09 100644
--- a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c
+++ b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c
@@ -2890,7 +2890,28 @@ static int mxc_v4l2_master_attach(struct v4l2_int_device *slave)
*/
static void mxc_v4l2_master_detach(struct v4l2_int_device *slave)
{
+ unsigned int i;
+ cam_data *cam = slave->u.slave->master->priv;
+
pr_debug("In MVC:mxc_v4l2_master_detach\n");
+
+ if (sensor_index > 1) {
+ for (i = 0; i < sensor_index; i++) {
+ if (cam->all_sensors[i] != slave)
+ continue;
+ /* Move all the sensors behind this
+ * sensor one step forward
+ */
+ for (; i < sensor_index - 1; i++)
+ cam->all_sensors[i] = cam->all_sensors[i+1];
+ break;
+ }
+ /* Point current sensor to the last one */
+ cam->sensor = cam->all_sensors[sensor_index - 2];
+ } else
+ cam->sensor = NULL;
+
+ sensor_index--;
vidioc_int_dev_exit(slave);
}