Commit f9dbb997 authored by Zhang Zekun's avatar Zhang Zekun Committed by Nishanth Menon

soc: ti: Use devm_platform_ioremap_resource_byname simplify logic

platform_get_resource_byname() and devm_ioremap_resource() can be
replaced by devm_platform_ioremap_resource_byname(), which can
simplify the code logic a bit, No functional change here.
Signed-off-by: default avatarZhang Zekun <zhangzekun11@huawei.com>
Reviewed-by: default avatarDhruva Gole <d-gole@ti.com>
Link: https://lore.kernel.org/r/20230809081523.26196-1-zhangzekun11@huawei.comSigned-off-by: default avatarNishanth Menon <nm@ti.com>
parent e50a7635
...@@ -1368,7 +1368,6 @@ static int k3_ringacc_init(struct platform_device *pdev, ...@@ -1368,7 +1368,6 @@ static int k3_ringacc_init(struct platform_device *pdev,
const struct soc_device_attribute *soc; const struct soc_device_attribute *soc;
void __iomem *base_fifo, *base_rt; void __iomem *base_fifo, *base_rt;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct resource *res;
int ret, i; int ret, i;
dev->msi.domain = of_msi_get_domain(dev, dev->of_node, dev->msi.domain = of_msi_get_domain(dev, dev->of_node,
...@@ -1387,24 +1386,20 @@ static int k3_ringacc_init(struct platform_device *pdev, ...@@ -1387,24 +1386,20 @@ static int k3_ringacc_init(struct platform_device *pdev,
ringacc->dma_ring_reset_quirk = soc_data->dma_ring_reset_quirk; ringacc->dma_ring_reset_quirk = soc_data->dma_ring_reset_quirk;
} }
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rt"); base_rt = devm_platform_ioremap_resource_byname(pdev, "rt");
base_rt = devm_ioremap_resource(dev, res);
if (IS_ERR(base_rt)) if (IS_ERR(base_rt))
return PTR_ERR(base_rt); return PTR_ERR(base_rt);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fifos"); base_fifo = devm_platform_ioremap_resource_byname(pdev, "fifos");
base_fifo = devm_ioremap_resource(dev, res);
if (IS_ERR(base_fifo)) if (IS_ERR(base_fifo))
return PTR_ERR(base_fifo); return PTR_ERR(base_fifo);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "proxy_gcfg"); ringacc->proxy_gcfg = devm_platform_ioremap_resource_byname(pdev, "proxy_gcfg");
ringacc->proxy_gcfg = devm_ioremap_resource(dev, res);
if (IS_ERR(ringacc->proxy_gcfg)) if (IS_ERR(ringacc->proxy_gcfg))
return PTR_ERR(ringacc->proxy_gcfg); return PTR_ERR(ringacc->proxy_gcfg);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, ringacc->proxy_target_base = devm_platform_ioremap_resource_byname(pdev,
"proxy_target"); "proxy_target");
ringacc->proxy_target_base = devm_ioremap_resource(dev, res);
if (IS_ERR(ringacc->proxy_target_base)) if (IS_ERR(ringacc->proxy_target_base))
return PTR_ERR(ringacc->proxy_target_base); return PTR_ERR(ringacc->proxy_target_base);
...@@ -1471,7 +1466,6 @@ struct k3_ringacc *k3_ringacc_dmarings_init(struct platform_device *pdev, ...@@ -1471,7 +1466,6 @@ struct k3_ringacc *k3_ringacc_dmarings_init(struct platform_device *pdev,
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct k3_ringacc *ringacc; struct k3_ringacc *ringacc;
void __iomem *base_rt; void __iomem *base_rt;
struct resource *res;
int i; int i;
ringacc = devm_kzalloc(dev, sizeof(*ringacc), GFP_KERNEL); ringacc = devm_kzalloc(dev, sizeof(*ringacc), GFP_KERNEL);
...@@ -1486,8 +1480,7 @@ struct k3_ringacc *k3_ringacc_dmarings_init(struct platform_device *pdev, ...@@ -1486,8 +1480,7 @@ struct k3_ringacc *k3_ringacc_dmarings_init(struct platform_device *pdev,
mutex_init(&ringacc->req_lock); mutex_init(&ringacc->req_lock);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ringrt"); base_rt = devm_platform_ioremap_resource_byname(pdev, "ringrt");
base_rt = devm_ioremap_resource(dev, res);
if (IS_ERR(base_rt)) if (IS_ERR(base_rt))
return ERR_CAST(base_rt); return ERR_CAST(base_rt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment