projects
/
vdummy
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1f8e478
)
conditional alloc_ctx type based on kernel version
master
author
John Tsiombikas
<nuclear@mutantstargoat.com>
Tue, 16 May 2017 06:19:04 +0000
(09:19 +0300)
committer
John Tsiombikas
<nuclear@mutantstargoat.com>
Tue, 16 May 2017 06:19:04 +0000
(09:19 +0300)
vdummy.c
patch
|
blob
|
history
diff --git
a/vdummy.c
b/vdummy.c
index
b434b6f
..
240d4f8
100644
(file)
--- a/
vdummy.c
+++ b/
vdummy.c
@@
-5,6
+5,7
@@
#include <linux/slab.h>
#include <linux/hrtimer.h>
#include <linux/ktime.h>
#include <linux/slab.h>
#include <linux/hrtimer.h>
#include <linux/ktime.h>
+#include <linux/version.h>
#include <asm/uaccess.h>
#include <linux/videodev2.h>
#include <media/videobuf2-vmalloc.h>
#include <asm/uaccess.h>
#include <linux/videodev2.h>
#include <media/videobuf2-vmalloc.h>
@@
-32,8
+33,15
@@
static int ioctl_get_parm(struct file *file, void *fh, struct v4l2_streamparm *f
static int ioctl_set_parm(struct file *file, void *fh, struct v4l2_streamparm *fmt);
static int ioctl_queryctl(struct file *file, void *fh, struct v4l2_queryctrl *ctl);
static int ioctl_set_parm(struct file *file, void *fh, struct v4l2_streamparm *fmt);
static int ioctl_queryctl(struct file *file, void *fh, struct v4l2_queryctrl *ctl);
+/* TODO find out exact version where this switched over */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
+#define ALLOC_CTX_TYPE void
+#else
+#define ALLOC_CTX_TYPE struct device
+#endif
+
static int queue_setup(struct vb2_queue *vbq, unsigned int *nbuf,
static int queue_setup(struct vb2_queue *vbq, unsigned int *nbuf,
- unsigned int *nplanes, unsigned int *sizes, struct device **alloc_ctx);
+ unsigned int *nplanes, unsigned int *sizes, ALLOC_CTX_TYPE **alloc_ctx);
static int buf_prepare(struct vb2_buffer *vb);
static void buf_queue(struct vb2_buffer *vb);
static int start_streaming(struct vb2_queue *vbq, unsigned int count);
static int buf_prepare(struct vb2_buffer *vb);
static void buf_queue(struct vb2_buffer *vb);
static int start_streaming(struct vb2_queue *vbq, unsigned int count);
@@
-301,7
+309,7
@@
static int ioctl_queryctl(struct file *file, void *fh, struct v4l2_queryctrl *ct
}
static int queue_setup(struct vb2_queue *vbq, unsigned int *nbuf,
}
static int queue_setup(struct vb2_queue *vbq, unsigned int *nbuf,
- unsigned int *nplanes, unsigned int *sizes, struct device **alloc_ctx)
+ unsigned int *nplanes, unsigned int *sizes, ALLOC_CTX_TYPE **alloc_ctx)
{
if(vbq->num_buffers + *nbuf < 2) {
*nbuf = 2 - vbq->num_buffers;
{
if(vbq->num_buffers + *nbuf < 2) {
*nbuf = 2 - vbq->num_buffers;