Update github.com git:// SRC_URIs
[AGL/meta-agl-demo.git] / recipes-kernel / most / files / 0013-Fix-build-with-5.7-kernel.patch
1 Fix building against 5.7 or newer kernels
2
3 VFL_TYPE_GRABBER was renamed VFL_TYPE_VIDEO in 5.7.  Marking as
4 inappropriate for upstream for now, as it seems the standalone
5 version of the driver has been superceded by the version in the
6 staging tree in the mainline kernel, and there are no obvious
7 signs of maintenance.
8
9 Upstream-Status: Inappropriate [no upstream]
10 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
11
12 ---
13 diff --git a/aim-v4l2/video.c b/aim-v4l2/video.c
14 index db75d4d..fbf7139 100644
15 --- a/aim-v4l2/video.c
16 +++ b/aim-v4l2/video.c
17 @@ -14,6 +14,7 @@
18  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19  
20  #include <linux/module.h>
21 +#include <linux/version.h>
22  #include <linux/slab.h>
23  #include <linux/init.h>
24  #include <linux/device.h>
25 @@ -31,6 +32,11 @@
26  
27  #define V4L2_AIM_MAX_INPUT  1
28  
29 +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0)
30 +/* Handle pre-5.7 naming */
31 +#define VFL_TYPE_VIDEO VFL_TYPE_GRABBER
32 +#endif
33 +
34  static struct most_aim aim_info;
35  
36  struct most_video_dev {
37 @@ -82,7 +88,7 @@ static int aim_vdev_open(struct file *filp)
38         v4l2_info(&mdev->v4l2_dev, "aim_vdev_open()\n");
39  
40         switch (vdev->vfl_type) {
41 -       case VFL_TYPE_GRABBER:
42 +       case VFL_TYPE_VIDEO:
43                 break;
44         default:
45                 return -EINVAL;
46 @@ -461,7 +467,7 @@ static int aim_register_videodev(struct most_video_dev *mdev)
47  
48         /* Register the v4l2 device */
49         video_set_drvdata(mdev->vdev, mdev);
50 -       ret = video_register_device(mdev->vdev, VFL_TYPE_GRABBER, -1);
51 +       ret = video_register_device(mdev->vdev, VFL_TYPE_VIDEO, -1);
52         if (ret) {
53                 v4l2_err(&mdev->v4l2_dev, "video_register_device failed (%d)\n",
54                          ret);