[PATCH] PCI: xilinx-xdma: Use devm_platform_ioremap_resource_byname

shao.mingyin@zte.com.cn posted 1 patch 10 months, 1 week ago
drivers/pci/controller/pcie-xilinx-dma-pl.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] PCI: xilinx-xdma: Use devm_platform_ioremap_resource_byname
Posted by shao.mingyin@zte.com.cn 10 months, 1 week ago
From: Xie Ludan <xie.ludan@zte.com.cn>

Introduce devm_platform_ioremap_resource_byname() to simplify
resource retrieval and mapping.This new function consolidates
platform_get_resource_byname() and devm_ioremap_resource() into a single
call, improving code readability and reducing API call overhead.

Signed-off-by: Xie Ludan <xie.ludan@zte.com.cn>
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
 drivers/pci/controller/pcie-xilinx-dma-pl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-xilinx-dma-pl.c b/drivers/pci/controller/pcie-xilinx-dma-pl.c
index dd117f07fc95..238deec3b948 100644
--- a/drivers/pci/controller/pcie-xilinx-dma-pl.c
+++ b/drivers/pci/controller/pcie-xilinx-dma-pl.c
@@ -753,8 +753,7 @@ static int xilinx_pl_dma_pcie_parse_dt(struct pl_dma_pcie *port,

 	if (port->variant->version == QDMA) {
 		port->cfg_base = port->cfg->win;
-		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "breg");
-		port->reg_base = devm_ioremap_resource(dev, res);
+		port->reg_base = devm_platform_ioremap_resource_byname(pdev, "breg");
 		if (IS_ERR(port->reg_base))
 			return PTR_ERR(port->reg_base);
 		port->phys_reg_base = res->start;
-- 
2.25.1
Re: [PATCH] PCI: xilinx-xdma: Use devm_platform_ioremap_resource_byname
Posted by Manivannan Sadhasivam 8 months, 2 weeks ago
On Thu, Apr 03, 2025 at 03:46:54PM +0800, shao.mingyin@zte.com.cn wrote:
> From: Xie Ludan <xie.ludan@zte.com.cn>
> 
> Introduce devm_platform_ioremap_resource_byname() to simplify
> resource retrieval and mapping.This new function consolidates
> platform_get_resource_byname() and devm_ioremap_resource() into a single
> call, improving code readability and reducing API call overhead.
> 
> Signed-off-by: Xie Ludan <xie.ludan@zte.com.cn>
> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
> ---
>  drivers/pci/controller/pcie-xilinx-dma-pl.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-xilinx-dma-pl.c b/drivers/pci/controller/pcie-xilinx-dma-pl.c
> index dd117f07fc95..238deec3b948 100644
> --- a/drivers/pci/controller/pcie-xilinx-dma-pl.c
> +++ b/drivers/pci/controller/pcie-xilinx-dma-pl.c
> @@ -753,8 +753,7 @@ static int xilinx_pl_dma_pcie_parse_dt(struct pl_dma_pcie *port,
> 
>  	if (port->variant->version == QDMA) {
>  		port->cfg_base = port->cfg->win;
> -		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "breg");
> -		port->reg_base = devm_ioremap_resource(dev, res);
> +		port->reg_base = devm_platform_ioremap_resource_byname(pdev, "breg");

This patch is entirely wrong as 'res' is used below. Please do not send buggy
cleanup patches.

- Mani

-- 
மணிவண்ணன் சதாசிவம்