[PATCH] net-sysfs: allow changing sysfs carrier when interface is down

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
 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




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux