[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <15d401da37c4$a9dece80$fd9c6b80$@samsung.com>
Date: Tue, 26 Dec 2023 11:57:53 +0530
From: "Aakarsh Jain" <aakarsh.jain@...sung.com>
To: "'Krzysztof Kozlowski'" <krzysztof.kozlowski@...aro.org>, "'Marek
Szyprowski'" <m.szyprowski@...sung.com>, "'Andrzej Hajda'"
<andrzej.hajda@...el.com>, "'Mauro Carvalho Chehab'" <mchehab@...nel.org>
Cc: <linux-fsd@...la.coma>, <linux-samsung-soc@...r.kernel.org>, "'Smitha T
Murthy'" <smithatmurthy@...il.com>, <linux-arm-kernel@...ts.infradead.org>,
<linux-media@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 09/15] media: s5p-mfc: constify s5p_mfc_fmt structures
> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
> Sent: 24 December 2023 21:14
> To: Marek Szyprowski <m.szyprowski@...sung.com>; Andrzej Hajda
> <andrzej.hajda@...el.com>; Mauro Carvalho Chehab
> <mchehab@...nel.org>
> Cc: Aakarsh Jain <aakarsh.jain@...sung.com>; linux-fsd@...la.coma; linux-
> samsung-soc@...r.kernel.org; Smitha T Murthy
> <smithatmurthy@...il.com>; linux-arm-kernel@...ts.infradead.org; linux-
> media@...r.kernel.org; linux-kernel@...r.kernel.org; Krzysztof Kozlowski
> <krzysztof.kozlowski@...aro.org>
> Subject: [PATCH 09/15] media: s5p-mfc: constify s5p_mfc_fmt structures
>
> 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@...aro.org>
> ---
> drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h | 4 ++--
> drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c | 6 +++---
> drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 8 ++++----
> 3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h
> b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h
> index fa556f27fa06..e9283020070e 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h
> @@ -633,8 +633,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;
> diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c
> b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c
> index 4dbe8792ac3d..2f664c7e9e4c 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c
> @@ -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,
> @@ -163,7 +163,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;
>
> @@ -387,7 +387,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) { diff --git
> a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c
> b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c
> index 4b4c129c09e7..d6a4b9c701eb 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c
> @@ -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,
> @@ -97,7 +97,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;
>
> @@ -1394,7 +1394,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) { @@ -
> 2355,7 +2355,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;
>
>
> --
> 2.34.1
Reviewed-by: Aakarsh Jain <aakarsh.jain@...sung.com>
Thanks!
Powered by blists - more mailing lists