From 727ae3032519e56a3b35e44baa96125ee240dd70 Mon Sep 17 00:00:00 2001 From: Alexander Beregalov Date: Sun, 10 May 2009 03:06:54 +0400 Subject: [PATCH] Staging: rtl8187se: convert to net_device_ops Signed-off-by: Alexander Beregalov Acked-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/Kconfig | 2 +- .../rtl8187se/ieee80211/ieee80211_module.c | 1 - drivers/staging/rtl8187se/r8180_core.c | 25 +++++++++++-------- drivers/staging/rtl8187se/r8180_pm.c | 6 +++-- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8187se/Kconfig b/drivers/staging/rtl8187se/Kconfig index f636296b54bc..236e42725447 100644 --- a/drivers/staging/rtl8187se/Kconfig +++ b/drivers/staging/rtl8187se/Kconfig @@ -1,6 +1,6 @@ config RTL8187SE tristate "RealTek RTL8187SE Wireless LAN NIC driver" depends on PCI - depends on WIRELESS_EXT && COMPAT_NET_DEV_OPS + depends on WIRELESS_EXT default N ---help--- diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c index 0c9fef0b4e3f..c2b61e648e4e 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c @@ -114,7 +114,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) goto failed; } ieee = netdev_priv(dev); - dev->hard_start_xmit = ieee80211_xmit; ieee->dev = dev; diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index e10413cee0df..7e2fecae813c 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -198,7 +198,8 @@ static void __devexit rtl8180_pci_remove(struct pci_dev *pdev); static void rtl8180_shutdown (struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); - dev->stop(dev); + if (dev->netdev_ops->ndo_stop) + dev->netdev_ops->ndo_stop(dev); pci_disable_device(pdev); } @@ -4551,8 +4552,6 @@ short rtl8180_init(struct net_device *dev) //DMESG("Reported EEPROM chip is a 93c46 (1Kbit)"); } - dev->get_stats = rtl8180_stats; - dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff; dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8; dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff; @@ -5832,6 +5831,18 @@ int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -----------------------------PCI STUFF--------------------------- *****************************************************************************/ +static const struct net_device_ops rtl8180_netdev_ops = { + .ndo_open = rtl8180_open, + .ndo_stop = rtl8180_close, + .ndo_get_stats = rtl8180_stats, + .ndo_tx_timeout = rtl8180_restart, + .ndo_do_ioctl = rtl8180_ioctl, + .ndo_set_multicast_list = r8180_set_multicast, + .ndo_set_mac_address = r8180_set_mac_adr, + .ndo_validate_addr = eth_validate_addr, + .ndo_change_mtu = eth_change_mtu, + .ndo_start_xmit = ieee80211_xmit, +}; static int __devinit rtl8180_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) @@ -5936,14 +5947,8 @@ static int __devinit rtl8180_pci_probe(struct pci_dev *pdev, dev->irq = pdev->irq; priv->irq = 0; - dev->open = rtl8180_open; - dev->stop = rtl8180_close; - //dev->hard_start_xmit = ieee80211_xmit; - dev->tx_timeout = rtl8180_restart; + dev->netdev_ops = &rtl8180_netdev_ops; dev->wireless_handlers = &r8180_wx_handlers_def; - dev->do_ioctl = rtl8180_ioctl; - dev->set_multicast_list = r8180_set_multicast; - dev->set_mac_address = r8180_set_mac_adr; #if WIRELESS_EXT >= 12 #if WIRELESS_EXT < 17 diff --git a/drivers/staging/rtl8187se/r8180_pm.c b/drivers/staging/rtl8187se/r8180_pm.c index 3851b9368356..2b3d642db77f 100644 --- a/drivers/staging/rtl8187se/r8180_pm.c +++ b/drivers/staging/rtl8187se/r8180_pm.c @@ -30,7 +30,8 @@ int rtl8180_suspend (struct pci_dev *pdev, pm_message_t state) if (!netif_running(dev)) goto out_pci_suspend; - dev->stop(dev); + if (dev->netdev_ops->ndo_stop) + dev->netdev_ops->ndo_stop(dev); netif_device_detach(dev); @@ -71,7 +72,8 @@ int rtl8180_resume (struct pci_dev *pdev) if(!netif_running(dev)) goto out; - dev->open(dev); + if (dev->netdev_ops->ndo_open) + dev->netdev_ops->ndo_open(dev); netif_device_attach(dev); out: return 0;