From: chenqiwu <chenqiwu@xxxxxxxxxx> Use devm_platform_ioremap_resource_byname() instead of calling platform_get_resource_byname() and devm_ioremap_resource() separately to simplify the code. Signed-off-by: chenqiwu <chenqiwu@xxxxxxxxxx> --- drivers/spmi/spmi-pmic-arb.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index de844b4..c65815c 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -1203,17 +1203,15 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev) else pmic_arb->ver_ops = &pmic_arb_v5; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, - "obsrvr"); - pmic_arb->rd_base = devm_ioremap_resource(&ctrl->dev, res); + pmic_arb->rd_base = + devm_platform_ioremap_resource_byname(pdev, "obsrvr"); if (IS_ERR(pmic_arb->rd_base)) { err = PTR_ERR(pmic_arb->rd_base); goto err_put_ctrl; } - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, - "chnls"); - pmic_arb->wr_base = devm_ioremap_resource(&ctrl->dev, res); + pmic_arb->wr_base = + devm_platform_ioremap_resource_byname(pdev, "chnls"); if (IS_ERR(pmic_arb->wr_base)) { err = PTR_ERR(pmic_arb->wr_base); goto err_put_ctrl; @@ -1223,15 +1221,13 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev) dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n", pmic_arb->ver_ops->ver_str, hw_ver); - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "intr"); - pmic_arb->intr = devm_ioremap_resource(&ctrl->dev, res); + pmic_arb->intr = devm_platform_ioremap_resource_byname(pdev, "intr"); if (IS_ERR(pmic_arb->intr)) { err = PTR_ERR(pmic_arb->intr); goto err_put_ctrl; } - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cnfg"); - pmic_arb->cnfg = devm_ioremap_resource(&ctrl->dev, res); + pmic_arb->cnfg = devm_platform_ioremap_resource_byname(pdev, "cnfg"); if (IS_ERR(pmic_arb->cnfg)) { err = PTR_ERR(pmic_arb->cnfg); goto err_put_ctrl; -- 1.9.1