Merge tag 'wireless-drivers-2021-02-26' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / drivers / staging / rtl8192e / rtl8192e / rtl_ethtool.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
4  *
5  * Based on the r8180 driver, which is:
6  * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al.
7  *
8  * Contact Information: wlanfae <wlanfae@realtek.com>
9  */
10 #include <linux/netdevice.h>
11 #include <linux/ethtool.h>
12 #include <linux/delay.h>
13
14 #include "rtl_core.h"
15
16 static void _rtl92e_ethtool_get_drvinfo(struct net_device *dev,
17                                         struct ethtool_drvinfo *info)
18 {
19         struct r8192_priv *priv = rtllib_priv(dev);
20
21         strscpy(info->driver, DRV_NAME, sizeof(info->driver));
22         strscpy(info->version, DRV_VERSION, sizeof(info->version));
23         strscpy(info->bus_info, pci_name(priv->pdev), sizeof(info->bus_info));
24 }
25
26 static u32 _rtl92e_ethtool_get_link(struct net_device *dev)
27 {
28         struct r8192_priv *priv = rtllib_priv(dev);
29
30         return ((priv->rtllib->state == RTLLIB_LINKED) ||
31                 (priv->rtllib->state == RTLLIB_LINKED_SCANNING));
32 }
33
34 const struct ethtool_ops rtl819x_ethtool_ops = {
35         .get_drvinfo = _rtl92e_ethtool_get_drvinfo,
36         .get_link = _rtl92e_ethtool_get_link,
37 };