blob: 24e18405cdb48fff6090831f656b4f883c926109 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
John W. Linville4890e3b2009-09-30 14:50:17 -04002#include <linux/utsname.h>
3#include <net/cfg80211.h>
John W. Linville36777132011-03-07 16:17:59 -05004#include "core.h"
Hila Gonene35e4d22012-06-27 17:19:42 +03005#include "rdev-ops.h"
John W. Linville4890e3b2009-09-30 14:50:17 -04006
Johannes Bergb7ffbd72014-06-04 17:31:56 +02007void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
John W. Linville4890e3b2009-09-30 14:50:17 -04008{
9 struct wireless_dev *wdev = dev->ieee80211_ptr;
Sergey Matyukevichbfb7bac2020-02-03 10:56:50 +000010 struct device *pdev = wiphy_dev(wdev->wiphy);
John W. Linville4890e3b2009-09-30 14:50:17 -040011
Sergey Matyukevichbfb7bac2020-02-03 10:56:50 +000012 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. Linville4890e3b2009-09-30 14:50:17 -040017
18 strlcpy(info->version, init_utsname()->release, sizeof(info->version));
19
Kalle Valodfce95f2009-09-24 11:02:42 -070020 if (wdev->wiphy->fw_version[0])
Jiri Pirko7826d432013-01-06 00:44:26 +000021 strlcpy(info->fw_version, wdev->wiphy->fw_version,
Kalle Valodfce95f2009-09-24 11:02:42 -070022 sizeof(info->fw_version));
23 else
Jiri Pirko7826d432013-01-06 00:44:26 +000024 strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
John W. Linville4890e3b2009-09-30 14:50:17 -040025
26 strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
27 sizeof(info->bus_info));
28}
Johannes Bergb7ffbd72014-06-04 17:31:56 +020029EXPORT_SYMBOL(cfg80211_get_drvinfo);