media: platform: make video_device const

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>
This commit is contained in:
Bhumika Goyal 2017-08-26 08:57:26 -04:00 committed by Mauro Carvalho Chehab
parent 3db4b68e46
commit 5303135c17
9 changed files with 9 additions and 9 deletions

View 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,

View 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,

View 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,

View 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,

View 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,

View 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,

View 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,

View 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,

View 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,