linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bus: fsl-mc: fsl-mc-bus: Use devm_platform_ioremap_resource() to simplify code
@ 2021-07-20 12:50 Tang Bin
  2021-07-21 14:34 ` Laurentiu Tudor
  0 siblings, 1 reply; 3+ messages in thread
From: Tang Bin @ 2021-07-20 12:50 UTC (permalink / raw)
  To: stuyoder, laurentiu.tudor; +Cc: linux-kernel, Tang Bin, Zhang Shengju

Use devm_platform_ioremap_resource() instead of
platform_get_resource() + devm_ioremap_resource().

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/bus/fsl-mc/fsl-mc-bus.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 380ad1fdb745..472f0daf4271 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -1080,12 +1080,9 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, mc);
 
-	plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (plat_res) {
-		mc->fsl_mc_regs = devm_ioremap_resource(&pdev->dev, plat_res);
-		if (IS_ERR(mc->fsl_mc_regs))
-			return PTR_ERR(mc->fsl_mc_regs);
-	}
+	mc->fsl_mc_regs = devm_platform_ioremap_resource(pdev, 1);
+	if (IS_ERR(mc->fsl_mc_regs))
+		return PTR_ERR(mc->fsl_mc_regs);
 
 	if (mc->fsl_mc_regs) {
 		/*
-- 
2.18.2




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bus: fsl-mc: fsl-mc-bus: Use devm_platform_ioremap_resource() to simplify code
  2021-07-20 12:50 [PATCH] bus: fsl-mc: fsl-mc-bus: Use devm_platform_ioremap_resource() to simplify code Tang Bin
@ 2021-07-21 14:34 ` Laurentiu Tudor
  0 siblings, 0 replies; 3+ messages in thread
From: Laurentiu Tudor @ 2021-07-21 14:34 UTC (permalink / raw)
  To: Tang Bin, stuyoder; +Cc: linux-kernel, Zhang Shengju



On 7/20/2021 3:50 PM, Tang Bin wrote:
> Use devm_platform_ioremap_resource() instead of
> platform_get_resource() + devm_ioremap_resource().
> 
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
>  drivers/bus/fsl-mc/fsl-mc-bus.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
> index 380ad1fdb745..472f0daf4271 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -1080,12 +1080,9 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, mc);
>  
> -	plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -	if (plat_res) {
> -		mc->fsl_mc_regs = devm_ioremap_resource(&pdev->dev, plat_res);
> -		if (IS_ERR(mc->fsl_mc_regs))
> -			return PTR_ERR(mc->fsl_mc_regs);
> -	}
> +	mc->fsl_mc_regs = devm_platform_ioremap_resource(pdev, 1);
> +	if (IS_ERR(mc->fsl_mc_regs))
> +		return PTR_ERR(mc->fsl_mc_regs);

Thanks for the patch, but this is not ok as it alters the original
behavior. Not having region1 in the device tree is a valid scenario, see
binding [1] while not being able to read is an error. Your change treats
both cases as error.

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt#n58
---
Best Regards, Laurentiu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] bus: fsl-mc: fsl-mc-bus: Use devm_platform_ioremap_resource() to simplify code
@ 2021-06-28 14:34 Tang Bin
  0 siblings, 0 replies; 3+ messages in thread
From: Tang Bin @ 2021-06-28 14:34 UTC (permalink / raw)
  To: stuyoder, laurentiu.tudor; +Cc: linux-kernel, Tang Bin, Zhang Shengju

Use devm_platform_ioremap_resource() instead of
platform_get_resource() + devm_ioremap_resource().

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/bus/fsl-mc/fsl-mc-bus.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 380ad1fdb745..472f0daf4271 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -1080,12 +1080,9 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, mc);
 
-	plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (plat_res) {
-		mc->fsl_mc_regs = devm_ioremap_resource(&pdev->dev, plat_res);
-		if (IS_ERR(mc->fsl_mc_regs))
-			return PTR_ERR(mc->fsl_mc_regs);
-	}
+	mc->fsl_mc_regs = devm_platform_ioremap_resource(pdev, 1);
+	if (IS_ERR(mc->fsl_mc_regs))
+		return PTR_ERR(mc->fsl_mc_regs);
 
 	if (mc->fsl_mc_regs) {
 		/*
-- 
2.18.2




^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-21 14:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 12:50 [PATCH] bus: fsl-mc: fsl-mc-bus: Use devm_platform_ioremap_resource() to simplify code Tang Bin
2021-07-21 14:34 ` Laurentiu Tudor
  -- strict thread matches above, loose matches on Subject: below --
2021-06-28 14:34 Tang Bin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).