[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220602003523.19530-1-joakim.tjernlund@infinera.com>
Date: Thu, 2 Jun 2022 02:35:23 +0200
From: Joakim Tjernlund <joakim.tjernlund@...inera.com>
To: <netdev@...r.kernel.org>
CC: Joakim Tjernlund <joakim.tjernlund@...inera.com>,
<stable@...r.kernel.org>
Subject: [PATCH] net-sysfs: allow changing sysfs carrier when interface is down
UP/DOWN and carrier are async events and it makes sense one can
adjust carrier in sysfs before bringing the interface up.
Signed-off-by: Joakim Tjernlund <joakim.tjernlund@...inera.com>
Cc: stable@...r.kernel.org
---
net/core/net-sysfs.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index a4ae65263384..3418ef7ef2d8 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -167,8 +167,6 @@ static DEVICE_ATTR_RO(broadcast);
static int change_carrier(struct net_device *dev, unsigned long new_carrier)
{
- if (!netif_running(dev))
- return -EINVAL;
return dev_change_carrier(dev, (bool)new_carrier);
}
@@ -191,10 +189,7 @@ static ssize_t carrier_show(struct device *dev,
{
struct net_device *netdev = to_net_dev(dev);
- if (netif_running(netdev))
- return sprintf(buf, fmt_dec, !!netif_carrier_ok(netdev));
-
- return -EINVAL;
+ return sprintf(buf, fmt_dec, !!netif_carrier_ok(netdev));
}
static DEVICE_ATTR_RW(carrier);
--
2.35.1
Powered by blists - more mailing lists