diff mbox series

soc: ti: Use devm_platform_ioremap_resource_byname simplify logic

Message ID 20230809081523.26196-1-zhangzekun11@huawei.com (mailing list archive)
State New, archived
Headers show
Series soc: ti: Use devm_platform_ioremap_resource_byname simplify logic | expand

Commit Message

zhangzekun (A) Aug. 9, 2023, 8:15 a.m. UTC
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: Zhang Zekun <zhangzekun11@huawei.com>
---
 drivers/soc/ti/k3-ringacc.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

Comments

Dhruva Gole Aug. 9, 2023, 12:10 p.m. UTC | #1
On Aug 09, 2023 at 16:15:23 +0800, Zhang Zekun wrote:
> 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.

Ack, have seen multiple such series in past as well like here:

commit 79caf207d6699419e83ac150accc5c80c5719b47 "phy: ti: convert to devm_platform_ioremap_resource(_byname)"

> 
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
> ---
>  drivers/soc/ti/k3-ringacc.c | 19 ++++++-------------
>  1 file changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/soc/ti/k3-ringacc.c b/drivers/soc/ti/k3-ringacc.c
> index 4c1353616b72..148f54d9691d 100644
> --- a/drivers/soc/ti/k3-ringacc.c
> +++ b/drivers/soc/ti/k3-ringacc.c
> @@ -1368,7 +1368,6 @@ static int k3_ringacc_init(struct platform_device *pdev,
>  	const struct soc_device_attribute *soc;
>  	void __iomem *base_fifo, *base_rt;
>  	struct device *dev = &pdev->dev;
> -	struct resource *res;
>  	int ret, i;
>  
>  	dev->msi.domain = of_msi_get_domain(dev, dev->of_node,
> @@ -1387,24 +1386,20 @@ static int k3_ringacc_init(struct platform_device *pdev,
>  		ringacc->dma_ring_reset_quirk = soc_data->dma_ring_reset_quirk;
>  	}
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rt");
> -	base_rt = devm_ioremap_resource(dev, res);
> +	base_rt = devm_platform_ioremap_resource_byname(pdev, "rt");
>  	if (IS_ERR(base_rt))
>  		return PTR_ERR(base_rt);
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fifos");
> -	base_fifo = devm_ioremap_resource(dev, res);
> +	base_fifo = devm_platform_ioremap_resource_byname(pdev, "fifos");
>  	if (IS_ERR(base_fifo))
>  		return PTR_ERR(base_fifo);
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "proxy_gcfg");
> -	ringacc->proxy_gcfg = devm_ioremap_resource(dev, res);
> +	ringacc->proxy_gcfg = devm_platform_ioremap_resource_byname(pdev, "proxy_gcfg");
>  	if (IS_ERR(ringacc->proxy_gcfg))
>  		return PTR_ERR(ringacc->proxy_gcfg);
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> -					   "proxy_target");
> -	ringacc->proxy_target_base = devm_ioremap_resource(dev, res);
> +	ringacc->proxy_target_base = devm_platform_ioremap_resource_byname(pdev,
> +									   "proxy_target");
>  	if (IS_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,
>  	struct device *dev = &pdev->dev;
>  	struct k3_ringacc *ringacc;
>  	void __iomem *base_rt;
> -	struct resource *res;
>  	int i;
>  
>  	ringacc = devm_kzalloc(dev, sizeof(*ringacc), GFP_KERNEL);
> @@ -1486,8 +1480,7 @@ struct k3_ringacc *k3_ringacc_dmarings_init(struct platform_device *pdev,
>  
>  	mutex_init(&ringacc->req_lock);
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ringrt");
> -	base_rt = devm_ioremap_resource(dev, res);
> +	base_rt = devm_platform_ioremap_resource_byname(pdev, "ringrt");
>  	if (IS_ERR(base_rt))
>  		return ERR_CAST(base_rt);
[...]

I don't see any major issues,
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Nishanth Menon Aug. 10, 2023, 5:13 a.m. UTC | #2
Hi Zhang Zekun,

On Wed, 9 Aug 2023 16:15:23 +0800, Zhang Zekun wrote:
> 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.
> 
> 

I have applied the following to branch ti-drivers-soc-next on [1].
Thank you!

[1/1] soc: ti: Use devm_platform_ioremap_resource_byname simplify logic
      commit: f9dbb99748bab004663e349498c24edbb2368f70

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent up the chain during
the next merge window (or sooner if it is a relevant bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

[1] git://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
diff mbox series

Patch

diff --git a/drivers/soc/ti/k3-ringacc.c b/drivers/soc/ti/k3-ringacc.c
index 4c1353616b72..148f54d9691d 100644
--- a/drivers/soc/ti/k3-ringacc.c
+++ b/drivers/soc/ti/k3-ringacc.c
@@ -1368,7 +1368,6 @@  static int k3_ringacc_init(struct platform_device *pdev,
 	const struct soc_device_attribute *soc;
 	void __iomem *base_fifo, *base_rt;
 	struct device *dev = &pdev->dev;
-	struct resource *res;
 	int ret, i;
 
 	dev->msi.domain = of_msi_get_domain(dev, dev->of_node,
@@ -1387,24 +1386,20 @@  static int k3_ringacc_init(struct platform_device *pdev,
 		ringacc->dma_ring_reset_quirk = soc_data->dma_ring_reset_quirk;
 	}
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rt");
-	base_rt = devm_ioremap_resource(dev, res);
+	base_rt = devm_platform_ioremap_resource_byname(pdev, "rt");
 	if (IS_ERR(base_rt))
 		return PTR_ERR(base_rt);
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fifos");
-	base_fifo = devm_ioremap_resource(dev, res);
+	base_fifo = devm_platform_ioremap_resource_byname(pdev, "fifos");
 	if (IS_ERR(base_fifo))
 		return PTR_ERR(base_fifo);
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "proxy_gcfg");
-	ringacc->proxy_gcfg = devm_ioremap_resource(dev, res);
+	ringacc->proxy_gcfg = devm_platform_ioremap_resource_byname(pdev, "proxy_gcfg");
 	if (IS_ERR(ringacc->proxy_gcfg))
 		return PTR_ERR(ringacc->proxy_gcfg);
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-					   "proxy_target");
-	ringacc->proxy_target_base = devm_ioremap_resource(dev, res);
+	ringacc->proxy_target_base = devm_platform_ioremap_resource_byname(pdev,
+									   "proxy_target");
 	if (IS_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,
 	struct device *dev = &pdev->dev;
 	struct k3_ringacc *ringacc;
 	void __iomem *base_rt;
-	struct resource *res;
 	int i;
 
 	ringacc = devm_kzalloc(dev, sizeof(*ringacc), GFP_KERNEL);
@@ -1486,8 +1480,7 @@  struct k3_ringacc *k3_ringacc_dmarings_init(struct platform_device *pdev,
 
 	mutex_init(&ringacc->req_lock);
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ringrt");
-	base_rt = devm_ioremap_resource(dev, res);
+	base_rt = devm_platform_ioremap_resource_byname(pdev, "ringrt");
 	if (IS_ERR(base_rt))
 		return ERR_CAST(base_rt);