Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li <[email protected]>
---
v2:
-keep comment
drivers/fpga/altera-pr-ip-core-plat.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/fpga/altera-pr-ip-core-plat.c b/drivers/fpga/altera-pr-ip-core-plat.c
index b008a6b8d2d3..06c6a4721205 100644
--- a/drivers/fpga/altera-pr-ip-core-plat.c
+++ b/drivers/fpga/altera-pr-ip-core-plat.c
@@ -15,13 +15,9 @@ static int alt_pr_platform_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
void __iomem *reg_base;
- struct resource *res;
/* First mmio base is for register access */
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
- reg_base = devm_ioremap_resource(dev, res);
-
+ reg_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(reg_base))
return PTR_ERR(reg_base);
--
2.39.0
When devm_regmap_init_mmio fails, we should return PTR_ERR(priv->regmap)
instead of -ENODEV.
Fixes: acbb910ae04b ("fpga-manager: Add Socfpga Arria10 support")
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/fpga/socfpga-a10.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/fpga/socfpga-a10.c b/drivers/fpga/socfpga-a10.c
index cc4861e345c9..b7b6e0bdb3d9 100644
--- a/drivers/fpga/socfpga-a10.c
+++ b/drivers/fpga/socfpga-a10.c
@@ -491,7 +491,7 @@ static int socfpga_a10_fpga_probe(struct platform_device *pdev)
priv->regmap = devm_regmap_init_mmio(dev, reg_base,
&socfpga_a10_fpga_regmap_config);
if (IS_ERR(priv->regmap))
- return -ENODEV;
+ return PTR_ERR(priv->regmap);
priv->clk = devm_clk_get(dev, NULL);
if (IS_ERR(priv->clk)) {
--
2.39.0
On Mon, Jul 10, 2023 at 09:38:30PM +0800, Yangtao Li wrote:
> When devm_regmap_init_mmio fails, we should return PTR_ERR(priv->regmap)
> instead of -ENODEV.
>
> Fixes: acbb910ae04b ("fpga-manager: Add Socfpga Arria10 support")
Why are you not also including a cc: stable@ tag here?
thanks,
greg k-h
On 2023-07-10 at 16:11:35 +0200, Greg Kroah-Hartman wrote:
> On Mon, Jul 10, 2023 at 09:38:30PM +0800, Yangtao Li wrote:
> > When devm_regmap_init_mmio fails, we should return PTR_ERR(priv->regmap)
> > instead of -ENODEV.
> >
> > Fixes: acbb910ae04b ("fpga-manager: Add Socfpga Arria10 support")
>
> Why are you not also including a cc: stable@ tag here?
The change is to propagate the error number produced by regmap, instead
of using a fixed error number.
I think this is more of an improvement, not a bug fix. So no need to
merge to stable? And the changelog should be improved to avoid
confusing.
Thanks,
Yilun
>
> thanks,
>
> greg k-h
On 2023-07-10 at 21:38:28 +0800, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() to simplify code.
>
> Signed-off-by: Yangtao Li <[email protected]>
Acked-by: Xu Yilun <[email protected]>
Applied.
> ---
> v2:
> -keep comment
> drivers/fpga/altera-pr-ip-core-plat.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/fpga/altera-pr-ip-core-plat.c b/drivers/fpga/altera-pr-ip-core-plat.c
> index b008a6b8d2d3..06c6a4721205 100644
> --- a/drivers/fpga/altera-pr-ip-core-plat.c
> +++ b/drivers/fpga/altera-pr-ip-core-plat.c
> @@ -15,13 +15,9 @@ static int alt_pr_platform_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> void __iomem *reg_base;
> - struct resource *res;
>
> /* First mmio base is for register access */
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -
> - reg_base = devm_ioremap_resource(dev, res);
> -
> + reg_base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(reg_base))
> return PTR_ERR(reg_base);
>
> --
> 2.39.0
>