linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: dm9000: Handle -EPROBE_DEFER in dm9000_parse_dt()
@ 2020-02-16 19:39 Paul Cercueil
  2020-02-16 19:58 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paul Cercueil @ 2020-02-16 19:39 UTC (permalink / raw)
  To: David S . Miller
  Cc: netdev, linux-kernel, Paul Cercueil, H . Nikolaus Schaller,
	Mathieu Malaterre

The call to of_get_mac_address() can return -EPROBE_DEFER, for instance
when the MAC address is read from a NVMEM driver that did not probe yet.

Cc: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/net/ethernet/davicom/dm9000.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 1ea3372775e6..e94ae9b94dbf 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1405,6 +1405,8 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
 	mac_addr = of_get_mac_address(np);
 	if (!IS_ERR(mac_addr))
 		ether_addr_copy(pdata->dev_addr, mac_addr);
+	else if (PTR_ERR(mac_addr) == -EPROBE_DEFER)
+		return ERR_CAST(mac_addr);
 
 	return pdata;
 }
-- 
2.25.0


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

* Re: [PATCH] net: ethernet: dm9000: Handle -EPROBE_DEFER in dm9000_parse_dt()
  2020-02-16 19:39 [PATCH] net: ethernet: dm9000: Handle -EPROBE_DEFER in dm9000_parse_dt() Paul Cercueil
@ 2020-02-16 19:58 ` Andrew Lunn
  2020-02-17  4:02 ` David Miller
  2020-02-17 10:04 ` H. Nikolaus Schaller
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2020-02-16 19:58 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: David S . Miller, netdev, linux-kernel, H . Nikolaus Schaller,
	Mathieu Malaterre

On Sun, Feb 16, 2020 at 04:39:43PM -0300, Paul Cercueil wrote:
> The call to of_get_mac_address() can return -EPROBE_DEFER, for instance
> when the MAC address is read from a NVMEM driver that did not probe yet.
> 
> Cc: H. Nikolaus Schaller <hns@goldelico.com>
> Cc: Mathieu Malaterre <malat@debian.org>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH] net: ethernet: dm9000: Handle -EPROBE_DEFER in dm9000_parse_dt()
  2020-02-16 19:39 [PATCH] net: ethernet: dm9000: Handle -EPROBE_DEFER in dm9000_parse_dt() Paul Cercueil
  2020-02-16 19:58 ` Andrew Lunn
@ 2020-02-17  4:02 ` David Miller
  2020-02-17 10:04 ` H. Nikolaus Schaller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2020-02-17  4:02 UTC (permalink / raw)
  To: paul; +Cc: netdev, linux-kernel, hns, malat

From: Paul Cercueil <paul@crapouillou.net>
Date: Sun, 16 Feb 2020 16:39:43 -0300

> The call to of_get_mac_address() can return -EPROBE_DEFER, for instance
> when the MAC address is read from a NVMEM driver that did not probe yet.
> 
> Cc: H. Nikolaus Schaller <hns@goldelico.com>
> Cc: Mathieu Malaterre <malat@debian.org>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Applied.

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

* Re: [PATCH] net: ethernet: dm9000: Handle -EPROBE_DEFER in dm9000_parse_dt()
  2020-02-16 19:39 [PATCH] net: ethernet: dm9000: Handle -EPROBE_DEFER in dm9000_parse_dt() Paul Cercueil
  2020-02-16 19:58 ` Andrew Lunn
  2020-02-17  4:02 ` David Miller
@ 2020-02-17 10:04 ` H. Nikolaus Schaller
  2020-02-17 12:59   ` Andrew Lunn
  2 siblings, 1 reply; 5+ messages in thread
From: H. Nikolaus Schaller @ 2020-02-17 10:04 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David S . Miller, netdev, linux-kernel, Mathieu Malaterre

Hi Paul,

> Am 16.02.2020 um 20:39 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> The call to of_get_mac_address() can return -EPROBE_DEFER, for instance
> when the MAC address is read from a NVMEM driver that did not probe yet.

a quick test on the CI20 board shows that it seems to work. Especially
in this config, which would be broken otherwise:

CONFIG_JZ4780_EFUSE=m
CONFIG_DM9000=y

The other way round is not expected to be a problem.

It also serializes

CONFIG_JZ4780_EFUSE=m
CONFIG_DM9000=m

properly.

What I am not sure is if it handles

CONFIG_JZ4780_EFUSE=y
CONFIG_DM9000=y

always correct.

Is the EPROBE_DEFER mechanism also working for drivers
fully compiled into the kernel (I may have been mislead
since EPROBE_DEFER patches are almost always done to make
drivers work as modules)?

If not, it depends on luck to have the EFUSE driver probed
successfully before DM9000.

Anyways you can add my Tested-by: H. Nikolaus Schaller <hns@goldelico.com>

BR and thanks,
Nikolaus

> 
> Cc: H. Nikolaus Schaller <hns@goldelico.com>
> Cc: Mathieu Malaterre <malat@debian.org>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> drivers/net/ethernet/davicom/dm9000.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
> index 1ea3372775e6..e94ae9b94dbf 100644
> --- a/drivers/net/ethernet/davicom/dm9000.c
> +++ b/drivers/net/ethernet/davicom/dm9000.c
> @@ -1405,6 +1405,8 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
> 	mac_addr = of_get_mac_address(np);
> 	if (!IS_ERR(mac_addr))
> 		ether_addr_copy(pdata->dev_addr, mac_addr);
> +	else if (PTR_ERR(mac_addr) == -EPROBE_DEFER)
> +		return ERR_CAST(mac_addr);
> 
> 	return pdata;
> }
> -- 
> 2.25.0
> 


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

* Re: [PATCH] net: ethernet: dm9000: Handle -EPROBE_DEFER in dm9000_parse_dt()
  2020-02-17 10:04 ` H. Nikolaus Schaller
@ 2020-02-17 12:59   ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2020-02-17 12:59 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Paul Cercueil, David S . Miller, netdev, linux-kernel, Mathieu Malaterre

> Is the EPROBE_DEFER mechanism also working for drivers
> fully compiled into the kernel (I may have been mislead
> since EPROBE_DEFER patches are almost always done to make
> drivers work as modules)?

Yes. It is a generic mechanism and used with all driver probe
functions.

     Andrew

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

end of thread, other threads:[~2020-02-17 13:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-16 19:39 [PATCH] net: ethernet: dm9000: Handle -EPROBE_DEFER in dm9000_parse_dt() Paul Cercueil
2020-02-16 19:58 ` Andrew Lunn
2020-02-17  4:02 ` David Miller
2020-02-17 10:04 ` H. Nikolaus Schaller
2020-02-17 12:59   ` Andrew Lunn

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).