[6/8] fpga: fpga-mgr: socfpga: Convert to devm_platform_ioremap_resource()

Message ID 20230705094655.44753-6-frank.li@vivo.com
State New
Headers
Series [1/8] fpga: bridge: Convert to devm_platform_ioremap_resource() |

Commit Message

李扬韬 July 5, 2023, 9:46 a.m. UTC
  Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/fpga/socfpga.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
  

Comments

Xu Yilun July 10, 2023, 8:47 a.m. UTC | #1
On 2023-07-05 at 17:46:53 +0800, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() to simplify code.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>

Acked-by: Xu Yilun <yilun.xu@intel.com>

Applied.

> ---
>  drivers/fpga/socfpga.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/fpga/socfpga.c b/drivers/fpga/socfpga.c
> index 7e0741f99696..723ea0ad3f09 100644
> --- a/drivers/fpga/socfpga.c
> +++ b/drivers/fpga/socfpga.c
> @@ -545,20 +545,17 @@ static int socfpga_fpga_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct socfpga_fpga_priv *priv;
>  	struct fpga_manager *mgr;
> -	struct resource *res;
>  	int ret;
>  
>  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>  	if (!priv)
>  		return -ENOMEM;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	priv->fpga_base_addr = devm_ioremap_resource(dev, res);
> +	priv->fpga_base_addr = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(priv->fpga_base_addr))
>  		return PTR_ERR(priv->fpga_base_addr);
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -	priv->fpga_data_addr = devm_ioremap_resource(dev, res);
> +	priv->fpga_data_addr = devm_platform_ioremap_resource(pdev, 1);
>  	if (IS_ERR(priv->fpga_data_addr))
>  		return PTR_ERR(priv->fpga_data_addr);
>  
> -- 
> 2.39.0
>
  

Patch

diff --git a/drivers/fpga/socfpga.c b/drivers/fpga/socfpga.c
index 7e0741f99696..723ea0ad3f09 100644
--- a/drivers/fpga/socfpga.c
+++ b/drivers/fpga/socfpga.c
@@ -545,20 +545,17 @@  static int socfpga_fpga_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct socfpga_fpga_priv *priv;
 	struct fpga_manager *mgr;
-	struct resource *res;
 	int ret;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->fpga_base_addr = devm_ioremap_resource(dev, res);
+	priv->fpga_base_addr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->fpga_base_addr))
 		return PTR_ERR(priv->fpga_base_addr);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	priv->fpga_data_addr = devm_ioremap_resource(dev, res);
+	priv->fpga_data_addr = devm_platform_ioremap_resource(pdev, 1);
 	if (IS_ERR(priv->fpga_data_addr))
 		return PTR_ERR(priv->fpga_data_addr);