Linux wireless drivers development
 help / color / mirror / Atom feed
From: Rory Little <roryl@candelatech.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org
Subject: [PATCH wireless-next] wifi: cfg80211: add fw_version device attribute for sysfs
Date: Tue, 28 Jul 2026 16:47:25 -0700	[thread overview]
Message-ID: <20260728234726.27479-1-roryl@candelatech.com> (raw)

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 <roryl@candelatech.com>
---
 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/<phyname>/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


             reply	other threads:[~2026-07-28 23:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 23:47 Rory Little [this message]
2026-07-29  1:34 ` [PATCH wireless-next] wifi: cfg80211: add fw_version device attribute for sysfs Jeff Johnson
2026-07-29  5:32   ` Rory Little

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260728234726.27479-1-roryl@candelatech.com \
    --to=roryl@candelatech.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox