Re: [PATCH net v1] net: broadcom: fix a mistake about ioremap resource

2020-05-05 Thread David Miller
From: Dejin Zheng 
Date: Tue,  5 May 2020 10:03:29 +0800

> Commit d7a5502b0bb8b ("net: broadcom: convert to
> devm_platform_ioremap_resource_byname()") will broke this driver.
> idm_base and nicpm_base were optional, after this change, they are
> mandatory. it will probe fails with -22 when the dtb doesn't have them
> defined. so revert part of this commit and make idm_base and nicpm_base
> as optional.
> 
> Fixes: d7a5502b0bb8bde ("net: broadcom: convert to 
> devm_platform_ioremap_resource_byname()")
> Reported-by: Jonathan Richardson 
> Signed-off-by: Dejin Zheng 

Applied, thank you.


Re: [PATCH net v1] net: broadcom: fix a mistake about ioremap resource

2020-05-05 Thread Dejin Zheng
On Mon, May 04, 2020 at 08:28:52PM -0700, Florian Fainelli wrote:
> 
> 
> On 5/4/2020 7:03 PM, Dejin Zheng wrote:
> > Commit d7a5502b0bb8b ("net: broadcom: convert to
> > devm_platform_ioremap_resource_byname()") will broke this driver.
> > idm_base and nicpm_base were optional, after this change, they are
> > mandatory. it will probe fails with -22 when the dtb doesn't have them
> > defined. so revert part of this commit and make idm_base and nicpm_base
> > as optional.
> > 
> > Fixes: d7a5502b0bb8bde ("net: broadcom: convert to 
> > devm_platform_ioremap_resource_byname()")
> > Reported-by: Jonathan Richardson 
> > Cc: Scott Branden 
> > Cc: Ray Jui 
> > Cc: Florian Fainelli 
> > Cc: David S. Miller 
> > Signed-off-by: Dejin Zheng 
> 
> Acked-by: Florian Fainelli 

Florian, Thank you very much for helping me as always!

BR,
Dejin

> -- 
> Florian


Re: [PATCH net v1] net: broadcom: fix a mistake about ioremap resource

2020-05-04 Thread Florian Fainelli



On 5/4/2020 7:03 PM, Dejin Zheng wrote:
> Commit d7a5502b0bb8b ("net: broadcom: convert to
> devm_platform_ioremap_resource_byname()") will broke this driver.
> idm_base and nicpm_base were optional, after this change, they are
> mandatory. it will probe fails with -22 when the dtb doesn't have them
> defined. so revert part of this commit and make idm_base and nicpm_base
> as optional.
> 
> Fixes: d7a5502b0bb8bde ("net: broadcom: convert to 
> devm_platform_ioremap_resource_byname()")
> Reported-by: Jonathan Richardson 
> Cc: Scott Branden 
> Cc: Ray Jui 
> Cc: Florian Fainelli 
> Cc: David S. Miller 
> Signed-off-by: Dejin Zheng 

Acked-by: Florian Fainelli 
-- 
Florian


[PATCH net v1] net: broadcom: fix a mistake about ioremap resource

2020-05-04 Thread Dejin Zheng
Commit d7a5502b0bb8b ("net: broadcom: convert to
devm_platform_ioremap_resource_byname()") will broke this driver.
idm_base and nicpm_base were optional, after this change, they are
mandatory. it will probe fails with -22 when the dtb doesn't have them
defined. so revert part of this commit and make idm_base and nicpm_base
as optional.

Fixes: d7a5502b0bb8bde ("net: broadcom: convert to 
devm_platform_ioremap_resource_byname()")
Reported-by: Jonathan Richardson 
Cc: Scott Branden 
Cc: Ray Jui 
Cc: Florian Fainelli 
Cc: David S. Miller 
Signed-off-by: Dejin Zheng 
---
 .../net/ethernet/broadcom/bgmac-platform.c| 24 ---
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bgmac-platform.c 
b/drivers/net/ethernet/broadcom/bgmac-platform.c
index a5d1a6cb9ce3..6795b6d95f54 100644
--- a/drivers/net/ethernet/broadcom/bgmac-platform.c
+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
@@ -172,6 +172,7 @@ static int bgmac_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
struct bgmac *bgmac;
+   struct resource *regs;
const u8 *mac_addr;
 
bgmac = bgmac_alloc(>dev);
@@ -206,16 +207,21 @@ static int bgmac_probe(struct platform_device *pdev)
if (IS_ERR(bgmac->plat.base))
return PTR_ERR(bgmac->plat.base);
 
-   bgmac->plat.idm_base =
-   devm_platform_ioremap_resource_byname(pdev, "idm_base");
-   if (IS_ERR(bgmac->plat.idm_base))
-   return PTR_ERR(bgmac->plat.idm_base);
-   bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
+   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
+   if (regs) {
+   bgmac->plat.idm_base = devm_ioremap_resource(>dev, regs);
+   if (IS_ERR(bgmac->plat.idm_base))
+   return PTR_ERR(bgmac->plat.idm_base);
+   bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
+   }
 
-   bgmac->plat.nicpm_base =
-   devm_platform_ioremap_resource_byname(pdev, "nicpm_base");
-   if (IS_ERR(bgmac->plat.nicpm_base))
-   return PTR_ERR(bgmac->plat.nicpm_base);
+   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base");
+   if (regs) {
+   bgmac->plat.nicpm_base = devm_ioremap_resource(>dev,
+  regs);
+   if (IS_ERR(bgmac->plat.nicpm_base))
+   return PTR_ERR(bgmac->plat.nicpm_base);
+   }
 
bgmac->read = platform_bgmac_read;
bgmac->write = platform_bgmac_write;
-- 
2.25.0