msm: camera: Cleanup msm_generic_buff list while close
Cleanup the camera msm generic buffer manager list
when all v4l2 nodes are closed.
Change-Id: I27636533621d3329bcc5dffba8c003d2cdc252c2
CRs-Fixed: 599983
Signed-off-by: Azam Sadiq Pasha Kapatrala Syed <akapatra@codeaurora.org>
diff --git a/drivers/media/platform/msm/camera_v2/msm.c b/drivers/media/platform/msm/camera_v2/msm.c
index 67f7c2b..f8f5110 100644
--- a/drivers/media/platform/msm/camera_v2/msm.c
+++ b/drivers/media/platform/msm/camera_v2/msm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -29,6 +29,8 @@
#include "msm.h"
#include "msm_vb2.h"
#include "msm_sd.h"
+#include <media/msmb_generic_buf_mgr.h>
+
static struct v4l2_device *msm_v4l2_dev;
static struct list_head ordered_sd_list;
@@ -504,6 +506,7 @@
int msm_destroy_session(unsigned int session_id)
{
struct msm_session *session;
+ struct v4l2_subdev *buf_mgr_subdev;
session = msm_queue_find(msm_session_q, struct msm_session,
list, __msm_queue_find_session, &session_id);
@@ -515,6 +518,12 @@
mutex_destroy(&session->lock);
msm_delete_entry(msm_session_q, struct msm_session,
list, session);
+ buf_mgr_subdev = msm_buf_mngr_get_subdev();
+ if (buf_mgr_subdev) {
+ v4l2_subdev_call(buf_mgr_subdev, core, ioctl,
+ MSM_SD_SHUTDOWN, NULL);
+ } else
+ pr_err("%s: Buff manger device node is NULL\n", __func__);
return 0;
}
diff --git a/drivers/media/platform/msm/camera_v2/msm_buf_mgr/msm_generic_buf_mgr.c b/drivers/media/platform/msm/camera_v2/msm_buf_mgr/msm_generic_buf_mgr.c
index 6994258..81d4eff 100644
--- a/drivers/media/platform/msm/camera_v2/msm_buf_mgr/msm_generic_buf_mgr.c
+++ b/drivers/media/platform/msm/camera_v2/msm_buf_mgr/msm_generic_buf_mgr.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -129,7 +129,6 @@
rc = -ENODEV;
return rc;
}
- buf_mngr_dev->msm_buf_mngr_open_cnt++;
return rc;
}
@@ -143,9 +142,6 @@
rc = -ENODEV;
return rc;
}
- buf_mngr_dev->msm_buf_mngr_open_cnt--;
- if (buf_mngr_dev->msm_buf_mngr_open_cnt == 0)
- msm_buf_mngr_sd_shutdown(buf_mngr_dev);
return rc;
}
diff --git a/drivers/media/platform/msm/camera_v2/msm_buf_mgr/msm_generic_buf_mgr.h b/drivers/media/platform/msm/camera_v2/msm_buf_mgr/msm_generic_buf_mgr.h
index 49fad22..82ea21f 100644
--- a/drivers/media/platform/msm/camera_v2/msm_buf_mgr/msm_generic_buf_mgr.h
+++ b/drivers/media/platform/msm/camera_v2/msm_buf_mgr/msm_generic_buf_mgr.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -36,6 +36,5 @@
spinlock_t buf_q_spinlock;
struct msm_sd_subdev subdev;
struct msm_sd_req_vb2_q vb2_ops;
- uint32_t msm_buf_mngr_open_cnt;
};
#endif