diff mbox series

[1/7] spi: atmel: Use devm_platform_get_and_ioremap_resource()

Message ID 20230706032727.9180-1-frank.li@vivo.com
State Accepted
Commit 616a733ccaee2412cd8def29f6f106e22c3cfabb
Headers show
Series [1/7] spi: atmel: Use devm_platform_get_and_ioremap_resource() | expand

Commit Message

Yangtao Li July 6, 2023, 3:27 a.m. UTC
Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/spi/spi-atmel.c | 6 +-----
 1 file changed, 1 insertion(+), 5 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
Thierry Reding July 7, 2023, 1:01 p.m. UTC | #2
On Thu, Jul 06, 2023 at 11:27:25AM +0800, Yangtao Li wrote:
> Convert platform_get_resource(), devm_ioremap_resource() to a single
> call to devm_platform_get_and_ioremap_resource(), as this is exactly
> what this function does.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  drivers/spi/spi-tegra20-slink.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>
Mark Brown July 11, 2023, 10:04 p.m. UTC | #3
On Thu, 06 Jul 2023 11:27:20 +0800, Yangtao Li wrote:
> Convert platform_get_resource(), devm_ioremap_resource() to a single
> call to devm_platform_get_and_ioremap_resource(), as this is exactly
> what this function does.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/7] spi: atmel: Use devm_platform_get_and_ioremap_resource()
      commit: 616a733ccaee2412cd8def29f6f106e22c3cfabb
[2/7] spi: davinci: Use devm_platform_get_and_ioremap_resource()
      commit: 2ae3c98b6e80f5b99afd9eafbdfab5146330dae5
[3/7] spi: ep93xx: Use devm_platform_get_and_ioremap_resource()
      commit: cb8ea3dd55acd191f80847488d2231a1d18ab1ed
[4/7] spi: spi-nxp-fspi: Convert to devm_platform_ioremap_resource() and devm_platform_ioremap_resource_byname()
      commit: 8c8e947b6be037d0a311f11688212c7d87aa5440
[5/7] spi: rspi: Use devm_platform_get_and_ioremap_resource()
      commit: b778d967979d7ed638fe1de8c2465ff33ace47d8
[6/7] spi: tegra20-slink: Use devm_platform_get_and_ioremap_resource()
      commit: 2e4ed2577936476e0e9bb9a07158e94effb86285
[7/7] spi: s3c64xx: Use devm_platform_get_and_ioremap_resource()
      commit: 4f81b540ccdf023b7b39432f5c0a26c7eadcc9ce

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a 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.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 152cd6773403..8a9c8b92be8c 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1450,10 +1450,6 @@  static int atmel_spi_probe(struct platform_device *pdev)
 	/* Select default pin state */
 	pinctrl_pm_select_default_state(&pdev->dev);
 
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!regs)
-		return -ENXIO;
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return irq;
@@ -1490,7 +1486,7 @@  static int atmel_spi_probe(struct platform_device *pdev)
 	spin_lock_init(&as->lock);
 
 	as->pdev = pdev;
-	as->regs = devm_ioremap_resource(&pdev->dev, regs);
+	as->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &regs);
 	if (IS_ERR(as->regs)) {
 		ret = PTR_ERR(as->regs);
 		goto out_unmap_regs;