forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/net/ethernet/realtek/8139too.c
....@@ -258,6 +258,7 @@
258258 {0x126c, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
259259 {0x1743, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
260260 {0x021b, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
261
+ {0x16ec, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
261262
262263 #ifdef CONFIG_SH_SECUREEDGE5410
263264 /* Bogus 8139 silicon reports 8129 without external PROM :-( */
....@@ -641,7 +642,7 @@
641642 static void mdio_write (struct net_device *dev, int phy_id, int location,
642643 int val);
643644 static void rtl8139_start_thread(struct rtl8139_private *tp);
644
-static void rtl8139_tx_timeout (struct net_device *dev);
645
+static void rtl8139_tx_timeout (struct net_device *dev, unsigned int txqueue);
645646 static void rtl8139_init_ring (struct net_device *dev);
646647 static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
647648 struct net_device *dev);
....@@ -977,7 +978,7 @@
977978 pdev->subsystem_vendor == PCI_VENDOR_ID_ATHEROS &&
978979 pdev->subsystem_device == PCI_DEVICE_ID_REALTEK_8139) {
979980 pr_info("OQO Model 2 detected. Forcing PIO\n");
980
- use_io = 1;
981
+ use_io = true;
981982 }
982983
983984 dev = rtl8139_init_board (pdev);
....@@ -1661,7 +1662,7 @@
16611662
16621663 napi_disable(&tp->napi);
16631664 netif_stop_queue(dev);
1664
- synchronize_sched();
1665
+ synchronize_rcu();
16651666
16661667 netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",
16671668 RTL_R8(ChipCmd), RTL_R16(IntrStatus),
....@@ -1699,7 +1700,7 @@
16991700 spin_unlock_bh(&tp->rx_lock);
17001701 }
17011702
1702
-static void rtl8139_tx_timeout (struct net_device *dev)
1703
+static void rtl8139_tx_timeout(struct net_device *dev, unsigned int txqueue)
17031704 {
17041705 struct rtl8139_private *tp = netdev_priv(dev);
17051706
....@@ -2602,16 +2603,12 @@
26022603 spin_unlock_irqrestore (&tp->lock, flags);
26032604 }
26042605
2605
-#ifdef CONFIG_PM
2606
-
2607
-static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
2606
+static int __maybe_unused rtl8139_suspend(struct device *device)
26082607 {
2609
- struct net_device *dev = pci_get_drvdata (pdev);
2608
+ struct net_device *dev = dev_get_drvdata(device);
26102609 struct rtl8139_private *tp = netdev_priv(dev);
26112610 void __iomem *ioaddr = tp->mmio_addr;
26122611 unsigned long flags;
2613
-
2614
- pci_save_state (pdev);
26152612
26162613 if (!netif_running (dev))
26172614 return 0;
....@@ -2630,38 +2627,30 @@
26302627
26312628 spin_unlock_irqrestore (&tp->lock, flags);
26322629
2633
- pci_set_power_state (pdev, PCI_D3hot);
2634
-
26352630 return 0;
26362631 }
26372632
2638
-
2639
-static int rtl8139_resume (struct pci_dev *pdev)
2633
+static int __maybe_unused rtl8139_resume(struct device *device)
26402634 {
2641
- struct net_device *dev = pci_get_drvdata (pdev);
2635
+ struct net_device *dev = dev_get_drvdata(device);
26422636
2643
- pci_restore_state (pdev);
26442637 if (!netif_running (dev))
26452638 return 0;
2646
- pci_set_power_state (pdev, PCI_D0);
2639
+
26472640 rtl8139_init_ring (dev);
26482641 rtl8139_hw_start (dev);
26492642 netif_device_attach (dev);
26502643 return 0;
26512644 }
26522645
2653
-#endif /* CONFIG_PM */
2654
-
2646
+static SIMPLE_DEV_PM_OPS(rtl8139_pm_ops, rtl8139_suspend, rtl8139_resume);
26552647
26562648 static struct pci_driver rtl8139_pci_driver = {
26572649 .name = DRV_NAME,
26582650 .id_table = rtl8139_pci_tbl,
26592651 .probe = rtl8139_init_one,
26602652 .remove = rtl8139_remove_one,
2661
-#ifdef CONFIG_PM
2662
- .suspend = rtl8139_suspend,
2663
- .resume = rtl8139_resume,
2664
-#endif /* CONFIG_PM */
2653
+ .driver.pm = &rtl8139_pm_ops,
26652654 };
26662655
26672656