From patchwork Thu Jun 8 10:12:07 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: 104910 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp174435vqr; Thu, 8 Jun 2023 03:20:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vCK3z0JDFsgGnRC5O57vO+L9yARANoBxTM7T1cT1R5ewn9sps8qHIc8WQ/ZjIsfLkYenA X-Received: by 2002:a67:ee51:0:b0:43d:c0d5:ed27 with SMTP id g17-20020a67ee51000000b0043dc0d5ed27mr977177vsp.32.1686219638796; Thu, 08 Jun 2023 03:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686219638; cv=none; d=google.com; s=arc-20160816; b=jKxvUYE1ByPKTJuDbWkL+PimgvGLr91qlv9/jQOO7ZoEnAfDihujnWoxsn+SxQ22dP 1OGwJhTA6HDUvKtC3zbAObTCH25VXVGLIdGcYYoOSBbT0lspzty0o6W7+ADnW7vd92qc NYeEjivB/eDyiObF2WIv8RCeRIijqY6Vb/P028EFdj7clYqlkqK6kTNlk8KhEB9KZ5Dn BpD2l9QuiK5PPBbFgwm6W7TrSM/0ihiIcrx+ruEd8FVdh2dC/smSP3qmKLPFzYdafztW 6tZzAhB/GOMuqGRDDeCR5k2UFfCu/eoUUwEvFRB5zRvX67o/TgCsJfKZr58En7h01o+D Z5RA== 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=gzhcPdnfla27Zc1fgVm6wF09Wk50X/GSq+k/6lW0Ty8=; b=urryw/U3D4cRVFuLYUggqmS5sDHEwAwtq8FA9t5bqyQjQgHIY2X9RtzN/MNnyJn6YK AwXw2nwVJlxCzwZDVRasRtRPWckuRy223YMErkQ5YZtMRQeRY0h3/x7wop6vpQoqca+j n2MthW6cBJt02CUXONc260K9zNE3xdhmKjGJkK1+CjQoAQ3xE5U4S0q1MqsQeYRqEQ+4 ch6IxG2FrjyiH0cx6kB4RGm8Z95nmkjqtlABOR8SDO2ogjbIzNOUSZG0sSZ1ayV3SSdu fc8wpy3XYgmJZ1LRdNd33D1XASHntkvUauwK+gm51Um3Ifx2bpPyLVB/zVPuVlHluLqy DChQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=EWE1G3ex; 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=QUARANTINE sp=QUARANTINE 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 v3-20020a655c43000000b00543ed7b1396si761912pgr.627.2023.06.08.03.20.26; Thu, 08 Jun 2023 03:20:38 -0700 (PDT) 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=EWE1G3ex; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235761AbjFHKMW (ORCPT + 99 others); Thu, 8 Jun 2023 06:12:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235661AbjFHKMS (ORCPT ); Thu, 8 Jun 2023 06:12:18 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE512700 for ; Thu, 8 Jun 2023 03:12:15 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (unknown [IPv6:2001:b07:2ed:14ed:a962:cd4d:a84:1eab]) (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 CF2BD6606F15; Thu, 8 Jun 2023 11:12:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686219134; bh=isK4CGNELBlWRVqlqiMyoiqJNOrso00n3+sFHCSv6Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EWE1G3exT9dMqXh46ixdS/QSrqY3n5H1InzjQQgpc5YUD+M8hWBUqsI18WHn0jydQ CP4SiWKfUi/CgDEkVzR4KK5pCBUihcRW3X/XTzr2d8twlEsOcpaNOxcKwMWFKj1or6 L/qQ3sGl5UBesg6PJeKq4XjrGB2peba0eX9WQ67NeCcRVs24lkt7vaIlWiPm2gLmz+ +Hy5gFOV8VPApBbCqAGIy1zWYjes8KEcFGN7mL9BJvb9QcY/kJiemGE9fSpdfKi0P7 ogCIHMzDPr67jcIJioIlA4OKbc9OLMMoeNevRx3KINCADt6Ul6AsMJykwGsg+2GklN ZX52SnAn2o5rw== From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Cc: p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com Subject: [PATCH 1/3] drm/mediatek: Use devm_platform_get_and_ioremap_resource() Date: Thu, 8 Jun 2023 12:12:07 +0200 Message-Id: <20230608101209.126499-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230608101209.126499-1-angelogioacchino.delregno@collabora.com> References: <20230608101209.126499-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, T_SCC_BODY_TEXT_LINE 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?1768129443538180431?= X-GMAIL-MSGID: =?utf-8?q?1768129443538180431?= Instead of open coding calls to platform_get_resource() followed by devm_ioremap_resource(), perform a single call to the helper devm_platform_get_and_ioremap_resource(). This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Alexandre Mergnat --- drivers/gpu/drm/mediatek/mtk_cec.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_aal.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_color.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_merge.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 3 +-- drivers/gpu/drm/mediatek/mtk_dsi.c | 3 +-- drivers/gpu/drm/mediatek/mtk_hdmi.c | 3 +-- drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c | 3 +-- drivers/gpu/drm/mediatek/mtk_mdp_rdma.c | 3 +-- 12 files changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_cec.c b/drivers/gpu/drm/mediatek/mtk_cec.c index b640bc0559e7..5136aada9023 100644 --- a/drivers/gpu/drm/mediatek/mtk_cec.c +++ b/drivers/gpu/drm/mediatek/mtk_cec.c @@ -195,8 +195,7 @@ static int mtk_cec_probe(struct platform_device *pdev) platform_set_drvdata(pdev, cec); spin_lock_init(&cec->lock); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - cec->regs = devm_ioremap_resource(dev, res); + cec->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(cec->regs)) { ret = PTR_ERR(cec->regs); dev_err(dev, "Failed to ioremap cec: %d\n", ret); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c index 8ddf7a97e583..68485c09ad8f 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c @@ -117,8 +117,7 @@ static int mtk_disp_aal_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap aal\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c index 1773379b2439..ae243e7db9b2 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c @@ -172,8 +172,7 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap ccorr\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_color.c b/drivers/gpu/drm/mediatek/mtk_disp_color.c index cac9206079e7..4ec37e20ade9 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_color.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_color.c @@ -110,8 +110,7 @@ static int mtk_disp_color_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap color\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index bd530e603264..cf9262aa4f89 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -276,8 +276,7 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap gamma\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_merge.c b/drivers/gpu/drm/mediatek/mtk_disp_merge.c index 6428b6203ffe..f1dfa6dfd967 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_merge.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_merge.c @@ -250,8 +250,7 @@ static int mtk_disp_merge_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap merge\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index 8f52cc1f3fba..a0b0a1eb91c9 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -529,8 +529,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap ovl\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c index d4df17ad600a..7106c05127b1 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c @@ -332,8 +332,7 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap rdma\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 19e2b042c9d5..fb6f45165e95 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -1113,8 +1113,7 @@ static int mtk_dsi_probe(struct platform_device *pdev) goto err_unregister_host; } - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - dsi->regs = devm_ioremap_resource(dev, regs); + dsi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, ®s); if (IS_ERR(dsi->regs)) { ret = PTR_ERR(dsi->regs); dev_err(dev, "Failed to ioremap memory: %d\n", ret); diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 0a8e0a13f516..0c784db9978b 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1474,8 +1474,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, } hdmi->sys_regmap = regmap; - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hdmi->regs = devm_ioremap_resource(dev, mem); + hdmi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem); if (IS_ERR(hdmi->regs)) { ret = PTR_ERR(hdmi->regs); goto put_device; diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c b/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c index 4d39ea0a05ca..dfd1f07b39f0 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c @@ -284,8 +284,7 @@ static int mtk_hdmi_ddc_probe(struct platform_device *pdev) return PTR_ERR(ddc->clk); } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - ddc->regs = devm_ioremap_resource(&pdev->dev, mem); + ddc->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem); if (IS_ERR(ddc->regs)) return PTR_ERR(ddc->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c index e06db6e56b5f..4eac4cbc0764 100644 --- a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c @@ -285,8 +285,7 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap rdma\n"); return PTR_ERR(priv->regs);