From patchwork Thu Sep 17 06:41:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Xiaojun X-Patchwork-Id: 293443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0FA2C43461 for ; Thu, 17 Sep 2020 06:55:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B41B2083B for ; Thu, 17 Sep 2020 06:55:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726151AbgIQGz2 (ORCPT ); Thu, 17 Sep 2020 02:55:28 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13209 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726106AbgIQGzZ (ORCPT ); Thu, 17 Sep 2020 02:55:25 -0400 X-Greylist: delayed 946 seconds by postgrey-1.27 at vger.kernel.org; Thu, 17 Sep 2020 02:55:25 EDT Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id DCF45C1115718EE0FF4F; Thu, 17 Sep 2020 14:39:36 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Thu, 17 Sep 2020 14:39:29 +0800 From: Wang Xiaojun To: , , CC: , , Subject: [PATCH -next] pinctrl: mediatek: use devm_platform_ioremap_resource_byname() Date: Thu, 17 Sep 2020 14:41:51 +0800 Message-ID: <20200917064151.2184010-1-wangxiaojun11@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Use the devm_platform_ioremap_resource_byname() helper instead of calling platform_get_resource_byname() and devm_ioremap_resource() separately. Signed-off-by: Wang Xiaojun Acked-by: Sean Wang --- drivers/pinctrl/mediatek/pinctrl-moore.c | 11 ++--------- drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 9 +-------- drivers/pinctrl/mediatek/pinctrl-paris.c | 11 ++--------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c index aa1068d2867f..5e00f93ac998 100644 --- a/drivers/pinctrl/mediatek/pinctrl-moore.c +++ b/drivers/pinctrl/mediatek/pinctrl-moore.c @@ -589,7 +589,6 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev, const struct mtk_pin_soc *soc) { struct pinctrl_pin_desc *pins; - struct resource *res; struct mtk_pinctrl *hw; int err, i; @@ -612,14 +611,8 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev, return -ENOMEM; for (i = 0; i < hw->soc->nbase_names; i++) { - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, - hw->soc->base_names[i]); - if (!res) { - dev_err(&pdev->dev, "missing IO resource\n"); - return -ENXIO; - } - - hw->base[i] = devm_ioremap_resource(&pdev->dev, res); + hw->base[i] = devm_platform_ioremap_resource_byname(pdev, + hw->soc->base_names[i]); if (IS_ERR(hw->base[i])) return PTR_ERR(hw->base[i]); } diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c index 2f3dfb56c3fa..e8622c7e117a 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c @@ -354,7 +354,6 @@ static const struct mtk_eint_xt mtk_eint_xt = { int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - struct resource *res; if (!IS_ENABLED(CONFIG_EINT_MTK)) return 0; @@ -366,13 +365,7 @@ int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev) if (!hw->eint) return -ENOMEM; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "eint"); - if (!res) { - dev_err(&pdev->dev, "Unable to get eint resource\n"); - return -ENODEV; - } - - hw->eint->base = devm_ioremap_resource(&pdev->dev, res); + hw->eint->base = devm_platform_ioremap_resource_byname(pdev, "eint"); if (IS_ERR(hw->eint->base)) return PTR_ERR(hw->eint->base); diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index a23c18251965..623af4410b07 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -940,7 +940,6 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev, { struct pinctrl_pin_desc *pins; struct mtk_pinctrl *hw; - struct resource *res; int err, i; hw = devm_kzalloc(&pdev->dev, sizeof(*hw), GFP_KERNEL); @@ -963,14 +962,8 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev, return -ENOMEM; for (i = 0; i < hw->soc->nbase_names; i++) { - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, - hw->soc->base_names[i]); - if (!res) { - dev_err(&pdev->dev, "missing IO resource\n"); - return -ENXIO; - } - - hw->base[i] = devm_ioremap_resource(&pdev->dev, res); + hw->base[i] = devm_platform_ioremap_resource_byname(pdev, + hw->soc->base_names[i]); if (IS_ERR(hw->base[i])) return PTR_ERR(hw->base[i]); }