[RFC,1/5] media: rcar_vin: Dont aggressively retire buffers

Message ID 1418914152.22813.14.camel@xylophone.i.decadent.org.uk (mailing list archive)
State Superseded, archived
Delegated to: Guennadi Liakhovetski
Headers

Commit Message

Ben Hutchings Dec. 18, 2014, 2:49 p.m. UTC
  From: Ian Molton <ian.molton@codethink.co.uk>

rcar_vin_videobuf_release() is called once per buffer from the buf_cleanup hook.

There is no need to look up the queue and free all buffers at this point.

Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
Signed-off-by: William Towle <william.towle@codethink.co.uk>
---
 drivers/media/platform/soc_camera/rcar_vin.c |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
  

Comments

Guennadi Liakhovetski Jan. 18, 2015, 8:16 p.m. UTC | #1
Hi Ben,

Sorry for a long delay. The patch looks good to me, although I'll extend 
it a bit by also removing the comment above the deleted loop - it's no 
longer relevant.

Thanks
Guennadi

On Thu, 18 Dec 2014, Ben Hutchings wrote:

> From: Ian Molton <ian.molton@codethink.co.uk>
> 
> rcar_vin_videobuf_release() is called once per buffer from the buf_cleanup hook.
> 
> There is no need to look up the queue and free all buffers at this point.
> 
> Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
> Signed-off-by: William Towle <william.towle@codethink.co.uk>
> ---
>  drivers/media/platform/soc_camera/rcar_vin.c |   12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
> index 8d8438b..773de53 100644
> --- a/drivers/media/platform/soc_camera/rcar_vin.c
> +++ b/drivers/media/platform/soc_camera/rcar_vin.c
> @@ -496,17 +496,11 @@ static void rcar_vin_videobuf_release(struct vb2_buffer *vb)
>  		 * to release could be any of the current buffers in use, so
>  		 * release all buffers that are in use by HW
>  		 */
> -		for (i = 0; i < MAX_BUFFER_NUM; i++) {
> -			if (priv->queue_buf[i]) {
> -				vb2_buffer_done(priv->queue_buf[i],
> -					VB2_BUF_STATE_ERROR);
> -				priv->queue_buf[i] = NULL;
> -			}
> -		}
> -	} else {
> -		list_del_init(to_buf_list(vb));
> +		priv->queue_buf[i] = NULL;
>  	}
>  
> +	list_del_init(to_buf_list(vb));
> +
>  	spin_unlock_irq(&priv->lock);
>  }
>  
> -- 
> 1.7.10.4
> 
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
index 8d8438b..773de53 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -496,17 +496,11 @@  static void rcar_vin_videobuf_release(struct vb2_buffer *vb)
 		 * to release could be any of the current buffers in use, so
 		 * release all buffers that are in use by HW
 		 */
-		for (i = 0; i < MAX_BUFFER_NUM; i++) {
-			if (priv->queue_buf[i]) {
-				vb2_buffer_done(priv->queue_buf[i],
-					VB2_BUF_STATE_ERROR);
-				priv->queue_buf[i] = NULL;
-			}
-		}
-	} else {
-		list_del_init(to_buf_list(vb));
+		priv->queue_buf[i] = NULL;
 	}
 
+	list_del_init(to_buf_list(vb));
+
 	spin_unlock_irq(&priv->lock);
 }