hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/net/ethernet/8390/lib8390.c
....@@ -50,6 +50,7 @@
5050
5151 */
5252
53
+#include <linux/build_bug.h>
5354 #include <linux/module.h>
5455 #include <linux/kernel.h>
5556 #include <linux/jiffies.h>
....@@ -112,8 +113,10 @@
112113 static void __NS8390_init(struct net_device *dev, int startp);
113114
114115 static unsigned version_printed;
115
-static u32 msg_enable;
116
-module_param(msg_enable, uint, 0444);
116
+static int msg_enable;
117
+static const int default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_RX_ERR |
118
+ NETIF_MSG_TX_ERR);
119
+module_param(msg_enable, int, 0444);
117120 MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
118121
119122 /*
....@@ -251,7 +254,7 @@
251254 * completed (or failed) - i.e. never posted a Tx related interrupt.
252255 */
253256
254
-static void __ei_tx_timeout(struct net_device *dev)
257
+static void __ei_tx_timeout(struct net_device *dev, unsigned int txqueue)
255258 {
256259 unsigned long e8390_base = dev->base_addr;
257260 struct ei_device *ei_local = netdev_priv(dev);
....@@ -597,10 +600,12 @@
597600 ei_local->txing = 1;
598601 NS8390_trigger_send(dev, ei_local->tx2, ei_local->tx_start_page + 6);
599602 netif_trans_update(dev);
600
- ei_local->tx2 = -1,
603
+ ei_local->tx2 = -1;
601604 ei_local->lasttx = 2;
602
- } else
603
- ei_local->lasttx = 20, ei_local->txing = 0;
605
+ } else {
606
+ ei_local->lasttx = 20;
607
+ ei_local->txing = 0;
608
+ }
604609 } else if (ei_local->tx2 < 0) {
605610 if (ei_local->lasttx != 2 && ei_local->lasttx != -2)
606611 pr_err("%s: bogus last_tx_buffer %d, tx2=%d\n",
....@@ -612,8 +617,10 @@
612617 netif_trans_update(dev);
613618 ei_local->tx1 = -1;
614619 ei_local->lasttx = 1;
615
- } else
616
- ei_local->lasttx = 10, ei_local->txing = 0;
620
+ } else {
621
+ ei_local->lasttx = 10;
622
+ ei_local->txing = 0;
623
+ }
617624 } /* else
618625 netdev_warn(dev, "unexpected TX-done interrupt, lasttx=%d\n",
619626 ei_local->lasttx);
....@@ -969,14 +976,14 @@
969976 {
970977 struct ei_device *ei_local = netdev_priv(dev);
971978
972
- if ((msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0))
973
- pr_info("%s", version);
974
-
975979 ether_setup(dev);
976980
977981 spin_lock_init(&ei_local->page_lock);
978982
979
- ei_local->msg_enable = msg_enable;
983
+ ei_local->msg_enable = netif_msg_init(msg_enable, default_msg_level);
984
+
985
+ if (netif_msg_drv(ei_local) && (version_printed++ == 0))
986
+ pr_info("%s", version);
980987 }
981988
982989 /**
....@@ -1014,8 +1021,7 @@
10141021 ? (0x48 | ENDCFG_WTS | (ei_local->bigendian ? ENDCFG_BOS : 0))
10151022 : 0x48;
10161023
1017
- if (sizeof(struct e8390_pkt_hdr) != 4)
1018
- panic("8390.c: header struct mispacked\n");
1024
+ BUILD_BUG_ON(sizeof(struct e8390_pkt_hdr) != 4);
10191025 /* Follow National Semi's recommendations for initing the DP83902. */
10201026 ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD); /* 0x21 */
10211027 ei_outb_p(endcfg, e8390_base + EN0_DCFG); /* 0x48 or 0x49 */