diff options
author | Simon Glass | 2023-01-17 10:47:28 -0700 |
---|---|---|
committer | Tom Rini | 2023-01-23 18:11:39 -0500 |
commit | 70dd88657b45e5439bf762507f2e1c44c2dee289 (patch) | |
tree | 5328a26970a170591162b9b316409e6820069201 /net/eth-uclass.c | |
parent | f43b2df3e068cc7be1aa5656c0c3223e270bba63 (diff) |
sandbox: Allow ethernet bootdevs to be disabled for tests
Most tests don't want these and can create a lot of noise. Add a way to
disable them. Use that in tests, with a flag provided to enable them for
tests that need this feature.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'net/eth-uclass.c')
-rw-r--r-- | net/eth-uclass.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/net/eth-uclass.c b/net/eth-uclass.c index f41da4b37b3..b01a910938e 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -38,9 +38,12 @@ struct eth_device_priv { * struct eth_uclass_priv - The structure attached to the uclass itself * * @current: The Ethernet device that the network functions are using + * @no_bootdevs: true to skip binding Ethernet bootdevs (this is a negative flag + * so that the default value enables it) */ struct eth_uclass_priv { struct udevice *current; + bool no_bootdevs; }; /* eth_errno - This stores the most recent failure code from DM functions */ @@ -59,6 +62,14 @@ static struct eth_uclass_priv *eth_get_uclass_priv(void) return uclass_get_priv(uc); } +void eth_set_enable_bootdevs(bool enable) +{ + struct eth_uclass_priv *priv = eth_get_uclass_priv(); + + if (priv) + priv->no_bootdevs = !enable; +} + void eth_set_current_to_next(void) { struct eth_uclass_priv *uc_priv; @@ -477,6 +488,7 @@ int eth_initialize(void) static int eth_post_bind(struct udevice *dev) { + struct eth_uclass_priv *priv = uclass_get_priv(dev->uclass); int ret; if (strchr(dev->name, ' ')) { @@ -488,7 +500,7 @@ static int eth_post_bind(struct udevice *dev) #ifdef CONFIG_DM_ETH_PHY eth_phy_binds_nodes(dev); #endif - if (CONFIG_IS_ENABLED(BOOTDEV_ETH)) { + if (CONFIG_IS_ENABLED(BOOTDEV_ETH) && !priv->no_bootdevs) { ret = bootdev_setup_for_dev(dev, "eth_bootdev"); if (ret) return log_msg_ret("bootdev", ret); |