GNU Linux-libre 4.9.318-gnu1
[releases.git] / net / wireless / ethtool.c
1 #include <linux/utsname.h>
2 #include <net/cfg80211.h>
3 #include "core.h"
4 #include "rdev-ops.h"
5
6 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
7 {
8         struct wireless_dev *wdev = dev->ieee80211_ptr;
9         struct device *pdev = wiphy_dev(wdev->wiphy);
10
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));
16
17         strlcpy(info->version, init_utsname()->release, sizeof(info->version));
18
19         if (wdev->wiphy->fw_version[0])
20                 strlcpy(info->fw_version, wdev->wiphy->fw_version,
21                         sizeof(info->fw_version));
22         else
23                 strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
24
25         strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
26                 sizeof(info->bus_info));
27 }
28 EXPORT_SYMBOL(cfg80211_get_drvinfo);