All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver
@ 2014-07-10  5:35 varkabhadram
  2014-07-10  5:35 ` [PATCH net v2 1/7] net: cpmac: remove space in macro defination varkabhadram
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: varkabhadram @ 2014-07-10  5:35 UTC (permalink / raw)
  To: netdev; +Cc: mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

From: Varka Bhadram <varkab@cdac.in>

This patch series cleanup for AR7 CPMAC Ethernet controller driver

Varka Bhadram (7):
  net: cpmac: remove space in macro defination
  net: cpmac: fix comments
  net: cpmac: dynamic debug fixes
  net: cpmac: fix cpmac driver structure
  net: cpmac: fix missing a blank line after declarations
  net: cpmac: fic proper spacing before return statement
  net: cpmac: fix in releasing resources

 drivers/net/ethernet/ti/cpmac.c |  287 ++++++++++++++++++++-------------------
 1 file changed, 148 insertions(+), 139 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH net v2 1/7] net: cpmac: remove space in macro defination
  2014-07-10  5:35 [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver varkabhadram
@ 2014-07-10  5:35 ` varkabhadram
  2014-07-10 13:07   ` Felipe Balbi
  2014-07-10  5:35 ` [PATCH net v2 2/7] net: cpmac: fix comments varkabhadram
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: varkabhadram @ 2014-07-10  5:35 UTC (permalink / raw)
  To: netdev; +Cc: mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

From: Varka Bhadram <varkab@cdac.in>

This patch fix the space after '#' in macro defination

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/ti/cpmac.c |   82 +++++++++++++++++++--------------------
 1 file changed, 41 insertions(+), 41 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 7399a52..61eb691 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -67,42 +67,42 @@ MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus");
 #define CPMAC_RX_CONTROL		0x0014
 #define CPMAC_RX_TEARDOWN		0x0018
 #define CPMAC_MBP			0x0100
-# define MBP_RXPASSCRC			0x40000000
-# define MBP_RXQOS			0x20000000
-# define MBP_RXNOCHAIN			0x10000000
-# define MBP_RXCMF			0x01000000
-# define MBP_RXSHORT			0x00800000
-# define MBP_RXCEF			0x00400000
-# define MBP_RXPROMISC			0x00200000
-# define MBP_PROMISCCHAN(channel)	(((channel) & 0x7) << 16)
-# define MBP_RXBCAST			0x00002000
-# define MBP_BCASTCHAN(channel)		(((channel) & 0x7) << 8)
-# define MBP_RXMCAST			0x00000020
-# define MBP_MCASTCHAN(channel)		((channel) & 0x7)
+#define MBP_RXPASSCRC			0x40000000
+#define MBP_RXQOS			0x20000000
+#define MBP_RXNOCHAIN			0x10000000
+#define MBP_RXCMF			0x01000000
+#define MBP_RXSHORT			0x00800000
+#define MBP_RXCEF			0x00400000
+#define MBP_RXPROMISC			0x00200000
+#define MBP_PROMISCCHAN(channel)	(((channel) & 0x7) << 16)
+#define MBP_RXBCAST			0x00002000
+#define MBP_BCASTCHAN(channel)		(((channel) & 0x7) << 8)
+#define MBP_RXMCAST			0x00000020
+#define MBP_MCASTCHAN(channel)		((channel) & 0x7)
 #define CPMAC_UNICAST_ENABLE		0x0104
 #define CPMAC_UNICAST_CLEAR		0x0108
 #define CPMAC_MAX_LENGTH		0x010c
 #define CPMAC_BUFFER_OFFSET		0x0110
 #define CPMAC_MAC_CONTROL		0x0160
-# define MAC_TXPTYPE			0x00000200
-# define MAC_TXPACE			0x00000040
-# define MAC_MII			0x00000020
-# define MAC_TXFLOW			0x00000010
-# define MAC_RXFLOW			0x00000008
-# define MAC_MTEST			0x00000004
-# define MAC_LOOPBACK			0x00000002
-# define MAC_FDX			0x00000001
+#define MAC_TXPTYPE			0x00000200
+#define MAC_TXPACE			0x00000040
+#define MAC_MII				0x00000020
+#define MAC_TXFLOW			0x00000010
+#define MAC_RXFLOW			0x00000008
+#define MAC_MTEST			0x00000004
+#define MAC_LOOPBACK			0x00000002
+#define MAC_FDX				0x00000001
 #define CPMAC_MAC_STATUS		0x0164
-# define MAC_STATUS_QOS			0x00000004
-# define MAC_STATUS_RXFLOW		0x00000002
-# define MAC_STATUS_TXFLOW		0x00000001
+#define MAC_STATUS_QOS			0x00000004
+#define MAC_STATUS_RXFLOW		0x00000002
+#define MAC_STATUS_TXFLOW		0x00000001
 #define CPMAC_TX_INT_ENABLE		0x0178
 #define CPMAC_TX_INT_CLEAR		0x017c
 #define CPMAC_MAC_INT_VECTOR		0x0180
-# define MAC_INT_STATUS			0x00080000
-# define MAC_INT_HOST			0x00040000
-# define MAC_INT_RX			0x00020000
-# define MAC_INT_TX			0x00010000
+#define MAC_INT_STATUS			0x00080000
+#define MAC_INT_HOST			0x00040000
+#define MAC_INT_RX			0x00020000
+#define MAC_INT_TX			0x00010000
 #define CPMAC_MAC_EOI_VECTOR		0x0184
 #define CPMAC_RX_INT_ENABLE		0x0198
 #define CPMAC_RX_INT_CLEAR		0x019c
@@ -157,24 +157,24 @@ MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus");
 /* MDIO bus */
 #define CPMAC_MDIO_VERSION		0x0000
 #define CPMAC_MDIO_CONTROL		0x0004
-# define MDIOC_IDLE			0x80000000
-# define MDIOC_ENABLE			0x40000000
-# define MDIOC_PREAMBLE			0x00100000
-# define MDIOC_FAULT			0x00080000
-# define MDIOC_FAULTDETECT		0x00040000
-# define MDIOC_INTTEST			0x00020000
-# define MDIOC_CLKDIV(div)		((div) & 0xff)
+#define MDIOC_IDLE			0x80000000
+#define MDIOC_ENABLE			0x40000000
+#define MDIOC_PREAMBLE			0x00100000
+#define MDIOC_FAULT			0x00080000
+#define MDIOC_FAULTDETECT		0x00040000
+#define MDIOC_INTTEST			0x00020000
+#define MDIOC_CLKDIV(div)		((div) & 0xff)
 #define CPMAC_MDIO_ALIVE		0x0008
 #define CPMAC_MDIO_LINK			0x000c
 #define CPMAC_MDIO_ACCESS(channel)	(0x0080 + (channel) * 8)
-# define MDIO_BUSY			0x80000000
-# define MDIO_WRITE			0x40000000
-# define MDIO_REG(reg)			(((reg) & 0x1f) << 21)
-# define MDIO_PHY(phy)			(((phy) & 0x1f) << 16)
-# define MDIO_DATA(data)		((data) & 0xffff)
+#define MDIO_BUSY			0x80000000
+#define MDIO_WRITE			0x40000000
+#define MDIO_REG(reg)			(((reg) & 0x1f) << 21)
+#define MDIO_PHY(phy)			(((phy) & 0x1f) << 16)
+#define MDIO_DATA(data)			((data) & 0xffff)
 #define CPMAC_MDIO_PHYSEL(channel)	(0x0084 + (channel) * 8)
