wireless: Print wiphy name in sysfs.
authorBen Greear <greearb@candelatech.com>
Mon, 11 Oct 2010 17:28:59 +0000 (10:28 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 12 Oct 2010 20:05:29 +0000 (16:05 -0400)
The index cannot be used to reliably reconstruct a phy
name, so explicitly add the phy name to sysfs so that scripts
can figure out the parent phy device for a particular
wireless interface.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/sysfs.c

index 74a9e3cce45249a4ab21a909fa28806127409f7f..4294fa22bb2dfc15cbd6d0d2e7c0303a42f7d278 100644 (file)
@@ -35,6 +35,14 @@ SHOW_FMT(index, "%d", wiphy_idx);
 SHOW_FMT(macaddress, "%pM", wiphy.perm_addr);
 SHOW_FMT(address_mask, "%pM", wiphy.addr_mask);
 
+static ssize_t name_show(struct device *dev,
+                        struct device_attribute *attr,
+                        char *buf) {
+       struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy;
+       return sprintf(buf, "%s\n", dev_name(&wiphy->dev));
+}
+
+
 static ssize_t addresses_show(struct device *dev,
                              struct device_attribute *attr,
                              char *buf)
@@ -57,6 +65,7 @@ static struct device_attribute ieee80211_dev_attrs[] = {
        __ATTR_RO(macaddress),
        __ATTR_RO(address_mask),
        __ATTR_RO(addresses),
+       __ATTR_RO(name),
        {}
 };