John W. Linville | 4890e3b | 2009-09-30 14:50:17 -0400 | [diff] [blame] | 1 | #include <linux/utsname.h> |
| 2 | #include <net/cfg80211.h> |
John W. Linville | 3677713 | 2011-03-07 16:17:59 -0500 | [diff] [blame] | 3 | #include "core.h" |
Hila Gonen | e35e4d2 | 2012-06-27 17:19:42 +0300 | [diff] [blame] | 4 | #include "rdev-ops.h" |
John W. Linville | 4890e3b | 2009-09-30 14:50:17 -0400 | [diff] [blame] | 5 | |
Johannes Berg | b7ffbd7 | 2014-06-04 17:31:56 +0200 | [diff] [blame] | 6 | void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
John W. Linville | 4890e3b | 2009-09-30 14:50:17 -0400 | [diff] [blame] | 7 | { |
| 8 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
Sergey Matyukevich | 415a1e4 | 2020-02-03 10:56:50 +0000 | [diff] [blame^] | 9 | struct device *pdev = wiphy_dev(wdev->wiphy); |
John W. Linville | 4890e3b | 2009-09-30 14:50:17 -0400 | [diff] [blame] | 10 | |
Sergey Matyukevich | 415a1e4 | 2020-02-03 10:56:50 +0000 | [diff] [blame^] | 11 | 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. Linville | 4890e3b | 2009-09-30 14:50:17 -0400 | [diff] [blame] | 16 | |
| 17 | strlcpy(info->version, init_utsname()->release, sizeof(info->version)); |
| 18 | |
Kalle Valo | dfce95f | 2009-09-24 11:02:42 -0700 | [diff] [blame] | 19 | if (wdev->wiphy->fw_version[0]) |
Jiri Pirko | 7826d43 | 2013-01-06 00:44:26 +0000 | [diff] [blame] | 20 | strlcpy(info->fw_version, wdev->wiphy->fw_version, |
Kalle Valo | dfce95f | 2009-09-24 11:02:42 -0700 | [diff] [blame] | 21 | sizeof(info->fw_version)); |
| 22 | else |
Jiri Pirko | 7826d43 | 2013-01-06 00:44:26 +0000 | [diff] [blame] | 23 | strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
John W. Linville | 4890e3b | 2009-09-30 14:50:17 -0400 | [diff] [blame] | 24 | |
| 25 | strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)), |
| 26 | sizeof(info->bus_info)); |
| 27 | } |
Johannes Berg | b7ffbd7 | 2014-06-04 17:31:56 +0200 | [diff] [blame] | 28 | EXPORT_SYMBOL(cfg80211_get_drvinfo); |