Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e62a5917 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: Fix race condition in msm_sd_register."

parents 89ad5ba0 9ea7be25
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@

static struct v4l2_device *msm_v4l2_dev;
static struct list_head    ordered_sd_list;
static struct mutex        ordered_sd_mtx;

static struct pm_qos_request msm_v4l2_pm_qos_request;

@@ -402,7 +403,9 @@ int msm_sd_register(struct msm_sd_subdev *msm_subdev)
	if (WARN_ON(!msm_v4l2_dev) || WARN_ON(!msm_v4l2_dev->dev))
		return -EIO;

	mutex_lock(&ordered_sd_mtx);
	msm_add_sd_in_position(msm_subdev, &ordered_sd_list);
	mutex_unlock(&ordered_sd_mtx);
	return __msm_sd_register_subdev(&msm_subdev->sd);
}
EXPORT_SYMBOL(msm_sd_register);
@@ -791,11 +794,13 @@ static long msm_private_ioctl(struct file *file, void *fh,
				__func__);
		}

		mutex_lock(&ordered_sd_mtx);
		if (!list_empty(&msm_v4l2_dev->subdevs)) {
			list_for_each_entry(msm_sd, &ordered_sd_list, list)
				__msm_sd_notify_freeze_subdevs(msm_sd,
					event_data->status);
		}
		mutex_unlock(&ordered_sd_mtx);
	}
		break;

@@ -980,9 +985,11 @@ static int msm_close(struct file *filep)
	struct msm_sd_subdev *msm_sd;

	/*stop all hardware blocks immediately*/
	mutex_lock(&ordered_sd_mtx);
	if (!list_empty(&msm_v4l2_dev->subdevs))
		list_for_each_entry(msm_sd, &ordered_sd_list, list)
			__msm_sd_close_subdevs(msm_sd, &sd_close);
	mutex_unlock(&ordered_sd_mtx);

	/* remove msm_v4l2_pm_qos_request */
	msm_pm_qos_remove_request();
@@ -1338,6 +1345,7 @@ static int msm_probe(struct platform_device *pdev)
	msm_init_queue(msm_session_q);
	spin_lock_init(&msm_eventq_lock);
	spin_lock_init(&msm_pid_lock);
	mutex_init(&ordered_sd_mtx);
	INIT_LIST_HEAD(&ordered_sd_list);

	cam_debugfs_root = debugfs_create_dir(MSM_CAM_LOGSYNC_FILE_BASEDIR,