Samsung VZW MB1 update
/drivers/media/video/msm/msm.c
blob:42c6ed30b76253914cf1fa96c4909ae1d8b93178 -> blob:c374c72a07715fcdb5a48d80c3301b6f0f932d30
--- drivers/media/video/msm/msm.c
+++ drivers/media/video/msm/msm.c
@@ -131,6 +131,7 @@ static int msm_server_control(struct msm
struct msm_ctrl_cmd *ctrlcmd;
struct msm_device_queue *queue = &server_dev->ctrl_q;
void *ctrlcmd_data;
+ uint8_t wait_count;
struct v4l2_event v4l2_evt;
struct msm_isp_event_ctrl *isp_event;
@@ -156,6 +157,7 @@ static int msm_server_control(struct msm
ctrlcmd_data = kzalloc(out->length, GFP_KERNEL);
if (!ctrlcmd_data) {
kfree(isp_event);
+ *((uint32_t *)v4l2_evt.u.data) = NULL; //MSM.C_DOUBLE_FREE
pr_err("%s Insufficient memory. return", __func__);
return -ENOMEM;
}
@@ -171,20 +173,29 @@ static int msm_server_control(struct msm
/* wait for config return status */
D("Waiting for config status\n");
- rc = wait_event_interruptible_timeout(queue->wait,
- !list_empty_careful(&queue->list),
- msecs_to_jiffies(out->timeout_ms));
+ wait_count = 2;
+ do {
+ rc = wait_event_interruptible_timeout(queue->wait,
+ !list_empty_careful(&queue->list),
+ msecs_to_jiffies(out->timeout_ms));
+ wait_count--;
+ if (rc != -ERESTARTSYS)
+ break;
+ D("%s: wait_event interrupted by signal, remain_count = %d",
+ __func__, wait_count);
+ } while (wait_count > 0);
D("Waiting is over for config status\n");
if (list_empty_careful(&queue->list)) {
if (!rc)
rc = -ETIMEDOUT;
if (rc < 0) {
rcmd = msm_dequeue(queue, list_control);
- if (!rcmd) {
+ if (rcmd) {
free_qcmd(rcmd);
rcmd = NULL;
}
kfree(isp_event);
+ *((uint32_t *)v4l2_evt.u.data) = NULL; //MSM.C_DOUBLE_FREE
if (g_server_dev.server_evt_id == 0)
g_server_dev.server_evt_id++;
pr_err("%s: wait_event error %d\n", __func__, rc);
@@ -243,7 +254,7 @@ static int msm_send_close_server(int vno
{
int rc = 0;
struct msm_ctrl_cmd ctrlcmd;
- D("%s\n", __func__);
+ pr_err("%s\n", __func__);
ctrlcmd.type = MSM_V4L2_CLOSE;
ctrlcmd.timeout_ms = 10000;
ctrlcmd.length = strnlen(g_server_dev.config_info.config_dev_name[0],
@@ -2025,6 +2036,7 @@ static long msm_ioctl_server(struct file
break;
}
kfree(k_isp_event);
+ (*((uint32_t *)ev.u.data)) = NULL; //MSM.C_DOUBLE_FREE
k_isp_event = NULL;
break;
}
@@ -2127,7 +2139,7 @@ static long msm_v4l2_evt_notify(struct m
ERR_COPY_FROM_USER();
return -EFAULT;
}
-
+ pr_err("%s: Sending event to HAL with type %x\n", __func__, v4l2_ev.type);
pcam = mctl->sync.pcam_sync;
ktime_get_ts(&v4l2_ev.timestamp);
v4l2_event_queue(pcam->pvdev, &v4l2_ev);
@@ -2281,6 +2293,15 @@ static long msm_ioctl_config(struct file
rc = -EINVAL;
break;
+ case MCTL_CAM_IOCTL_SET_FOCUS:
+ if (copy_from_user(&config_cam->p_mctl->sync.focus_state,
+ (void __user *)arg, sizeof(uint32_t))) {
+ ERR_COPY_FROM_USER();
+ rc = -EINVAL;
+ break;
+ }
+ break;
+
default:{
/* For the rest of config command, forward to media controller*/
struct msm_cam_media_controller *p_mctl = config_cam->p_mctl;