ethtool.c 843 B

1234567891011121314151617181920212223242526272829
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <linux/utsname.h>
  3. #include <net/cfg80211.h>
  4. #include "core.h"
  5. #include "rdev-ops.h"
  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. if (pdev->driver)
  11. strlcpy(info->driver, pdev->driver->name,
  12. sizeof(info->driver));
  13. else
  14. strlcpy(info->driver, "N/A", sizeof(info->driver));
  15. strlcpy(info->version, init_utsname()->release, sizeof(info->version));
  16. if (wdev->wiphy->fw_version[0])
  17. strlcpy(info->fw_version, wdev->wiphy->fw_version,
  18. sizeof(info->fw_version));
  19. else
  20. strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
  21. strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
  22. sizeof(info->bus_info));
  23. }
  24. EXPORT_SYMBOL(cfg80211_get_drvinfo);