From patchwork Wed Feb 22 09:42:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 60453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp481969wrd; Wed, 22 Feb 2023 01:58:08 -0800 (PST) X-Google-Smtp-Source: AK7set9BPgeg8w5vEEmmUlzeF/UWZzJLf96bXGqOEBD83GvDeBPT0hIj+3/r/LTuQ1XL9/BQZT0Y X-Received: by 2002:a17:907:9715:b0:7c1:458b:a947 with SMTP id jg21-20020a170907971500b007c1458ba947mr21758186ejc.26.1677059888340; Wed, 22 Feb 2023 01:58:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677059888; cv=none; d=google.com; s=arc-20160816; b=iEQztg5jvpNRG94TP+lb8gG4gVST9JuUVlkGKaiea4S3UHQaHtULO1TB+r3yU1+KlT 3iLoSKdDuq2lJTM/ieMxt+2EzwKKc9cjrUpBO1ovnCiE6HkL4dHcTnAhDM1rQzd1olVh t9BedIrStdFgFfbMHUYP33tqqfeljbJgglXLeVokLJjZL34F3Hax8xE+mrb9f6YbdcxQ PuCsctqLmaW5mcaWp4ICdfCTpkUp3WYnPAexKQzgtjoCtA9LcaNbcA07/XwM6QbIotqB rHFhIRWtUHtStzv/6MosxD3vRRCdrZLmGxOiOzJ4RDYnVDzqLxHjczF41KcOSbusMHgM pE2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LySAHNP7mTCRe2nowX38J9T4myZvj8JYW77lo4fp3Tg=; b=xw8hTZQmvL0ShmHAImu5HTupHdm+MWpbSNa0EkbQ3QWkpcFEr1XCrF8yoYQJon/2jc siP2JbSWu87xoBnHLfxQK+PXGm34Y9w/MIDpCAKkLflU8kVonl2FnP9i09gnhZd8B6Yk ocdNenvWNTXV4sadVPyITR3gN1BpPZgCOCZZTzgKulyld+3pYJPLM6JpXNO/0YOZclk/ yVcK8uCZb6sM7hP4BKatrKeW0gMnh/UdPOw3MZC5e3iLnPwuvTVf2dNztqtK+GvXHtdd 8H5xrwAyC2oFXRsN2joI4bWtNsmDOpfUIEDfuHF3gL69Um2BUvw1vpB1MdOePfKUKrcg 0zBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=icQqmQC1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ms32-20020a170907622000b008b17a84e038si17444472ejc.329.2023.02.22.01.57.45; Wed, 22 Feb 2023 01:58:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=icQqmQC1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232351AbjBVJwR (ORCPT + 99 others); Wed, 22 Feb 2023 04:52:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232305AbjBVJvz (ORCPT ); Wed, 22 Feb 2023 04:51:55 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4CC33756A for ; Wed, 22 Feb 2023 01:50:09 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id ECD2B66021B6; Wed, 22 Feb 2023 09:42:59 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058980; bh=ZVUGUSkQPIkJqJdXlquYlMTH70M4rX6hh28fX2ZpB5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icQqmQC1NwhnkaUQUa+HJKbglRLmbx/Cj2SKtRtzcRiAcaZ6bhD1Me/eThlsET4+i ujYA1sNyAbC9oPZFJYpa9XFob5Sx/YjCt4ShTyTalCwsz2Er43whYGhep8a2lvMUUH RyGA+0aIlYplbyCeYhJGCZ15xq/YKNHkZvkZNmAwwiDj5hAtK6901UscTnn1KpS865 S9bZSHyzPYmPHneLMLyiUwBFEEO2/IJPz4qE7tZTzZHGDdA944Hwwowg+WftffoDX6 nft5SV61zPfGuvYbc23A5utu3uh/YnAq0yL3fSR7UgphZZV1u2sJ93YcCnYJF9oBpi 5G644Bm21xEWw== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno , Chen-Yu Tsai Subject: [PATCH v2 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback Date: Wed, 22 Feb 2023 10:42:45 +0100 Message-Id: <20230222094253.23678-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758524749326809562?= X-GMAIL-MSGID: =?utf-8?q?1758524749326809562?= Add a .remove() callback to correctly unregister the multimedia clocks and DRM drivers. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c index eb4c7e57896c..af22f3490034 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -121,6 +121,8 @@ static const struct mtk_mmsys_driver_data mt8365_mmsys_driver_data = { struct mtk_mmsys { void __iomem *regs; const struct mtk_mmsys_driver_data *data; + struct platform_device *clks_pdev; + struct platform_device *drm_pdev; spinlock_t lock; /* protects mmsys_sw_rst_b reg */ struct reset_controller_dev rcdev; struct cmdq_client_reg cmdq_base; @@ -342,6 +344,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev) PLATFORM_DEVID_AUTO, NULL, 0); if (IS_ERR(clks)) return PTR_ERR(clks); + mmsys->clks_pdev = clks; if (mmsys->data->is_vppsys) goto out_probe_done; @@ -352,11 +355,22 @@ static int mtk_mmsys_probe(struct platform_device *pdev) platform_device_unregister(clks); return PTR_ERR(drm); } + mmsys->drm_pdev = drm; out_probe_done: return 0; } +static int mtk_mmsys_remove(struct platform_device *pdev) +{ + struct mtk_mmsys *mmsys = platform_get_drvdata(pdev); + + platform_device_unregister(mmsys->drm_pdev); + platform_device_unregister(mmsys->clks_pdev); + + return 0; +} + static const struct of_device_id of_match_mtk_mmsys[] = { { .compatible = "mediatek,mt2701-mmsys", @@ -431,6 +445,7 @@ static struct platform_driver mtk_mmsys_drv = { .of_match_table = of_match_mtk_mmsys, }, .probe = mtk_mmsys_probe, + .remove = mtk_mmsys_remove, }; static int __init mtk_mmsys_init(void) From patchwork Wed Feb 22 09:42:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 60457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp490660wrd; Wed, 22 Feb 2023 02:21:16 -0800 (PST) X-Google-Smtp-Source: AK7set9T5ZVq+8DnI8SCHIgYj7zD+zc6BNzexCP8Lw+32d6h2blXmY3zx/LOuc8p0rH0GxU53XdW X-Received: by 2002:a17:90a:351:b0:236:6c7f:3223 with SMTP id 17-20020a17090a035100b002366c7f3223mr8809017pjf.10.1677061275919; Wed, 22 Feb 2023 02:21:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677061275; cv=none; d=google.com; s=arc-20160816; b=QwY/qFF/St9armMpQ07K4ZwnPwZ11JoQz9UP1D2YH9YNf/rlrqC2R4wyKDXrs/OBsW 9Lm5r+y9RaRJNGTakZBjTMRrdO90/TpdDzFrZpMbNdFmLt1Xhhu2M4AS8LFPy3WfltNY 693g4VH731ldDkZqDB0vhq4DOuF4TD6NjbgTSiThEphJ0QvQrzQ16PY3Q7MFk550KB6C AWAeoXQZaHZnKmzj8Xr5iVN0rQv9NJWC2R20GjS9j5LAR/3zqxicI4sB26xFLqxb5uQz Y0wn35usZnYZBbXVEswuB7ITvvA7V3EuCuT8cpAL4gNwpF0p+hK2BZZNnqErU8vLaXAb lknQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=96rzDARD3Mq7VYuLIo+Rq9QzGm896oZABe+FbDqtZGY=; b=TEIHX0/7CcfK0loE15LNkZvMBEt+VO+By8TjVyZ5Cm5sKMvdeLmr+DBpbVDDkH3sAb XnoP7wNv4/mgznE+j67wLXVKPyvjFTPLx6GOylzmy5weuSGoPahq3g6KvRV5Z2pTjFQW AcJ/0Osad4LVJwfGcMF4ctW1g3cY27aaZeTYIs6kXENxJFBPn+2D5zk1xt1p6K5vPZRc YUQOKlLnvErebOJO0vPlQ5yy+hWgpn+e0Veiqq+MEPoSdQdegwD1swtgufxfNqwWd/40 /En7O51s2w9YYSgLfxU/0z/QO6Deskdv2xgJTyRoRQFZic9f3SPY4xRV9YWgC7J0W3l1 xlRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=g4g6Jf22; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gd5-20020a17090b0fc500b002368e89eecesi5800458pjb.180.2023.02.22.02.21.02; Wed, 22 Feb 2023 02:21:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=g4g6Jf22; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231634AbjBVJue (ORCPT + 99 others); Wed, 22 Feb 2023 04:50:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbjBVJuL (ORCPT ); Wed, 22 Feb 2023 04:50:11 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B580F3608D for ; Wed, 22 Feb 2023 01:48:03 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 9D6D966021B8; Wed, 22 Feb 2023 09:43:00 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058981; bh=rAHk+6D4DP7ZKavkjU3OoAIsoPs/edVh3yg1JAxrz8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g4g6Jf22hidJPXb/h9Wa8OCLtlftHXym9YpMsWyHjgCb/rbi6ZzmyzhoatYtDv+M/ ihQFLLNEDnRriFk+ZSh0F7EwjqEwx9LXoFmd9Yxyy5gUPeYst0TAO0dkLwPT5eeLJT NfHzhiOR8BGZshr6QZkR6kRtEax+109UdlzzCbW1pkLCi0G4qxTghDNLoTotkBcspL aQ2WGmrWRozR4mXpxGchvduT7502ivAoW6+7JqSDwESi/EUJTxvjhKoeLKh6Qh7qbs BqClANiOO9XNowtXBLIiBHUenXd6W3zpbdP9YvuJMZuOGAYOkSdBUNG5UEzVHGiPsP ESxOlbKporAZQ== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno , Chen-Yu Tsai Subject: [PATCH v2 2/9] soc: mediatek: mtk-mmsys: Use module_platform_driver() macro Date: Wed, 22 Feb 2023 10:42:46 +0100 Message-Id: <20230222094253.23678-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758526204204887998?= X-GMAIL-MSGID: =?utf-8?q?1758526204204887998?= Instead of open-coding init/exit calls, switch to using the module_platform_driver() macro instead, doing the exact same. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c index af22f3490034..1a574de9484d 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -447,19 +447,7 @@ static struct platform_driver mtk_mmsys_drv = { .probe = mtk_mmsys_probe, .remove = mtk_mmsys_remove, }; - -static int __init mtk_mmsys_init(void) -{ - return platform_driver_register(&mtk_mmsys_drv); -} - -static void __exit mtk_mmsys_exit(void) -{ - platform_driver_unregister(&mtk_mmsys_drv); -} - -module_init(mtk_mmsys_init); -module_exit(mtk_mmsys_exit); +module_platform_driver(mtk_mmsys_drv); MODULE_AUTHOR("Yongqiang Niu "); MODULE_DESCRIPTION("MediaTek SoC MMSYS driver"); From patchwork Wed Feb 22 09:42:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 60447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp480792wrd; Wed, 22 Feb 2023 01:53:27 -0800 (PST) X-Google-Smtp-Source: AK7set81YSl+hgrfmzDMPczJ+4y81MPmZyq59QEag+A8IUsksEXkXag6SgtR8H3D7RhkoBfKam/V X-Received: by 2002:a05:6402:1604:b0:4ac:d973:bb2c with SMTP id f4-20020a056402160400b004acd973bb2cmr9402309edv.28.1677059607167; Wed, 22 Feb 2023 01:53:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677059607; cv=none; d=google.com; s=arc-20160816; b=NV6X9F8bHtVh6l/iSeXi2eyjZ1XJr7EQjOS63mkoiFwvXsc08OjMODrq1rDfZU+rLb KRXgB1bR4avj0F/llHjkWVbxgC2vNMYfdnixCWSw6u3d6BHgfU2OnakXofC4tdW0xh49 kV1scBoUj5EuMU7rkLCvHTPDxHQoZ7RNJvRRkL1K8dMOIR2rvVHbXin7R/a1ZSLlV9iF 9OhqHujuL9Zc88SpGfKuP4s3qkYqxOQtaITSSkWvsblMfGrSy/PNNd2NDijGHS6BlVVB B2lrzAwKe4uLKHPXZ/eHW/PbJ/8T0njSxnTnNsAzicK7sqSYW0Wi67k/UmfqwJIgjugI YKJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SBJqdueKzWGERhe7LO3Jh5BUunb3nxELtMe7iavkoZU=; b=qOsTV5zq1RBDE+x6qc5/moC2lm/8nLJJqebYX9N/WBvto/skziusjDeOf6sApMdO0v /9XpvWCH40iC75qOcfeABQ9dynl3hxR27+bp/zfRcsKXYXcWd7/eiFgiRL2lBhHdjISK TuYm+wAhPXJEidgSGuwnhUf6Gy/Eg29GvgmHYZWCH34LhJXFuMNR6lJtGaDXvfr69m4p 3S5SPCnQnNWUunU5jsd3GxToOgVzYcyFaetg5eSA0LtzTzfBxQNvrHUM6FgLWyVRe/7c FhC2hVVWcDrrCic1IPhfhuzB6XBwjGB9pPaHuDqAD8Tr+cn2GxhxknUG6V5zwE9172Cq 8Vdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=HPlsRs8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dy9-20020a05640231e900b004aef3d356eesi9723933edb.621.2023.02.22.01.53.04; Wed, 22 Feb 2023 01:53:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=HPlsRs8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232224AbjBVJqW (ORCPT + 99 others); Wed, 22 Feb 2023 04:46:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231324AbjBVJqF (ORCPT ); Wed, 22 Feb 2023 04:46:05 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF3273B870 for ; Wed, 22 Feb 2023 01:43:58 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 4EB4666021BA; Wed, 22 Feb 2023 09:43:01 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058981; bh=D2Wg1MCaTWqKvlTyCHCMNbxkOo7Gmf+eDXCX8QbUlHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HPlsRs8ew86CCn01Gcuu9S1HtWNy6942rbS5Jbv4zMYqrVjhcsHaBalT9RmEZkw48 Nyi6tw/H76/HYemFUPNzRJELwqS1zt7qTbSAp0IWcYbD03PlCpIKVzSFYpiSu39zxt laa++YqNavcWmihqf+ry9qsMssFZ9sGmxnK8+gDtWmCuucC76lZYlgHb1UMFBiunya B57NyVWHoVP67dD5j28Z2vGQaJzMCyv6nPHYfdDcKC3uPyp2wo4jUUzCE+NwT8NjQK OcOWjO/obaYQuJYD2+N64AQ8kbkDKcRgfrnCIvGwnGGHk8WNKwV9R74yAOX98gmQmI eR8yqip69z9fw== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno , Chen-Yu Tsai Subject: [PATCH v2 3/9] soc: mediatek: mtk-mmsys: Compress of_device_id array entries Date: Wed, 22 Feb 2023 10:42:47 +0100 Message-Id: <20230222094253.23678-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758524454873578581?= X-GMAIL-MSGID: =?utf-8?q?1758524454873578581?= Compress entries of the of_match_mtk_mmsys array to reduce the amount of lines and increase readability; this brings us to a maximum of 90 columns. While at it, also add a sentinel comment to the last entry for the sole purpose of consistency. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 83 +++++++------------------------- 1 file changed, 18 insertions(+), 65 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c index 1a574de9484d..fcf702fda92e 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -372,71 +372,24 @@ static int mtk_mmsys_remove(struct platform_device *pdev) } static const struct of_device_id of_match_mtk_mmsys[] = { - { - .compatible = "mediatek,mt2701-mmsys", - .data = &mt2701_mmsys_driver_data, - }, - { - .compatible = "mediatek,mt2712-mmsys", - .data = &mt2712_mmsys_driver_data, - }, - { - .compatible = "mediatek,mt6779-mmsys", - .data = &mt6779_mmsys_driver_data, - }, - { - .compatible = "mediatek,mt6797-mmsys", - .data = &mt6797_mmsys_driver_data, - }, - { - .compatible = "mediatek,mt8167-mmsys", - .data = &mt8167_mmsys_driver_data, - }, - { - .compatible = "mediatek,mt8173-mmsys", - .data = &mt8173_mmsys_driver_data, - }, - { - .compatible = "mediatek,mt8183-mmsys", - .data = &mt8183_mmsys_driver_data, - }, - { - .compatible = "mediatek,mt8186-mmsys", - .data = &mt8186_mmsys_driver_data, - }, - { - .compatible = "mediatek,mt8188-vdosys0", - .data = &mt8188_vdosys0_driver_data, - }, - { - .compatible = "mediatek,mt8192-mmsys", - .data = &mt8192_mmsys_driver_data, - }, - { /* deprecated compatible */ - .compatible = "mediatek,mt8195-mmsys", - .data = &mt8195_vdosys0_driver_data, - }, - { - .compatible = "mediatek,mt8195-vdosys0", - .data = &mt8195_vdosys0_driver_data, - }, - { - .compatible = "mediatek,mt8195-vdosys1", - .data = &mt8195_vdosys1_driver_data, - }, - { - .compatible = "mediatek,mt8195-vppsys0", - .data = &mt8195_vppsys0_driver_data, - }, - { - .compatible = "mediatek,mt8195-vppsys1", - .data = &mt8195_vppsys1_driver_data, - }, - { - .compatible = "mediatek,mt8365-mmsys", - .data = &mt8365_mmsys_driver_data, - }, - { } + { .compatible = "mediatek,mt2701-mmsys", .data = &mt2701_mmsys_driver_data }, + { .compatible = "mediatek,mt2712-mmsys", .data = &mt2712_mmsys_driver_data }, + { .compatible = "mediatek,mt6779-mmsys", .data = &mt6779_mmsys_driver_data }, + { .compatible = "mediatek,mt6797-mmsys", .data = &mt6797_mmsys_driver_data }, + { .compatible = "mediatek,mt8167-mmsys", .data = &mt8167_mmsys_driver_data }, + { .compatible = "mediatek,mt8173-mmsys", .data = &mt8173_mmsys_driver_data }, + { .compatible = "mediatek,mt8183-mmsys", .data = &mt8183_mmsys_driver_data }, + { .compatible = "mediatek,mt8186-mmsys", .data = &mt8186_mmsys_driver_data }, + { .compatible = "mediatek,mt8188-vdosys0", .data = &mt8188_vdosys0_driver_data }, + { .compatible = "mediatek,mt8192-mmsys", .data = &mt8192_mmsys_driver_data }, + /* "mediatek,mt8195-mmsys" compatible is deprecated */ + { .compatible = "mediatek,mt8195-mmsys", .data = &mt8195_vdosys0_driver_data }, + { .compatible = "mediatek,mt8195-vdosys0", .data = &mt8195_vdosys0_driver_data }, + { .compatible = "mediatek,mt8195-vdosys1", .data = &mt8195_vdosys1_driver_data }, + { .compatible = "mediatek,mt8195-vppsys0", .data = &mt8195_vppsys0_driver_data }, + { .compatible = "mediatek,mt8195-vppsys1", .data = &mt8195_vppsys1_driver_data }, + { .compatible = "mediatek,mt8365-mmsys", .data = &mt8365_mmsys_driver_data }, + { /* sentinel */ } }; static struct platform_driver mtk_mmsys_drv = { From patchwork Wed Feb 22 09:42:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 60456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp490643wrd; Wed, 22 Feb 2023 02:21:14 -0800 (PST) X-Google-Smtp-Source: AK7set9L+a49geC5ep2o+y+FLi/CJNSMGPxMLRDXNUjrjTEcjO0e2hStwP3tjgrAe3Vm0dddx1xA X-Received: by 2002:a17:907:60d4:b0:8e1:cc38:6e78 with SMTP id hv20-20020a17090760d400b008e1cc386e78mr5970616ejc.39.1677061273971; Wed, 22 Feb 2023 02:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677061273; cv=none; d=google.com; s=arc-20160816; b=H3812btuPZulNTzOSed/9JIWRD2QZltDVBnv8KfS+xF3k7IJhMP02oCOWzyBe2/oHE uzRPLhdmaOjSwCE/t4rdsJTDx3JJVf99BNp/0qOpPz88jFK8DHzSI5jul5cO05OqOBpn wen0ue4530lv473Ett6wxAfXPOzNh9S0eUXceW/+4YlfnATNnooeTgVFhxRleJUuY2A7 U85jy32+O4OhYNyBI2N5W8Cw5HSoCjV5fDQcgCR2OMYXnFHFuhFuD7+KC7ZjZgyhChGG wzpn5i2AZFCzeSCrRduUYvIRBg+FyEtOBE5ZY9YIDSSVsi5+24xjZesIpB+Bo5bp6VpU ZVkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ctg8ERf/4rRDsGsd3RTSMaAAkHQavwE17jWyngyXiWw=; b=b7c7CaYp8YRGoea8HbzAn+6jMLbp32IosX2gJpgOkEsty87VKw1tCIVnoxU2XepEmn v4Y8lgnn7ylPwiueTc6INHSEzWLbM2XZCAjc16NUwvIVP+c+QcyhFQodw0QBGQ95vZiO HbI+ujq/Fq15u+KlXwQv1m/70hPWpcKaeo5OEvVVhndBp+9tLR4IT5jsNp2HskpFPODi cdwedAGZj4tuLfJqVKFsXn3EVltuJKMmeOkhr9mykf4DscubFr0bZbLmf1FptcN+mg7w 7lDvX1eDOQVsyGuZpForP6yiPl4aUo0KQci+tDEFM2VXctdBclMzrTpVuwkjyFMfJlbU 1U7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aj2IRggv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mx12-20020a1709065a0c00b008b23ed7e385si16791883ejc.91.2023.02.22.02.20.48; Wed, 22 Feb 2023 02:21:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aj2IRggv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232285AbjBVJun (ORCPT + 99 others); Wed, 22 Feb 2023 04:50:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232263AbjBVJuW (ORCPT ); Wed, 22 Feb 2023 04:50:22 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73041B76C for ; Wed, 22 Feb 2023 01:48:13 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 00AB766021BC; Wed, 22 Feb 2023 09:43:01 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058982; bh=HdA9LzRyfYNiXvz7Hffi4ApU2JZCzXJht1XHORTPc54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aj2IRggvt5KoR/paEff124zVV1bz7iA05sKUjbBbqW53DSgsrF8Ac/HSDp9MWgTPS HCEO/WtQLd3yHAz+y093jCIDbYYvNkG4FSh3yTRWXVMKQ+o3m164hFc9o3K2RA3OLO DlWsdQcMy7Y+l8cQoLZMs/jiS10fdbjVz6XMmRDk6zQFPyIiXNywAbaDYA5/ZBlmJZ IiqjB8+S4VW5TWxrsSsFtb+B6Cj+O9Z+K+o/8pO/bg/YVMWnqSp9oxyQW/ayp5tbjB DcAzhUnKvKoO4Vr6zuprIgzbgbLnuziDblLf2e+xnq84MjeDErNiD61Ibm35tP4Fg6 zI4jnG1pL1B5A== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno , Chen-Yu Tsai Subject: [PATCH v2 4/9] soc: mediatek: mtk-mmsys: Add MODULE_DEVICE_TABLE() to allow auto-load Date: Wed, 22 Feb 2023 10:42:48 +0100 Message-Id: <20230222094253.23678-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758526202300762348?= X-GMAIL-MSGID: =?utf-8?q?1758526202300762348?= Allow module auto-loading by adding a MODULE_DEVICE_TABLE for of_match_mmsys. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c index fcf702fda92e..0f0fa27e17a5 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -391,6 +391,7 @@ static const struct of_device_id of_match_mtk_mmsys[] = { { .compatible = "mediatek,mt8365-mmsys", .data = &mt8365_mmsys_driver_data }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, of_match_mtk_mmsys); static struct platform_driver mtk_mmsys_drv = { .driver = { From patchwork Wed Feb 22 09:42:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 60449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp480956wrd; Wed, 22 Feb 2023 01:54:06 -0800 (PST) X-Google-Smtp-Source: AK7set+s0HQQyfQ4VNXN5tjOtUHtWVlvepJVnNtJmxSTCLeodgobIMcINhFSFyEsCFXP6nuC7pKd X-Received: by 2002:aa7:c6d7:0:b0:4ab:4676:f92f with SMTP id b23-20020aa7c6d7000000b004ab4676f92fmr6214531eds.37.1677059646748; Wed, 22 Feb 2023 01:54:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677059646; cv=none; d=google.com; s=arc-20160816; b=yxrAMviUV3Xx4QwcswWSOMYoaCVMDJcXZHtNL1Ra05Ei4dyn7/JMCbQ3T//YUgiDX8 +QhBaup2pl2vP+lp+ISDlfq09CtduCNjwPLiQYmIBMGTMxgIllX7mA+yhHyMDOp4EhUQ 5ziwXl0q51VTer3GHXRoq/dT8vyDi1cG1xNSbwdpVZ+EWVAQgJG9Uenv7e7WLUbNvRo9 0mt/QY2q14dKsyf2tHseU5F68idQMQKW6thWlaqtvN5zXMKGydPxGligrj9kjJFDx35R yv1JwSShzyQPe8MHkd6eqqijoDTqAUQNItcq9Lbg4T1KUTBCapb+NsKRwjOtSCQFSS7l wW4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LPa41hPr5/fhJv7254qcfTXwpYGgRmk/sL294po1Vt0=; b=peUOIWCPkQPKartsknTzuEnfitO4oKhkUmh8Ayh01OxHuUwQrKcahSpNpBxX7mCSz2 it5J5TuY4biLRtqsLgpcO7qUfbZYELt2/RjZIGAZijmiZq7w4+zNBndeRAeWlMOZNEb4 ixiBtHxqBgQnUSX33JHsmse7fcYDILzOC2loqDowSwPSSzBawVvQ0sEuTiqXryxsmvBK 8PxO5+EHvdZUhax561nK+y6l0LOuHaCWc2WOEEcIuYF3ihOtj8NZwtSRO9eQyayTnqH5 Q5wS6JfSQsvM+16qmSkxFh1OY64rynhBvKsT/HupWZvUizm9JZtgSxQ1y8WhSNL7G3kS N/Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KiQGObEP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l14-20020aa7d94e000000b004acb9be144dsi124881eds.106.2023.02.22.01.53.43; Wed, 22 Feb 2023 01:54:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KiQGObEP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230446AbjBVJrT (ORCPT + 99 others); Wed, 22 Feb 2023 04:47:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbjBVJq6 (ORCPT ); Wed, 22 Feb 2023 04:46:58 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F305B38678 for ; Wed, 22 Feb 2023 01:45:01 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id B047766021C8; Wed, 22 Feb 2023 09:43:02 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058983; bh=spGpqKbSxXn7OPXf28QXu2nWmpVE56wv353pvm/OWK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KiQGObEP5jZxRUVhDOL6ay7oS1WI1Kiipid2I0XbAIUpfOi/IggijilljCw/MzTpN xeML0gjTJUeebPP5T7/jMXmWJutlyVE+AKql56wtHX1INL8H/ytEqE4R6tF3i8ZGCz VgMSxhf241mWeIiIqKXHX5C3zkNqPCu62e//DtTFWdmSquxQuLuJgHLkXVIisjKb+0 XLJkQQuKFtpXUiFIYIS3x1XKVmynltqQ4SYUOZYXmpoqT690P0EqL2+W6RbWY9/g1x JKEhzqUyxhrqGPljZWEfXomO9Pwn7rXF4O1wj9ju2c/A/TptJ6FsMcb92bLYOVASJE 1TIBKLMm1vlEA== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno Subject: [PATCH v2 5/9] soc: mediatek: mtk-mutex: Compress of_device_id array entries Date: Wed, 22 Feb 2023 10:42:49 +0100 Message-Id: <20230222094253.23678-6-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758524495954992423?= X-GMAIL-MSGID: =?utf-8?q?1758524495954992423?= Compress entries of the of_match_mtk_mmsys array to reduce the amount of lines and increase readability; this brings us to a maximum of 95 columns. While at it, also add a sentinel comment to the last entry for the sole purpose of consistency. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-mutex.c | 41 +++++++++++--------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c index 7751527fc30d..a59fde2bdcba 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -1040,33 +1040,20 @@ static int mtk_mutex_probe(struct platform_device *pdev) } static const struct of_device_id mutex_driver_dt_match[] = { - { .compatible = "mediatek,mt2701-disp-mutex", - .data = &mt2701_mutex_driver_data}, - { .compatible = "mediatek,mt2712-disp-mutex", - .data = &mt2712_mutex_driver_data}, - { .compatible = "mediatek,mt6795-disp-mutex", - .data = &mt6795_mutex_driver_data}, - { .compatible = "mediatek,mt8167-disp-mutex", - .data = &mt8167_mutex_driver_data}, - { .compatible = "mediatek,mt8173-disp-mutex", - .data = &mt8173_mutex_driver_data}, - { .compatible = "mediatek,mt8183-disp-mutex", - .data = &mt8183_mutex_driver_data}, - { .compatible = "mediatek,mt8186-disp-mutex", - .data = &mt8186_mutex_driver_data}, - { .compatible = "mediatek,mt8186-mdp3-mutex", - .data = &mt8186_mdp_mutex_driver_data}, - { .compatible = "mediatek,mt8188-disp-mutex", - .data = &mt8188_mutex_driver_data}, - { .compatible = "mediatek,mt8192-disp-mutex", - .data = &mt8192_mutex_driver_data}, - { .compatible = "mediatek,mt8195-disp-mutex", - .data = &mt8195_mutex_driver_data}, - { .compatible = "mediatek,mt8195-vpp-mutex", - .data = &mt8195_vpp_mutex_driver_data}, - { .compatible = "mediatek,mt8365-disp-mutex", - .data = &mt8365_mutex_driver_data}, - {}, + { .compatible = "mediatek,mt2701-disp-mutex", .data = &mt2701_mutex_driver_data }, + { .compatible = "mediatek,mt2712-disp-mutex", .data = &mt2712_mutex_driver_data }, + { .compatible = "mediatek,mt6795-disp-mutex", .data = &mt6795_mutex_driver_data }, + { .compatible = "mediatek,mt8167-disp-mutex", .data = &mt8167_mutex_driver_data }, + { .compatible = "mediatek,mt8173-disp-mutex", .data = &mt8173_mutex_driver_data }, + { .compatible = "mediatek,mt8183-disp-mutex", .data = &mt8183_mutex_driver_data }, + { .compatible = "mediatek,mt8186-disp-mutex", .data = &mt8186_mutex_driver_data }, + { .compatible = "mediatek,mt8186-mdp3-mutex", .data = &mt8186_mdp_mutex_driver_data }, + { .compatible = "mediatek,mt8188-disp-mutex", .data = &mt8188_mutex_driver_data }, + { .compatible = "mediatek,mt8192-disp-mutex", .data = &mt8192_mutex_driver_data }, + { .compatible = "mediatek,mt8195-disp-mutex", .data = &mt8195_mutex_driver_data }, + { .compatible = "mediatek,mt8195-vpp-mutex", .data = &mt8195_vpp_mutex_driver_data }, + { .compatible = "mediatek,mt8365-disp-mutex", .data = &mt8365_mutex_driver_data }, + { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, mutex_driver_dt_match); From patchwork Wed Feb 22 09:42:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 60454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp487362wrd; Wed, 22 Feb 2023 02:12:13 -0800 (PST) X-Google-Smtp-Source: AK7set+jtKgZofFl4KCyqBgsI5q8zUKwOWn2yPVXyliwFL8DNebmQGmpLlkBtbAXJynPvXC2CN2w X-Received: by 2002:a17:906:fe47:b0:8b0:1769:f099 with SMTP id wz7-20020a170906fe4700b008b01769f099mr25553848ejb.0.1677060733337; Wed, 22 Feb 2023 02:12:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677060733; cv=none; d=google.com; s=arc-20160816; b=DveRwZmx8in7a76KbGYXySEn1cGs2TkXRVBb3v0G28TerG8f4O4C5jJYv9fmB4on6U r9UU3WFIqgHNV13mdGJ2MycErKLz570uJI0DOVGbDouzhXEo5oZ5FzZ3itRSLpshtabA bePalkgoRfd9TWF9moi7qK71YYIk4AgMiGu6s2w+LzUGcQ/22uP8cQ669YbT6IToGITe bG6rERxwMCDDBbBVs+4QRthnKtvcnPa2BjeZOYWSJZv3Y9X5vQkLSXehUDagT+9PzMiY drIduztCeEYjrE16xyfQFhflyVIC17svvMIzZmAuHvY1FkwwR1cEZCja15PDtYUxZ1kb Dc1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q5qC1XLVDYEJF9rL3YgsMUwTcag1bRb/HT9qGAHn9vs=; b=JpTJz0+5MVxYtHpgnHGbOMFQtrJnH8vMshGrAZ60lzZB3R8EuRWbRKZVPaEj0yTL/6 nZyG0pZjjtl+yAVsYC0vk+CQm/iGaW7uo/xYCOS5HvnrKU8cKGtfM8zQYZldHsjzCDm+ /sIBaoSEEH45b+x/dspxqreHJZpQOF9EehEQNUmfYCDstiqI2RfndzD76FOM2oFxqlbB a1IdwVR/+uxFsWLqoZu3FSZBSPys2cE3E+IcwYPoBFeI2aLQMjEhTLKM8ms+M4qbOojj z21J4k9V7PJFBD09LPmuykpNMCjd7qzOZAWJp5KXXASKZJt5bWJxMvKG764UGmt+nj8V Lnhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=TW49Kut0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z22-20020a17090674d600b008ceb29eb5c2si1373988ejl.380.2023.02.22.02.11.50; Wed, 22 Feb 2023 02:12:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=TW49Kut0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232012AbjBVJvg (ORCPT + 99 others); Wed, 22 Feb 2023 04:51:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231495AbjBVJvO (ORCPT ); Wed, 22 Feb 2023 04:51:14 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAFC13B650 for ; Wed, 22 Feb 2023 01:49:20 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 57B2E66021CF; Wed, 22 Feb 2023 09:43:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058983; bh=e3IoV4WZMMZpp/4i2Ywjd+HRfKbXhy2Fwpb6MBe7E9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TW49Kut03chnB17gy+oOlEdsRglJEPbtp6qrJAlIi8l9dX/aAXscA8EVrCy9h5pod vmlmwn+lOeZGv4cNWr3zwCKFU6sjKUUdpXRoregGMJEZS2ToV0jetU4KDvkFgkDNaU W7g2RJb0B6OWT8seVbkS8WSjlNLUWvr1/dZk0og0s2zISZ6AzFuu/J6egY6vuG+6au GOw8/CCLUd+vh3VmweL7umYnQJIej/9xZwoENc4GXIDMz0/VvJcIeA7ih1wepdM+4i GR39oKu2mPiAWnXXlcvz0CVVMU+XfsA9ZkWaD/9UrB7oSMH3yd8rZPa3h9ExIzoe74 kO087S6EsxWBw== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno , Chen-Yu Tsai Subject: [PATCH v2 6/9] soc: mediatek: mtk-mutex: Replace max handles number with definition Date: Wed, 22 Feb 2023 10:42:50 +0100 Message-Id: <20230222094253.23678-7-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758525635195069742?= X-GMAIL-MSGID: =?utf-8?q?1758525635195069742?= Replace the magic number "10", defining the maximum number of supported handles with a MTK_MUTEX_MAX_HANDLES definition. While at it, also change the type for `id` from a signed integer to a unsigned 8 bits integer to save some (small) memory footprint, as this number is never higher than 10. This cleanup brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mutex.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c index a59fde2bdcba..b68bb87bc365 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -14,6 +14,8 @@ #include #include +#define MTK_MUTEX_MAX_HANDLES 10 + #define MT2701_MUTEX0_MOD0 0x2c #define MT2701_MUTEX0_SOF0 0x30 #define MT8183_MUTEX0_MOD0 0x30 @@ -282,7 +284,7 @@ #define MT8195_MUTEX_EOF_DPI1 (MT8195_MUTEX_SOF_DPI1 << 7) struct mtk_mutex { - int id; + u8 id; bool claimed; }; @@ -312,7 +314,7 @@ struct mtk_mutex_ctx { struct device *dev; struct clk *clk; void __iomem *regs; - struct mtk_mutex mutex[10]; + struct mtk_mutex mutex[MTK_MUTEX_MAX_HANDLES]; const struct mtk_mutex_data *data; phys_addr_t addr; struct cmdq_client_reg cmdq_reg; @@ -717,7 +719,7 @@ struct mtk_mutex *mtk_mutex_get(struct device *dev) struct mtk_mutex_ctx *mtx = dev_get_drvdata(dev); int i; - for (i = 0; i < 10; i++) + for (i = 0; i < MTK_MUTEX_MAX_HANDLES; i++) if (!mtx->mutex[i].claimed) { mtx->mutex[i].claimed = true; return &mtx->mutex[i]; @@ -1007,7 +1009,7 @@ static int mtk_mutex_probe(struct platform_device *pdev) if (!mtx) return -ENOMEM; - for (i = 0; i < 10; i++) + for (i = 0; i < MTK_MUTEX_MAX_HANDLES; i++) mtx->mutex[i].id = i; mtx->data = of_device_get_match_data(dev); From patchwork Wed Feb 22 09:42:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 60448 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp480926wrd; Wed, 22 Feb 2023 01:53:59 -0800 (PST) X-Google-Smtp-Source: AK7set+kcGobm6wTa9wDGXmHeX32LNfPZy7oaNbpn9DBIfK57TYRNb6fmrKTEsSDEzmKFdnu5Zee X-Received: by 2002:aa7:96b4:0:b0:5d2:248d:7ec3 with SMTP id g20-20020aa796b4000000b005d2248d7ec3mr2960845pfk.8.1677059638928; Wed, 22 Feb 2023 01:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677059638; cv=none; d=google.com; s=arc-20160816; b=YpDPdmlV7+6UK9R3y3YUqZAAnS8/W4vV7imQqXLZfQtySgRKeN1QOm6pZpAiyCTUNu mm5eKoV2zMev8HoWoECIqFe1B+x9ejqmoK/jriZHPTe2vzXT359umLiDn7SesvVLb4yW eFweVtBs0PbdSMp+4ITFUwCfikdskVU3YqXU8f4WeYTBTTF5g5Z1yiUyhmfyedxLiD+/ GI3J7LlE7gf7llOnk9R9yPFQ/a0LFKWxXN2trxv/YVZ5TPz0QKrAHErhKtDU/B49b22i NqWBUFiLySJEnA+edBKTNiwL2TOusVWlfDndNIkTcBcwy9xHpWg5Yy391DZ9EMdd4V9Z 9Dcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S+lNjOww9VGCqfvbV7mnLsn5TFFFbEQ4qKu2TXJI3XI=; b=rum9f/vRL5WdYxQg1EfUwYrVSQ3f6fwTTLtqaQOo2vtfalT0ASYJlFNfOcxXCsOXD3 2CBNoy48AjWpSPlv8pYXYxbMX2+C5uVLmqM3ORLmUcd/ZuS4iqEZxgZUIzJzAfJDQTws 30HWqtVceA2lMJdvq/MD6hqFn7ymMNVv7jDPRogpojVHRx3EgbV+3T5dNz1nN1j6yGMC eSfaEE57HJe2f1CUpq1mBKNEkXcMhZoF/+XE6mWi/xOAQ8rDcTjC6cacHzWisCrLqGEz NexHwDjaETQOfyxgYpc9lITioAro0ViLfOXti21GyJz3kIkSsIMiydgr7/uLxR8lue2d 4seQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Npvg6e4p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020a056a0010c600b005a90e791de8si20085431pfu.296.2023.02.22.01.53.46; Wed, 22 Feb 2023 01:53:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Npvg6e4p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232146AbjBVJrV (ORCPT + 99 others); Wed, 22 Feb 2023 04:47:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbjBVJrA (ORCPT ); Wed, 22 Feb 2023 04:47:00 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 666413CE0C for ; Wed, 22 Feb 2023 01:45:04 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 0A8DF66021D0; Wed, 22 Feb 2023 09:43:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058984; bh=W3yq5QP4VSIp5kuNHWkTn9ITtbb/6KY6TaV3sJDTiN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Npvg6e4prXO4gcc0DXYI5ohzflUH1du/8pA8tgxw0rxzh7TEUPb/Ae2kzyj/FnwB0 pI7Gf0c9ob4sKINxhGmpGLNp5kjZ37BUhg5DJotm8UQSdCS0ii31AqADnNYjF9Q5Ct 4xvi9SLp6B6TsdEqUekc2lahepdB7W0MoyU1pD9wctvu0fRan/aCzstzGMay6L4vy+ VSCHyosMm5d8LV2Ysa5PzmftGBdrftP3nU6Yfr6QzD6g6PUCKJMot4Ydaxf5ZFU2em 6ivphDJBKG9cOir6/GMi8xtTdBB5d4aetKVZnITmc6M6Cyicq+vaBvbVQaNa+ZD+IA V0erBJYFq04Ug== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno , Chen-Yu Tsai Subject: [PATCH v2 7/9] soc: mediatek: mtk-mutex: Use module_platform_driver() macro Date: Wed, 22 Feb 2023 10:42:51 +0100 Message-Id: <20230222094253.23678-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758524488210494231?= X-GMAIL-MSGID: =?utf-8?q?1758524488210494231?= Replace open-coded init/exit calls with the module_platform_driver() macro being equivalent. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mutex.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c index b68bb87bc365..b106f3d23e0d 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -1067,19 +1067,7 @@ static struct platform_driver mtk_mutex_driver = { .of_match_table = mutex_driver_dt_match, }, }; - -static int __init mtk_mutex_init(void) -{ - return platform_driver_register(&mtk_mutex_driver); -} - -static void __exit mtk_mutex_exit(void) -{ - platform_driver_unregister(&mtk_mutex_driver); -} - -module_init(mtk_mutex_init); -module_exit(mtk_mutex_exit); +module_platform_driver(mtk_mutex_driver); MODULE_AUTHOR("Yongqiang Niu "); MODULE_DESCRIPTION("MediaTek SoC MUTEX driver"); From patchwork Wed Feb 22 09:42:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 60450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp481293wrd; Wed, 22 Feb 2023 01:55:36 -0800 (PST) X-Google-Smtp-Source: AK7set9VoMug1xPjSDNCe3ZZshKn29NCrVeSQJqF5xuEkFLTp1oKH2r4Z04pu456GoE8CD+6WWHw X-Received: by 2002:a17:906:f249:b0:878:81d7:9f77 with SMTP id gy9-20020a170906f24900b0087881d79f77mr13416512ejb.34.1677059736448; Wed, 22 Feb 2023 01:55:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677059736; cv=none; d=google.com; s=arc-20160816; b=a3rZtz1z41NsXKOLXXd+90MA2ahWdCdh+w65X07BU2JItBLBLwEhSZ2jT4YyNtedli ilESCcsvCokxxpi1WWICavwlirZoHkzn9kTf0hHlwc/0gNi6L/vSqPU3wLmzVLgs0Gt+ JMhezDVm8Vf5ApX/3mn4jk526BPpffIyWUWISvFapziH0JbQfSrUriAJzKF5ME3zEXiT jUCDhiJ9KPSnNAcLQ0GkBvEhZScpwKSHzlS/ZLDXDQ+Avamfam/zfinc4TT/MxI8rXcM YYnijDW2sp/45sVsE0AWQaNvbMgrNwEDi77SnZ+9oUcmwqJ4Slwq3hU+W84ieK4/57/y Povw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=f9DZFjHkXD9oTdu8QdUEq9lRR/LQtsT4fUSmrhHq+Zs=; b=KpwoekxgcIF9Q6+rHBcFjOuSOubBxNvSYtG/O71kxMhCI3+jCLr7MOU98SjhmwNBM1 vJkELoeeIkLxDuEZe0vs7weZmyhDR1eUrIpGFPkwz4k7WL2xQRSCCGMm8QD98cyvwYRK oz9j350r89mS0pVMRNWUUuko1MyFMuSjQjv+8c5ytOUyAu/0K8bbJFYz2EHAsBJSvqPw oA0DH1ezCKP+dteDZ/PoIKDrx7SMNAIZko6Wa7mG9HC8yUyQuA0a9iDpNx/2RxmEjp5L MYuHyJOU/F3KvuvXYHrW1RpWYfstxK9x/XeUzmCqtf4IOu+WWi4zXAqKTT6E1sB3Gehy SFyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="Az6tc/dd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm1-20020a170907938100b008c7986cbd76si11425564ejc.745.2023.02.22.01.55.12; Wed, 22 Feb 2023 01:55:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="Az6tc/dd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbjBVJsV (ORCPT + 99 others); Wed, 22 Feb 2023 04:48:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232018AbjBVJr7 (ORCPT ); Wed, 22 Feb 2023 04:47:59 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D8203A86F for ; Wed, 22 Feb 2023 01:46:07 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id B0B4866021D4; Wed, 22 Feb 2023 09:43:04 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058985; bh=QLUE6gweejlnVZKkySch/QDsSqbrZL8wTCZxRZLCRkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Az6tc/ddE8y2KAl2HzuVlrtJbg8p6y/QCMj+LY17E+uey84JRNm4RVFIoZInorF/8 8P06AalpXwNGCvZwN2beagEfIoBEJengdPxXi8M4KTcGMs+pqnrMn3YTtRQh5QXbpy t7KnGth9jk9pw9XF9pVr0tsCB3A90pAj8CJ5+d6Iox2XfTluMl1PpdeELngEaK5GYG 10+7PsORVre2ca4geI2lapOhIoFMSUVkUcQTjBGEAzMsK/LpbrmdWY8TzukUu4FlLM 6HDMs+UNts96Sn2BVBlrarM439J7aJO00j+tAD92TV10isK9HWbKyueRoZW3eYg9bI I0uVTCubJK0WA== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno , Chen-Yu Tsai Subject: [PATCH v2 8/9] soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ Date: Wed, 22 Feb 2023 10:42:52 +0100 Message-Id: <20230222094253.23678-9-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758524590189597931?= X-GMAIL-MSGID: =?utf-8?q?1758524590189597931?= In preparation for a cleanup of ifdef instances of IS_REACHABLE() for the CONFIG_MTK_CMDQ configuration option, add inline functions that will either return a failure or, for void functions, do nothing. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- include/linux/soc/mediatek/mtk-cmdq.h | 114 ++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index 2b498f4f3946..649955d2cf5c 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -27,6 +27,8 @@ struct cmdq_client { struct mbox_chan *chan; }; +#if IS_ENABLED(CONFIG_MTK_CMDQ) + /** * cmdq_dev_get_client_reg() - parse cmdq client reg from the device * node of CMDQ client @@ -277,4 +279,116 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt); */ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt); +#else /* IS_ENABLED(CONFIG_MTK_CMDQ) */ + +static inline int cmdq_dev_get_client_reg(struct device *dev, + struct cmdq_client_reg *client_reg, int idx) +{ + return -ENODEV; +} + +static inline struct cmdq_client *cmdq_mbox_create(struct device *dev, int index) +{ + return ERR_PTR(-EINVAL); +} + +static inline void cmdq_mbox_destroy(struct cmdq_client *client) { } + +static inline struct cmdq_pkt *cmdq_pkt_create(struct cmdq_client *client, size_t size) +{ + return ERR_PTR(-EINVAL); +} + +static inline void cmdq_pkt_destroy(struct cmdq_pkt *pkt) { } + +static inline int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys, + u16 offset, u32 value, u32 mask) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, + u16 addr_low, u16 reg_idx) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, + u16 addr_low, u16 src_reg_idx) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, + u16 addr_low, u16 src_reg_idx, u32 mask) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, + u16 addr_low, u32 value) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, + u16 addr_low, u32 value, u32 mask) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys, + u16 offset, u32 value) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys, + u16 offset, u32 value, u32 mask) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_flush_async(struct cmdq_pkt *pkt) +{ + return -EINVAL; +} + +#endif /* IS_ENABLED(CONFIG_MTK_CMDQ) */ + #endif /* __MTK_CMDQ_H__ */ From patchwork Wed Feb 22 09:42:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 60451 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp481320wrd; Wed, 22 Feb 2023 01:55:43 -0800 (PST) X-Google-Smtp-Source: AK7set/D8aWyGxllhdUFSI1HdVfebc1JGXrWUPPnRMzN/kO1deBBTc+v7LqHMns+QQaWPFcTsgbv X-Received: by 2002:a17:903:78c:b0:19a:8316:6b4a with SMTP id kn12-20020a170903078c00b0019a83166b4amr6930212plb.26.1677059743398; Wed, 22 Feb 2023 01:55:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677059743; cv=none; d=google.com; s=arc-20160816; b=a3fEdOn6YZHX50LGQ5nTIgrEEw7fsxMWqDL2eQgTRc3GdEe6+aAVKmnVP7Oy/uag7o bnKSqNiR6eJ9luPWagvThoFAm8w1zuq58BQUYUIMhxGFZatAQP9JBJoHSqRLRvttrrZ9 KyqMVhDDG4KL29gW7JiqlgulKt/gYuZpp3tAQXGN4AlXrDirMucUPBEgCDSuSjdJJQ3C bH9ImCVE1VV6Nmb1lNKUyDKRKX0GOs5Mj0yNfGfNV226r1pvQMLv8uAtD2MK4XS8Sd+n hcnKiofxqKAF4/vxpU9AQxfboh/egj/NvHP6pjscAZzZZlNzxdlTDJBMatoKEozB12st Ol5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VVJyKjrhaqRZ0w/StQGRkSFgwa0DYFt5USJ+Q9kZUu0=; b=YNKWLqmcWfOzsSDDUc3yKxi8FtTTfrlXh3Awaz5tuofkAjAQvEjRacoX4jKmx6VQiG 5M1IhYdicjUuxK12UsfNCD2KXawYALfWcfX7mmit2jYQJcLeRGg3LfNa2YLRIq/hlmiy A9frfBgJBLEHZSczgEvAbVL5lRNVGejc9yvLJmV9BnvoN6MJ3qDTtNOvAhTppj2AQY2H n0VdVtRNAsFc0mryJ9s9OmmzB+pmFmGXWNigjF7WtXLvek0Plm9hLNdpMcH4fZxR4ija 3HQWmrPElQ1wtUrZzXY9UxMoVv1Q/MEivyB2UURrgbHWdcIYYmKxz5KKVhKaHYWkoXun l1Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ihCuNPi0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a170902d48600b0019647978087si17830514plg.364.2023.02.22.01.55.30; Wed, 22 Feb 2023 01:55:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ihCuNPi0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232237AbjBVJsY (ORCPT + 99 others); Wed, 22 Feb 2023 04:48:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232110AbjBVJsA (ORCPT ); Wed, 22 Feb 2023 04:48:00 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66F933866E for ; Wed, 22 Feb 2023 01:46:11 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 627B866021D5; Wed, 22 Feb 2023 09:43:05 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058985; bh=t0WQRQY93wT7Ed+artLK4huBmFp5RCO/YHHv1kqN5ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ihCuNPi0WgxnIHJEEL+kMrFdWXEi9a4xwIiBOZoekKc0R1UMCAscg4QF16nCCkfw5 bEwK2qBpTo/xZzWahGFe2Xt2JHnkzsnbqyD/NTM5Q8N92XPpPxcilEv95/gLSuoE1G l19rMU234gvbymd2bprEeJBPS8kIETCZds1t72eG/hFBT6D/6m8ko9BByk7IKTUKrM ZWcZRuOm8BPL1g5+JgHVh8C2aAW3tXGpXc+nW7xkRWTRsVMwF1CDkQzc2wBmR7KmaT Ov8Tc888vKvh7sS3KQBmOWpZkn2pjn8LQETcdxJtj/40vzb3FoCWGlXjOD04banzzD iYLlSU5XpaEnA== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno , Chen-Yu Tsai Subject: [PATCH v2 9/9] soc: mediatek: Cleanup ifdefs for IS_REACHABLE(CONFIG_MTK_CMDQ) Date: Wed, 22 Feb 2023 10:42:53 +0100 Message-Id: <20230222094253.23678-10-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758524597474399662?= X-GMAIL-MSGID: =?utf-8?q?1758524597474399662?= Now that the mtk-cmdq.h header contains inline functions for cases in which the driver is not enabled (either module or built-in), we can safely go on with cleaning up ifdefs for CMDQ handling. This also shows in a clearer manner that writing through CMDQ HW is optional and used only for performance purposes when/where wanted, needed and/or required. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 22 +++++++++------------- drivers/soc/mediatek/mtk-mutex.c | 15 +++------------ 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c index 0f0fa27e17a5..8da5c8d26ed0 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -131,21 +131,18 @@ struct mtk_mmsys { static void mtk_mmsys_update_bits(struct mtk_mmsys *mmsys, u32 offset, u32 mask, u32 val, struct cmdq_pkt *cmdq_pkt) { + int ret; u32 tmp; -#if IS_REACHABLE(CONFIG_MTK_CMDQ) - if (cmdq_pkt) { - if (mmsys->cmdq_base.size == 0) { - pr_err("mmsys lose gce property, failed to update mmsys bits with cmdq"); + if (mmsys->cmdq_base.size && cmdq_pkt) { + ret = cmdq_pkt_write_mask(cmdq_pkt, mmsys->cmdq_base.subsys, + mmsys->cmdq_base.offset + offset, val, + mask); + if (ret) + pr_debug("CMDQ unavailable: using CPU write\n"); + else return; - } - cmdq_pkt_write_mask(cmdq_pkt, mmsys->cmdq_base.subsys, - mmsys->cmdq_base.offset + offset, val, - mask); - return; } -#endif - tmp = readl_relaxed(mmsys->regs + offset); tmp = (tmp & ~mask) | (val & mask); writel_relaxed(tmp, mmsys->regs + offset); @@ -332,11 +329,10 @@ static int mtk_mmsys_probe(struct platform_device *pdev) } } -#if IS_REACHABLE(CONFIG_MTK_CMDQ) + /* CMDQ is optional */ ret = cmdq_dev_get_client_reg(dev, &mmsys->cmdq_base, 0); if (ret) dev_dbg(dev, "No mediatek,gce-client-reg!\n"); -#endif platform_set_drvdata(pdev, mmsys); diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c index b106f3d23e0d..b92cffec7be7 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -871,23 +871,18 @@ int mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex, void *pkt) { struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, mutex[mutex->id]); -#if IS_REACHABLE(CONFIG_MTK_CMDQ) struct cmdq_pkt *cmdq_pkt = (struct cmdq_pkt *)pkt; WARN_ON(&mtx->mutex[mutex->id] != mutex); if (!mtx->cmdq_reg.size) { dev_err(mtx->dev, "mediatek,gce-client-reg hasn't been set"); - return -EINVAL; + return -ENODEV; } cmdq_pkt_write(cmdq_pkt, mtx->cmdq_reg.subsys, mtx->addr + DISP_REG_MUTEX_EN(mutex->id), 1); return 0; -#else - dev_err(mtx->dev, "Not support for enable MUTEX by CMDQ"); - return -ENODEV; -#endif } EXPORT_SYMBOL_GPL(mtk_mutex_enable_by_cmdq); @@ -1000,10 +995,7 @@ static int mtk_mutex_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct mtk_mutex_ctx *mtx; struct resource *regs; - int i; -#if IS_REACHABLE(CONFIG_MTK_CMDQ) - int ret; -#endif + int i, ret; mtx = devm_kzalloc(dev, sizeof(*mtx), GFP_KERNEL); if (!mtx) @@ -1030,11 +1022,10 @@ static int mtk_mutex_probe(struct platform_device *pdev) } mtx->addr = regs->start; -#if IS_REACHABLE(CONFIG_MTK_CMDQ) + /* CMDQ is optional */ ret = cmdq_dev_get_client_reg(dev, &mtx->cmdq_reg, 0); if (ret) dev_dbg(dev, "No mediatek,gce-client-reg!\n"); -#endif platform_set_drvdata(pdev, mtx);