The firmware version is already exposed via ethtool, but is not accessible without an attached interface to create a netdev. Expose this info in sysfs to allow users to query it without the use of ethtool. Signed-off-by: Rory Little --- Documentation/ABI/testing/sysfs-class-ieee80211 | 7 +++++++ MAINTAINERS | 1 + net/wireless/sysfs.c | 14 ++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-ieee80211 diff --git a/Documentation/ABI/testing/sysfs-class-ieee80211 b/Documentation/ABI/testing/sysfs-class-ieee80211 new file mode 100644 index 000000000000..caaf4f3fd4b4 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-ieee80211 @@ -0,0 +1,7 @@ +What: /sys/class/ieee80211//fw_version +Date: July 2026 +Contact: linux-wireless@vger.kernel.org +Description: Read-only firmware version string provided by the driver for + this wireless device. The read data will match the information + provided by ethtool get_drvinfo. As drivers are not required to + provide this information, reading may yield no data. diff --git a/MAINTAINERS b/MAINTAINERS index 2d420d40782e..56181edb718f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -117,6 +117,7 @@ W: https://wireless.wiki.kernel.org/ Q: https://patchwork.kernel.org/project/linux-wireless/list/ T: git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git +F: Documentation/ABI/testing/sysfs-class-ieee80211 F: Documentation/driver-api/80211/cfg80211.rst F: Documentation/networking/regulatory.rst F: include/linux/ieee80211.h diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c index 3ec25d3f004e..e63b6d1fa411 100644 --- a/net/wireless/sysfs.c +++ b/net/wireless/sysfs.c @@ -65,12 +65,26 @@ static ssize_t addresses_show(struct device *dev, } static DEVICE_ATTR_RO(addresses); +static ssize_t fw_version_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy; + + if (!wiphy->fw_version[0]) + return 0; + + return sysfs_emit(buf, "%s\n", wiphy->fw_version); +} +static DEVICE_ATTR_RO(fw_version); + static struct attribute *ieee80211_attrs[] = { &dev_attr_index.attr, &dev_attr_macaddress.attr, &dev_attr_address_mask.attr, &dev_attr_addresses.attr, &dev_attr_name.attr, + &dev_attr_fw_version.attr, NULL, }; ATTRIBUTE_GROUPS(ieee80211); -- 2.52.0