All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com
Cc: dafna.hirschfeld@collabora.com, helen.koike@collabora.com,
	ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com,
	dafna3@gmail.com, sakari.ailus@linux.intel.com,
	linux-rockchip@lists.infradead.org, mchehab@kernel.org,
	tfiga@chromium.org
Subject: [PATCH 3/3] media: staging: rkisp1: params: in 'stop_streaming' don't release the lock while returning buffers
Date: Thu, 25 Jun 2020 19:42:57 +0200	[thread overview]
Message-ID: <20200625174257.22216-4-dafna.hirschfeld@collabora.com> (raw)
In-Reply-To: <20200625174257.22216-1-dafna.hirschfeld@collabora.com>

In the stop_streaming callback 'rkisp1_params_vb2_stop_streaming'
there is no need to release the lock 'config_lock' and then acquire
it again at each iteration when returning all buffers.
This is because the stream is about to end and there is no need
to let the isr access a buffer.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 drivers/staging/media/rkisp1/rkisp1-params.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
index bf006dbeee2d..5169b02731f1 100644
--- a/drivers/staging/media/rkisp1/rkisp1-params.c
+++ b/drivers/staging/media/rkisp1/rkisp1-params.c
@@ -1488,19 +1488,13 @@ static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq)
 	/* stop params input firstly */
 	spin_lock_irqsave(&params->config_lock, flags);
 	params->is_streaming = false;
-	spin_unlock_irqrestore(&params->config_lock, flags);
 
 	for (i = 0; i < RKISP1_ISP_PARAMS_REQ_BUFS_MAX; i++) {
-		spin_lock_irqsave(&params->config_lock, flags);
 		if (!list_empty(&params->params)) {
 			buf = list_first_entry(&params->params,
 					       struct rkisp1_buffer, queue);
 			list_del(&buf->queue);
-			spin_unlock_irqrestore(&params->config_lock,
-					       flags);
 		} else {
-			spin_unlock_irqrestore(&params->config_lock,
-					       flags);
 			break;
 		}
 
@@ -1508,6 +1502,7 @@ static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq)
 			vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
 		buf = NULL;
 	}
+	spin_unlock_irqrestore(&params->config_lock, flags);
 }
 
 static int
-- 
2.17.1


  parent reply	other threads:[~2020-06-25 17:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25 17:42 [PATCH 0/3] media: staging: rkisp1: various bug fixes in params Dafna Hirschfeld
2020-06-25 17:42 ` [PATCH 1/3] media: staging: rkisp1: params: don't reference the vb2 buffer after calling vb2_buffer_done Dafna Hirschfeld
2020-06-26 17:02   ` Helen Koike
2020-06-25 17:42 ` [PATCH 2/3] media: staging: rkisp1: params: don't release lock in isr before buffer is done Dafna Hirschfeld
2020-06-26 17:20   ` Helen Koike
2020-06-25 17:42 ` Dafna Hirschfeld [this message]
2020-06-26 13:32   ` [PATCH 3/3] media: staging: rkisp1: params: in 'stop_streaming' don't release the lock while returning buffers Robin Murphy
2020-06-26 14:03     ` Tomasz Figa
2020-06-26 15:48       ` Dafna Hirschfeld
2020-06-26 15:59         ` Tomasz Figa
2020-06-26 16:58           ` Robin Murphy
2020-08-13 10:44             ` Dafna Hirschfeld
2020-08-13 10:44               ` Dafna Hirschfeld
2020-08-13 10:53               ` Laurent Pinchart
2020-08-13 10:53                 ` Laurent Pinchart
2020-08-13 12:50                 ` Tomasz Figa
2020-08-13 12:50                   ` Tomasz Figa
2020-08-13 13:02                   ` Laurent Pinchart
2020-08-13 13:02                     ` Laurent Pinchart
2020-08-13 13:05                     ` Tomasz Figa
2020-08-13 13:05                       ` Tomasz Figa
2020-08-13 13:09                       ` Laurent Pinchart
2020-08-13 13:09                         ` Laurent Pinchart
2020-08-14 11:04       ` Dafna Hirschfeld
2020-08-14 11:04         ` Dafna Hirschfeld
2020-08-14 11:23         ` Tomasz Figa
2020-08-14 11:23           ` Tomasz Figa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200625174257.22216-4-dafna.hirschfeld@collabora.com \
    --to=dafna.hirschfeld@collabora.com \
    --cc=dafna3@gmail.com \
    --cc=ezequiel@collabora.com \
    --cc=helen.koike@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.