forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/net/ethernet/sun/sunbmac.c
....@@ -5,6 +5,7 @@
55 */
66
77 #include <linux/module.h>
8
+#include <linux/pgtable.h>
89
910 #include <linux/kernel.h>
1011 #include <linux/types.h>
....@@ -34,7 +35,6 @@
3435 #include <asm/io.h>
3536 #include <asm/openprom.h>
3637 #include <asm/oplib.h>
37
-#include <asm/pgtable.h>
3838
3939 #include "sunbmac.h"
4040
....@@ -209,13 +209,13 @@
209209 }
210210 }
211211
212
-static void bigmac_init_rings(struct bigmac *bp, int from_irq)
212
+static void bigmac_init_rings(struct bigmac *bp, bool non_blocking)
213213 {
214214 struct bmac_init_block *bb = bp->bmac_block;
215215 int i;
216216 gfp_t gfp_flags = GFP_KERNEL;
217217
218
- if (from_irq || in_interrupt())
218
+ if (non_blocking)
219219 gfp_flags = GFP_ATOMIC;
220220
221221 bp->rx_new = bp->rx_old = bp->tx_new = bp->tx_old = 0;
....@@ -489,7 +489,7 @@
489489 }
490490 }
491491
492
-static int bigmac_init_hw(struct bigmac *, int);
492
+static int bigmac_init_hw(struct bigmac *, bool);
493493
494494 static int try_next_permutation(struct bigmac *bp, void __iomem *tregs)
495495 {
....@@ -549,7 +549,7 @@
549549 if (ret == -1) {
550550 printk(KERN_ERR "%s: Link down, cable problem?\n",
551551 bp->dev->name);
552
- ret = bigmac_init_hw(bp, 0);
552
+ ret = bigmac_init_hw(bp, true);
553553 if (ret) {
554554 printk(KERN_ERR "%s: Error, cannot re-init the "
555555 "BigMAC.\n", bp->dev->name);
....@@ -617,7 +617,7 @@
617617 add_timer(&bp->bigmac_timer);
618618 }
619619
620
-static int bigmac_init_hw(struct bigmac *bp, int from_irq)
620
+static int bigmac_init_hw(struct bigmac *bp, bool non_blocking)
621621 {
622622 void __iomem *gregs = bp->gregs;
623623 void __iomem *cregs = bp->creg;
....@@ -635,7 +635,7 @@
635635 qec_init(bp);
636636
637637 /* Alloc and reset the tx/rx descriptor chains. */
638
- bigmac_init_rings(bp, from_irq);
638
+ bigmac_init_rings(bp, non_blocking);
639639
640640 /* Initialize the PHY. */
641641 bigmac_tcvr_init(bp);
....@@ -749,7 +749,7 @@
749749 }
750750
751751 printk(" RESET\n");
752
- bigmac_init_hw(bp, 1);
752
+ bigmac_init_hw(bp, true);
753753 }
754754
755755 /* BigMAC transmit complete service routines. */
....@@ -781,7 +781,7 @@
781781
782782 DTX(("skb(%p) ", skb));
783783 bp->tx_skbs[elem] = NULL;
784
- dev_kfree_skb_irq(skb);
784
+ dev_consume_skb_irq(skb);
785785
786786 elem = NEXT_TX(elem);
787787 }
....@@ -921,7 +921,7 @@
921921 return ret;
922922 }
923923 timer_setup(&bp->bigmac_timer, bigmac_timer, 0);
924
- ret = bigmac_init_hw(bp, 0);
924
+ ret = bigmac_init_hw(bp, false);
925925 if (ret)
926926 free_irq(dev->irq, bp);
927927 return ret;
....@@ -941,11 +941,11 @@
941941 return 0;
942942 }
943943
944
-static void bigmac_tx_timeout(struct net_device *dev)
944
+static void bigmac_tx_timeout(struct net_device *dev, unsigned int txqueue)
945945 {
946946 struct bigmac *bp = netdev_priv(dev);
947947
948
- bigmac_init_hw(bp, 0);
948
+ bigmac_init_hw(bp, true);
949949 netif_wake_queue(dev);
950950 }
951951