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

Commit 552fac7b authored by Karthik Anantha Ram's avatar Karthik Anantha Ram
Browse files

msm: camera: sensor: Protect link/unlink calls



Use the same lock while modifying the brigde params and
processing driver commands.

Change-Id: I5b4de0cbcc23bf32dd47950e4627fe70b19c9c62
Signed-off-by: default avatarKarthik Anantha Ram <kartanan@codeaurora.org>
parent 78d6e9c5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -352,6 +352,8 @@ int32_t cam_actuator_establish_link(
		CAM_ERR(CAM_ACTUATOR, "Device data is NULL");
		return -EINVAL;
	}

	mutex_lock(&(a_ctrl->actuator_mutex));
	if (link->link_enable) {
		a_ctrl->bridge_intf.link_hdl = link->link_hdl;
		a_ctrl->bridge_intf.crm_cb = link->crm_cb;
@@ -359,6 +361,7 @@ int32_t cam_actuator_establish_link(
		a_ctrl->bridge_intf.link_hdl = -1;
		a_ctrl->bridge_intf.crm_cb = NULL;
	}
	mutex_unlock(&(a_ctrl->actuator_mutex));

	return 0;
}
+2 −0
Original line number Diff line number Diff line
@@ -859,6 +859,7 @@ int cam_flash_establish_link(struct cam_req_mgr_core_dev_link_setup *link)
		return -EINVAL;
	}

	mutex_lock(&fctrl->flash_mutex);
	if (link->link_enable) {
		fctrl->bridge_intf.link_hdl = link->link_hdl;
		fctrl->bridge_intf.crm_cb = link->crm_cb;
@@ -866,6 +867,7 @@ int cam_flash_establish_link(struct cam_req_mgr_core_dev_link_setup *link)
		fctrl->bridge_intf.link_hdl = -1;
		fctrl->bridge_intf.crm_cb = NULL;
	}
	mutex_unlock(&fctrl->flash_mutex);

	return 0;
}
+3 −0
Original line number Diff line number Diff line
@@ -918,6 +918,8 @@ int cam_sensor_establish_link(struct cam_req_mgr_core_dev_link_setup *link)
		CAM_ERR(CAM_SENSOR, "Device data is NULL");
		return -EINVAL;
	}

	mutex_lock(&s_ctrl->cam_sensor_mutex);
	if (link->link_enable) {
		s_ctrl->bridge_intf.link_hdl = link->link_hdl;
		s_ctrl->bridge_intf.crm_cb = link->crm_cb;
@@ -925,6 +927,7 @@ int cam_sensor_establish_link(struct cam_req_mgr_core_dev_link_setup *link)
		s_ctrl->bridge_intf.link_hdl = -1;
		s_ctrl->bridge_intf.crm_cb = NULL;
	}
	mutex_unlock(&s_ctrl->cam_sensor_mutex);

	return 0;
}