Hello. On 12/18/2014 05:50 PM, Ben Hutchings wrote:
From: William Towle <william.towle@xxxxxxxxxxxxxxx>
Move the buffer state test in the .buf_cleanup handler into .stop_streaming so that a) the vb2_queue API is not subverted, and b) tracking of active-state buffers via priv->queue_buf[] is handled as early as is possible
Signed-off-by: William Towle <william.towle@xxxxxxxxxxxxxxx> --- drivers/media/platform/soc_camera/rcar_vin.c | 36 ++++++++++---------------- 1 file changed, 14 insertions(+), 22 deletions(-)
diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c index 20dbedf..bf60074 100644 --- a/drivers/media/platform/soc_camera/rcar_vin.c +++ b/drivers/media/platform/soc_camera/rcar_vin.c
[...]
@@ -533,8 +513,20 @@ static void rcar_vin_stop_streaming(struct vb2_queue *vq) rcar_vin_wait_stop_streaming(priv); for (i = 0; i < vq->num_buffers; ++i) - if (vq->bufs[i]->state == VB2_BUF_STATE_ACTIVE) + if (vq->bufs[i]->state == VB2_BUF_STATE_ACTIVE) { + int j; + + /* Is this a buffer we have told the + * hardware about? Update the associated + * list, if so + */ + for (j = 0; j < MAX_BUFFER_NUM; j++) { + if (priv->queue_buf[j] == vq->bufs[i]) { + priv->queue_buf[j] = NULL; + }
Don't need {} here.
+ } vb2_buffer_done(vq->bufs[i], VB2_BUF_STATE_ERROR); + }
WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html