diff options
| author | Florian Echtler <floe@butterbrot.org> | 2015-05-25 08:04:16 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-05-30 10:45:00 -0400 |
| commit | 2b7eea83a4e694018ddc155078bc36bf702ea466 (patch) | |
| tree | 9d37051e1546a50902d9f22312b0ca2e35d00be8 /drivers/input | |
| parent | 0cfdfcc1db13c7b6b6f930ac0528d5b010f45220 (diff) | |
[media] return BUF_STATE_ERROR if streaming stopped during acquisition
When stop_streaming is called while a frame is currently being retrieved, the
buffer being filled will still be returned with BUF_STATE_DONE. By resetting
the sequence number and checking before returning the buffer, it can now
correctly be returned with BUF_STATE_ERROR.
Signed-off-by: Martin Kaltenbrunner <modin@yuri.at>
Signed-off-by: Florian Echtler <floe@butterbrot.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/input')
| -rw-r--r-- | drivers/input/touchscreen/sur40.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c index 8add986abc82..8be7b9b79f20 100644 --- a/drivers/input/touchscreen/sur40.c +++ b/drivers/input/touchscreen/sur40.c | |||
| @@ -438,6 +438,10 @@ static void sur40_process_video(struct sur40_state *sur40) | |||
| 438 | 438 | ||
| 439 | dev_dbg(sur40->dev, "image acquired\n"); | 439 | dev_dbg(sur40->dev, "image acquired\n"); |
| 440 | 440 | ||
| 441 | /* return error if streaming was stopped in the meantime */ | ||
| 442 | if (sur40->sequence == -1) | ||
| 443 | goto err_poll; | ||
| 444 | |||
| 441 | /* mark as finished */ | 445 | /* mark as finished */ |
| 442 | v4l2_get_timestamp(&new_buf->vb.v4l2_buf.timestamp); | 446 | v4l2_get_timestamp(&new_buf->vb.v4l2_buf.timestamp); |
| 443 | new_buf->vb.v4l2_buf.sequence = sur40->sequence++; | 447 | new_buf->vb.v4l2_buf.sequence = sur40->sequence++; |
| @@ -723,6 +727,7 @@ static int sur40_start_streaming(struct vb2_queue *vq, unsigned int count) | |||
| 723 | static void sur40_stop_streaming(struct vb2_queue *vq) | 727 | static void sur40_stop_streaming(struct vb2_queue *vq) |
| 724 | { | 728 | { |
| 725 | struct sur40_state *sur40 = vb2_get_drv_priv(vq); | 729 | struct sur40_state *sur40 = vb2_get_drv_priv(vq); |
| 730 | sur40->sequence = -1; | ||
| 726 | 731 | ||
| 727 | /* Release all active buffers */ | 732 | /* Release all active buffers */ |
| 728 | return_all_buffers(sur40, VB2_BUF_STATE_ERROR); | 733 | return_all_buffers(sur40, VB2_BUF_STATE_ERROR); |
