From: Sylwester Nawrocki Date: Thu, 19 Apr 2018 12:09:33 +0000 (+0200) Subject: fimc-is: Remove dubious spin_(un)lock_irq() use X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d289aacc42def59d243a211c11913de74817d06b;p=platform%2Fkernel%2Flinux-exynos.git fimc-is: Remove dubious spin_(un)lock_irq() use There should not be a need to use spin_lock_irq/spin_unlock_irq in those critical sections. spin_unlock_irq() enables interrupts unconditionally which can be harmful. Change-Id: I29df4e56475a56a94762bb1585a6ba3d55c45259 Signed-off-by: Sylwester Nawrocki --- diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.h b/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.h index 19a5fe9f1e7a..d35aab6384f0 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.h @@ -66,10 +66,7 @@ spin_lock_irqsave(&this->slock, flag) #define framemgr_x_barrier_irqr(this, index, flag) \ spin_unlock_irqrestore(&this->slock, flag) -#define framemgr_e_barrier_irq(this, index) \ - spin_lock_irq(&this->slock) -#define framemgr_x_barrier_irq(this, index) \ - spin_unlock_irq(&this->slock) + #define framemgr_e_barrier(this, index) \ spin_lock(&this->slock) #define framemgr_x_barrier(this, index) \ diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-subdev-ctrl.c b/drivers/media/platform/exynos/fimc-is/fimc-is-subdev-ctrl.c index 7563dbf916dc..11e227fc0465 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-subdev-ctrl.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-subdev-ctrl.c @@ -191,6 +191,7 @@ int fimc_is_subdev_buffer_finish(struct fimc_is_subdev *subdev, int ret = 0; struct fimc_is_framemgr *framemgr; struct fimc_is_frame *frame; + unsigned long flags; BUG_ON(!subdev); BUG_ON(index >= FRAMEMGR_MAX_REQUEST); @@ -202,7 +203,7 @@ int fimc_is_subdev_buffer_finish(struct fimc_is_subdev *subdev, goto p_err; } - framemgr_e_barrier_irq(framemgr, index); + framemgr_e_barrier_irqs(framemgr, index, flags); fimc_is_frame_complete_head(framemgr, &frame); if (frame) { @@ -220,7 +221,7 @@ int fimc_is_subdev_buffer_finish(struct fimc_is_subdev *subdev, ret = -EINVAL; } - framemgr_x_barrier_irq(framemgr, index); + framemgr_x_barrier_irqr(framemgr, index, flags); p_err: return ret; diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-video.c b/drivers/media/platform/exynos/fimc-is/fimc-is-video.c index 4a4956cf5075..18a5da25fb40 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-video.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-video.c @@ -1176,6 +1176,7 @@ int fimc_is_video_dqbuf(struct file *file, bool blocking; struct fimc_is_queue *queue; struct fimc_is_framemgr *framemgr; + unsigned long flags; BUG_ON(!file); BUG_ON(!vctx); @@ -1204,11 +1205,11 @@ int fimc_is_video_dqbuf(struct file *file, goto p_err; } - framemgr_e_barrier_irq(framemgr, 0); + framemgr_e_barrier_irqs(framemgr, 0, flags); qcount = framemgr->frame_req_cnt + framemgr->frame_pro_cnt + framemgr->frame_com_cnt; - framemgr_x_barrier_irq(framemgr, 0); + framemgr_x_barrier_irqr(framemgr, 0, flags); if (qcount <= 0) { /* HACK : this log is commented until timeout issue fixed */ @@ -1269,6 +1270,7 @@ int fimc_is_video_streamoff(struct file *file, struct fimc_is_queue *queue; struct vb2_queue *vbq; struct fimc_is_framemgr *framemgr; + unsigned long flags; BUG_ON(!file); BUG_ON(!vctx); @@ -1282,11 +1284,11 @@ int fimc_is_video_streamoff(struct file *file, goto p_err; } - framemgr_e_barrier_irq(framemgr, 0); + framemgr_e_barrier_irqs(framemgr, 0, flags); qcount = framemgr->frame_req_cnt + framemgr->frame_pro_cnt + framemgr->frame_com_cnt; - framemgr_x_barrier_irq(framemgr, 0); + framemgr_x_barrier_irqr(framemgr, 0, flags); if (qcount > 0) mwarn("video%d stream off : queued buffer is not empty(%d)", vctx,