From f111e97b9bd949543177eca23e3eabd419cdcfe0 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Thu, 27 Dec 2012 23:49:38 +0000 Subject: [PATCH] --- yaml --- r: 351213 b: refs/heads/master c: fdae0fde5352790030d89edd09f1b43b9bed97f8 h: refs/heads/master i: 351211: 870c4a2a263bd65c8445a3c4b1f9a430b9900804 v: v3 --- [refs] | 2 +- trunk/net/core/net-sysfs.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 65bdea854077..0f5ae31b677c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4bf84c35c65f36a344fb7a6cde6274df4120efb8 +refs/heads/master: fdae0fde5352790030d89edd09f1b43b9bed97f8 diff --git a/trunk/net/core/net-sysfs.c b/trunk/net/core/net-sysfs.c index 28c5f5aa7ca7..29c884a74c38 100644 --- a/trunk/net/core/net-sysfs.c +++ b/trunk/net/core/net-sysfs.c @@ -126,6 +126,19 @@ static ssize_t show_broadcast(struct device *dev, return -EINVAL; } +static int change_carrier(struct net_device *net, unsigned long new_carrier) +{ + if (!netif_running(net)) + return -EINVAL; + return dev_change_carrier(net, (bool) new_carrier); +} + +static ssize_t store_carrier(struct device *dev, struct device_attribute *attr, + const char *buf, size_t len) +{ + return netdev_store(dev, attr, buf, len, change_carrier); +} + static ssize_t show_carrier(struct device *dev, struct device_attribute *attr, char *buf) { @@ -331,7 +344,7 @@ static struct device_attribute net_class_attributes[] = { __ATTR(link_mode, S_IRUGO, show_link_mode, NULL), __ATTR(address, S_IRUGO, show_address, NULL), __ATTR(broadcast, S_IRUGO, show_broadcast, NULL), - __ATTR(carrier, S_IRUGO, show_carrier, NULL), + __ATTR(carrier, S_IRUGO | S_IWUSR, show_carrier, store_carrier), __ATTR(speed, S_IRUGO, show_speed, NULL), __ATTR(duplex, S_IRUGO, show_duplex, NULL), __ATTR(dormant, S_IRUGO, show_dormant, NULL),