From: Hans Verkuil Date: Fri, 14 Feb 2014 09:46:50 +0000 (-0300) Subject: [media] vb2: fix read/write regression X-Git-Tag: v3.15-rc1~85^2~172 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e5a4d8a8e970bd6b96c1c710cd636770b776697;p=pandora-kernel.git [media] vb2: fix read/write regression Commit 88e268702bfba78448abd20a31129458707383aa ("vb2: Improve file I/O emulation to handle buffers in any order") broke read/write support if the size of the buffer being read/written is less than the size of the image. When the commit was tested originally I used qv4l2, which calls read() with exactly the size of the image. But if you try 'cat /dev/video0' then it will fail and typically hang after reading two buffers. This patch fixes the behavior by adding a new cur_index field that contains the index of the field currently being filled/read, or it is num_buffers in which case a new buffer needs to be dequeued. The old index field has been renamed to initial_index in order to be a bit more descriptive. This has been tested with both read and write. Signed-off-by: Hans Verkuil Tested-by: Hans Verkuil Cc: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- Reading git-diff-tree failed