Skip to content

Commit bfb1b99

Browse files
arndbHans Verkuil
authored andcommitted
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: bf1d556 ("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>
1 parent d0b07f7 commit bfb1b99

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static void mtk_mdp_vpu_handle_init_ack(const struct mdp_ipi_comm_ack *msg)
2626
vpu->inst_addr = msg->vpu_inst_addr;
2727
}
2828

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,
3030
void *priv)
3131
{
3232
const struct mdp_ipi_comm_ack *msg = data;

drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,7 @@ static int mtk_vcodec_vpu_set_ipi_register(struct mtk_vcodec_fw *fw, int id,
2929
mtk_vcodec_ipi_handler handler,
3030
const char *name, void *priv)
3131
{
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);
4133
}
4234

4335
static int mtk_vcodec_vpu_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf,

drivers/media/platform/mediatek/vpu/mtk_vpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ int vpu_load_firmware(struct platform_device *pdev)
635635
}
636636
EXPORT_SYMBOL_GPL(vpu_load_firmware);
637637

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)
639639
{
640640
struct mtk_vpu *vpu = priv;
641641
const struct vpu_run *run = data;

drivers/media/platform/mediatek/vpu/mtk_vpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* VPU interfaces with other blocks by share memory and interrupt.
1818
*/
1919

20-
typedef void (*ipi_handler_t) (const void *data,
20+
typedef void (*ipi_handler_t) (void *data,
2121
unsigned int len,
2222
void *priv);
2323

0 commit comments

Comments
 (0)