Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ben Greear and committed by
John W. Linville
cfd8e12f 5807bae7

+9
+9
net/wireless/sysfs.c
··· 35 35 SHOW_FMT(macaddress, "%pM", wiphy.perm_addr); 36 36 SHOW_FMT(address_mask, "%pM", wiphy.addr_mask); 37 37 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 + 38 46 static ssize_t addresses_show(struct device *dev, 39 47 struct device_attribute *attr, 40 48 char *buf) ··· 65 57 __ATTR_RO(macaddress), 66 58 __ATTR_RO(address_mask), 67 59 __ATTR_RO(addresses), 60 + __ATTR_RO(name), 68 61 {} 69 62 }; 70 63