forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/net/ethernet/realtek/8139cp.c
....@@ -691,7 +691,7 @@
691691 }
692692 bytes_compl += skb->len;
693693 pkts_compl++;
694
- dev_kfree_skb_irq(skb);
694
+ dev_consume_skb_irq(skb);
695695 }
696696
697697 cp->tx_skb[tx_tail] = NULL;
....@@ -1235,11 +1235,11 @@
12351235 return 0;
12361236 }
12371237
1238
-static void cp_tx_timeout(struct net_device *dev)
1238
+static void cp_tx_timeout(struct net_device *dev, unsigned int txqueue)
12391239 {
12401240 struct cp_private *cp = netdev_priv(dev);
12411241 unsigned long flags;
1242
- int rc, i;
1242
+ int i;
12431243
12441244 netdev_warn(dev, "Transmit timeout, status %2x %4x %4x %4x\n",
12451245 cpr8(Cmd), cpr16(CpCmd),
....@@ -1260,7 +1260,7 @@
12601260
12611261 cp_stop_hw(cp);
12621262 cp_clean_rings(cp);
1263
- rc = cp_init_rings(cp);
1263
+ cp_init_rings(cp);
12641264 cp_start_hw(cp);
12651265 __cp_set_rx_mode(dev);
12661266 cpw16_f(IntrMask, cp_norx_intr_mask);
....@@ -2054,10 +2054,9 @@
20542054 free_netdev(dev);
20552055 }
20562056
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)
20592058 {
2060
- struct net_device *dev = pci_get_drvdata(pdev);
2059
+ struct net_device *dev = dev_get_drvdata(device);
20612060 struct cp_private *cp = netdev_priv(dev);
20622061 unsigned long flags;
20632062
....@@ -2075,16 +2074,14 @@
20752074
20762075 spin_unlock_irqrestore (&cp->lock, flags);
20772076
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);
20812078
20822079 return 0;
20832080 }
20842081
2085
-static int cp_resume (struct pci_dev *pdev)
2082
+static int __maybe_unused cp_resume(struct device *device)
20862083 {
2087
- struct net_device *dev = pci_get_drvdata (pdev);
2084
+ struct net_device *dev = dev_get_drvdata(device);
20882085 struct cp_private *cp = netdev_priv(dev);
20892086 unsigned long flags;
20902087
....@@ -2092,10 +2089,6 @@
20922089 return 0;
20932090
20942091 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);
20992092
21002093 /* FIXME: sh*t may happen if the Rx ring buffer is depleted */
21012094 cp_init_rings_index (cp);
....@@ -2111,7 +2104,6 @@
21112104
21122105 return 0;
21132106 }
2114
-#endif /* CONFIG_PM */
21152107
21162108 static const struct pci_device_id cp_pci_tbl[] = {
21172109 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139), },
....@@ -2120,15 +2112,14 @@
21202112 };
21212113 MODULE_DEVICE_TABLE(pci, cp_pci_tbl);
21222114
2115
+static SIMPLE_DEV_PM_OPS(cp_pm_ops, cp_suspend, cp_resume);
2116
+
21232117 static struct pci_driver cp_driver = {
21242118 .name = DRV_NAME,
21252119 .id_table = cp_pci_tbl,
21262120 .probe = cp_init_one,
21272121 .remove = cp_remove_one,
2128
-#ifdef CONFIG_PM
2129
- .resume = cp_resume,
2130
- .suspend = cp_suspend,
2131
-#endif
2122
+ .driver.pm = &cp_pm_ops,
21322123 };
21332124
21342125 module_pci_driver(cp_driver);