Skip to content

Commit cfd8e12

Browse files
greearblinvjw
authored andcommitted
wireless: Print wiphy name in sysfs.
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>
1 parent 5807bae commit cfd8e12

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎net/wireless/sysfs.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ SHOW_FMT(index, "%d", wiphy_idx);
3535
SHOW_FMT(macaddress, "%pM", wiphy.perm_addr);
3636
SHOW_FMT(address_mask, "%pM", wiphy.addr_mask);
3737

38+
static ssize_t name_show(struct device *dev,
39+
struct device_attribute *attr,
40+
char *buf) {
41+
struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy;
42+
return sprintf(buf, "%s\n", dev_name(&wiphy->dev));
43+
}
44+
45+
3846
static ssize_t addresses_show(struct device *dev,
3947
struct device_attribute *attr,
4048
char *buf)
@@ -57,6 +65,7 @@ static struct device_attribute ieee80211_dev_attrs[] = {
5765
__ATTR_RO(macaddress),
5866
__ATTR_RO(address_mask),
5967
__ATTR_RO(addresses),
68+
__ATTR_RO(name),
6069
{}
6170
};
6271

0 commit comments

Comments
 (0)