diff options
author | Kamil Debski <k.debski@samsung.com> | 2015-02-23 07:26:16 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-10 08:44:38 -0400 |
commit | 06e7a9b638467fddf8f62ca9f07adc7754319461 (patch) | |
tree | 97d1e05d23d9b181ff5ec032ee501bef3756f466 /drivers/media | |
parent | be8e58d93fba531b12ef2fce4fb33c9c5fb5b69f (diff) |
[media] vb2: split the io_flags member of vb2_queue into a bit field
This patch splits the io_flags member of vb2_queue into a bit field.
Instead of an enum with flags separate bit fields were introduced.
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-core.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 167c1d93bd4c..8bc2a6e8623d 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -2760,7 +2760,8 @@ struct vb2_fileio_data { | |||
2760 | unsigned int initial_index; | 2760 | unsigned int initial_index; |
2761 | unsigned int q_count; | 2761 | unsigned int q_count; |
2762 | unsigned int dq_count; | 2762 | unsigned int dq_count; |
2763 | unsigned int flags; | 2763 | unsigned read_once:1; |
2764 | unsigned write_immediately:1; | ||
2764 | }; | 2765 | }; |
2765 | 2766 | ||
2766 | /** | 2767 | /** |
@@ -2798,14 +2799,16 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read) | |||
2798 | */ | 2799 | */ |
2799 | count = 1; | 2800 | count = 1; |
2800 | 2801 | ||
2801 | dprintk(3, "setting up file io: mode %s, count %d, flags %08x\n", | 2802 | dprintk(3, "setting up file io: mode %s, count %d, read_once %d, write_immediately %d\n", |
2802 | (read) ? "read" : "write", count, q->io_flags); | 2803 | (read) ? "read" : "write", count, q->fileio_read_once, |
2804 | q->fileio_write_immediately); | ||
2803 | 2805 | ||
2804 | fileio = kzalloc(sizeof(struct vb2_fileio_data), GFP_KERNEL); | 2806 | fileio = kzalloc(sizeof(struct vb2_fileio_data), GFP_KERNEL); |
2805 | if (fileio == NULL) | 2807 | if (fileio == NULL) |
2806 | return -ENOMEM; | 2808 | return -ENOMEM; |
2807 | 2809 | ||
2808 | fileio->flags = q->io_flags; | 2810 | fileio->read_once = q->fileio_read_once; |
2811 | fileio->write_immediately = q->fileio_write_immediately; | ||
2809 | 2812 | ||
2810 | /* | 2813 | /* |
2811 | * Request buffers and use MMAP type to force driver | 2814 | * Request buffers and use MMAP type to force driver |
@@ -3028,13 +3031,11 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_ | |||
3028 | /* | 3031 | /* |
3029 | * Queue next buffer if required. | 3032 | * Queue next buffer if required. |
3030 | */ | 3033 | */ |
3031 | if (buf->pos == buf->size || | 3034 | if (buf->pos == buf->size || (!read && fileio->write_immediately)) { |
3032 | (!read && (fileio->flags & VB2_FILEIO_WRITE_IMMEDIATELY))) { | ||
3033 | /* | 3035 | /* |
3034 | * Check if this is the last buffer to read. | 3036 | * Check if this is the last buffer to read. |
3035 | */ | 3037 | */ |
3036 | if (read && (fileio->flags & VB2_FILEIO_READ_ONCE) && | 3038 | if (read && fileio->read_once && fileio->dq_count == 1) { |
3037 | fileio->dq_count == 1) { | ||
3038 | dprintk(3, "read limit reached\n"); | 3039 | dprintk(3, "read limit reached\n"); |
3039 | return __vb2_cleanup_fileio(q); | 3040 | return __vb2_cleanup_fileio(q); |
3040 | } | 3041 | } |