RE: [PATCH 07/15] media: s5p-mfc: constify s5p_mfc_hw_cmds structures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> Sent: 24 December 2023 21:14
> To: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>; Andrzej Hajda
> <andrzej.hajda@xxxxxxxxx>; Mauro Carvalho Chehab
> <mchehab@xxxxxxxxxx>
> Cc: Aakarsh Jain <aakarsh.jain@xxxxxxxxxxx>; linux-fsd@xxxxxxxxxx; linux-
> samsung-soc@xxxxxxxxxxxxxxx; Smitha T Murthy
> <smithatmurthy@xxxxxxxxx>; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-
> media@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Krzysztof Kozlowski
> <krzysztof.kozlowski@xxxxxxxxxx>
> Subject: [PATCH 07/15] media: s5p-mfc: constify s5p_mfc_hw_cmds
> structures
> 
> Static "s5p_mfc_hw_cmds" structures are not modified by the driver, so they
> can be made const for code safety.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> ---
>  drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.c | 4 ++--
> drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.h | 2 +-
> drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c | 4 ++--
> drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.h | 2 +-
> drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h | 2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.c
> b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.c
> index 327e54e70611..1fbf7ed5d4cc 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.c
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.c
> @@ -148,7 +148,7 @@ static int s5p_mfc_close_inst_cmd_v5(struct
> s5p_mfc_ctx *ctx)  }
> 
>  /* Initialize cmd function pointers for MFC v5 */ -static struct
> s5p_mfc_hw_cmds s5p_mfc_cmds_v5 = {
> +static const struct s5p_mfc_hw_cmds s5p_mfc_cmds_v5 = {
>  	.cmd_host2risc = s5p_mfc_cmd_host2risc_v5,
>  	.sys_init_cmd = s5p_mfc_sys_init_cmd_v5,
>  	.sleep_cmd = s5p_mfc_sleep_cmd_v5,
> @@ -157,7 +157,7 @@ static struct s5p_mfc_hw_cmds s5p_mfc_cmds_v5 = {
>  	.close_inst_cmd = s5p_mfc_close_inst_cmd_v5,  };
> 
> -struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v5(void)
> +const struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v5(void)
>  {
>  	return &s5p_mfc_cmds_v5;
>  }
> diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.h
> b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.h
> index 6eafa514aebc..c626376053c4 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.h
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.h
> @@ -11,6 +11,6 @@
> 
>  #include "s5p_mfc_common.h"
> 
> -struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v5(void);
> +const struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v5(void);
> 
>  #endif /* S5P_MFC_CMD_H_ */
> diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c
> b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c
> index 25c4719a5dd0..740aa4dfae57 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c
> @@ -154,7 +154,7 @@ static int s5p_mfc_close_inst_cmd_v6(struct
> s5p_mfc_ctx *ctx)  }
> 
>  /* Initialize cmd function pointers for MFC v6 */ -static struct
> s5p_mfc_hw_cmds s5p_mfc_cmds_v6 = {
> +static const struct s5p_mfc_hw_cmds s5p_mfc_cmds_v6 = {
>  	.cmd_host2risc = s5p_mfc_cmd_host2risc_v6,
>  	.sys_init_cmd = s5p_mfc_sys_init_cmd_v6,
>  	.sleep_cmd = s5p_mfc_sleep_cmd_v6,
> @@ -163,7 +163,7 @@ static struct s5p_mfc_hw_cmds s5p_mfc_cmds_v6 = {
>  	.close_inst_cmd = s5p_mfc_close_inst_cmd_v6,  };
> 
> -struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v6(void)
> +const struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v6(void)
>  {
>  	return &s5p_mfc_cmds_v6;
>  }
> diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.h
> b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.h
> index 9dc44460cc38..29083436f517 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.h
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.h
> @@ -11,6 +11,6 @@
> 
>  #include "s5p_mfc_common.h"
> 
> -struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v6(void);
> +const struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v6(void);
> 
>  #endif /* S5P_MFC_CMD_H_ */
> 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 6a47f3434c60..9278ed537e9c 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h
> @@ -339,7 +339,7 @@ struct s5p_mfc_dev {
>  	struct s5p_mfc_priv_buf ctx_buf;
>  	int warn_start;
>  	struct s5p_mfc_hw_ops *mfc_ops;
> -	struct s5p_mfc_hw_cmds *mfc_cmds;
> +	const struct s5p_mfc_hw_cmds *mfc_cmds;
>  	const struct s5p_mfc_regs *mfc_regs;
>  	enum s5p_mfc_fw_ver fw_ver;
>  	bool fw_get_done;
> 
> --
> 2.34.1

Reviewed-by: Aakarsh Jain <aakarsh.jain@xxxxxxxxxxx>

Thanks!






[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux