msm: camera_v2: Post fd close event to user space.

Post the stream destroy event to back-end even if the last
fd is being closed. This is required because when the mediaserver
crashes, the fds are closed in no particular order.

Change-Id: Ie6098f9aa2b9090d9901684998a8ab3a332d4805
Signed-off-by: Ankit Premrajka <ankitp@codeaurora.org>
This commit is contained in:
Ankit Premrajka
2013-04-18 14:20:47 -07:00
committed by Iliyan Malchev
parent 566841c3e9
commit 546e4c48e1
2 changed files with 7 additions and 1 deletions

View File

@@ -596,13 +596,18 @@ static int camera_v4l2_close(struct file *filep)
struct v4l2_event event;
struct msm_video_device *pvdev = video_drvdata(filep);
struct camera_v4l2_private *sp = fh_to_private(filep->private_data);
BUG_ON(!pvdev);
atomic_sub_return(1, &pvdev->opened);
if (atomic_read(&pvdev->opened) == 0) {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
camera_pack_event(filep, MSM_CAMERA_DEL_SESSION, 0, -1, &event);
/* Donot wait, imaging server may have crashed */

View File

@@ -661,6 +661,7 @@ int msm_post_event(struct v4l2_event *event, int timeout)
rc = -ETIMEDOUT;
}
if (rc < 0) {
pr_err("%s: rc = %d\n", __func__, rc);
mutex_unlock(&session->lock);
return rc;
}