162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci#include <linux/utsname.h>
362306a36Sopenharmony_ci#include <net/cfg80211.h>
462306a36Sopenharmony_ci#include "core.h"
562306a36Sopenharmony_ci#include "rdev-ops.h"
662306a36Sopenharmony_ci
762306a36Sopenharmony_civoid cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
862306a36Sopenharmony_ci{
962306a36Sopenharmony_ci	struct wireless_dev *wdev = dev->ieee80211_ptr;
1062306a36Sopenharmony_ci	struct device *pdev = wiphy_dev(wdev->wiphy);
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci	if (pdev->driver)
1362306a36Sopenharmony_ci		strscpy(info->driver, pdev->driver->name,
1462306a36Sopenharmony_ci			sizeof(info->driver));
1562306a36Sopenharmony_ci	else
1662306a36Sopenharmony_ci		strscpy(info->driver, "N/A", sizeof(info->driver));
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci	strscpy(info->version, init_utsname()->release, sizeof(info->version));
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci	if (wdev->wiphy->fw_version[0])
2162306a36Sopenharmony_ci		strscpy(info->fw_version, wdev->wiphy->fw_version,
2262306a36Sopenharmony_ci			sizeof(info->fw_version));
2362306a36Sopenharmony_ci	else
2462306a36Sopenharmony_ci		strscpy(info->fw_version, "N/A", sizeof(info->fw_version));
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci	strscpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
2762306a36Sopenharmony_ci		sizeof(info->bus_info));
2862306a36Sopenharmony_ci}
2962306a36Sopenharmony_ciEXPORT_SYMBOL(cfg80211_get_drvinfo);
30