diff mbox series

[2/6] media: staging: rkisp1: params: in stop_streaming, use list_splice_init to move the buffers

Message ID 20201002184222.7094-3-dafna.hirschfeld@collabora.com (mailing list archive)
State New, archived
Headers show
Series media: staging: rkisp1: improvements | expand

Commit Message

Dafna Hirschfeld Oct. 2, 2020, 6:42 p.m. UTC
Currently the code uses 'list_cut_position' to move the
buffers to a temporary list. Replace it with
'list_splice_init'. This is nicer since we don't need
to access params.prev. Also, replace INIT_LIST_HEAD
with the simpler LIST_HEAD.

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

Comments

Helen Mae Koike Fornazier Oct. 14, 2020, 8:27 p.m. UTC | #1
On 10/2/20 3:42 PM, Dafna Hirschfeld wrote:
> Currently the code uses 'list_cut_position' to move the
> buffers to a temporary list. Replace it with
> 'list_splice_init'. This is nicer since we don't need
> to access params.prev. Also, replace INIT_LIST_HEAD
> with the simpler LIST_HEAD.
> 
> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>

Acked-by: Helen Koike <helen.koike@collabora.com>

Thanks
Helen

> ---
>  drivers/staging/media/rkisp1/rkisp1-params.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
> index 986d293201e6..cb9f3332a9a0 100644
> --- a/drivers/staging/media/rkisp1/rkisp1-params.c
> +++ b/drivers/staging/media/rkisp1/rkisp1-params.c
> @@ -1462,9 +1462,7 @@ static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq)
>  {
>  	struct rkisp1_params *params = vq->drv_priv;
>  	struct rkisp1_buffer *buf;
> -	struct list_head tmp_list;
> -
> -	INIT_LIST_HEAD(&tmp_list);
> +	LIST_HEAD(tmp_list);
>  
>  	/*
>  	 * we first move the buffers into a local list 'tmp_list'
> @@ -1473,7 +1471,7 @@ static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq)
>  	 */
>  	spin_lock_irq(&params->config_lock);
>  	params->is_streaming = false;
> -	list_cut_position(&tmp_list, &params->params, params->params.prev);
> +	list_splice_init(&params->params, &tmp_list);
>  	spin_unlock_irq(&params->config_lock);
>  
>  	list_for_each_entry(buf, &tmp_list, queue)
>
diff mbox series

Patch

diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
index 986d293201e6..cb9f3332a9a0 100644
--- a/drivers/staging/media/rkisp1/rkisp1-params.c
+++ b/drivers/staging/media/rkisp1/rkisp1-params.c
@@ -1462,9 +1462,7 @@  static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq)
 {
 	struct rkisp1_params *params = vq->drv_priv;
 	struct rkisp1_buffer *buf;
-	struct list_head tmp_list;
-
-	INIT_LIST_HEAD(&tmp_list);
+	LIST_HEAD(tmp_list);
 
 	/*
 	 * we first move the buffers into a local list 'tmp_list'
@@ -1473,7 +1471,7 @@  static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq)
 	 */
 	spin_lock_irq(&params->config_lock);
 	params->is_streaming = false;
-	list_cut_position(&tmp_list, &params->params, params->params.prev);
+	list_splice_init(&params->params, &tmp_list);
 	spin_unlock_irq(&params->config_lock);
 
 	list_for_each_entry(buf, &tmp_list, queue)