[4/7] spi: spi-nxp-fspi: Convert to devm_platform_ioremap_resource() and devm_platform_ioremap_resource_byname()

Message ID 20230706032727.9180-4-frank.li@vivo.com
State New
Headers
Series [1/7] spi: atmel: Use devm_platform_get_and_ioremap_resource() |

Commit Message

李扬韬 July 6, 2023, 3:27 a.m. UTC
  Use devm_platform_ioremap_resource() and
devm_platform_ioremap_resource_byname() to simplify code.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/spi/spi-nxp-fspi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Comments

Bough Chen July 6, 2023, 6:06 a.m. UTC | #1
> -----Original Message-----
> From: Yangtao Li <frank.li@vivo.com>
> Sent: 2023年7月6日 11:27
> To: Han Xu <han.xu@nxp.com>; Bough Chen <haibo.chen@nxp.com>; Yogesh
> Gaur <yogeshgaur.83@gmail.com>; Mark Brown <broonie@kernel.org>
> Cc: Yangtao Li <frank.li@vivo.com>; linux-spi@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: [PATCH 4/7] spi: spi-nxp-fspi: Convert to
> devm_platform_ioremap_resource() and
> devm_platform_ioremap_resource_byname()
> 
> Use devm_platform_ioremap_resource() and
> devm_platform_ioremap_resource_byname() to simplify code.

Thanks!

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>

Best Regards
Haibo Chen

> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  drivers/spi/spi-nxp-fspi.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c index
> 544017655787..4cf9b3bf7b57 100644
> --- a/drivers/spi/spi-nxp-fspi.c
> +++ b/drivers/spi/spi-nxp-fspi.c
> @@ -1157,12 +1157,10 @@ static int nxp_fspi_probe(struct platform_device
> *pdev)
> 
>  	/* find the resources - configuration register address space */
>  	if (is_acpi_node(dev_fwnode(f->dev)))
> -		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +		f->iobase = devm_platform_ioremap_resource(pdev, 0);
>  	else
> -		res = platform_get_resource_byname(pdev,
> -				IORESOURCE_MEM, "fspi_base");
> +		f->iobase = devm_platform_ioremap_resource_byname(pdev,
> "fspi_base");
> 
> -	f->iobase = devm_ioremap_resource(dev, res);
>  	if (IS_ERR(f->iobase)) {
>  		ret = PTR_ERR(f->iobase);
>  		goto err_put_ctrl;
> --
> 2.39.0
  

Patch

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 544017655787..4cf9b3bf7b57 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -1157,12 +1157,10 @@  static int nxp_fspi_probe(struct platform_device *pdev)
 
 	/* find the resources - configuration register address space */
 	if (is_acpi_node(dev_fwnode(f->dev)))
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+		f->iobase = devm_platform_ioremap_resource(pdev, 0);
 	else
-		res = platform_get_resource_byname(pdev,
-				IORESOURCE_MEM, "fspi_base");
+		f->iobase = devm_platform_ioremap_resource_byname(pdev, "fspi_base");
 
-	f->iobase = devm_ioremap_resource(dev, res);
 	if (IS_ERR(f->iobase)) {
 		ret = PTR_ERR(f->iobase);
 		goto err_put_ctrl;