Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: mediatek: vcodec: avoid -Wcast-function-type-strict warning

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>

authored by

Arnd Bergmann and committed by
Hans Verkuil
bfb1b998 d0b07f71

+4 -12
+1 -1
drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c
··· 26 26 vpu->inst_addr = msg->vpu_inst_addr; 27 27 } 28 28 29 - static void mtk_mdp_vpu_ipi_handler(const void *data, unsigned int len, 29 + static void mtk_mdp_vpu_ipi_handler(void *data, unsigned int len, 30 30 void *priv) 31 31 { 32 32 const struct mdp_ipi_comm_ack *msg = data;
+1 -9
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c
··· 29 29 mtk_vcodec_ipi_handler handler, 30 30 const char *name, void *priv) 31 31 { 32 - /* 33 - * The handler we receive takes a void * as its first argument. We 34 - * cannot change this because it needs to be passed down to the rproc 35 - * subsystem when SCP is used. VPU takes a const argument, which is 36 - * more constrained, so the conversion below is safe. 37 - */ 38 - ipi_handler_t handler_const = (ipi_handler_t)handler; 39 - 40 - return vpu_ipi_register(fw->pdev, id, handler_const, name, priv); 32 + return vpu_ipi_register(fw->pdev, id, handler, name, priv); 41 33 } 42 34 43 35 static int mtk_vcodec_vpu_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf,
+1 -1
drivers/media/platform/mediatek/vpu/mtk_vpu.c
··· 635 635 } 636 636 EXPORT_SYMBOL_GPL(vpu_load_firmware); 637 637 638 - static void vpu_init_ipi_handler(const void *data, unsigned int len, void *priv) 638 + static void vpu_init_ipi_handler(void *data, unsigned int len, void *priv) 639 639 { 640 640 struct mtk_vpu *vpu = priv; 641 641 const struct vpu_run *run = data;
+1 -1
drivers/media/platform/mediatek/vpu/mtk_vpu.h
··· 17 17 * VPU interfaces with other blocks by share memory and interrupt. 18 18 */ 19 19 20 - typedef void (*ipi_handler_t) (const void *data, 20 + typedef void (*ipi_handler_t) (void *data, 21 21 unsigned int len, 22 22 void *priv); 23 23