2017-06-29 08:54:05

by Bhumika Goyal

[permalink] [raw]
Subject: [PATCH] [media] media/platform: add const to v4l2_file_operations structures

Declare v4l2_file_operations structures as const as they are only stored
in the fops field of video_device structures. This field is of type
const, so declare v4l2_file_operations structures with similar properties
as const.

Cross compiled bfin_capture.o for blackfin arch. vpbe_display.o file did
not cross compile for arm. Could not find any architecture matching the
configuraion symbol for fsl-viu.c file.

Signed-off-by: Bhumika Goyal <[email protected]>
---
drivers/media/platform/blackfin/bfin_capture.c | 2 +-
drivers/media/platform/davinci/vpbe_display.c | 2 +-
drivers/media/platform/davinci/vpif_capture.c | 2 +-
drivers/media/platform/fsl-viu.c | 2 +-
drivers/media/platform/soc_camera/soc_camera.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
index 1c5166d..294d696 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -769,7 +769,7 @@ static const struct v4l2_ioctl_ops bcap_ioctl_ops = {
.vidioc_log_status = bcap_log_status,
};

-static struct v4l2_file_operations bcap_fops = {
+static const struct v4l2_file_operations bcap_fops = {
.owner = THIS_MODULE,
.open = v4l2_fh_open,
.release = vb2_fop_release,
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c
index a9bc017..ca2adfa 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -1275,7 +1275,7 @@ static const struct v4l2_ioctl_ops vpbe_ioctl_ops = {
.vidioc_enum_dv_timings = vpbe_display_enum_dv_timings,
};

-static struct v4l2_file_operations vpbe_fops = {
+static const struct v4l2_file_operations vpbe_fops = {
.owner = THIS_MODULE,
.open = vpbe_display_open,
.release = vpbe_display_release,
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index d78580f..fbdc196 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1344,7 +1344,7 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
};

/* vpif file operations */
-static struct v4l2_file_operations vpif_fops = {
+static const struct v4l2_file_operations vpif_fops = {
.owner = THIS_MODULE,
.open = v4l2_fh_open,
.release = vb2_fop_release,
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index 97e164b..f7b88e5 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -1340,7 +1340,7 @@ static int viu_mmap(struct file *file, struct vm_area_struct *vma)
return ret;
}

-static struct v4l2_file_operations viu_fops = {
+static const struct v4l2_file_operations viu_fops = {
.owner = THIS_MODULE,
.open = viu_open,
.release = viu_release,
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 45a0429..dd349ef 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -820,7 +820,7 @@ static unsigned int soc_camera_poll(struct file *file, poll_table *pt)
return res;
}

-static struct v4l2_file_operations soc_camera_fops = {
+static const struct v4l2_file_operations soc_camera_fops = {
.owner = THIS_MODULE,
.open = soc_camera_open,
.release = soc_camera_close,
--
2.7.4


2017-06-30 09:51:22

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH] [media] media/platform: add const to v4l2_file_operations structures

Hi,

Thanks for the patch.

On Thu, Jun 29, 2017 at 9:51 AM, Bhumika Goyal <[email protected]> wrote:
> Declare v4l2_file_operations structures as const as they are only stored
> in the fops field of video_device structures. This field is of type
> const, so declare v4l2_file_operations structures with similar properties
> as const.
>
> Cross compiled bfin_capture.o for blackfin arch. vpbe_display.o file did
> not cross compile for arm. Could not find any architecture matching the
> configuraion symbol for fsl-viu.c file.
>
s/configuraion/configuration

Ideally the above statement should go below --- (after the signoff) so that
its not the part of commit message.

> Signed-off-by: Bhumika Goyal <[email protected]>
> ---
> drivers/media/platform/davinci/vpbe_display.c | 2 +-
> drivers/media/platform/davinci/vpif_capture.c | 2 +-

For above:
Acked-by: Lad, Prabhakar <[email protected]>

Cheers,
--Prabhakar Lad