blob: 3cedf2c2b60bd79c88c5d060f0b4596d94a8fe64 [file] [log] [blame]
John W. Linville4890e3b2009-09-30 14:50:17 -04001#include <linux/utsname.h>
2#include <net/cfg80211.h>
John W. Linville36777132011-03-07 16:17:59 -05003#include "core.h"
Hila Gonene35e4d22012-06-27 17:19:42 +03004#include "rdev-ops.h"
John W. Linville4890e3b2009-09-30 14:50:17 -04005
Johannes Bergb7ffbd72014-06-04 17:31:56 +02006void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
John W. Linville4890e3b2009-09-30 14:50:17 -04007{
8 struct wireless_dev *wdev = dev->ieee80211_ptr;
Sergey Matyukevich415a1e42020-02-03 10:56:50 +00009 struct device *pdev = wiphy_dev(wdev->wiphy);
John W. Linville4890e3b2009-09-30 14:50:17 -040010
Sergey Matyukevich415a1e42020-02-03 10:56:50 +000011 if (pdev->driver)
12 strlcpy(info->driver, pdev->driver->name,
13 sizeof(info->driver));
14 else
15 strlcpy(info->driver, "N/A", sizeof(info->driver));
John W. Linville4890e3b2009-09-30 14:50:17 -040016
17 strlcpy(info->version, init_utsname()->release, sizeof(info->version));
18
Kalle Valodfce95f2009-09-24 11:02:42 -070019 if (wdev->wiphy->fw_version[0])
Jiri Pirko7826d432013-01-06 00:44:26 +000020 strlcpy(info->fw_version, wdev->wiphy->fw_version,
Kalle Valodfce95f2009-09-24 11:02:42 -070021 sizeof(info->fw_version));
22 else
Jiri Pirko7826d432013-01-06 00:44:26 +000023 strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
John W. Linville4890e3b2009-09-30 14:50:17 -040024
25 strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
26 sizeof(info->bus_info));
27}
Johannes Bergb7ffbd72014-06-04 17:31:56 +020028EXPORT_SYMBOL(cfg80211_get_drvinfo);