From patchwork Sat Feb 24 12:10:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 205835 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1114497dyb; Sat, 24 Feb 2024 04:12:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXtxkqUBjCvvnYh6yPeOtbdvAG2kf2gex8coxxtKSIYeiqQhlce1msiNsbD5it44/nC8RB0f39usJ8ykm9F7I36jDJ/1A== X-Google-Smtp-Source: AGHT+IEljoxL533nIB0L529/6nGz6AAcKf+NgK1ojkkPTzmsGy86fr1SijxzyL7R7mtcAEkWemCS X-Received: by 2002:a05:6a21:3102:b0:1a0:af47:aa4b with SMTP id yz2-20020a056a21310200b001a0af47aa4bmr3453544pzb.26.1708776727802; Sat, 24 Feb 2024 04:12:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708776727; cv=pass; d=google.com; s=arc-20160816; b=CfAYpnKIoGfOdoFVIsS1wCkdUcputI3S6xvtDTqxF2Pva0AtiLbAyEMZsMxJX/o+t/ rSeKqgRLwn/uO7VwYru3GNzk1iI7gMoacjt75MzG/OCn80EpxEwgirZ9EyKNb3xHRfZw rgbWJmbdpEAtvwq0pHz7jJBje4tZwWyDi/N7U7QE58dHAUyh37uW95gokY1PJyjmELpF qrx2lo9Twz9l6EbdW2FrgUfRodY7rbd6Xs3Ujrlxf/CWS/9J7SlP6XSfja2+QrGuY0Fe c7I10nfd5NIqheo/D0lFTIRIxlM5N63NKC/UQEP12uX0emeNCga5gyYGWuoj9Z+j01dY jZoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=U9giDF/64ltL75T58+e/0tM6lDyrQeRyQ2KV8p/jU40=; fh=1IfpW2iYKUx02IfjrVLTSXsX/VlU8ABKmen00ZdY94A=; b=Yq4qLwok3W5tcNEUiczTou7caxNhXNuNLLjh5oQPwIN4vktkHnpkHuWA4Q8tk3PjnF PCa97TBu9LY3n9z8kaaXdZp4N1VavpyLeO1BOq7PgCvjAzMtD9VKVL1841Kx0T14Micd ZBTblTKyZbS8gqrEMCKBR5/4YYP0V1z9bHKpVxo4BB2dLLWh/F4wDj5ag59Ky0JVSzFr QplQFy1fVJasPWL5aVtTS4q6QblYKaNUJkl/i35onjCn0m6ozHaPagVy4lTdM0vP3L8a O52Gniqpe9FvG14T1I1e2NdylIVHP++bxRTQwlh4Dc4buSBwl6EWZdrDwS/RVHM8MFEt U+EA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hSt7BXxu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79628-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79628-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q21-20020a62e115000000b006e4904242dbsi828628pfh.173.2024.02.24.04.12.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 04:12:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79628-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hSt7BXxu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79628-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79628-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 53207B21AD6 for ; Sat, 24 Feb 2024 12:11:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3D893E48E; Sat, 24 Feb 2024 12:11:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hSt7BXxu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32B32250EA; Sat, 24 Feb 2024 12:11:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708776667; cv=none; b=YcAHN/xrs9Ms3+tjsh8keFYXOIO9iURezUt/Ua6Z/c/Q0bpwreFCb4rBvz4wJIGVYAa+VDqxro8iMyJRNrHLiEN7kMTSCnFeMvaSbopIZjw1xKwA5+s+Qbdc5xxUrmxYfDRF3L49kz4RsqutKQNBhEoAnBwuhnRGKuHXBwB06jc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708776667; c=relaxed/simple; bh=Pu6N//eyTGdqifeP3OJ4ufRMcGGxcldi31zFNRd6ipY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=LhsJDbV8vWYnWrfm2ps51FpDnWUViNuUj03HCE+T1SsDRsllw3q3bNVXv8nRSkx6Igos3GCA2CNbQOTV1AhV0+RZ3cuEk6Z/5+U3oyowY+fiCbqrfK+UniA6sK701eaRohn5Wsp4JRSOpIEUhEiNLk/KSlWnOrWv7CwVRvxAMv0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hSt7BXxu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58343C433C7; Sat, 24 Feb 2024 12:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708776666; bh=Pu6N//eyTGdqifeP3OJ4ufRMcGGxcldi31zFNRd6ipY=; h=From:To:Cc:Subject:Date:From; b=hSt7BXxugFK7a6uTMtUsydYhZeyQvuf31BUXhaJ2r+XvwbmhPWMF92aOdJnU6cG6e 5fGPGAVUGUD0xRtCmMLGWzVHrGLJgLB5KO7QDq9Wn3U/+6m5gB3mIVGgR98q7n0hW3 Ckej0H/uKk8yTVnBKL4d1qpGph+i7TDUchqkZxTpLRr4XT0S4XkaVtx0LklqDNgy+0 7PhsF4w26CAE0nuKrrzrDwx4jgQt14gxjnTEF0HpAzAC0OyXBikS5sOTCQz3G4Z9vM 7CHJZXoYKz1aTO+X5Yv+DeZ+WsRxtrpkoFpM7LvmQlc9E4N1x0FW9Ex3t0XgcsXGa0 U+TM8UY7Z4QWg== From: Arnd Bergmann To: Minghsiu Tsai , Houlong Wei , Andrew-CT Chen , Mauro Carvalho Chehab Cc: Arnd Bergmann , Matthias Brugger , AngeloGioacchino Del Regno , Tiffany Lin , Yunfei Dong , Hans Verkuil , Nicolas Dufresne , Alexandre Courbot , Pi-Hsun Shih , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH] media: mediatek: vcodec: avoid -Wcast-function-type-strict warning Date: Sat, 24 Feb 2024 13:10:22 +0100 Message-Id: <20240224121059.1806691-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791782266287430215 X-GMAIL-MSGID: 1791782266287430215 From: Arnd Bergmann 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 Reviewed-by: Ricardo Ribalda --- drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c | 2 +- .../mediatek/vcodec/common/mtk_vcodec_fw_vpu.c | 10 +--------- drivers/media/platform/mediatek/vpu/mtk_vpu.c | 2 +- drivers/media/platform/mediatek/vpu/mtk_vpu.h | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c b/drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c index b065ccd06914..378a1cba0144 100644 --- a/drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c +++ b/drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c @@ -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; diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c index 9f6e4b59455d..4c34344dc7dc 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c @@ -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, diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.c b/drivers/media/platform/mediatek/vpu/mtk_vpu.c index 7243604a82a5..724ae7c2ab3b 100644 --- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c +++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c @@ -635,7 +635,7 @@ int vpu_load_firmware(struct platform_device *pdev) } 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; diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.h b/drivers/media/platform/mediatek/vpu/mtk_vpu.h index a56053ff135a..da05f3e74081 100644 --- a/drivers/media/platform/mediatek/vpu/mtk_vpu.h +++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.h @@ -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);