bus: fsl-mc: fsl-mc-bus: Use devm_platform_ioremap_resource() to simplify code
PATCH 1/1 bus: fsl-mc: fsl-mc-bus: Use devm_platform_ioremap_resource() to simplify code
Use devm_platform_ioremap_resource() instead of platform_get_resource() + devm_ioremap_resource().
--- drivers/bus/fsl-mc/fsl-mc-bus.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/bus/fsl-mc/fsl-mc-bus.c +3 -6
@@ -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) {/*
Signature · 1 line
2.18.2
Quoted 16 lines · Tang Bin
Use
devm_platform_ioremap_resource()instead ofplatform_get_resource()+devm_ioremap_resource().Signed-off-by Zhang Shengju <[email protected]>Signed-off-by Tang Bin <[email protected]>--- drivers/bus/fsl-mc/fsl-mc-bus.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)drivers/bus/fsl-mc/fsl-mc-bus.c +0
-0@@ -1080,12 +1080,9 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)platform_set_drvdata (pdev, mc);
drivers/bus/fsl-mc/fsl-mc-bus.c static int fsl_mc_bus_probe(struct platform_device *pdev) · line 1085
Quoted 10 lines
drivers/bus/fsl-mc/fsl-mc-bus.c +3
-6- 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