diff mbox series

PCI: mediatek: Make use of the helper function devm_platform_ioremap_resource_byname()

Message ID 20210901073942.8733-1-caihuoqing@baidu.com (mailing list archive)
State New, archived
Headers show
Series PCI: mediatek: Make use of the helper function devm_platform_ioremap_resource_byname() | expand

Commit Message

Cai,Huoqing Sept. 1, 2021, 7:39 a.m. UTC
Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/pci/controller/pcie-mediatek.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
index 4cb5ea8e1069..90913025da05 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
@@ -980,16 +980,12 @@  static int mtk_pcie_subsys_powerup(struct mtk_pcie *pcie)
 {
 	struct device *dev = pcie->dev;
 	struct platform_device *pdev = to_platform_device(dev);
-	struct resource *regs;
 	int err;
 
 	/* get shared registers, which are optional */
-	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "subsys");
-	if (regs) {
-		pcie->base = devm_ioremap_resource(dev, regs);
-		if (IS_ERR(pcie->base))
-			return PTR_ERR(pcie->base);
-	}
+	pcie->base = devm_platform_ioremap_resource_byname(pdev, "subsys");
+	if (IS_ERR(pcie->base))
+		return PTR_ERR(pcie->base);
 
 	pcie->free_ck = devm_clk_get(dev, "free_ck");
 	if (IS_ERR(pcie->free_ck)) {