lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221005120501.3527435-2-clabbe@baylibre.com>
Date:   Wed,  5 Oct 2022 12:04:59 +0000
From:   Corentin Labbe <clabbe@...libre.com>
To:     davem@...emloft.net, edumazet@...gle.com, khalasa@...p.pl,
        kuba@...nel.org, pabeni@...hat.com
Cc:     linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
        Corentin Labbe <clabbe@...libre.com>
Subject: [PATCH 2/4] net: ethernet: xscale: fix printk issues

Fix all checkpatch issues about printk and co.
Some pr_xx are replaced by netdev_xxx when appropriate.
Furthermore, there are lot of typo on netdev_debug instead of
netdev_dbg; since this is ifdef-ed debug code, no need for a fixes tag.

Signed-off-by: Corentin Labbe <clabbe@...libre.com>
---
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 95 ++++++++++++------------
 1 file changed, 46 insertions(+), 49 deletions(-)

diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 71d36ff7cd1b..b4539dd2cfe4 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -462,7 +462,7 @@ static int ixp4xx_mdio_cmd(struct mii_bus *bus, int phy_id, int location,
 	int cycles = 0;
 
 	if (__raw_readl(&mdio_regs->mdio_command[3]) & 0x80) {
-		printk(KERN_ERR "%s: MII not ready to transmit\n", bus->name);
+		pr_err("%s: MII not ready to transmit\n", bus->name);
 		return -1;
 	}
 
@@ -482,14 +482,13 @@ static int ixp4xx_mdio_cmd(struct mii_bus *bus, int phy_id, int location,
 	}
 
 	if (cycles == MAX_MDIO_RETRIES) {
-		printk(KERN_ERR "%s #%i: MII write failed\n", bus->name,
-		       phy_id);
+		pr_err("%s #%i: MII write failed\n", bus->name, phy_id);
 		return -1;
 	}
 
 #if DEBUG_MDIO
-	printk(KERN_DEBUG "%s #%i: mdio_%s() took %i cycles\n", bus->name,
-	       phy_id, write ? "write" : "read", cycles);
+	pr_debug("%s #%i: mdio_%s() took %i cycles\n", bus->name,
+		 phy_id, write ? "write" : "read", cycles);
 #endif
 
 	if (write)
@@ -497,8 +496,7 @@ static int ixp4xx_mdio_cmd(struct mii_bus *bus, int phy_id, int location,
 
 	if (__raw_readl(&mdio_regs->mdio_status[3]) & 0x80) {
 #if DEBUG_MDIO
-		printk(KERN_DEBUG "%s #%i: MII read failed\n", bus->name,
-		       phy_id);
+		pr_debug("%s #%i: MII read failed\n", bus->name, phy_id);
 #endif
 		return 0xFFFF; /* don't return error */
 	}
@@ -516,8 +514,8 @@ static int ixp4xx_mdio_read(struct mii_bus *bus, int phy_id, int location)
 	ret = ixp4xx_mdio_cmd(bus, phy_id, location, 0, 0);
 	spin_unlock_irqrestore(&mdio_lock, flags);
 #if DEBUG_MDIO
-	printk(KERN_DEBUG "%s #%i: MII read [%i] -> 0x%X\n", bus->name,
-	       phy_id, location, ret);
+	pr_debug("%s #%i: MII read [%i] -> 0x%X\n", bus->name, phy_id,
+		 location, ret);
 #endif
 	return ret;
 }
@@ -532,8 +530,8 @@ static int ixp4xx_mdio_write(struct mii_bus *bus, int phy_id, int location,
 	ret = ixp4xx_mdio_cmd(bus, phy_id, location, 1, val);
 	spin_unlock_irqrestore(&mdio_lock, flags);
 #if DEBUG_MDIO
-	printk(KERN_DEBUG "%s #%i: MII write [%i] <- 0x%X, err = %i\n",
-	       bus->name, phy_id, location, val, ret);
+	pr_debug("%s #%i: MII write [%i] <- 0x%X, err = %i\n", bus->name,
+		 phy_id, location, val, ret);
 #endif
 	return ret;
 }
@@ -572,7 +570,7 @@ static void ixp4xx_adjust_link(struct net_device *dev)
 	if (!phydev->link) {
 		if (port->speed) {
 			port->speed = 0;
-			printk(KERN_INFO "%s: link down\n", dev->name);
+			netdev_info(dev, "link down\n");
 		}
 		return;
 	}
@@ -590,8 +588,8 @@ static void ixp4xx_adjust_link(struct net_device *dev)
 		__raw_writel(DEFAULT_TX_CNTRL0 | TX_CNTRL0_HALFDUPLEX,
 			     &port->regs->tx_control[0]);
 
-	netdev_info(dev, "%s: link up, speed %u Mb/s, %s duplex\n",
-		    dev->name, port->speed, port->duplex ? "full" : "half");
+	netdev_info(dev, "link up, speed %u Mb/s, %s duplex\n",
+		    port->speed, port->duplex ? "full" : "half");
 }
 
 static inline void debug_pkt(struct net_device *dev, const char *func,
@@ -600,30 +598,30 @@ static inline void debug_pkt(struct net_device *dev, const char *func,
 #if DEBUG_PKT_BYTES
 	int i;
 
-	netdev_debug(dev, "%s(%i) ", func, len);
+	netdev_dbg(dev, "%s(%i) ", func, len);
 	for (i = 0; i < len; i++) {
 		if (i >= DEBUG_PKT_BYTES)
 			break;
-		printk("%s%02X",
-		       ((i == 6) || (i == 12) || (i >= 14)) ? " " : "",
-		       data[i]);
+		netdev_dbg(dev, "%s%02X",
+			   ((i == 6) || (i == 12) || (i >= 14)) ? " " : "",
+			   data[i]);
 	}
-	printk("\n");
+	netdev_dbg(dev, "\n");
 #endif
 }
 
 static inline void debug_desc(u32 phys, struct desc *desc)
 {
 #if DEBUG_DESC
-	printk(KERN_DEBUG "%X: %X %3X %3X %08X %2X < %2X %4X %X"
-	       " %X %X %02X%02X%02X%02X%02X%02X < %02X%02X%02X%02X%02X%02X\n",
-	       phys, desc->next, desc->buf_len, desc->pkt_len,
-	       desc->data, desc->dest_id, desc->src_id, desc->flags,
-	       desc->qos, desc->padlen, desc->vlan_tci,
-	       desc->dst_mac_0, desc->dst_mac_1, desc->dst_mac_2,
-	       desc->dst_mac_3, desc->dst_mac_4, desc->dst_mac_5,
-	       desc->src_mac_0, desc->src_mac_1, desc->src_mac_2,
-	       desc->src_mac_3, desc->src_mac_4, desc->src_mac_5);
+	pr_debug("%X: %X %3X %3X %08X %2X < %2X %4X %X"
+		 " %X %X %02X%02X%02X%02X%02X%02X < %02X%02X%02X%02X%02X%02X\n",
+		 phys, desc->next, desc->buf_len, desc->pkt_len,
+		 desc->data, desc->dest_id, desc->src_id, desc->flags,
+		 desc->qos, desc->padlen, desc->vlan_tci,
+		 desc->dst_mac_0, desc->dst_mac_1, desc->dst_mac_2,
+		 desc->dst_mac_3, desc->dst_mac_4, desc->dst_mac_5,
+		 desc->src_mac_0, desc->src_mac_1, desc->src_mac_2,
+		 desc->src_mac_3, desc->src_mac_4, desc->src_mac_5);
 #endif
 }
 
@@ -674,7 +672,7 @@ static void eth_rx_irq(void *pdev)
 	struct port *port = netdev_priv(dev);
 
 #if DEBUG_RX
-	printk(KERN_DEBUG "%s: eth_rx_irq\n", dev->name);
+	netdev_dbg(dev, "%s\n", __func__);
 #endif
 	qmgr_disable_irq(port->plat->rxq);
 	napi_schedule(&port->napi);
@@ -688,7 +686,7 @@ static int eth_poll(struct napi_struct *napi, int budget)
 	int received = 0;
 
 #if DEBUG_RX
-	netdev_debug(dev, "eth_poll\n");
+	netdev_dbg(dev, "%s\n", __func__);
 #endif
 
 	while (received < budget) {
@@ -702,20 +700,21 @@ static int eth_poll(struct napi_struct *napi, int budget)
 
 		if ((n = queue_get_desc(rxq, port, 0)) < 0) {
 #if DEBUG_RX
-			netdev_debug(dev, "eth_poll napi_complete\n");
+			netdev_dbg(dev, "%s napi_complete\n", __func__);
 #endif
 			napi_complete(napi);
 			qmgr_enable_irq(rxq);
 			if (!qmgr_stat_below_low_watermark(rxq) &&
 			    napi_reschedule(napi)) { /* not empty again */
 #if DEBUG_RX
-				netdev_debug(dev, "eth_poll napi_reschedule succeeded\n");
+				netdev_dbg(dev, "%s napi_reschedule succeeded\n",
+					   __func__);
 #endif
 				qmgr_disable_irq(rxq);
 				continue;
 			}
 #if DEBUG_RX
-			netdev_debug(dev, "eth_poll all done\n");
+			netdev_dbg(dev, "%s all done\n", __func__);
 #endif
 			return received; /* all work done */
 		}
@@ -760,7 +759,7 @@ static int eth_poll(struct napi_struct *napi, int budget)
 		skb_reserve(skb, NET_IP_ALIGN);
 		skb_put(skb, desc->pkt_len);
 
-		debug_pkt(dev, "eth_poll", skb->data, skb->len);
+		debug_pkt(dev, __func__, skb->data, skb->len);
 
 		ixp_rx_timestamp(port, skb);
 		skb->protocol = eth_type_trans(skb, dev);
@@ -780,7 +779,7 @@ static int eth_poll(struct napi_struct *napi, int budget)
 	}
 
 #if DEBUG_RX
-	netdev_debug(dev, "eth_poll(): end, not all work done\n");
+	netdev_dbg(dev, "%s: end, not all work done\n", __func__);
 #endif
 	return received;		/* not all work done */
 }
