diff options
| author | Ramesh V <ramev@codeaurora.org> | 2017-05-09 16:57:09 +0530 |
|---|---|---|
| committer | Ramesh V <ramev@codeaurora.org> | 2017-05-15 17:00:16 +0530 |
| commit | cc12a0966bc5bbdafc5abace2279b4397dacb997 (patch) | |
| tree | 1ce017ee57a505a17772ae58351b95fa6f666bd5 | |
| parent | 3d82d66409abb91539bcb9d1f343fcb9d583f2b4 (diff) | |
msm: camera: isp : Fix race condition in close sequence
Serializing reset_hw and reset_irq, to avoid race condition.
Change-Id: I0fd4fc8cfcdef9fe0e0679c3cee44b2dddc7b506
Signed-off-by: Ramesh V <ramev@codeaurora.org>
| -rw-r--r-- | drivers/media/platform/msm/camera_v2/isp/msm_isp.c | 1 | ||||
| -rw-r--r-- | drivers/media/platform/msm/camera_v2/isp/msm_isp.h | 1 | ||||
| -rw-r--r-- | drivers/media/platform/msm/camera_v2/isp/msm_isp47.c | 7 |
3 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp.c index 737433209c2b..23f936258660 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp.c @@ -638,6 +638,7 @@ int vfe_hw_probe(struct platform_device *pdev) spin_lock_init(&vfe_dev->shared_data_lock); spin_lock_init(&vfe_dev->reg_update_lock); spin_lock_init(&req_history_lock); + spin_lock_init(&vfe_dev->completion_lock); media_entity_init(&vfe_dev->subdev.sd.entity, 0, NULL, 0); vfe_dev->subdev.sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV; vfe_dev->subdev.sd.entity.group_id = MSM_CAMERA_SUBDEV_VFE; diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp.h b/drivers/media/platform/msm/camera_v2/isp/msm_isp.h index b283f6277b87..a15544cb8965 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp.h +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp.h @@ -793,6 +793,7 @@ struct vfe_device { struct mutex core_mutex; spinlock_t shared_data_lock; spinlock_t reg_update_lock; + spinlock_t completion_lock; /* Tasklet info */ atomic_t irq_cnt; diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c index a66ca7e93537..8cd42414afa8 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c @@ -437,9 +437,13 @@ void msm_vfe47_clear_status_reg(struct vfe_device *vfe_dev) void msm_vfe47_process_reset_irq(struct vfe_device *vfe_dev, uint32_t irq_status0, uint32_t irq_status1) { + unsigned long flags; + if (irq_status0 & (1 << 31)) { + spin_lock_irqsave(&vfe_dev->completion_lock, flags); complete(&vfe_dev->reset_complete); vfe_dev->reset_pending = 0; + spin_unlock_irqrestore(&vfe_dev->completion_lock, flags); } } @@ -750,8 +754,11 @@ long msm_vfe47_reset_hardware(struct vfe_device *vfe_dev, { long rc = 0; uint32_t reset; + unsigned long flags; + spin_lock_irqsave(&vfe_dev->completion_lock, flags); init_completion(&vfe_dev->reset_complete); + spin_unlock_irqrestore(&vfe_dev->completion_lock, flags); if (blocking_call) vfe_dev->reset_pending = 1; |
