media: mediatek: vcodec: avoid -Wcast-function-type-strict warning
authorArnd Bergmann <arnd@arndb.de>
Sat, 24 Feb 2024 12:10:22 +0000 (13:10 +0100)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 28 Feb 2024 15:00:33 +0000 (16:00 +0100)
The ipi handler here tries hard to maintain const-ness of its argument,
but by doing that causes a warning about function type casts:

drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c:38:32: error: cast from 'mtk_vcodec_ipi_handler' (aka 'void (*)(void *, unsigned int, void *)') to 'ipi_handler_t' (aka 'void (*)(const void *, unsigned int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
   38 |         ipi_handler_t handler_const = (ipi_handler_t)handler;
      |                                       ^~~~~~~~~~~~~~~~~~~~~~

Remove the hack and just use a non-const argument.

Fixes: bf1d556ad4e0 ("media: mtk-vcodec: abstract firmware interface")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c
drivers/media/platform/mediatek/vpu/mtk_vpu.c
drivers/media/platform/mediatek/vpu/mtk_vpu.h

index b065ccd0691404e73a4fdb1ec4952d5ef1e20d3a..378a1cba0144fa771eddbb021f22569c133c3221 100644 (file)
@@ -26,7 +26,7 @@ static void mtk_mdp_vpu_handle_init_ack(const struct mdp_ipi_comm_ack *msg)
        vpu->inst_addr = msg->vpu_inst_addr;
 }
 
-static void mtk_mdp_vpu_ipi_handler(const void *data, unsigned int len,
+static void mtk_mdp_vpu_ipi_handler(void *data, unsigned int len,
                                    void *priv)
 {
        const struct mdp_ipi_comm_ack *msg = data;
index 9f6e4b59455dab9fcd392633103e4a85a15c1364..4c34344dc7dcb876e29d66358bcfcc79e1e77705 100644 (file)
@@ -29,15 +29,7 @@ static int mtk_vcodec_vpu_set_ipi_register(struct mtk_vcodec_fw *fw, int id,
                                           mtk_vcodec_ipi_handler handler,
                                           const char *name, void *priv)
 {
-       /*
-        * The handler we receive takes a void * as its first argument. We
-        * cannot change this because it needs to be passed down to the rproc
-        * subsystem when SCP is used. VPU takes a const argument, which is
-        * more constrained, so the conversion below is safe.
-        */
-       ipi_handler_t handler_const = (ipi_handler_t)handler;
-
-       return vpu_ipi_register(fw->pdev, id, handler_const, name, priv);
+       return vpu_ipi_register(fw->pdev, id, handler, name, priv);
 }
 
 static int mtk_vcodec_vpu_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf,
index 7243604a82a5bb26b625c0de94572b048f6d72b2..724ae7c2ab3ba2090727b3aa8410fe5dbf5ca10e 100644 (file)
@@ -635,7 +635,7 @@ OUT_LOAD_FW:
 }
 EXPORT_SYMBOL_GPL(vpu_load_firmware);
 
-static void vpu_init_ipi_handler(const void *data, unsigned int len, void *priv)
+static void vpu_init_ipi_handler(void *data, unsigned int len, void *priv)
 {
        struct mtk_vpu *vpu = priv;
        const struct vpu_run *run = data;
index a56053ff135af7b8e74c4463c7687b4a3a98f113..da05f3e74081084dd965284ecfe7e38af2fef99c 100644 (file)
@@ -17,7 +17,7 @@
  * VPU interfaces with other blocks by share memory and interrupt.
  */
 
-typedef void (*ipi_handler_t) (const void *data,
+typedef void (*ipi_handler_t) (void *data,
                               unsigned int len,
                               void *priv);