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