diff mbox series

[-next] spi: wpcm-fiu: switch to use devm_platform_ioremap_resource_byname()

Message ID 20230803021428.3739149-1-yangyingliang@huawei.com
State New
Headers show
Series [-next] spi: wpcm-fiu: switch to use devm_platform_ioremap_resource_byname() | expand

Commit Message

Yang Yingliang Aug. 3, 2023, 2:14 a.m. UTC
Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/spi/spi-wpcm-fiu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

J. Neuschäfer Aug. 14, 2023, 8:13 a.m. UTC | #1
Hello,

thanks for your patch!

On Thu, Aug 03, 2023 at 10:14:28AM +0800, Yang Yingliang wrote:
> Use the devm_platform_ioremap_resource_byname() helper instead of
> calling platform_get_resource_byname() and devm_ioremap_resource()
> separately.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/spi/spi-wpcm-fiu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-wpcm-fiu.c b/drivers/spi/spi-wpcm-fiu.c
> index 852ffe013d32..d07a06f49204 100644
> --- a/drivers/spi/spi-wpcm-fiu.c
> +++ b/drivers/spi/spi-wpcm-fiu.c
> @@ -448,8 +448,7 @@ static int wpcm_fiu_probe(struct platform_device *pdev)
>  	fiu = spi_controller_get_devdata(ctrl);
>  	fiu->dev = dev;
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "control");
> -	fiu->regs = devm_ioremap_resource(dev, res);
> +	fiu->regs = devm_platform_ioremap_resource_byname(pdev, "control");

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>


Unfortunately, the other platform_get_resource_byname/devm_ioremap_resource
pair a few lines below can't easily be converted to
devm_platform_ioremap_resource_byname, because resource_size is needed.


Best regards,
Jonathan
diff mbox series

Patch

diff --git a/drivers/spi/spi-wpcm-fiu.c b/drivers/spi/spi-wpcm-fiu.c
index 852ffe013d32..d07a06f49204 100644
--- a/drivers/spi/spi-wpcm-fiu.c
+++ b/drivers/spi/spi-wpcm-fiu.c
@@ -448,8 +448,7 @@  static int wpcm_fiu_probe(struct platform_device *pdev)
 	fiu = spi_controller_get_devdata(ctrl);
 	fiu->dev = dev;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "control");
-	fiu->regs = devm_ioremap_resource(dev, res);
+	fiu->regs = devm_platform_ioremap_resource_byname(pdev, "control");
 	if (IS_ERR(fiu->regs)) {
 		dev_err(dev, "Failed to map registers\n");
 		return PTR_ERR(fiu->regs);