media: s5p-mfc: constify s5p_mfc_hw_cmds structures
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 24 Dec 2023 15:44:06 +0000 (16:44 +0100)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 22 Jan 2024 11:16:43 +0000 (12:16 +0100)
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@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_cmd_v5.c
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.h
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.h
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h

index 327e54e7061140ee0ce94221176a2f5c2d64c6fa..1fbf7ed5d4cca6d7769986ad642f033fa68f9128 100644 (file)
@@ -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;
 }
index 6eafa514aebca7c7fe73740097b2ca2f17d82b78..c626376053c45990b06fac5d3dedbfcad06cc86c 100644 (file)
@@ -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_ */
index 25c4719a5dd058791c537c6ac03f8b263cb52e85..740aa4dfae579e3bcffb8d17e14da3cc720ea480 100644 (file)
@@ -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;
 }
index 9dc44460cc38d95f2e11d1d76f8377a478ba028a..29083436f517333cf4eeee58ee013f6e665f03a2 100644 (file)
@@ -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_ */
index 77ebceeb65e8691f375de89a872730f375e4adfd..fd43c58848d45e81f785195aa6c38dd4b5aadbe3 100644 (file)
@@ -341,7 +341,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;