summaryrefslogtreecommitdiff
path: root/drivers/media/video/mxc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/mxc')
-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 e3af2f817990..9d5fd09ef48a 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);
}