| .. | .. |
|---|
| 691 | 691 | } |
|---|
| 692 | 692 | bytes_compl += skb->len; |
|---|
| 693 | 693 | pkts_compl++; |
|---|
| 694 | | - dev_kfree_skb_irq(skb); |
|---|
| 694 | + dev_consume_skb_irq(skb); |
|---|
| 695 | 695 | } |
|---|
| 696 | 696 | |
|---|
| 697 | 697 | cp->tx_skb[tx_tail] = NULL; |
|---|
| .. | .. |
|---|
| 1235 | 1235 | return 0; |
|---|
| 1236 | 1236 | } |
|---|
| 1237 | 1237 | |
|---|
| 1238 | | -static void cp_tx_timeout(struct net_device *dev) |
|---|
| 1238 | +static void cp_tx_timeout(struct net_device *dev, unsigned int txqueue) |
|---|
| 1239 | 1239 | { |
|---|
| 1240 | 1240 | struct cp_private *cp = netdev_priv(dev); |
|---|
| 1241 | 1241 | unsigned long flags; |
|---|
| 1242 | | - int rc, i; |
|---|
| 1242 | + int i; |
|---|
| 1243 | 1243 | |
|---|
| 1244 | 1244 | netdev_warn(dev, "Transmit timeout, status %2x %4x %4x %4x\n", |
|---|
| 1245 | 1245 | cpr8(Cmd), cpr16(CpCmd), |
|---|
| .. | .. |
|---|
| 1260 | 1260 | |
|---|
| 1261 | 1261 | cp_stop_hw(cp); |
|---|
| 1262 | 1262 | cp_clean_rings(cp); |
|---|
| 1263 | | - rc = cp_init_rings(cp); |
|---|
| 1263 | + cp_init_rings(cp); |
|---|
| 1264 | 1264 | cp_start_hw(cp); |
|---|
| 1265 | 1265 | __cp_set_rx_mode(dev); |
|---|
| 1266 | 1266 | cpw16_f(IntrMask, cp_norx_intr_mask); |
|---|
| .. | .. |
|---|
| 2054 | 2054 | free_netdev(dev); |
|---|
| 2055 | 2055 | } |
|---|
| 2056 | 2056 | |
|---|
| 2057 | | -#ifdef CONFIG_PM |
|---|
| 2058 | | -static int cp_suspend (struct pci_dev *pdev, pm_message_t state) |
|---|
| 2057 | +static int __maybe_unused cp_suspend(struct device *device) |
|---|
| 2059 | 2058 | { |
|---|
| 2060 | | - struct net_device *dev = pci_get_drvdata(pdev); |
|---|
| 2059 | + struct net_device *dev = dev_get_drvdata(device); |
|---|
| 2061 | 2060 | struct cp_private *cp = netdev_priv(dev); |
|---|
| 2062 | 2061 | unsigned long flags; |
|---|
| 2063 | 2062 | |
|---|
| .. | .. |
|---|
| 2075 | 2074 | |
|---|
| 2076 | 2075 | spin_unlock_irqrestore (&cp->lock, flags); |
|---|
| 2077 | 2076 | |
|---|
| 2078 | | - pci_save_state(pdev); |
|---|
| 2079 | | - pci_enable_wake(pdev, pci_choose_state(pdev, state), cp->wol_enabled); |
|---|
| 2080 | | - pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
|---|
| 2077 | + device_set_wakeup_enable(device, cp->wol_enabled); |
|---|
| 2081 | 2078 | |
|---|
| 2082 | 2079 | return 0; |
|---|
| 2083 | 2080 | } |
|---|
| 2084 | 2081 | |
|---|
| 2085 | | -static int cp_resume (struct pci_dev *pdev) |
|---|
| 2082 | +static int __maybe_unused cp_resume(struct device *device) |
|---|
| 2086 | 2083 | { |
|---|
| 2087 | | - struct net_device *dev = pci_get_drvdata (pdev); |
|---|
| 2084 | + struct net_device *dev = dev_get_drvdata(device); |
|---|
| 2088 | 2085 | struct cp_private *cp = netdev_priv(dev); |
|---|
| 2089 | 2086 | unsigned long flags; |
|---|
| 2090 | 2087 | |
|---|
| .. | .. |
|---|
| 2092 | 2089 | return 0; |
|---|
| 2093 | 2090 | |
|---|
| 2094 | 2091 | netif_device_attach (dev); |
|---|
| 2095 | | - |
|---|
| 2096 | | - pci_set_power_state(pdev, PCI_D0); |
|---|
| 2097 | | - pci_restore_state(pdev); |
|---|
| 2098 | | - pci_enable_wake(pdev, PCI_D0, 0); |
|---|
| 2099 | 2092 | |
|---|
| 2100 | 2093 | /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ |
|---|
| 2101 | 2094 | cp_init_rings_index (cp); |
|---|
| .. | .. |
|---|
| 2111 | 2104 | |
|---|
| 2112 | 2105 | return 0; |
|---|
| 2113 | 2106 | } |
|---|
| 2114 | | -#endif /* CONFIG_PM */ |
|---|
| 2115 | 2107 | |
|---|
| 2116 | 2108 | static const struct pci_device_id cp_pci_tbl[] = { |
|---|
| 2117 | 2109 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139), }, |
|---|
| .. | .. |
|---|
| 2120 | 2112 | }; |
|---|
| 2121 | 2113 | MODULE_DEVICE_TABLE(pci, cp_pci_tbl); |
|---|
| 2122 | 2114 | |
|---|
| 2115 | +static SIMPLE_DEV_PM_OPS(cp_pm_ops, cp_suspend, cp_resume); |
|---|
| 2116 | + |
|---|
| 2123 | 2117 | static struct pci_driver cp_driver = { |
|---|
| 2124 | 2118 | .name = DRV_NAME, |
|---|
| 2125 | 2119 | .id_table = cp_pci_tbl, |
|---|
| 2126 | 2120 | .probe = cp_init_one, |
|---|
| 2127 | 2121 | .remove = cp_remove_one, |
|---|
| 2128 | | -#ifdef CONFIG_PM |
|---|
| 2129 | | - .resume = cp_resume, |
|---|
| 2130 | | - .suspend = cp_suspend, |
|---|
| 2131 | | -#endif |
|---|
| 2122 | + .driver.pm = &cp_pm_ops, |
|---|
| 2132 | 2123 | }; |
|---|
| 2133 | 2124 | |
|---|
| 2134 | 2125 | module_pci_driver(cp_driver); |
|---|