-# define PHYSEL_LINKSEL			0x00000040
-# define PHYSEL_LINKINT			0x00000020
+#define PHYSEL_LINKSEL			0x00000040
+#define PHYSEL_LINKINT			0x00000020
 
 struct cpmac_desc {
 	u32 hw_next;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net v2 2/7] net: cpmac: fix comments
  2014-07-10  5:35 [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver varkabhadram
  2014-07-10  5:35 ` [PATCH net v2 1/7] net: cpmac: remove space in macro defination varkabhadram
@ 2014-07-10  5:35 ` varkabhadram
  2014-07-10 13:07   ` Felipe Balbi
  2014-07-10  5:35 ` [PATCH net v2 3/7] net: cpmac: dynamic debug fixes varkabhadram
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: varkabhadram @ 2014-07-10  5:35 UTC (permalink / raw)
  To: netdev; +Cc: mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

From: Varka Bhadram <varkab@cdac.in>

This patch convert the normal comments to networking subsystem
style comments.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/ti/cpmac.c |   40 ++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 61eb691..1d8ef39 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -118,8 +118,8 @@ MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus");
 #define CPMAC_TX_ACK(channel)		(0x0640 + (channel) * 4)
 #define CPMAC_RX_ACK(channel)		(0x0660 + (channel) * 4)
 #define CPMAC_REG_END			0x0680
-/*
- * Rx/Tx statistics
+
+/* Rx/Tx statistics
  * TODO: use some of them to fill stats in cpmac_stats()
  */
 #define CPMAC_STATS_RX_GOOD		0x0200
@@ -331,8 +331,7 @@ static void cpmac_set_multicast_list(struct net_device *dev)
 			cpmac_write(priv->regs, CPMAC_MAC_HASH_LO, 0xffffffff);
 			cpmac_write(priv->regs, CPMAC_MAC_HASH_HI, 0xffffffff);
 		} else {
-			/*
-			 * cpmac uses some strange mac address hashing
+			/* cpmac uses some strange mac address hashing
 			 * (not crc32)
 			 */
 			netdev_for_each_mc_addr(ha, dev) {
@@ -432,10 +431,10 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
 
 		if ((desc->dataflags & CPMAC_EOQ) != 0) {
 			/* The last update to eoq->hw_next didn't happen
-			* soon enough, and the receiver stopped here.
-			*Remember this descriptor so we can restart
-			* the receiver after freeing some space.
-			*/
+			 * soon enough, and the receiver stopped here.
+			 * Remember this descriptor so we can restart
+			 * the receiver after freeing some space.
+			 */
 			if (unlikely(restart)) {
 				if (netif_msg_rx_err(priv))
 					printk(KERN_ERR "%s: poll found a"
@@ -457,25 +456,27 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
 
 	if (desc != priv->rx_head) {
 		/* We freed some buffers, but not the whole ring,
-		 * add what we did free to the rx list */
+		 * add what we did free to the rx list
+		 */
 		desc->prev->hw_next = (u32)0;
 		priv->rx_head->prev->hw_next = priv->rx_head->mapping;
 	}
 
 	/* Optimization: If we did not actually process an EOQ (perhaps because
 	 * of quota limits), check to see if the tail of the queue has EOQ set.
-	* We should immediately restart in that case so that the receiver can
-	* restart and run in parallel with more packet processing.
-	* This lets us handle slightly larger bursts before running
-	* out of ring space (assuming dev->weight < ring_size) */
+	 * We should immediately restart in that case so that the receiver can
+	 * restart and run in parallel with more packet processing.
+	 * This lets us handle slightly larger bursts before running
+	 * out of ring space (assuming dev->weight < ring_size)
+	 */
 
 	if (!restart &&
 	     (priv->rx_head->prev->dataflags & (CPMAC_OWN|CPMAC_EOQ))
 		    == CPMAC_EOQ &&
 	     (priv->rx_head->dataflags & CPMAC_OWN) != 0) {
 		/* reset EOQ so the poll loop (above) doesn't try to
-		* restart this when it eventually gets to this descriptor.
-		*/
+		 * restart this when it eventually gets to this descriptor.
+		 */
 		priv->rx_head->prev->dataflags &= ~CPMAC_EOQ;
 		restart = priv->rx_head;
 	}
@@ -506,7 +507,8 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
 		       priv->dev->name, received);
 	if (processed == 0) {
 		/* we ran out of packets to read,
-		 * revert to interrupt-driven mode */
+		 * revert to interrupt-driven mode
+		 */
 		napi_complete(napi);
 		cpmac_write(priv->regs, CPMAC_RX_INT_ENABLE, 1);
 		return 0;
@@ -516,8 +518,8 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
 
 fatal_error:
 	/* Something went horribly wrong.
-	 * Reset hardware to try to recover rather than wedging. */
-
+	 * Reset hardware to try to recover rather than wedging.
+	 */
 	if (netif_msg_drv(priv)) {
 		printk(KERN_ERR "%s: cpmac_poll is confused. "
 				"Resetting hardware\n", priv->dev->name);
@@ -751,7 +753,7 @@ static void cpmac_check_status(struct net_device *dev)
 	if (rx_code || tx_code) {
 		if (netif_msg_drv(priv) && net_ratelimit()) {
 			/* Can't find any documentation on what these
-			 *error codes actually are. So just log them and hope..
+			 * error codes actually are. So just log them and hope..
 			 */
 			if (rx_code)
 				printk(KERN_WARNING "%s: host error %d on rx "
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net v2 3/7] net: cpmac: dynamic debug fixes
  2014-07-10  5:35 [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver varkabhadram
  2014-07-10  5:35 ` [PATCH net v2 1/7] net: cpmac: remove space in macro defination varkabhadram
  2014-07-10  5:35 ` [PATCH net v2 2/7] net: cpmac: fix comments varkabhadram
@ 2014-07-10  5:35 ` varkabhadram
  2014-07-10  8:31   ` Joe Perches
  2014-07-10 13:08   ` Felipe Balbi
  2014-07-10  5:35 ` [PATCH net v2 4/7] net: cpmac: fix cpmac driver structure varkabhadram
                   ` (4 subsequent siblings)
  7 siblings, 2 replies; 23+ messages in thread
From: varkabhadram @ 2014-07-10  5:35 UTC (permalink / raw)
  To: netdev; +Cc: mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

From: Varka Bhadram <varkab@cdac.in>

This patch does the following changes
1. convert printk(KERN_DEBUG.. to netdev_dbg() if we have net_device object
   or convert to dev_dbg() if we have device object.
2. convert printk(KERN_WARNING.. to netdev_warn() if we have net_device object
   or convert to dev_warn() if we have device object
3. convert printk() to pr_*

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/ti/cpmac.c |  136 ++++++++++++++++++---------------------
 1 file changed, 62 insertions(+), 74 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 1d8ef39..9faf669 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -228,21 +228,20 @@ static void cpmac_dump_regs(struct net_device *dev)
 		if (i % 16 == 0) {
 			if (i)
 				pr_cont("\n");
-			printk(KERN_DEBUG "%s: reg[%p]:", dev->name,
-			       priv->regs + i);
+			netdev_dbg(dev, "reg[%p]:", priv->regs + i);
 		}
-		printk(" %08x", cpmac_read(priv->regs, i));
+		pr_debug(" %08x", cpmac_read(priv->regs, i));
 	}
-	printk("\n");
+	pr_debug("\n");
 }
 
 static void cpmac_dump_desc(struct net_device *dev, struct cpmac_desc *desc)
 {
 	int i;
-	printk(KERN_DEBUG "%s: desc[%p]:", dev->name, desc);
+	netdev_dbg(dev, "desc[%p]:", desc);
 	for (i = 0; i < sizeof(*desc) / 4; i++)
-		printk(" %08x", ((u32 *)desc)[i]);
-	printk("\n");
+		pr_debug(" %08x", ((u32 *)desc)[i]);
+	pr_debug("\n");
 }
 
 static void cpmac_dump_all_desc(struct net_device *dev)
@@ -258,17 +257,16 @@ static void cpmac_dump_all_desc(struct net_device *dev)
 static void cpmac_dump_skb(struct net_device *dev, struct sk_buff *skb)
 {
 	int i;
-	printk(KERN_DEBUG "%s: skb 0x%p, len=%d\n", dev->name, skb, skb->len);
+	netdev_dbg(dev, "skb 0x%p, len=%d\n", skb, skb->len);
 	for (i = 0; i < skb->len; i++) {
 		if (i % 16 == 0) {
 			if (i)
 				pr_cont("\n");
-			printk(KERN_DEBUG "%s: data[%p]:", dev->name,
-			       skb->data + i);
+			netdev_dbg(dev, "data[%p]:", skb->data + i);
 		}
-		printk(" %02x", ((u8 *)skb->data)[i]);
+		pr_debug(" %02x", ((u8 *)skb->data)[i]);
 	}
-	printk("\n");
+	pr_debug("\n");
 }
 
 static int cpmac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
@@ -300,7 +298,7 @@ static int cpmac_mdio_reset(struct mii_bus *bus)
 
 	cpmac_clk = clk_get(&bus->dev, "cpmac");
 	if (IS_ERR(cpmac_clk)) {
-		printk(KERN_ERR "unable to get cpmac clock\n");
+		pr_err("unable to get cpmac clock\n");
 		return -1;
 	}
 	ar7_device_reset(AR7_RESET_BIT_MDIO);
@@ -368,8 +366,8 @@ static struct sk_buff *cpmac_rx_one(struct cpmac_priv *priv,
 	cpmac_write(priv->regs, CPMAC_RX_ACK(0), (u32)desc->mapping);
 	if (unlikely(!desc->datalen)) {
 		if (netif_msg_rx_err(priv) && net_ratelimit())
-			printk(KERN_WARNING "%s: rx: spurious interrupt\n",
-			       priv->dev->name);
+			netdev_warn(priv->dev, "rx: spurious interrupt\n");
+
 		return NULL;
 	}
 
@@ -389,15 +387,14 @@ static struct sk_buff *cpmac_rx_one(struct cpmac_priv *priv,
 						    DMA_FROM_DEVICE);
 		desc->hw_data = (u32)desc->data_mapping;
 		if (unlikely(netif_msg_pktdata(priv))) {
-			printk(KERN_DEBUG "%s: received packet:\n",
-			       priv->dev->name);
+			netdev_dbg(priv->dev, "received packet:\n");
 			cpmac_dump_skb(priv->dev, result);
 		}
 	} else {
 		if (netif_msg_rx_err(priv) && net_ratelimit())
-			printk(KERN_WARNING
-			       "%s: low on skbs, dropping packet\n",
-			       priv->dev->name);
+			netdev_warn(priv->dev,
+				    "low on skbs, dropping packet\n");
+
 		priv->dev->stats.rx_dropped++;
 	}
 
@@ -417,8 +414,8 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
 	spin_lock(&priv->rx_lock);
 	if (unlikely(!priv->rx_head)) {
 		if (netif_msg_rx_err(priv) && net_ratelimit())
-			printk(KERN_WARNING "%s: rx: polling, but no queue\n",
-			       priv->dev->name);
+			netdev_warn(priv->dev, "rx: polling, but no queue\n");
+
 		spin_unlock(&priv->rx_lock);
 		napi_complete(napi);
 		return 0;
@@ -437,9 +434,9 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
 			 */
 			if (unlikely(restart)) {
 				if (netif_msg_rx_err(priv))
-					printk(KERN_ERR "%s: poll found a"
-						" duplicate EOQ: %p and %p\n",
-						priv->dev->name, restart, desc);
+					netdev_err(priv->dev, "poll found a"
+						   " duplicate EOQ: %p and %p\n",
+						   restart, desc);
 				goto fatal_error;
 			}
 
@@ -485,15 +482,13 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
 		priv->dev->stats.rx_errors++;
 		priv->dev->stats.rx_fifo_errors++;
 		if (netif_msg_rx_err(priv) && net_ratelimit())
-			printk(KERN_WARNING "%s: rx dma ring overrun\n",
-			       priv->dev->name);
+			netdev_warn(priv->dev, "rx dma ring overrun\n");
 
 		if (unlikely((restart->dataflags & CPMAC_OWN) == 0)) {
 			if (netif_msg_drv(priv))
-				printk(KERN_ERR "%s: cpmac_poll is trying to "
-					"restart rx from a descriptor that's "
-					"not free: %p\n",
-					priv->dev->name, restart);
+				netdev_err(priv->dev, "cpmac_poll is trying "
+					"to restart rx from a descriptor "
+					"that's not free: %p\n", restart);
 			goto fatal_error;
 		}
 
@@ -503,8 +498,8 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
 	priv->rx_head = desc;
 	spin_unlock(&priv->rx_lock);
 	if (unlikely(netif_msg_rx_status(priv)))
-		printk(KERN_DEBUG "%s: poll processed %d packets\n",
-		       priv->dev->name, received);
+		netdev_dbg(priv->dev, "poll processed %d packets\n", received);
+
 	if (processed == 0) {
 		/* we ran out of packets to read,
 		 * revert to interrupt-driven mode
@@ -521,13 +516,12 @@ fatal_error:
 	 * Reset hardware to try to recover rather than wedging.
 	 */
 	if (netif_msg_drv(priv)) {
-		printk(KERN_ERR "%s: cpmac_poll is confused. "
-				"Resetting hardware\n", priv->dev->name);
+		netdev_err(priv->dev, "cpmac_poll is confused. "
+			   "Resetting hardware\n");
 		cpmac_dump_all_desc(priv->dev);
-		printk(KERN_DEBUG "%s: RX_PTR(0)=0x%08x RX_ACK(0)=0x%08x\n",
-			priv->dev->name,
-			cpmac_read(priv->regs, CPMAC_RX_PTR(0)),
-			cpmac_read(priv->regs, CPMAC_RX_ACK(0)));
+		netdev_dbg(priv->dev, "RX_PTR(0)=0x%08x RX_ACK(0)=0x%08x\n",
+			   cpmac_read(priv->regs, CPMAC_RX_PTR(0)),
+			   cpmac_read(priv->regs, CPMAC_RX_ACK(0)));
 	}
 
 	spin_unlock(&priv->rx_lock);
@@ -562,8 +556,8 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	desc = &priv->desc_ring[queue];
 	if (unlikely(desc->dataflags & CPMAC_OWN)) {
 		if (netif_msg_tx_err(priv) && net_ratelimit())
-			printk(KERN_WARNING "%s: tx dma ring full\n",
-			       dev->name);
+			netdev_warn(dev, "tx dma ring full\n");
+
 		return NETDEV_TX_BUSY;
 	}
 
@@ -577,8 +571,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	desc->datalen = len;
 	desc->buflen = len;
 	if (unlikely(netif_msg_tx_queued(priv)))
-		printk(KERN_DEBUG "%s: sending 0x%p, len=%d\n", dev->name, skb,
-		       skb->len);
+		netdev_dbg(dev, "sending 0x%p, len=%d\n", skb, skb->len);
 	if (unlikely(netif_msg_hw(priv)))
 		cpmac_dump_desc(dev, desc);
 	if (unlikely(netif_msg_pktdata(priv)))
@@ -604,8 +597,8 @@ static void cpmac_end_xmit(struct net_device *dev, int queue)
 				 DMA_TO_DEVICE);
 
 		if (unlikely(netif_msg_tx_done(priv)))
-			printk(KERN_DEBUG "%s: sent 0x%p, len=%d\n", dev->name,
-			       desc->skb, desc->skb->len);
+			netdev_dbg(dev, "sent 0x%p, len=%d\n",
+				   desc->skb, desc->skb->len);
 
 		dev_kfree_skb_irq(desc->skb);
 		desc->skb = NULL;
@@ -613,8 +606,7 @@ static void cpmac_end_xmit(struct net_device *dev, int queue)
 			netif_wake_subqueue(dev, queue);
 	} else {
 		if (netif_msg_tx_err(priv) && net_ratelimit())
-			printk(KERN_WARNING
-			       "%s: end_xmit: spurious interrupt\n", dev->name);
+			netdev_warn(dev, "end_xmit: spurious interrupt\n");
 		if (__netif_subqueue_stopped(dev, queue))
 			netif_wake_subqueue(dev, queue);
 	}
@@ -695,8 +687,7 @@ static void cpmac_clear_rx(struct net_device *dev)
 	for (i = 0; i < priv->ring_size; i++) {
 		if ((desc->dataflags & CPMAC_OWN) == 0) {
 			if (netif_msg_rx_err(priv) && net_ratelimit())
-				printk(KERN_WARNING "%s: packet dropped\n",
-				       dev->name);
+				netdev_warn(dev, "packet dropped\n");
 			if (unlikely(netif_msg_hw(priv)))
 				cpmac_dump_desc(dev, desc);
 			desc->dataflags = CPMAC_OWN;
@@ -756,13 +747,13 @@ static void cpmac_check_status(struct net_device *dev)
 			 * error codes actually are. So just log them and hope..
 			 */
 			if (rx_code)
-				printk(KERN_WARNING "%s: host error %d on rx "
-				     "channel %d (macstatus %08x), resetting\n",
-				     dev->name, rx_code, rx_channel, macstatus);
+				netdev_warn(dev, "host error %d on rx "
+					"channel %d (macstatus %08x), resetting\n",
+					rx_code, rx_channel, macstatus);
 			if (tx_code)
-				printk(KERN_WARNING "%s: host error %d on tx "
-				     "channel %d (macstatus %08x), resetting\n",
-				     dev->name, tx_code, tx_channel, macstatus);
+				netdev_warn(dev, "host error %d on tx "
+					"channel %d (macstatus %08x), resetting\n",
+					tx_code, tx_channel, macstatus);
 		}
 
 		netif_tx_stop_all_queues(dev);
@@ -787,8 +778,7 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id)
 	status = cpmac_read(priv->regs, CPMAC_MAC_INT_VECTOR);
 
 	if (unlikely(netif_msg_intr(priv)))
-		printk(KERN_DEBUG "%s: interrupt status: 0x%08x\n", dev->name,
-		       status);
+		netdev_dbg(dev, "interrupt status: 0x%08x\n", status);
 
 	if (status & MAC_INT_TX)
 		cpmac_end_xmit(dev, (status & 7));
@@ -817,7 +807,7 @@ static void cpmac_tx_timeout(struct net_device *dev)
 	dev->stats.tx_errors++;
 	spin_unlock(&priv->lock);
 	if (netif_msg_tx_err(priv) && net_ratelimit())
-		printk(KERN_WARNING "%s: transmit timeout\n", dev->name);
+		netdev_warn(dev, "transmit timeout\n");
 
 	atomic_inc(&priv->reset_pending);
 	barrier();
@@ -953,8 +943,8 @@ static int cpmac_open(struct net_device *dev)
 	mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs");
 	if (!request_mem_region(mem->start, resource_size(mem), dev->name)) {
 		if (netif_msg_drv(priv))
-			printk(KERN_ERR "%s: failed to request registers\n",
-			       dev->name);
+			netdev_err(dev, "failed to request registers\n");
+
 		res = -ENXIO;
 		goto fail_reserve;
 	}
@@ -962,8 +952,8 @@ static int cpmac_open(struct net_device *dev)
 	priv->regs = ioremap(mem->start, resource_size(mem));
 	if (!priv->regs) {
 		if (netif_msg_drv(priv))
-			printk(KERN_ERR "%s: failed to remap registers\n",
-			       dev->name);
+			netdev_err(dev, "failed to remap registers\n");
+
 		res = -ENXIO;
 		goto fail_remap;
 	}
@@ -1005,8 +995,8 @@ static int cpmac_open(struct net_device *dev)
 	res = request_irq(dev->irq, cpmac_irq, IRQF_SHARED, dev->name, dev);
 	if (res) {
 		if (netif_msg_drv(priv))
-			printk(KERN_ERR "%s: failed to obtain irq\n",
-			       dev->name);
+			netdev_err(dev, "failed to obtain irq\n");
+
 		goto fail_irq;
 	}
 
@@ -1123,7 +1113,7 @@ static int cpmac_probe(struct platform_device *pdev)
 
 	if (phy_id == PHY_MAX_ADDR) {
 		dev_err(&pdev->dev, "no PHY present, falling back "
-					"to switch on MDIO bus 0\n");
+			"to switch on MDIO bus 0\n");
 		strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */
 		phy_id = pdev->id;
 	}
@@ -1164,24 +1154,22 @@ static int cpmac_probe(struct platform_device *pdev)
 
 	if (IS_ERR(priv->phy)) {
 		if (netif_msg_drv(priv))
-			printk(KERN_ERR "%s: Could not attach to PHY\n",
-			       dev->name);
+			dev_err(&pdev->dev, "Could not attach to PHY\n");
+
 		rc = PTR_ERR(priv->phy);
 		goto fail;
 	}
 
 	rc = register_netdev(dev);
 	if (rc) {
-		printk(KERN_ERR "cpmac: error %i registering device %s\n", rc,
-		       dev->name);
+		dev_err(&pdev->dev, "Could not register net device\n");
 		goto fail;
 	}
 
 	if (netif_msg_probe(priv)) {
-		printk(KERN_INFO
-		       "cpmac: device %s (regs: %p, irq: %d, phy: %s, "
-		       "mac: %pM)\n", dev->name, (void *)mem->start, dev->irq,
-		       priv->phy_name, dev->dev_addr);
+		dev_info(&pdev->dev, "regs: %p, irq: %d, phy: %s, "
+			 "mac: %pM\n", (void *)mem->start, dev->irq,
+			 priv->phy_name, dev->dev_addr);
 	}
 	return 0;
 
@@ -1223,7 +1211,7 @@ int cpmac_init(void)
 	cpmac_mii->priv = ioremap(AR7_REGS_MDIO, 256);
 
 	if (!cpmac_mii->priv) {
-		printk(KERN_ERR "Can't ioremap mdio registers\n");
+		pr_err("Can't ioremap mdio registers\n");
 		res = -ENXIO;
 		goto fail_alloc;
 	}
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net v2 4/7] net: cpmac: fix cpmac driver structure
  2014-07-10  5:35 [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver varkabhadram
                   ` (2 preceding siblings ...)
  2014-07-10  5:35 ` [PATCH net v2 3/7] net: cpmac: dynamic debug fixes varkabhadram
@ 2014-07-10  5:35 ` varkabhadram
  2014-07-10 13:08   ` Felipe Balbi
  2014-07-10  5:35 ` [PATCH net v2 5/7] net: cpmac: fix missing a blank line after declarations varkabhadram
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: varkabhadram @ 2014-07-10  5:35 UTC (permalink / raw)
  To: netdev; +Cc: mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

From: Varka Bhadram <varkab@cdac.in>

This patch changes to style of declarattion which follows every driver

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/ti/cpmac.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 9faf669..1520c19 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1187,9 +1187,11 @@ static int cpmac_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver cpmac_driver = {
-	.driver.name = "cpmac",
-	.driver.owner = THIS_MODULE,
-	.probe = cpmac_probe,
+	.driver = {
+		.name 	= "cpmac",
+		.owner 	= THIS_MODULE,
+	},
+	.probe 	= cpmac_probe,
 	.remove = cpmac_remove,
 };
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net v2 5/7] net: cpmac: fix missing a blank line after declarations
  2014-07-10  5:35 [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver varkabhadram
                   ` (3 preceding siblings ...)
  2014-07-10  5:35 ` [PATCH net v2 4/7] net: cpmac: fix cpmac driver structure varkabhadram
@ 2014-07-10  5:35 ` varkabhadram
  2014-07-10 13:08   ` Felipe Balbi
  2014-07-10  5:35 ` [PATCH net v2 6/7] net: cpmac: fix proper spacing before return statement varkabhadram
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: varkabhadram @ 2014-07-10  5:35 UTC (permalink / raw)
  To: netdev; +Cc: mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

From: Varka Bhadram <varkab@cdac.in>

This patch insert a blank line after declaration

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/ti/cpmac.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 1520c19..3d3ead4 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -224,6 +224,7 @@ static void cpmac_dump_regs(struct net_device *dev)
 {
 	int i;
 	struct cpmac_priv *priv = netdev_priv(dev);
+
 	for (i = 0; i < CPMAC_REG_END; i += 4) {
 		if (i % 16 == 0) {
 			if (i)
@@ -238,6 +239,7 @@ static void cpmac_dump_regs(struct net_device *dev)
 static void cpmac_dump_desc(struct net_device *dev, struct cpmac_desc *desc)
 {
 	int i;
+
 	netdev_dbg(dev, "desc[%p]:", desc);
 	for (i = 0; i < sizeof(*desc) / 4; i++)
 		pr_debug(" %08x", ((u32 *)desc)[i]);
@@ -248,6 +250,7 @@ static void cpmac_dump_all_desc(struct net_device *dev)
 {
 	struct cpmac_priv *priv = netdev_priv(dev);
 	struct cpmac_desc *dump = priv->rx_head;
+
 	do {
 		cpmac_dump_desc(dev, dump);
 		dump = dump->next;
@@ -257,6 +260,7 @@ static void cpmac_dump_all_desc(struct net_device *dev)
 static void cpmac_dump_skb(struct net_device *dev, struct sk_buff *skb)
 {
 	int i;
+
 	netdev_dbg(dev, "skb 0x%p, len=%d\n", skb, skb->len);
 	for (i = 0; i < skb->len; i++) {
 		if (i % 16 == 0) {
@@ -681,6 +685,7 @@ static void cpmac_clear_rx(struct net_device *dev)
 	struct cpmac_priv *priv = netdev_priv(dev);
 	struct cpmac_desc *desc;
 	int i;
+
 	if (unlikely(!priv->rx_head))
 		return;
 	desc = priv->rx_head;
@@ -703,6 +708,7 @@ static void cpmac_clear_tx(struct net_device *dev)
 {
 	struct cpmac_priv *priv = netdev_priv(dev);
 	int i;
+
 	if (unlikely(!priv->desc_ring))
 		return;
 	for (i = 0; i < CPMAC_QUEUES; i++) {
@@ -821,6 +827,7 @@ static void cpmac_tx_timeout(struct net_device *dev)
 static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
 	struct cpmac_priv *priv = netdev_priv(dev);
+
 	if (!(netif_running(dev)))
 		return -EINVAL;
 	if (!priv->phy)
@@ -1181,6 +1188,7 @@ fail:
 static int cpmac_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
+
 	unregister_netdev(dev);
 	free_netdev(dev);
 	return 0;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net v2 6/7] net: cpmac: fix proper spacing before return statement
  2014-07-10  5:35 [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver varkabhadram
                   ` (4 preceding siblings ...)
  2014-07-10  5:35 ` [PATCH net v2 5/7] net: cpmac: fix missing a blank line after declarations varkabhadram
@ 2014-07-10  5:35 ` varkabhadram
  2014-07-10 13:09   ` Felipe Balbi
  2014-07-10  5:35 ` [PATCH net v2 7/7] net: cpmac: fix in releasing resources varkabhadram
  2014-07-10  7:41 ` [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver David Miller
  7 siblings, 1 reply; 23+ messages in thread
From: varkabhadram @ 2014-07-10  5:35 UTC (permalink / raw)
  To: netdev; +Cc: mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

From: Varka Bhadram <varkab@cdac.in>

This patch insert proper spaces before return statement.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/ti/cpmac.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 3d3ead4..b6efe3e 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -283,6 +283,7 @@ static int cpmac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
 		    MDIO_PHY(phy_id));
 	while ((val = cpmac_read(bus->priv, CPMAC_MDIO_ACCESS(0))) & MDIO_BUSY)
 		cpu_relax();
+
 	return MDIO_DATA(val);
 }
 
@@ -293,6 +294,7 @@ static int cpmac_mdio_write(struct mii_bus *bus, int phy_id,
 		cpu_relax();
 	cpmac_write(bus->priv, CPMAC_MDIO_ACCESS(0), MDIO_BUSY | MDIO_WRITE |
 		    MDIO_REG(reg) | MDIO_PHY(phy_id) | MDIO_DATA(val));
+
 	return 0;
 }
 
@@ -308,6 +310,7 @@ static int cpmac_mdio_reset(struct mii_bus *bus)
 	ar7_device_reset(AR7_RESET_BIT_MDIO);
 	cpmac_write(bus->priv, CPMAC_MDIO_CONTROL, MDIOC_ENABLE |
 		    MDIOC_CLKDIV(clk_get_rate(cpmac_clk) / 2200000 - 1));
+
 	return 0;
 }
 
@@ -537,6 +540,7 @@ fatal_error:
 	cpmac_hw_stop(priv->dev);
 	if (!schedule_work(&priv->reset_work))
 		atomic_dec(&priv->reset_pending);
+
 	return 0;
 
 }
@@ -883,6 +887,7 @@ static int cpmac_set_ringparam(struct net_device *dev,
 	if (netif_running(dev))
 		return -EBUSY;
 	priv->ring_size = ring->rx_pending;
+
 	return 0;
 }
 
@@ -1076,6 +1081,7 @@ static int cpmac_stop(struct net_device *dev)
 	dma_free_coherent(&dev->dev, sizeof(struct cpmac_desc) *
 			  (CPMAC_QUEUES + priv->ring_size),
 			  priv->desc_ring, priv->dma_ring);
+
 	return 0;
 }
 
@@ -1178,6 +1184,7 @@ static int cpmac_probe(struct platform_device *pdev)
 			 "mac: %pM\n", (void *)mem->start, dev->irq,
 			 priv->phy_name, dev->dev_addr);
 	}
+
 	return 0;
 
 fail:
@@ -1191,6 +1198,7 @@ static int cpmac_remove(struct platform_device *pdev)
 
 	unregister_netdev(dev);
 	free_netdev(dev);
+
 	return 0;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net v2 7/7] net: cpmac: fix in releasing resources
  2014-07-10  5:35 [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver varkabhadram
                   ` (5 preceding siblings ...)
  2014-07-10  5:35 ` [PATCH net v2 6/7] net: cpmac: fix proper spacing before return statement varkabhadram
@ 2014-07-10  5:35 ` varkabhadram
  2014-07-10 13:11   ` Felipe Balbi
  2014-07-10  7:41 ` [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver David Miller
  7 siblings, 1 reply; 23+ messages in thread
From: varkabhadram @ 2014-07-10  5:35 UTC (permalink / raw)
  To: netdev; +Cc: mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

From: Varka Bhadram <varkab@cdac.in>

before registering the the net device this code freeing net device
by using the label 'fail'

fixed by introducing an another label 'out'

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/ti/cpmac.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index b6efe3e..b68c5b5 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1142,7 +1142,7 @@ static int cpmac_probe(struct platform_device *pdev)
 	mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
 	if (!mem) {
 		rc = -ENODEV;
-		goto fail;
+		goto out;
 	}
 
 	dev->irq = platform_get_irq_byname(pdev, "irq");
@@ -1170,7 +1170,7 @@ static int cpmac_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev, "Could not attach to PHY\n");
 
 		rc = PTR_ERR(priv->phy);
-		goto fail;
+		goto out;
 	}
 
 	rc = register_netdev(dev);
@@ -1189,6 +1189,7 @@ static int cpmac_probe(struct platform_device *pdev)
 
 fail:
 	free_netdev(dev);
+out:
 	return rc;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver
  2014-07-10  5:35 [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver varkabhadram
                   ` (6 preceding siblings ...)
  2014-07-10  5:35 ` [PATCH net v2 7/7] net: cpmac: fix in releasing resources varkabhadram
@ 2014-07-10  7:41 ` David Miller
  7 siblings, 0 replies; 23+ messages in thread
From: David Miller @ 2014-07-10  7:41 UTC (permalink / raw)
  To: varkabhadram; +Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, varkab

From: varkabhadram@gmail.com
Date: Thu, 10 Jul 2014 11:05:38 +0530

> This patch series cleanup for AR7 CPMAC Ethernet controller driver

Series applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 3/7] net: cpmac: dynamic debug fixes
  2014-07-10  5:35 ` [PATCH net v2 3/7] net: cpmac: dynamic debug fixes varkabhadram
@ 2014-07-10  8:31   ` Joe Perches
  2014-07-10  8:45     ` Varka Bhadram
  2014-07-10 13:08   ` Felipe Balbi
  1 sibling, 1 reply; 23+ messages in thread
From: Joe Perches @ 2014-07-10  8:31 UTC (permalink / raw)
  To: varkabhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

On Thu, 2014-07-10 at 11:05 +0530, varkabhadram@gmail.com wrote:
> From: Varka Bhadram <varkab@cdac.in>
> 
> This patch does the following changes
> 1. convert printk(KERN_DEBUG.. to netdev_dbg() if we have net_device object
>    or convert to dev_dbg() if we have device object.
[]
> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
[]
> @@ -228,21 +228,20 @@ static void cpmac_dump_regs(struct net_device *dev)
>  		if (i % 16 == 0) {
>  			if (i)
>  				pr_cont("\n");
> -			printk(KERN_DEBUG "%s: reg[%p]:", dev->name,
> -			       priv->regs + i);
> +			netdev_dbg(dev, "reg[%p]:", priv->regs + i);
>  		}
> -		printk(" %08x", cpmac_read(priv->regs, i));
> +		pr_debug(" %08x", cpmac_read(priv->regs, i));
>  	}
> -	printk("\n");
> +	pr_debug("\n");
>  }

This changes output from a compact form to
usig very many individual lines like:

<7>dev->name: reg[addr]: p1 p2 p3 p4 p5 p6 p7 p8
<7>dev->name: reg[addr]: p9 pa ...            pn

to:

<7>bus desc/dev->name: reg[addr]:
<7> p1
<7> p2
...
<7>bus desc/dev->name: reg[addr]:
<7> p9
<7> pa
...
<7> pn

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 3/7] net: cpmac: dynamic debug fixes
  2014-07-10  8:31   ` Joe Perches
@ 2014-07-10  8:45     ` Varka Bhadram
  2014-07-10  9:03       ` Joe Perches
  0 siblings, 1 reply; 23+ messages in thread
From: Varka Bhadram @ 2014-07-10  8:45 UTC (permalink / raw)
  To: Joe Perches
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

Hi,

This series already applied to net-next by David Miller.


Anyway we will discuss this. If change required i will send the patch

On 07/10/2014 02:01 PM, Joe Perches wrote:
> On Thu, 2014-07-10 at 11:05 +0530, varkabhadram@gmail.com wrote:
>> From: Varka Bhadram <varkab@cdac.in>
>>
>> This patch does the following changes
>> 1. convert printk(KERN_DEBUG.. to netdev_dbg() if we have net_device object
>>     or convert to dev_dbg() if we have device object.
> []
>> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
> []
>> @@ -228,21 +228,20 @@ static void cpmac_dump_regs(struct net_device *dev)
>>   		if (i % 16 == 0) {
>>   			if (i)
>>   				pr_cont("\n");
>> -			printk(KERN_DEBUG "%s: reg[%p]:", dev->name,
>> -			       priv->regs + i);
>> +			netdev_dbg(dev, "reg[%p]:", priv->regs + i);
>>   		}
>> -		printk(" %08x", cpmac_read(priv->regs, i));
>> +		pr_debug(" %08x", cpmac_read(priv->regs, i));

You mean to say that the pr_debug will insert the new line ?... I dont think so..


I think this patch will do the job as you show like

<7>dev->name: reg[addr]: p1 p2 p3 p4 p5 p6 p7 p8
<7>dev->name: reg[addr]: p9 pa ...            pn
  

>>   	}
>> -	printk("\n");
>> +	pr_debug("\n");
>>   }
> This changes output from a compact form to
> usig very many individual lines like:
>
> <7>dev->name: reg[addr]: p1 p2 p3 p4 p5 p6 p7 p8
> <7>dev->name: reg[addr]: p9 pa ...            pn
>
> to:
>
> <7>bus desc/dev->name: reg[addr]:
> <7> p1
> <7> p2
> ...
> <7>bus desc/dev->name: reg[addr]:
> <7> p9
> <7> pa
> ...
> <7> pn
>
>

-- 
Regards,
Varka Bhadram.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 3/7] net: cpmac: dynamic debug fixes
  2014-07-10  8:45     ` Varka Bhadram
@ 2014-07-10  9:03       ` Joe Perches
  2014-07-10  9:35         ` Varka Bhadram
  0 siblings, 1 reply; 23+ messages in thread
From: Joe Perches @ 2014-07-10  9:03 UTC (permalink / raw)
  To: Varka Bhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

On Thu, 2014-07-10 at 14:15 +0530, Varka Bhadram wrote:
> Hi,

Hello.

> This series already applied to net-next by David Miller.

You could improve it anyway.

> Anyway we will discuss this. If change required i will send the patch
> 
> On 07/10/2014 02:01 PM, Joe Perches wrote:
> > On Thu, 2014-07-10 at 11:05 +0530, varkabhadram@gmail.com wrote:
> >> From: Varka Bhadram <varkab@cdac.in>
> >>
> >> This patch does the following changes
> >> 1. convert printk(KERN_DEBUG.. to netdev_dbg() if we have net_device object
> >>     or convert to dev_dbg() if we have device object.
> > []
> >> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
> > []
> >> @@ -228,21 +228,20 @@ static void cpmac_dump_regs(struct net_device *dev)
> >>   		if (i % 16 == 0) {
> >>   			if (i)
> >>   				pr_cont("\n");
> >> -			printk(KERN_DEBUG "%s: reg[%p]:", dev->name,
> >> -			       priv->regs + i);
> >> +			netdev_dbg(dev, "reg[%p]:", priv->regs + i);
> >>   		}
> >> -		printk(" %08x", cpmac_read(priv->regs, i));
> >> +		pr_debug(" %08x", cpmac_read(priv->regs, i));
> 
> You mean to say that the pr_debug will insert the new line ?... I dont think so..

Try it.

If you're using dynamic_debug, remember to
enable all the lines.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 3/7] net: cpmac: dynamic debug fixes
  2014-07-10  9:03       ` Joe Perches
@ 2014-07-10  9:35         ` Varka Bhadram
  2014-07-10 10:10           ` Joe Perches
  0 siblings, 1 reply; 23+ messages in thread
From: Varka Bhadram @ 2014-07-10  9:35 UTC (permalink / raw)
  To: Joe Perches
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

On 07/10/2014 02:33 PM, Joe Perches wrote:
> On Thu, 2014-07-10 at 14:15 +0530, Varka Bhadram wrote:
>> Hi,
> Hello.
>
>> This series already applied to net-next by David Miller.
> You could improve it anyway.
>
>> Anyway we will discuss this. If change required i will send the patch
>>
>> On 07/10/2014 02:01 PM, Joe Perches wrote:
>>> On Thu, 2014-07-10 at 11:05 +0530, varkabhadram@gmail.com wrote:
>>>> From: Varka Bhadram <varkab@cdac.in>
>>>>
>>>> This patch does the following changes
>>>> 1. convert printk(KERN_DEBUG.. to netdev_dbg() if we have net_device object
>>>>      or convert to dev_dbg() if we have device object.
>>> []
>>>> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
>>> []
>>>> @@ -228,21 +228,20 @@ static void cpmac_dump_regs(struct net_device *dev)
>>>>    		if (i % 16 == 0) {
>>>>    			if (i)
>>>>    				pr_cont("\n");
>>>> -			printk(KERN_DEBUG "%s: reg[%p]:", dev->name,
>>>> -			       priv->regs + i);
>>>> +			netdev_dbg(dev, "reg[%p]:", priv->regs + i);
>>>>    		}
>>>> -		printk(" %08x", cpmac_read(priv->regs, i));
>>>> +		pr_debug(" %08x", cpmac_read(priv->regs, i));
>> You mean to say that the pr_debug will insert the new line ?... I dont think so..
> Try it.
>
> If you're using dynamic_debug, remember to
> enable all the lines.
>
>
Ya you are correct. New line inserted when i use pr_debug().
I will submit the patch for this.

Thanks.

-- 
Regards,
Varka Bhadram.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 3/7] net: cpmac: dynamic debug fixes
  2014-07-10  9:35         ` Varka Bhadram
@ 2014-07-10 10:10           ` Joe Perches
  2014-07-10 10:11             ` Varka Bhadram
  0 siblings, 1 reply; 23+ messages in thread
From: Joe Perches @ 2014-07-10 10:10 UTC (permalink / raw)
  To: Varka Bhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

On Thu, 2014-07-10 at 15:05 +0530, Varka Bhadram wrote:
> I will submit the patch for this.

You'll have to buffer the line locally because
there's no simple way to use dynamic debug with
line continuations.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 3/7] net: cpmac: dynamic debug fixes
  2014-07-10 10:10           ` Joe Perches
@ 2014-07-10 10:11             ` Varka Bhadram
  2014-07-10 10:17               ` Joe Perches
  0 siblings, 1 reply; 23+ messages in thread
From: Varka Bhadram @ 2014-07-10 10:11 UTC (permalink / raw)
  To: Joe Perches
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

On 07/10/2014 03:40 PM, Joe Perches wrote:
> On Thu, 2014-07-10 at 15:05 +0530, Varka Bhadram wrote:
>> I will submit the patch for this.
> You'll have to buffer the line locally because
> there's no simple way to use dynamic debug with
> line continuations.
>
>
>
I submitted the patch with subject: net: cpmac: fix in debug messages

Please see it.

-- 
Regards,
Varka Bhadram.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 3/7] net: cpmac: dynamic debug fixes
  2014-07-10 10:11             ` Varka Bhadram
@ 2014-07-10 10:17               ` Joe Perches
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Perches @ 2014-07-10 10:17 UTC (permalink / raw)
  To: Varka Bhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

On Thu, 2014-07-10 at 15:41 +0530, Varka Bhadram wrote:
> On 07/10/2014 03:40 PM, Joe Perches wrote:
> > On Thu, 2014-07-10 at 15:05 +0530, Varka Bhadram wrote:
> >> I will submit the patch for this.
> > You'll have to buffer the line locally because
> > there's no simple way to use dynamic debug with
> > line continuations.
> >
> >
> >
> I submitted the patch with subject: net: cpmac: fix in debug messages
> 
> Please see it.

I think you should buffer the lines locally.

btw; It seems what you submitted is a partial revert and
so it should be described as such in the patch description.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 1/7] net: cpmac: remove space in macro defination
  2014-07-10  5:35 ` [PATCH net v2 1/7] net: cpmac: remove space in macro defination varkabhadram
@ 2014-07-10 13:07   ` Felipe Balbi
  0 siblings, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2014-07-10 13:07 UTC (permalink / raw)
  To: varkabhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

[-- Attachment #1: Type: text/plain, Size: 5120 bytes --]

On Thu, Jul 10, 2014 at 11:05:39AM +0530, varkabhadram@gmail.com wrote:
> From: Varka Bhadram <varkab@cdac.in>
> 
> This patch fix the space after '#' in macro defination
> 
> Signed-off-by: Varka Bhadram <varkab@cdac.in>

Reviewed-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/net/ethernet/ti/cpmac.c |   82 +++++++++++++++++++--------------------
>  1 file changed, 41 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
> index 7399a52..61eb691 100644
> --- a/drivers/net/ethernet/ti/cpmac.c
> +++ b/drivers/net/ethernet/ti/cpmac.c
> @@ -67,42 +67,42 @@ MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus");
>  #define CPMAC_RX_CONTROL		0x0014
>  #define CPMAC_RX_TEARDOWN		0x0018
>  #define CPMAC_MBP			0x0100
> -# define MBP_RXPASSCRC			0x40000000
> -# define MBP_RXQOS			0x20000000
> -# define MBP_RXNOCHAIN			0x10000000
> -# define MBP_RXCMF			0x01000000
> -# define MBP_RXSHORT			0x00800000
> -# define MBP_RXCEF			0x00400000
> -# define MBP_RXPROMISC			0x00200000
> -# define MBP_PROMISCCHAN(channel)	(((channel) & 0x7) << 16)
> -# define MBP_RXBCAST			0x00002000
> -# define MBP_BCASTCHAN(channel)		(((channel) & 0x7) << 8)
> -# define MBP_RXMCAST			0x00000020
> -# define MBP_MCASTCHAN(channel)		((channel) & 0x7)
> +#define MBP_RXPASSCRC			0x40000000
> +#define MBP_RXQOS			0x20000000
> +#define MBP_RXNOCHAIN			0x10000000
> +#define MBP_RXCMF			0x01000000
> +#define MBP_RXSHORT			0x00800000
> +#define MBP_RXCEF			0x00400000
> +#define MBP_RXPROMISC			0x00200000
> +#define MBP_PROMISCCHAN(channel)	(((channel) & 0x7) << 16)
> +#define MBP_RXBCAST			0x00002000
> +#define MBP_BCASTCHAN(channel)		(((channel) & 0x7) << 8)
> +#define MBP_RXMCAST			0x00000020
> +#define MBP_MCASTCHAN(channel)		((channel) & 0x7)
>  #define CPMAC_UNICAST_ENABLE		0x0104
>  #define CPMAC_UNICAST_CLEAR		0x0108
>  #define CPMAC_MAX_LENGTH		0x010c
>  #define CPMAC_BUFFER_OFFSET		0x0110
>  #define CPMAC_MAC_CONTROL		0x0160
> -# define MAC_TXPTYPE			0x00000200
> -# define MAC_TXPACE			0x00000040
> -# define MAC_MII			0x00000020
> -# define MAC_TXFLOW			0x00000010
> -# define MAC_RXFLOW			0x00000008
> -# define MAC_MTEST			0x00000004
> -# define MAC_LOOPBACK			0x00000002
> -# define MAC_FDX			0x00000001
> +#define MAC_TXPTYPE			0x00000200
> +#define MAC_TXPACE			0x00000040
> +#define MAC_MII				0x00000020
> +#define MAC_TXFLOW			0x00000010
> +#define MAC_RXFLOW			0x00000008
> +#define MAC_MTEST			0x00000004
> +#define MAC_LOOPBACK			0x00000002
> +#define MAC_FDX				0x00000001
>  #define CPMAC_MAC_STATUS		0x0164
> -# define MAC_STATUS_QOS			0x00000004
> -# define MAC_STATUS_RXFLOW		0x00000002
> -# define MAC_STATUS_TXFLOW		0x00000001
> +#define MAC_STATUS_QOS			0x00000004
> +#define MAC_STATUS_RXFLOW		0x00000002
> +#define MAC_STATUS_TXFLOW		0x00000001
>  #define CPMAC_TX_INT_ENABLE		0x0178
>  #define CPMAC_TX_INT_CLEAR		0x017c
>  #define CPMAC_MAC_INT_VECTOR		0x0180
> -# define MAC_INT_STATUS			0x00080000
> -# define MAC_INT_HOST			0x00040000
> -# define MAC_INT_RX			0x00020000
> -# define MAC_INT_TX			0x00010000
> +#define MAC_INT_STATUS			0x00080000
> +#define MAC_INT_HOST			0x00040000
> +#define MAC_INT_RX			0x00020000
> +#define MAC_INT_TX			0x00010000
>  #define CPMAC_MAC_EOI_VECTOR		0x0184
>  #define CPMAC_RX_INT_ENABLE		0x0198
>  #define CPMAC_RX_INT_CLEAR		0x019c
> @@ -157,24 +157,24 @@ MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus");
>  /* MDIO bus */
>  #define CPMAC_MDIO_VERSION		0x0000
>  #define CPMAC_MDIO_CONTROL		0x0004
> -# define MDIOC_IDLE			0x80000000
> -# define MDIOC_ENABLE			0x40000000
> -# define MDIOC_PREAMBLE			0x00100000
> -# define MDIOC_FAULT			0x00080000
> -# define MDIOC_FAULTDETECT		0x00040000
> -# define MDIOC_INTTEST			0x00020000
> -# define MDIOC_CLKDIV(div)		((div) & 0xff)
> +#define MDIOC_IDLE			0x80000000
> +#define MDIOC_ENABLE			0x40000000
> +#define MDIOC_PREAMBLE			0x00100000
> +#define MDIOC_FAULT			0x00080000
> +#define MDIOC_FAULTDETECT		0x00040000
> +#define MDIOC_INTTEST			0x00020000
> +#define MDIOC_CLKDIV(div)		((div) & 0xff)
>  #define CPMAC_MDIO_ALIVE		0x0008
>  #define CPMAC_MDIO_LINK			0x000c
>  #define CPMAC_MDIO_ACCESS(channel)	(0x0080 + (channel) * 8)
> -# define MDIO_BUSY			0x80000000
> -# define MDIO_WRITE			0x40000000
> -# define MDIO_REG(reg)			(((reg) & 0x1f) << 21)
> -# define MDIO_PHY(phy)			(((phy) & 0x1f) << 16)
> -# define MDIO_DATA(data)		((data) & 0xffff)
> +#define MDIO_BUSY			0x80000000
> +#define MDIO_WRITE			0x40000000
> +#define MDIO_REG(reg)			(((reg) & 0x1f) << 21)
> +#define MDIO_PHY(phy)			(((phy) & 0x1f) << 16)
> +#define MDIO_DATA(data)			((data) & 0xffff)
>  #define CPMAC_MDIO_PHYSEL(channel)	(0x0084 + (channel) * 8)
> -# define PHYSEL_LINKSEL			0x00000040
> -# define PHYSEL_LINKINT			0x00000020
> +#define PHYSEL_LINKSEL			0x00000040
> +#define PHYSEL_LINKINT			0x00000020
>  
>  struct cpmac_desc {
>  	u32 hw_next;
> -- 
> 1.7.9.5
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 2/7] net: cpmac: fix comments
  2014-07-10  5:35 ` [PATCH net v2 2/7] net: cpmac: fix comments varkabhadram
@ 2014-07-10 13:07   ` Felipe Balbi
  0 siblings, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2014-07-10 13:07 UTC (permalink / raw)
  To: varkabhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

[-- Attachment #1: Type: text/plain, Size: 4955 bytes --]

On Thu, Jul 10, 2014 at 11:05:40AM +0530, varkabhadram@gmail.com wrote:
> From: Varka Bhadram <varkab@cdac.in>
> 
> This patch convert the normal comments to networking subsystem
> style comments.
> 
> Signed-off-by: Varka Bhadram <varkab@cdac.in>

Reviewed-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/net/ethernet/ti/cpmac.c |   40 ++++++++++++++++++++-------------------
>  1 file changed, 21 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
> index 61eb691..1d8ef39 100644
> --- a/drivers/net/ethernet/ti/cpmac.c
> +++ b/drivers/net/ethernet/ti/cpmac.c
> @@ -118,8 +118,8 @@ MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus");
>  #define CPMAC_TX_ACK(channel)		(0x0640 + (channel) * 4)
>  #define CPMAC_RX_ACK(channel)		(0x0660 + (channel) * 4)
>  #define CPMAC_REG_END			0x0680
> -/*
> - * Rx/Tx statistics
> +
> +/* Rx/Tx statistics
>   * TODO: use some of them to fill stats in cpmac_stats()
>   */
>  #define CPMAC_STATS_RX_GOOD		0x0200
> @@ -331,8 +331,7 @@ static void cpmac_set_multicast_list(struct net_device *dev)
>  			cpmac_write(priv->regs, CPMAC_MAC_HASH_LO, 0xffffffff);
>  			cpmac_write(priv->regs, CPMAC_MAC_HASH_HI, 0xffffffff);
>  		} else {
> -			/*
> -			 * cpmac uses some strange mac address hashing
> +			/* cpmac uses some strange mac address hashing
>  			 * (not crc32)
>  			 */
>  			netdev_for_each_mc_addr(ha, dev) {
> @@ -432,10 +431,10 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
>  
>  		if ((desc->dataflags & CPMAC_EOQ) != 0) {
>  			/* The last update to eoq->hw_next didn't happen
> -			* soon enough, and the receiver stopped here.
> -			*Remember this descriptor so we can restart
> -			* the receiver after freeing some space.
> -			*/
> +			 * soon enough, and the receiver stopped here.
> +			 * Remember this descriptor so we can restart
> +			 * the receiver after freeing some space.
> +			 */
>  			if (unlikely(restart)) {
>  				if (netif_msg_rx_err(priv))
>  					printk(KERN_ERR "%s: poll found a"
> @@ -457,25 +456,27 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
>  
>  	if (desc != priv->rx_head) {
>  		/* We freed some buffers, but not the whole ring,
> -		 * add what we did free to the rx list */
> +		 * add what we did free to the rx list
> +		 */
>  		desc->prev->hw_next = (u32)0;
>  		priv->rx_head->prev->hw_next = priv->rx_head->mapping;
>  	}
>  
>  	/* Optimization: If we did not actually process an EOQ (perhaps because
>  	 * of quota limits), check to see if the tail of the queue has EOQ set.
> -	* We should immediately restart in that case so that the receiver can
> -	* restart and run in parallel with more packet processing.
> -	* This lets us handle slightly larger bursts before running
> -	* out of ring space (assuming dev->weight < ring_size) */
> +	 * We should immediately restart in that case so that the receiver can
> +	 * restart and run in parallel with more packet processing.
> +	 * This lets us handle slightly larger bursts before running
> +	 * out of ring space (assuming dev->weight < ring_size)
> +	 */
>  
>  	if (!restart &&
>  	     (priv->rx_head->prev->dataflags & (CPMAC_OWN|CPMAC_EOQ))
>  		    == CPMAC_EOQ &&
>  	     (priv->rx_head->dataflags & CPMAC_OWN) != 0) {
>  		/* reset EOQ so the poll loop (above) doesn't try to
> -		* restart this when it eventually gets to this descriptor.
> -		*/
> +		 * restart this when it eventually gets to this descriptor.
> +		 */
>  		priv->rx_head->prev->dataflags &= ~CPMAC_EOQ;
>  		restart = priv->rx_head;
>  	}
> @@ -506,7 +507,8 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
>  		       priv->dev->name, received);
>  	if (processed == 0) {
>  		/* we ran out of packets to read,
> -		 * revert to interrupt-driven mode */
> +		 * revert to interrupt-driven mode
> +		 */
>  		napi_complete(napi);
>  		cpmac_write(priv->regs, CPMAC_RX_INT_ENABLE, 1);
>  		return 0;
> @@ -516,8 +518,8 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
>  
>  fatal_error:
>  	/* Something went horribly wrong.
> -	 * Reset hardware to try to recover rather than wedging. */
> -
> +	 * Reset hardware to try to recover rather than wedging.
> +	 */
>  	if (netif_msg_drv(priv)) {
>  		printk(KERN_ERR "%s: cpmac_poll is confused. "
>  				"Resetting hardware\n", priv->dev->name);
> @@ -751,7 +753,7 @@ static void cpmac_check_status(struct net_device *dev)
>  	if (rx_code || tx_code) {
>  		if (netif_msg_drv(priv) && net_ratelimit()) {
>  			/* Can't find any documentation on what these
> -			 *error codes actually are. So just log them and hope..
> +			 * error codes actually are. So just log them and hope..
>  			 */
>  			if (rx_code)
>  				printk(KERN_WARNING "%s: host error %d on rx "
> -- 
> 1.7.9.5
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 3/7] net: cpmac: dynamic debug fixes
  2014-07-10  5:35 ` [PATCH net v2 3/7] net: cpmac: dynamic debug fixes varkabhadram
  2014-07-10  8:31   ` Joe Perches
@ 2014-07-10 13:08   ` Felipe Balbi
  1 sibling, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2014-07-10 13:08 UTC (permalink / raw)
  To: varkabhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]

On Thu, Jul 10, 2014 at 11:05:41AM +0530, varkabhadram@gmail.com wrote:
> From: Varka Bhadram <varkab@cdac.in>
> 
> This patch does the following changes
> 1. convert printk(KERN_DEBUG.. to netdev_dbg() if we have net_device object
>    or convert to dev_dbg() if we have device object.
> 2. convert printk(KERN_WARNING.. to netdev_warn() if we have net_device object
>    or convert to dev_warn() if we have device object
> 3. convert printk() to pr_*
> 
> Signed-off-by: Varka Bhadram <varkab@cdac.in>
> ---
>  drivers/net/ethernet/ti/cpmac.c |  136 ++++++++++++++++++---------------------
>  1 file changed, 62 insertions(+), 74 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
> index 1d8ef39..9faf669 100644
> --- a/drivers/net/ethernet/ti/cpmac.c
> +++ b/drivers/net/ethernet/ti/cpmac.c
> @@ -228,21 +228,20 @@ static void cpmac_dump_regs(struct net_device *dev)
>  		if (i % 16 == 0) {
>  			if (i)
>  				pr_cont("\n");
> -			printk(KERN_DEBUG "%s: reg[%p]:", dev->name,
> -			       priv->regs + i);
> +			netdev_dbg(dev, "reg[%p]:", priv->regs + i);
>  		}
> -		printk(" %08x", cpmac_read(priv->regs, i));
> +		pr_debug(" %08x", cpmac_read(priv->regs, i));

looks like this should be pr_cont()

>  	}
> -	printk("\n");
> +	pr_debug("\n");

same here. Ditto to all below

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 4/7] net: cpmac: fix cpmac driver structure
  2014-07-10  5:35 ` [PATCH net v2 4/7] net: cpmac: fix cpmac driver structure varkabhadram
@ 2014-07-10 13:08   ` Felipe Balbi
  0 siblings, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2014-07-10 13:08 UTC (permalink / raw)
  To: varkabhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]

On Thu, Jul 10, 2014 at 11:05:42AM +0530, varkabhadram@gmail.com wrote:
> From: Varka Bhadram <varkab@cdac.in>
> 
> This patch changes to style of declarattion which follows every driver
> 
> Signed-off-by: Varka Bhadram <varkab@cdac.in>

Reviewed-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/net/ethernet/ti/cpmac.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
> index 9faf669..1520c19 100644
> --- a/drivers/net/ethernet/ti/cpmac.c
> +++ b/drivers/net/ethernet/ti/cpmac.c
> @@ -1187,9 +1187,11 @@ static int cpmac_remove(struct platform_device *pdev)
>  }
>  
>  static struct platform_driver cpmac_driver = {
> -	.driver.name = "cpmac",
> -	.driver.owner = THIS_MODULE,
> -	.probe = cpmac_probe,
> +	.driver = {
> +		.name 	= "cpmac",
> +		.owner 	= THIS_MODULE,
> +	},
> +	.probe 	= cpmac_probe,
>  	.remove = cpmac_remove,
>  };
>  
> -- 
> 1.7.9.5
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 5/7] net: cpmac: fix missing a blank line after declarations
  2014-07-10  5:35 ` [PATCH net v2 5/7] net: cpmac: fix missing a blank line after declarations varkabhadram
@ 2014-07-10 13:08   ` Felipe Balbi
  0 siblings, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2014-07-10 13:08 UTC (permalink / raw)
  To: varkabhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

[-- Attachment #1: Type: text/plain, Size: 2694 bytes --]

On Thu, Jul 10, 2014 at 11:05:43AM +0530, varkabhadram@gmail.com wrote:
> From: Varka Bhadram <varkab@cdac.in>
> 
> This patch insert a blank line after declaration
> 
> Signed-off-by: Varka Bhadram <varkab@cdac.in>

Reviewed-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/net/ethernet/ti/cpmac.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
> index 1520c19..3d3ead4 100644
> --- a/drivers/net/ethernet/ti/cpmac.c
> +++ b/drivers/net/ethernet/ti/cpmac.c
> @@ -224,6 +224,7 @@ static void cpmac_dump_regs(struct net_device *dev)
>  {
>  	int i;
>  	struct cpmac_priv *priv = netdev_priv(dev);
> +
>  	for (i = 0; i < CPMAC_REG_END; i += 4) {
>  		if (i % 16 == 0) {
>  			if (i)
> @@ -238,6 +239,7 @@ static void cpmac_dump_regs(struct net_device *dev)
>  static void cpmac_dump_desc(struct net_device *dev, struct cpmac_desc *desc)
>  {
>  	int i;
> +
>  	netdev_dbg(dev, "desc[%p]:", desc);
>  	for (i = 0; i < sizeof(*desc) / 4; i++)
>  		pr_debug(" %08x", ((u32 *)desc)[i]);
> @@ -248,6 +250,7 @@ static void cpmac_dump_all_desc(struct net_device *dev)
>  {
>  	struct cpmac_priv *priv = netdev_priv(dev);
>  	struct cpmac_desc *dump = priv->rx_head;
> +
>  	do {
>  		cpmac_dump_desc(dev, dump);
>  		dump = dump->next;
> @@ -257,6 +260,7 @@ static void cpmac_dump_all_desc(struct net_device *dev)
>  static void cpmac_dump_skb(struct net_device *dev, struct sk_buff *skb)
>  {
>  	int i;
> +
>  	netdev_dbg(dev, "skb 0x%p, len=%d\n", skb, skb->len);
>  	for (i = 0; i < skb->len; i++) {
>  		if (i % 16 == 0) {
> @@ -681,6 +685,7 @@ static void cpmac_clear_rx(struct net_device *dev)
>  	struct cpmac_priv *priv = netdev_priv(dev);
>  	struct cpmac_desc *desc;
>  	int i;
> +
>  	if (unlikely(!priv->rx_head))
>  		return;
>  	desc = priv->rx_head;
> @@ -703,6 +708,7 @@ static void cpmac_clear_tx(struct net_device *dev)
>  {
>  	struct cpmac_priv *priv = netdev_priv(dev);
>  	int i;
> +
>  	if (unlikely(!priv->desc_ring))
>  		return;
>  	for (i = 0; i < CPMAC_QUEUES; i++) {
> @@ -821,6 +827,7 @@ static void cpmac_tx_timeout(struct net_device *dev)
>  static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
>  {
>  	struct cpmac_priv *priv = netdev_priv(dev);
> +
>  	if (!(netif_running(dev)))
>  		return -EINVAL;
>  	if (!priv->phy)
> @@ -1181,6 +1188,7 @@ fail:
>  static int cpmac_remove(struct platform_device *pdev)
>  {
>  	struct net_device *dev = platform_get_drvdata(pdev);
> +
>  	unregister_netdev(dev);
>  	free_netdev(dev);
>  	return 0;
> -- 
> 1.7.9.5
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 6/7] net: cpmac: fix proper spacing before return statement
  2014-07-10  5:35 ` [PATCH net v2 6/7] net: cpmac: fix proper spacing before return statement varkabhadram
@ 2014-07-10 13:09   ` Felipe Balbi
  0 siblings, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2014-07-10 13:09 UTC (permalink / raw)
  To: varkabhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

[-- Attachment #1: Type: text/plain, Size: 2471 bytes --]

On Thu, Jul 10, 2014 at 11:05:44AM +0530, varkabhadram@gmail.com wrote:
> From: Varka Bhadram <varkab@cdac.in>
> 
> This patch insert proper spaces before return statement.
> 
> Signed-off-by: Varka Bhadram <varkab@cdac.in>

can probably be merged with previous patch:

Reviewed-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/net/ethernet/ti/cpmac.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
> index 3d3ead4..b6efe3e 100644
> --- a/drivers/net/ethernet/ti/cpmac.c
> +++ b/drivers/net/ethernet/ti/cpmac.c
> @@ -283,6 +283,7 @@ static int cpmac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
>  		    MDIO_PHY(phy_id));
>  	while ((val = cpmac_read(bus->priv, CPMAC_MDIO_ACCESS(0))) & MDIO_BUSY)
>  		cpu_relax();
> +
>  	return MDIO_DATA(val);
>  }
>  
> @@ -293,6 +294,7 @@ static int cpmac_mdio_write(struct mii_bus *bus, int phy_id,
>  		cpu_relax();
>  	cpmac_write(bus->priv, CPMAC_MDIO_ACCESS(0), MDIO_BUSY | MDIO_WRITE |
>  		    MDIO_REG(reg) | MDIO_PHY(phy_id) | MDIO_DATA(val));
> +
>  	return 0;
>  }
>  
> @@ -308,6 +310,7 @@ static int cpmac_mdio_reset(struct mii_bus *bus)
>  	ar7_device_reset(AR7_RESET_BIT_MDIO);
>  	cpmac_write(bus->priv, CPMAC_MDIO_CONTROL, MDIOC_ENABLE |
>  		    MDIOC_CLKDIV(clk_get_rate(cpmac_clk) / 2200000 - 1));
> +
>  	return 0;
>  }
>  
> @@ -537,6 +540,7 @@ fatal_error:
>  	cpmac_hw_stop(priv->dev);
>  	if (!schedule_work(&priv->reset_work))
>  		atomic_dec(&priv->reset_pending);
> +
>  	return 0;
>  
>  }
> @@ -883,6 +887,7 @@ static int cpmac_set_ringparam(struct net_device *dev,
>  	if (netif_running(dev))
>  		return -EBUSY;
>  	priv->ring_size = ring->rx_pending;
> +
>  	return 0;
>  }
>  
> @@ -1076,6 +1081,7 @@ static int cpmac_stop(struct net_device *dev)
>  	dma_free_coherent(&dev->dev, sizeof(struct cpmac_desc) *
>  			  (CPMAC_QUEUES + priv->ring_size),
>  			  priv->desc_ring, priv->dma_ring);
> +
>  	return 0;
>  }
>  
> @@ -1178,6 +1184,7 @@ static int cpmac_probe(struct platform_device *pdev)
>  			 "mac: %pM\n", (void *)mem->start, dev->irq,
>  			 priv->phy_name, dev->dev_addr);
>  	}
> +
>  	return 0;
>  
>  fail:
> @@ -1191,6 +1198,7 @@ static int cpmac_remove(struct platform_device *pdev)
>  
>  	unregister_netdev(dev);
>  	free_netdev(dev);
> +
>  	return 0;
>  }
>  
> -- 
> 1.7.9.5
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net v2 7/7] net: cpmac: fix in releasing resources
  2014-07-10  5:35 ` [PATCH net v2 7/7] net: cpmac: fix in releasing resources varkabhadram
@ 2014-07-10 13:11   ` Felipe Balbi
  0 siblings, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2014-07-10 13:11 UTC (permalink / raw)
  To: varkabhadram
  Cc: netdev, mugunthanvnm, linux, balbi, george.cherian, davem, Varka Bhadram

[-- Attachment #1: Type: text/plain, Size: 1399 bytes --]

On Thu, Jul 10, 2014 at 11:05:45AM +0530, varkabhadram@gmail.com wrote:
> From: Varka Bhadram <varkab@cdac.in>
> 
> before registering the the net device this code freeing net device

remove one 'the'

> by using the label 'fail'
> 
> fixed by introducing an another label 'out'
> 
> Signed-off-by: Varka Bhadram <varkab@cdac.in>
> ---
>  drivers/net/ethernet/ti/cpmac.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
> index b6efe3e..b68c5b5 100644
> --- a/drivers/net/ethernet/ti/cpmac.c
> +++ b/drivers/net/ethernet/ti/cpmac.c
> @@ -1142,7 +1142,7 @@ static int cpmac_probe(struct platform_device *pdev)
>  	mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
>  	if (!mem) {
>  		rc = -ENODEV;
> -		goto fail;
> +		goto out;
>  	}
>  
>  	dev->irq = platform_get_irq_byname(pdev, "irq");
> @@ -1170,7 +1170,7 @@ static int cpmac_probe(struct platform_device *pdev)
>  			dev_err(&pdev->dev, "Could not attach to PHY\n");
>  
>  		rc = PTR_ERR(priv->phy);
> -		goto fail;
> +		goto out;
>  	}
>  
>  	rc = register_netdev(dev);
> @@ -1189,6 +1189,7 @@ static int cpmac_probe(struct platform_device *pdev)
>  
>  fail:
>  	free_netdev(dev);
> +out:

this will leak 'dev'.

>  	return rc;
>  }
>  
> -- 
> 1.7.9.5
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2014-07-10 13:12 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-10  5:35 [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver varkabhadram
2014-07-10  5:35 ` [PATCH net v2 1/7] net: cpmac: remove space in macro defination varkabhadram
2014-07-10 13:07   ` Felipe Balbi
2014-07-10  5:35 ` [PATCH net v2 2/7] net: cpmac: fix comments varkabhadram
2014-07-10 13:07   ` Felipe Balbi
2014-07-10  5:35 ` [PATCH net v2 3/7] net: cpmac: dynamic debug fixes varkabhadram
2014-07-10  8:31   ` Joe Perches
2014-07-10  8:45     ` Varka Bhadram
2014-07-10  9:03       ` Joe Perches
2014-07-10  9:35         ` Varka Bhadram
2014-07-10 10:10           ` Joe Perches
2014-07-10 10:11             ` Varka Bhadram
2014-07-10 10:17               ` Joe Perches
2014-07-10 13:08   ` Felipe Balbi
2014-07-10  5:35 ` [PATCH net v2 4/7] net: cpmac: fix cpmac driver structure varkabhadram
2014-07-10 13:08   ` Felipe Balbi
2014-07-10  5:35 ` [PATCH net v2 5/7] net: cpmac: fix missing a blank line after declarations varkabhadram
2014-07-10 13:08   ` Felipe Balbi
2014-07-10  5:35 ` [PATCH net v2 6/7] net: cpmac: fix proper spacing before return statement varkabhadram
2014-07-10 13:09   ` Felipe Balbi
2014-07-10  5:35 ` [PATCH net v2 7/7] net: cpmac: fix in releasing resources varkabhadram
2014-07-10 13:11   ` Felipe Balbi
2014-07-10  7:41 ` [PATCH net v2 0/7] cleanup for AR7 CPMAC Ethernet controller driver David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.