media: s5p-mfc: constify s5p_mfc_fmt structures
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 24 Dec 2023 15:44:08 +0000 (16:44 +0100)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 22 Jan 2024 11:16:43 +0000 (12:16 +0100)
Static "s5p_mfc_fmt" structures are not modified by the driver, so
they can be made const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Aakarsh Jain <aakarsh.jain@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c

index 4457dacc3c9c70b65f329884114a19cd9655c4bd..0f6e260746c992d43aaf45e07ff178a053045b79 100644 (file)
@@ -639,8 +639,8 @@ struct s5p_mfc_ctx {
        unsigned int int_err;
        wait_queue_head_t queue;
 
-       struct s5p_mfc_fmt *src_fmt;
-       struct s5p_mfc_fmt *dst_fmt;
+       const struct s5p_mfc_fmt *src_fmt;
+       const struct s5p_mfc_fmt *dst_fmt;
 
        struct vb2_queue vq_src;
        struct vb2_queue vq_dst;
index ad7a868af6c3fce4550c0bf151968c784153d0f6..b25ac2c89ff50504cec7a5b433e895b5f9ac3c13 100644 (file)
@@ -27,7 +27,7 @@
 #include "s5p_mfc_opr.h"
 #include "s5p_mfc_pm.h"
 
-static struct s5p_mfc_fmt formats[] = {
+static const struct s5p_mfc_fmt formats[] = {
        {
                .fourcc         = V4L2_PIX_FMT_NV12MT_16X16,
                .codec_mode     = S5P_MFC_CODEC_NONE,
@@ -177,7 +177,7 @@ static struct s5p_mfc_fmt formats[] = {
 #define NUM_FORMATS ARRAY_SIZE(formats)
 
 /* Find selected format description */
-static struct s5p_mfc_fmt *find_format(struct v4l2_format *f, unsigned int t)
+static const struct s5p_mfc_fmt *find_format(struct v4l2_format *f, unsigned int t)
 {
        unsigned int i;
 
@@ -406,7 +406,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
 static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
 {
        struct s5p_mfc_dev *dev = video_drvdata(file);
-       struct s5p_mfc_fmt *fmt;
+       const struct s5p_mfc_fmt *fmt;
 
        mfc_debug(2, "Type is %d\n", f->type);
        if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
index ef8bb40b9712e4cd39eb489a4fc83472d53a2a26..abc8fdeab305f44d0db1b2f2aa5d80eb73224d9e 100644 (file)
@@ -30,7 +30,7 @@
 #define DEF_SRC_FMT_ENC        V4L2_PIX_FMT_NV12M
 #define DEF_DST_FMT_ENC        V4L2_PIX_FMT_H264
 
-static struct s5p_mfc_fmt formats[] = {
+static const struct s5p_mfc_fmt formats[] = {
        {
                .fourcc         = V4L2_PIX_FMT_NV12MT_16X16,
                .codec_mode     = S5P_MFC_CODEC_NONE,
@@ -111,7 +111,7 @@ static struct s5p_mfc_fmt formats[] = {
 };
 
 #define NUM_FORMATS ARRAY_SIZE(formats)
-static struct s5p_mfc_fmt *find_format(struct v4l2_format *f, unsigned int t)
+static const struct s5p_mfc_fmt *find_format(struct v4l2_format *f, unsigned int t)
 {
        unsigned int i;
 
@@ -1431,7 +1431,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
 static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
 {
        struct s5p_mfc_dev *dev = video_drvdata(file);
-       struct s5p_mfc_fmt *fmt;
+       const struct s5p_mfc_fmt *fmt;
        struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
 
        if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
@@ -2392,7 +2392,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_enc_ioctl_ops = {
        .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
 };
 
-static int check_vb_with_fmt(struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb)
+static int check_vb_with_fmt(const struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb)
 {
        int i;