On Fri Aug 21 08:38:05 2026 +0200, Alain Volmat wrote:
> CMIER register is common between all pipes and thus needs to be
> protected from concurrent access.  The struct v4l2_device structure,
> unique to the whole driver embeds a spin_lock which can also be used
> by the driver itself as explained in its description.  Rely on this
> spin_lock to protect from concurrent access to the CMIER register.
> 
> Signed-off-by: Alain Volmat <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c | 4 ++++
 1 file changed, 4 insertions(+)

---

diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c 
b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c
index 0e789bbd1198..f6011b42203c 100644
--- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c
+++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c
@@ -438,7 +438,9 @@ static int dcmipp_bytecap_start_streaming(struct vb2_queue 
*vq,
        dcmipp_start_capture(vcap, vcap->next);
 
        /* Enable interruptions */
+       spin_lock(&vcap->vdev.v4l2_dev->lock);
        reg_set(vcap, DCMIPP_CMIER, DCMIPP_CMIER_P0ALL);
+       spin_unlock(&vcap->vdev.v4l2_dev->lock);
 
        vcap->state = DCMIPP_RUNNING;
 
@@ -494,7 +496,9 @@ static void dcmipp_bytecap_stop_streaming(struct vb2_queue 
*vq)
        media_pipeline_stop(vcap->vdev.entity.pads);
 
        /* Disable interruptions */
+       spin_lock(&vcap->vdev.v4l2_dev->lock);
        reg_clear(vcap, DCMIPP_CMIER, DCMIPP_CMIER_P0ALL);
+       spin_unlock(&vcap->vdev.v4l2_dev->lock);
 
        /* Stop capture */
        reg_clear(vcap, DCMIPP_P0FCTCR, DCMIPP_P0FCTCR_CPTREQ);
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to