18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci#include <linux/utsname.h>
38c2ecf20Sopenharmony_ci#include <net/cfg80211.h>
48c2ecf20Sopenharmony_ci#include "core.h"
58c2ecf20Sopenharmony_ci#include "rdev-ops.h"
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_civoid cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
88c2ecf20Sopenharmony_ci{
98c2ecf20Sopenharmony_ci	struct wireless_dev *wdev = dev->ieee80211_ptr;
108c2ecf20Sopenharmony_ci	struct device *pdev = wiphy_dev(wdev->wiphy);
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci	if (pdev->driver)
138c2ecf20Sopenharmony_ci		strlcpy(info->driver, pdev->driver->name,
148c2ecf20Sopenharmony_ci			sizeof(info->driver));
158c2ecf20Sopenharmony_ci	else
168c2ecf20Sopenharmony_ci		strlcpy(info->driver, "N/A", sizeof(info->driver));
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	strlcpy(info->version, init_utsname()->release, sizeof(info->version));
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	if (wdev->wiphy->fw_version[0])
218c2ecf20Sopenharmony_ci		strlcpy(info->fw_version, wdev->wiphy->fw_version,
228c2ecf20Sopenharmony_ci			sizeof(info->fw_version));
238c2ecf20Sopenharmony_ci	else
248c2ecf20Sopenharmony_ci		strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
278c2ecf20Sopenharmony_ci		sizeof(info->bus_info));
288c2ecf20Sopenharmony_ci}
298c2ecf20Sopenharmony_ciEXPORT_SYMBOL(cfg80211_get_drvinfo);
30