Skip to content

Commit

Permalink
wireless: Print wiphy name in sysfs.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Greear authored and John W. Linville committed Oct 12, 2010
1 parent 5807bae commit cfd8e12
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions net/wireless/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -57,6 +65,7 @@ static struct device_attribute ieee80211_dev_attrs[] = {
__ATTR_RO(macaddress),
__ATTR_RO(address_mask),
__ATTR_RO(addresses),
__ATTR_RO(name),
{}
};

Expand Down

0 comments on commit cfd8e12

Please sign in to comment.