Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp402001pxb; Wed, 8 Sep 2021 03:59:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4woCWfGMWpQdnBes7fvIdyNFMiYfEXVZtjddvTmHAsgezaU9q2GjmzgycGO4MIQqMMOnx X-Received: by 2002:a05:6e02:214e:: with SMTP id d14mr2209865ilv.142.1631098785476; Wed, 08 Sep 2021 03:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631098785; cv=none; d=google.com; s=arc-20160816; b=ClZmuAPh0nYPsXWId4G2A8qdoxeEJVnn3SckbaWciaFyS/3/7txyuBrVYbmemPWO0j 50SSHBVpGSb08XIDXiYs8SL1nM5qq7NZdHpKZraW5AdJ7ftwd3b8Jf919cir/f+XaZMr mul8rNMhUp28F37enKTBn+/71nvm6YKkYplxOKIqPjVuwZ607yuICfzFH0bjvE2+WsZD ywGnbRigo3a8L/0fLa0thy3R71ruq3ifJE6bJbUcK/vn3isaRXk0nuv2n9Nr3SW6JKL/ L0lex71JeGf26365rL5fm+ZRcAps68r+7dwA/DHRro7ctvg+KKGxNK3j6RuZtx/RDku4 nK2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=UFuljPKClEagbZLSlh/uLCzSGYxXwsJuaZWHiuqVHac=; b=kCUxfdoruuWQofFwo8OPh20pVAqnb3S7QcCF9kUpe7OZRwVfkAO0a52NgVQ9Hq34ga ZhnQpV0Gq0vIlGe61HUU3rNpZ/LfarmShIfRsa4HhmERZD4sNvcNRSb3W/WywIyTPEJU mGoOXpypz95EygCKbdAh+s3LIce8NFmtOqa/jGkJEPj2Df5SERh+GVKeJaHUDkTdMSPE lQUtIyTn9q0y8S3VGB3WWvaOq/DnN36mI7/p+IGFufOPHOhAvD75jnoXsPXytkC0J59e Dseshkq3Nusb5inM5TRPH3uReT4e69ERu5CYidAdhlw9Ez4pnHlKtfP7VlecQnMertpi oWCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n22si1744999ioo.36.2021.09.08.03.59.31; Wed, 08 Sep 2021 03:59:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351434AbhIHK7S (ORCPT + 99 others); Wed, 8 Sep 2021 06:59:18 -0400 Received: from mx21.baidu.com ([220.181.3.85]:41506 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1348997AbhIHK7A (ORCPT ); Wed, 8 Sep 2021 06:59:00 -0400 Received: from BC-Mail-Ex15.internal.baidu.com (unknown [172.31.51.55]) by Forcepoint Email with ESMTPS id 6C437233306795A43B4D; Wed, 8 Sep 2021 18:57:51 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex15.internal.baidu.com (172.31.51.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Wed, 8 Sep 2021 18:57:51 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Wed, 8 Sep 2021 18:57:50 +0800 From: Cai Huoqing To: CC: Liam Girdwood , Mark Brown , Subject: [PATCH] regulator: ti-abb: Make use of the helper function devm_ioremap related Date: Wed, 8 Sep 2021 18:57:44 +0800 Message-ID: <20210908105745.1984-1-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BJHW-Mail-Ex15.internal.baidu.com (10.127.64.38) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the devm_platform_ioremap_resource_byname() helper instead of calling platform_get_resource_byname() and devm_ioremap/devm_ioremap_resource() separately Signed-off-by: Cai Huoqing --- drivers/regulator/ti-abb-regulator.c | 31 ++++++---------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c index 9f0a4d50cead..2931a0b89bff 100644 --- a/drivers/regulator/ti-abb-regulator.c +++ b/drivers/regulator/ti-abb-regulator.c @@ -725,9 +725,7 @@ static int ti_abb_probe(struct platform_device *pdev) /* Map ABB resources */ if (abb->regs->setup_off || abb->regs->control_off) { - pname = "base-address"; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname); - abb->base = devm_ioremap_resource(dev, res); + abb->base = devm_platform_ioremap_resource_byname(pdev, "base-address"); if (IS_ERR(abb->base)) return PTR_ERR(abb->base); @@ -735,35 +733,18 @@ static int ti_abb_probe(struct platform_device *pdev) abb->control_reg = abb->base + abb->regs->control_off; } else { - pname = "control-address"; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname); - abb->control_reg = devm_ioremap_resource(dev, res); + abb->control_reg = devm_platform_ioremap_resource_byname(pdev, "control-address"); if (IS_ERR(abb->control_reg)) return PTR_ERR(abb->control_reg); - pname = "setup-address"; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname); - abb->setup_reg = devm_ioremap_resource(dev, res); + abb->setup_reg = devm_platform_ioremap_resource_byname(pdev, "setup-address"); if (IS_ERR(abb->setup_reg)) return PTR_ERR(abb->setup_reg); } - pname = "int-address"; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname); - if (!res) { - dev_err(dev, "Missing '%s' IO resource\n", pname); - return -ENODEV; - } - /* - * We may have shared interrupt register offsets which are - * write-1-to-clear between domains ensuring exclusivity. - */ - abb->int_base = devm_ioremap(dev, res->start, - resource_size(res)); - if (!abb->int_base) { - dev_err(dev, "Unable to map '%s'\n", pname); - return -ENOMEM; - } + abb->int_base = devm_platform_ioremap_resource_byname(pdev, "int-address"); + if (IS_ERR(abb->int_base)) + return PTR_ERR(abb->int_base); /* Map Optional resources */ pname = "efuse-address"; -- 2.25.1