From patchwork Tue Feb 2 13:29:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12061633 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=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 34423C4332B for ; Tue, 2 Feb 2021 13:31:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E46D164DBD for ; Tue, 2 Feb 2021 13:31:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231998AbhBBNbB (ORCPT ); Tue, 2 Feb 2021 08:31:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:59344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231713AbhBBNan (ORCPT ); Tue, 2 Feb 2021 08:30:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D15B164F5F; Tue, 2 Feb 2021 13:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612272602; bh=Kq8Ew8T+rpiYwjmx29cnowJ2F9DKPIXYcwC0xRArm8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hzzZJpCMHKf6jBeFAhaJLL2a+bvIfWpjjB2JnCRtm2CnmUGQHUCNtAIQttHhk/qle +fuRf7hb2c/IAK4qHixnckJv6q244xOFqlrrv3QeONhujIGS1d6rqwjM0+1uF+2qLi eKxOgf6qy7Lh42YBO2Tf8orNjD5swiZvZyDAYqB1/tOmnknDcL1KmhTSekefoBXziA MmwRJSTvdb7W8ObCub8LJ0C1ZY1fC9SmnrS16rw1kFK2HpoPNNFWy3gqaTlgyeoYGA 4RKfBLB/oBDXFKnnNc8srdZYtKDVbH+zk1SZcgtUOnIFsrEG8irLL2T8YKuqU/ZZrF oy2crB4xkRITw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1l6vkl-0011yz-MY; Tue, 02 Feb 2021 14:29:59 +0100 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Binghui Wang , Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , Xiaowei Song , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH 07/13] pci: dwc: pcie-kirin: simplify kirin 970 get resource logic Date: Tue, 2 Feb 2021 14:29:52 +0100 Message-Id: X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Use devm_platform_ioremap_resource_byname() in order to simplify the logic and to make the logic for Kirin 970 similar to the one for Kirin 960. Signed-off-by: Mauro Carvalho Chehab --- drivers/pci/controller/dwc/pcie-kirin.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c index f46a51ffd2c8..e1ebe0747978 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -297,13 +297,13 @@ static long kirin960_pcie_get_resource(struct kirin_pcie *kirin_pcie, { struct device *dev = &pdev->dev; - kirin_pcie->apb_base = - devm_platform_ioremap_resource_byname(pdev, "apb"); + kirin_pcie->apb_base = devm_platform_ioremap_resource_byname(pdev, + "apb"); if (IS_ERR(kirin_pcie->apb_base)) return PTR_ERR(kirin_pcie->apb_base); - kirin_pcie->phy_base = - devm_platform_ioremap_resource_byname(pdev, "phy"); + kirin_pcie->phy_base = devm_platform_ioremap_resource_byname(pdev, + "phy"); if (IS_ERR(kirin_pcie->phy_base)) return PTR_ERR(kirin_pcie->phy_base); @@ -329,23 +329,20 @@ static long kirin970_pcie_get_resource(struct kirin_pcie *kirin_pcie, struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct resource *apb; - struct resource *phy; - struct resource *dbi; int ret; - apb = platform_get_resource_byname(pdev, IORESOURCE_MEM, "apb"); - kirin_pcie->apb_base = devm_ioremap_resource(dev, apb); + kirin_pcie->apb_base = devm_platform_ioremap_resource_byname(pdev, + "apb"); if (IS_ERR(kirin_pcie->apb_base)) return PTR_ERR(kirin_pcie->apb_base); - phy = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy"); - kirin_pcie->phy_base = devm_ioremap_resource(dev, phy); + kirin_pcie->phy_base = devm_platform_ioremap_resource_byname(pdev, + "phy"); if (IS_ERR(kirin_pcie->phy_base)) return PTR_ERR(kirin_pcie->phy_base); - dbi = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi"); - kirin_pcie->pci->dbi_base = devm_ioremap_resource(dev, dbi); + kirin_pcie->pci->dbi_base = devm_platform_ioremap_resource_byname(pdev, + "dbi"); if (IS_ERR(kirin_pcie->pci->dbi_base)) return PTR_ERR(kirin_pcie->pci->dbi_base);