@@ -790,7 +789,7 @@ static void eth_txdone_irq(void *unused)
 	u32 phys;
 
 #if DEBUG_TX
-	printk(KERN_DEBUG DRV_NAME ": eth_txdone_irq\n");
+	pr_debug(DRV_NAME ": %s\n", __func__);
 #endif
 	while ((phys = qmgr_get_entry(TXDONE_QUEUE)) != 0) {
 		u32 npe_id, n_desc;
@@ -814,8 +813,8 @@ static void eth_txdone_irq(void *unused)
 
 			dma_unmap_tx(port, desc);
 #if DEBUG_TX
-			printk(KERN_DEBUG "%s: eth_txdone_irq free %p\n",
-			       port->netdev->name, port->tx_buff_tab[n_desc]);
+			netdev_dbg(port->netdev, "%s free %p\n", __func__,
+				   port->tx_buff_tab[n_desc]);
 #endif
 			free_buffer_irq(port->tx_buff_tab[n_desc]);
 			port->tx_buff_tab[n_desc] = NULL;
@@ -825,8 +824,7 @@ static void eth_txdone_irq(void *unused)
 		queue_put_desc(port->plat->txreadyq, phys, desc);
 		if (start) { /* TX-ready queue was empty */
 #if DEBUG_TX
-			printk(KERN_DEBUG "%s: eth_txdone_irq xmit ready\n",
-			       port->netdev->name);
+			netdev_dbg(port->netdev, "%s xmit ready\n", __func__);
 #endif
 			netif_wake_queue(port->netdev);
 		}
@@ -843,7 +841,7 @@ static netdev_tx_t eth_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct desc *desc;
 
 #if DEBUG_TX
-	netdev_debug(dev, "eth_xmit\n");
+	netdev_dbg(dev, "%s\n", __func__);
 #endif
 
 	if (unlikely(skb->len > MAX_MRU)) {
@@ -852,7 +850,7 @@ static netdev_tx_t eth_xmit(struct sk_buff *skb, struct net_device *dev)
 		return NETDEV_TX_OK;
 	}
 
-	debug_pkt(dev, "eth_xmit", skb->data, skb->len);
+	debug_pkt(dev, __func__, skb->data, skb->len);
 
 	len = skb->len;
 #ifdef __ARMEB__
@@ -898,21 +896,21 @@ static netdev_tx_t eth_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	if (qmgr_stat_below_low_watermark(txreadyq)) { /* empty */
 #if DEBUG_TX
-		netdev_debug(dev, "eth_xmit queue full\n");
+		netdev_dbg(dev, "%s queue full\n", __func__);
 #endif
 		netif_stop_queue(dev);
 		/* we could miss TX ready interrupt */
 		/* really empty in fact */
 		if (!qmgr_stat_below_low_watermark(txreadyq)) {
 #if DEBUG_TX
-			netdev_debug(dev, "eth_xmit ready again\n");
+			netdev_dbg(dev, "%s ready again\n", __func__);
 #endif
 			netif_wake_queue(dev);
 		}
 	}
 
 #if DEBUG_TX
-	netdev_debug(dev, "eth_xmit end\n");
+	netdev_dbg(dev, "%s end\n", __func__);
 #endif
 
 	ixp_tx_timestamp(port, skb);
@@ -1077,8 +1075,7 @@ static int request_queues(struct port *port)
 	qmgr_release_queue(port->plat->rxq);
 rel_rxfree:
 	qmgr_release_queue(RXFREE_QUEUE(port->id));
-	printk(KERN_DEBUG "%s: unable to request hardware queues\n",
-	       port->netdev->name);
+	netdev_dbg(port->netdev, "unable to request hardware queues\n");
 	return err;
 }
 
@@ -1327,7 +1324,7 @@ static int eth_close(struct net_device *dev)
 			    " left in NPE\n", buffs);
 #if DEBUG_CLOSE
 	if (!buffs)
-		netdev_debug(dev, "draining RX queue took %i cycles\n", i);
+		netdev_dbg(dev, "draining RX queue took %i cycles\n", i);
 #endif
 
 	buffs = TX_DESCS;
@@ -1347,7 +1344,7 @@ static int eth_close(struct net_device *dev)
 			    "left in NPE\n", buffs);
 #if DEBUG_CLOSE
 	if (!buffs)
-		netdev_debug(dev, "draining TX queues took %i cycles\n", i);
+		netdev_dbg(dev, "draining TX queues took %i cycles\n", i);
 #endif
 
 	msg.byte3 = 0;
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