media: platform: make video_device const
authorBhumika Goyal <bhumirks@gmail.com>
Sat, 26 Aug 2017 12:57:26 +0000 (08:57 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sun, 27 Aug 2017 12:44:30 +0000 (08:44 -0400)
Make these const as they are only used during a copy operation.
Done using Coccinelle:

@match disable optional_qualifier@
identifier s;
@@
static struct video_device s = {...};

@ref@
position p;
identifier match.s;
@@
s@p

@good1@
identifier match.s;
expression list[3] es;
position ref.p;
@@
cx88_vdev_init(es,&s@p,...)

@good2@
position ref.p;
identifier match.s,f,c;
expression e;
@@
(
e = s@p
|
e = s@p.f
|
c(...,s@p.f,...)
|
c(...,s@p,...)
)

@bad depends on  !good1 && !good2@
position ref.p;
identifier match.s;
@@
s@p

@depends on forall !bad disable optional_qualifier@
identifier match.s;
@@
static
+ const
struct video_device s;

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/fsl-viu.c
drivers/media/platform/m2m-deinterlace.c
drivers/media/platform/marvell-ccic/mcam-core.c
drivers/media/platform/mx2_emmaprp.c
drivers/media/platform/s5p-g2d/g2d.c
drivers/media/platform/ti-vpe/cal.c
drivers/media/platform/ti-vpe/vpe.c
drivers/media/platform/via-camera.c
drivers/media/platform/vim2m.c

index 2e06dd5..fb43025 100644 (file)
@@ -1380,7 +1380,7 @@ static const struct v4l2_ioctl_ops viu_ioctl_ops = {
        .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
 };
 
-static struct video_device viu_template = {
+static const struct video_device viu_template = {
        .name           = "FSL viu",
        .fops           = &viu_fops,
        .minor          = -1,
index 98f6db2..c8a1249 100644 (file)
@@ -979,7 +979,7 @@ static const struct v4l2_file_operations deinterlace_fops = {
        .mmap           = deinterlace_mmap,
 };
 
-static struct video_device deinterlace_videodev = {
+static const struct video_device deinterlace_videodev = {
        .name           = MEM2MEM_NAME,
        .fops           = &deinterlace_fops,
        .ioctl_ops      = &deinterlace_ioctl_ops,
index 8cac2f2..b07a251 100644 (file)
@@ -1639,7 +1639,7 @@ static const struct v4l2_file_operations mcam_v4l_fops = {
  * This template device holds all of those v4l2 methods; we
  * clone it for specific real devices.
  */
-static struct video_device mcam_v4l_template = {
+static const struct video_device mcam_v4l_template = {
        .name = "mcam",
        .fops = &mcam_v4l_fops,
        .ioctl_ops = &mcam_v4l_ioctl_ops,
index 92124ff..4a2b1af 100644 (file)
@@ -873,7 +873,7 @@ static const struct v4l2_file_operations emmaprp_fops = {
        .mmap           = emmaprp_mmap,
 };
 
-static struct video_device emmaprp_videodev = {
+static const struct video_device emmaprp_videodev = {
        .name           = MEM2MEM_NAME,
        .fops           = &emmaprp_fops,
        .ioctl_ops      = &emmaprp_ioctl_ops,
index bd655b5..66aa8cf 100644 (file)
@@ -602,7 +602,7 @@ static const struct v4l2_ioctl_ops g2d_ioctl_ops = {
        .vidioc_cropcap                 = vidioc_cropcap,
 };
 
-static struct video_device g2d_videodev = {
+static const struct video_device g2d_videodev = {
        .name           = G2D_NAME,
        .fops           = &g2d_fops,
        .ioctl_ops      = &g2d_ioctl_ops,
index 0c7ddf8..42e383a 100644 (file)
@@ -1420,7 +1420,7 @@ static const struct v4l2_ioctl_ops cal_ioctl_ops = {
        .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
 };
 
-static struct video_device cal_videodev = {
+static const struct video_device cal_videodev = {
        .name           = CAL_MODULE_NAME,
        .fops           = &cal_fops,
        .ioctl_ops      = &cal_ioctl_ops,
index 2873c22..45bd105 100644 (file)
@@ -2421,7 +2421,7 @@ static const struct v4l2_file_operations vpe_fops = {
        .mmap           = v4l2_m2m_fop_mmap,
 };
 
-static struct video_device vpe_videodev = {
+static const struct video_device vpe_videodev = {
        .name           = VPE_MODULE_NAME,
        .fops           = &vpe_fops,
        .ioctl_ops      = &vpe_ioctl_ops,
index e16f70a..805d4a8 100644 (file)
@@ -1259,7 +1259,7 @@ static struct viafb_pm_hooks viacam_pm_hooks = {
  * Setup stuff.
  */
 
-static struct video_device viacam_v4l_template = {
+static const struct video_device viacam_v4l_template = {
        .name           = "via-camera",
        .minor          = -1,
        .tvnorms        = V4L2_STD_NTSC_M,
index afbaa35..b01fba0 100644 (file)
@@ -974,7 +974,7 @@ static const struct v4l2_file_operations vim2m_fops = {
        .mmap           = v4l2_m2m_fop_mmap,
 };
 
-static struct video_device vim2m_videodev = {
+static const struct video_device vim2m_videodev = {
        .name           = MEM2MEM_NAME,
        .vfl_dir        = VFL_DIR_M2M,
        .fops           = &vim2m_fops,