Skip to contentSkip to conversation

staging: et131x: Fix checkpatch whitespace warnings

PATCH In review Mark Einon 3 participants 6 messages Sep 3, 2011 – Sep 10, 2011 Staging

lore
Share & tools
lore

Mark Einon

author
#0 lore raw

PATCH 1/2 staging: et131x: Fix checkpatch whitespace warnings

Some of my previous hacking attempts have not been following the rules. All fixes either lines > 80 chars or whitespace corrections (spaces->tabs etc).

---
 drivers/staging/et131x/et1310_mac.c     |    5 ++-
 drivers/staging/et131x/et1310_phy.c     |   16 +++++++----
 drivers/staging/et131x/et1310_phy.h     |   27 +++++++++----------
 drivers/staging/et131x/et1310_tx.c      |    5 ++-
 drivers/staging/et131x/et131x_ethtool.c |    8 +++---
 drivers/staging/et131x/et131x_initpci.c |   44 +++++++++++++++---------------
 drivers/staging/et131x/et131x_isr.c     |    6 +++-
 drivers/staging/et131x/et131x_netdev.c  |    7 +++-
 8 files changed, 64 insertions(+), 54 deletions(-)
drivers/staging/et131x/et1310_mac.c +3 -2
index ab85cb3..36f2168 100644
@@ -191,7 +191,8 @@ void et1310_config_mac_regs2(struct et131x_adapter *adapter)
 	cfg1 |= CFG1_RX_ENABLE | CFG1_TX_ENABLE | CFG1_TX_FLOW;
 	/* Initialize loop back to off */
 	cfg1 &= ~(CFG1_LOOPBACK | CFG1_RX_FLOW);
-	if (adapter->flowcontrol == FLOW_RXONLY || adapter->flowcontrol == FLOW_BOTH)
+	if (adapter->flowcontrol == FLOW_RXONLY ||
+				adapter->flowcontrol == FLOW_BOTH)
 		cfg1 |= CFG1_RX_FLOW;
 	writel(cfg1, &mac->cfg1);
 
@@ -287,7 +288,7 @@ void et1310_config_rxmac_regs(struct et131x_adapter *adapter)
 	writel(sa_lo, &rxmac->sa_lo);
 
 	sa_hi = (u32) (adapter->addr[0] << ET_WOL_HI_SA1_SHIFT) |
-	               adapter->addr[1];
+		       adapter->addr[1];
 	writel(sa_hi, &rxmac->sa_hi);
 
 	/* Disable all Packet Filtering */
drivers/staging/et131x/et1310_phy.c +10 -6
index fedde6b..12345c7 100644
@@ -132,7 +132,7 @@ int et131x_mii_read(struct et131x_adapter *adapter, u8 reg, u16 *value)
 {
 	struct phy_device *phydev = adapter->phydev;
 
-	if(!phydev)
+	if (!phydev)
 		return -EIO;
 
 	return et131x_phy_mii_read(adapter, phydev->addr, reg, value);
@@ -224,7 +224,7 @@ int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value)
 	u32 mii_cmd;
 	u32 mii_indicator;
 
-	if(!phydev)
+	if (!phydev)
 		return -EIO;
 
 	addr = phydev->addr;
@@ -465,10 +465,12 @@ void et131x_mii_check(struct et131x_adapter *adapter,
 				u16 register18;
 
 				et131x_mii_read(adapter, 0x12, &register18);
-				et131x_mii_write(adapter, 0x12, register18 | 0x4);
+				et131x_mii_write(adapter, 0x12,
+						 register18 | 0x4);
 				et131x_mii_write(adapter, 0x10,
 						 register18 | 0x8402);
-				et131x_mii_write(adapter, 0x11, register18 | 511);
+				et131x_mii_write(adapter, 0x11,
+						 register18 | 511);
 				et131x_mii_write(adapter, 0x12, register18);
 			}
 
@@ -529,10 +531,12 @@ void et131x_mii_check(struct et131x_adapter *adapter,
 				u16 register18;
 
 				et131x_mii_read(adapter, 0x12, &register18);
-				et131x_mii_write(adapter, 0x12, register18 | 0x4);
+				et131x_mii_write(adapter, 0x12,
+						 register18 | 0x4);
 				et131x_mii_write(adapter, 0x10,
 						 register18 | 0x8402);
-				et131x_mii_write(adapter, 0x11, register18 | 511);
+				et131x_mii_write(adapter, 0x11,
+						 register18 | 511);
 				et131x_mii_write(adapter, 0x12, register18);
 			}
 
drivers/staging/et131x/et1310_phy.h +13 -14
index d8753f1..88dc8cd 100644
@@ -280,19 +280,18 @@ struct mi_regs {
 #define PHY_INDEX_REG              0x10
 #define PHY_DATA_REG               0x11
 
-#define PHY_MPHY_CONTROL_REG       0x12	/* #define TRU_VMI_MPHY_CONTROL_REGISTER           18 */
-
-#define PHY_LOOPBACK_CONTROL       0x13	/* #define TRU_VMI_LOOPBACK_CONTROL_1_REGISTER     19 */
-					/* #define TRU_VMI_LOOPBACK_CONTROL_2_REGISTER     20 */
-#define PHY_REGISTER_MGMT_CONTROL  0x15	/* #define TRU_VMI_MI_SEQ_CONTROL_REGISTER         21 */
-#define PHY_CONFIG                 0x16	/* #define TRU_VMI_CONFIGURATION_REGISTER          22 */
-#define PHY_PHY_CONTROL            0x17	/* #define TRU_VMI_PHY_CONTROL_REGISTER            23 */
-#define PHY_INTERRUPT_MASK         0x18	/* #define TRU_VMI_INTERRUPT_MASK_REGISTER         24 */
-#define PHY_INTERRUPT_STATUS       0x19	/* #define TRU_VMI_INTERRUPT_STATUS_REGISTER       25 */
-#define PHY_PHY_STATUS             0x1A	/* #define TRU_VMI_PHY_STATUS_REGISTER             26 */
-#define PHY_LED_1                  0x1B	/* #define TRU_VMI_LED_CONTROL_1_REGISTER          27 */
-#define PHY_LED_2                  0x1C	/* #define TRU_VMI_LED_CONTROL_2_REGISTER          28 */
-					/* #define TRU_VMI_LINK_CONTROL_REGISTER           29 */
-					/* #define TRU_VMI_TIMING_CONTROL_REGISTER */
+#define PHY_MPHY_CONTROL_REG       0x12
+#define PHY_LOOPBACK_CONTROL       0x13	/* TRU_VMI_LOOPBACK_CONTROL_1_REG 19 */
+					/* TRU_VMI_LOOPBACK_CONTROL_2_REG 20 */
+#define PHY_REGISTER_MGMT_CONTROL  0x15	/* TRU_VMI_MI_SEQ_CONTROL_REG     21 */
+#define PHY_CONFIG                 0x16	/* TRU_VMI_CONFIGURATION_REG      22 */
+#define PHY_PHY_CONTROL            0x17	/* TRU_VMI_PHY_CONTROL_REG        23 */
+#define PHY_INTERRUPT_MASK         0x18	/* TRU_VMI_INTERRUPT_MASK_REG     24 */
+#define PHY_INTERRUPT_STATUS       0x19	/* TRU_VMI_INTERRUPT_STATUS_REG   25 */
+#define PHY_PHY_STATUS             0x1A	/* TRU_VMI_PHY_STATUS_REG         26 */
+#define PHY_LED_1                  0x1B	/* TRU_VMI_LED_CONTROL_1_REG      27 */
+#define PHY_LED_2                  0x1C	/* TRU_VMI_LED_CONTROL_2_REG      28 */
+					/* TRU_VMI_LINK_CONTROL_REG       29 */
+					/* TRU_VMI_TIMING_CONTROL_REG        */
 
 #endif /* _ET1310_PHY_H_ */
drivers/staging/et131x/et1310_tx.c +3 -2
index f821104..aa07138 100644
@@ -435,7 +435,7 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb)
 	add_10bit(&adapter->tx_ring.send_idx, thiscopy);
 
 	if (INDEX10(adapter->tx_ring.send_idx) == 0 ||
-		    INDEX10(adapter->tx_ring.send_idx) == NUM_DESC_PER_RING_TX) {
+		  INDEX10(adapter->tx_ring.send_idx) == NUM_DESC_PER_RING_TX) {
 		adapter->tx_ring.send_idx &= ~ET_DMA10_MASK;
 		adapter->tx_ring.send_idx ^= ET_DMA10_WRAP;
 	}
@@ -641,7 +641,8 @@ static inline void free_send_packet(struct et131x_adapter *adapter,
 		 * they point to
 		 */
 		do {
-			desc = (struct tx_desc *)(adapter->tx_ring.tx_desc_ring +
+			desc = (struct tx_desc *)
+				    (adapter->tx_ring.tx_desc_ring +
 						INDEX10(tcb->index_start));
 
 			pci_unmap_single(adapter->pdev,
drivers/staging/et131x/et131x_ethtool.c +4 -4
index d980ad6..b92633f 100644
@@ -58,10 +58,10 @@ static void et131x_get_drvinfo(struct net_device *netdev,
 }
 
 static struct ethtool_ops et131x_ethtool_ops = {
-        .get_settings = et131x_get_settings,
-        .set_settings = et131x_set_settings,
-        .get_drvinfo = et131x_get_drvinfo,
-        .get_link = ethtool_op_get_link,
+	.get_settings = et131x_get_settings,
+	.set_settings = et131x_set_settings,
+	.get_drvinfo = et131x_get_drvinfo,
+	.get_link = ethtool_op_get_link,
 };
 
 void et131x_set_ethtool_ops(struct net_device *netdev)
drivers/staging/et131x/et131x_initpci.c +22 -22

74 lines not on this page · raw message

drivers/staging/et131x/et131x_isr.c +4 -2
index 4d75690..94565c1 100644
@@ -119,7 +119,8 @@ void et131x_enable_interrupts(struct et131x_adapter *adapter)
 	u32 mask;
 
 	/* Enable all global interrupts */
-	if (adapter->flowcontrol == FLOW_TXONLY || adapter->flowcontrol == FLOW_BOTH)
+	if (adapter->flowcontrol == FLOW_TXONLY ||
+			    adapter->flowcontrol == FLOW_BOTH)
 		mask = INT_MASK_ENABLE;
 	else
 		mask = INT_MASK_ENABLE_NO_FLOW;
@@ -276,7 +277,8 @@ void et131x_isr_handler(struct work_struct *work)
 		}
 
 		/* Handle Free Buffer Ring 0 and 1 Low interrupt */
-		if (status & (ET_INTR_RXDMA_FB_R0_LOW | ET_INTR_RXDMA_FB_R1_LOW)) {
+		if (status &
+		    (ET_INTR_RXDMA_FB_R0_LOW | ET_INTR_RXDMA_FB_R1_LOW)) {
 			/*
 			 * This indicates the number of unused buffers in
 			 * RXDMA free buffer ring 0 is <= the limit you
drivers/staging/et131x/et131x_netdev.c +5 -2
index d12e05e..5fb4056 100644
@@ -408,7 +408,7 @@ void et131x_tx_timeout(struct net_device *netdev)
 	unsigned long flags;
 
 	/* If the device is closed, ignore the timeout */
-	if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE));
+	if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE))
 		return;
 
 	/* Any nonrecoverable hardware error?
@@ -453,7 +453,10 @@ void et131x_tx_timeout(struct net_device *netdev)
 			/* Disable device interrupts */
 			et131x_disable_interrupts(adapter);
 
-			/* Enable the Tx and Rx DMA engines (if not already enabled) */
+			/*
+			 * Enable the Tx and Rx DMA engines
+			 * (if not already enabled)
+			 */
 			et131x_rx_dma_enable(adapter);
 			et131x_tx_dma_enable(adapter);
 
Signature · 1 line
1.7.6
author
#1 lore raw

PATCH 2/2 staging: et131x: Amend README file

I think the kernel style cleanups are done now.
Adding myself as a recipient of patches.

---
 drivers/staging/et131x/README |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/et131x/README +1 -1
index 28752a5..c6bcc6a 100644
@@ -9,7 +9,6 @@ Note, the powermanagement options were removed from the vendor provided
 driver as they did not build properly at the time.
 
 TODO:
-	- kernel coding style cleanups
 	- forward port for latest network driver changes
 	- kill useless typecasts (e.g. in et1310_phy.c)
 	- alloc_etherdev is initializing memory with zero?!?
@@ -19,6 +18,7 @@ TODO:
 
 Please send patches to:
 	Greg Kroah-Hartman <[email protected]>
+	Mark Einon <[email protected]>
 
 And Cc: Olaf Hartmann <[email protected]> as he has this device and can
 test any changes.
Signature · 1 line
1.7.6
#2 lore raw
In reply to Mark Einon

drivers/staging/et131x/et131x_netdev.c void et131x_tx_timeout(struct net_device *netdev) · line 413

Quoted 10 lines · Mark Einon
drivers/staging/et131x/et131x_netdev.c +1 -1
@@ -408,7 +408,7 @@ void et131x_tx_timeout(struct net_device *netdev)
 	unsigned long flags;
 
 	/* If the device is closed, ignore the timeout */
-	if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE));
+	if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE))
 		return;
 

You fixed a bug here. That's not mentioned in the commit message. Why would you want to keep that a secret? Also it should go in a separate commit.

But otherwise this patch looks good.

regards,
dan carpenter

author
#3 lore raw
Quoted 6 lines · Dan Carpenter
Quoted 5 lines · Mark Einon
drivers/staging/et131x/et131x_netdev.c +0 -0
@@ -408,7 +408,7 @@ void et131x_tx_timeout(struct net_device *netdev)
       unsigned long flags;
 
Quoted 9 lines

drivers/staging/et131x/et131x_netdev.c void et131x_tx_timeout(struct net_device *netdev) · line 413

Quoted 5 lines
drivers/staging/et131x/et131x_netdev.c +1 -1
       /* If the device is closed, ignore the timeout */
-     if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE));
+     if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE))
               return;
 

You fixed a bug here.  That's not mentioned in the commit message. Why would you want to keep that a secret?  Also it should go in a separate commit.

Oh yes, i did, didn't I? I must have forgot that was there.

Thanks for the spot.

Would you like it in a different patch?

Cheers,

Mark

#4 lore raw
In reply to Mark Einon
Quoted 2 lines · Mark Einon

Some of my previous hacking attempts have not been following the rules. All fixes either lines > 80 chars or whitespace corrections (spaces->tabs etc).

[]

drivers/staging/et131x/et1310_mac.c void et1310_config_mac_regs2(struct et131x_adapter *adapter) · line 195

Quoted 11 lines
drivers/staging/et131x/et1310_mac.c +2 -1
index ab85cb3..36f2168 100644
@@ -191,7 +191,8 @@ void et1310_config_mac_regs2(struct et131x_adapter *adapter)
 	cfg1 |= CFG1_RX_ENABLE | CFG1_TX_ENABLE | CFG1_TX_FLOW;
 	/* Initialize loop back to off */
 	cfg1 &= ~(CFG1_LOOPBACK | CFG1_RX_FLOW);
-	if (adapter->flowcontrol == FLOW_RXONLY || adapter->flowcontrol == FLOW_BOTH)
+	if (adapter->flowcontrol == FLOW_RXONLY ||
+				adapter->flowcontrol == FLOW_BOTH)

Especially in cases like this, it helps readability to align to open parenthesis like:

	if (adapter->flowcontrol == FLOW_RXONLY ||
	    adapter->flowcontrol == FLOW_BOTH)

[]

drivers/staging/et131x/et1310_mac.c static inline void free_send_packet(struct et131x_adapter *adapter, · line 646

Quoted 8 lines
drivers/staging/et131x/et1310_mac.c +2 -1
@@ -641,7 +641,8 @@ static inline void free_send_packet(struct et131x_adapter *adapter,
 		 * they point to
 		 */
 		do {
-			desc = (struct tx_desc *)(adapter->tx_ring.tx_desc_ring +
+			desc = (struct tx_desc *)
+				    (adapter->tx_ring.tx_desc_ring +
 						INDEX10(tcb->index_start));

Isn't this an unnecessary cast?
Perhaps it's better as:

			u32 i10 = INDEX10(tcb->index_start);

			desc = &adapter->tx_ring.tx_desc_ring[i10];
author
#5 lore raw
Quoted 19 lines · Joe Perches
Quoted 2 lines · Mark Einon

Some of my previous hacking attempts have not been following the rules. All fixes either lines > 80 chars or whitespace corrections (spaces->tabs etc).

[]

drivers/staging/et131x/et1310_mac.c void et1310_config_mac_regs2(struct et131x_adapter *adapter) · line 195

Quoted 11 lines
drivers/staging/et131x/et1310_mac.c +2 -1
index ab85cb3..36f2168 100644
@@ -191,7 +191,8 @@ void et1310_config_mac_regs2(struct et131x_adapter *adapter)
       cfg1 |= CFG1_RX_ENABLE | CFG1_TX_ENABLE | CFG1_TX_FLOW;
       /* Initialize loop back to off */
       cfg1 &= ~(CFG1_LOOPBACK | CFG1_RX_FLOW);
-     if (adapter->flowcontrol == FLOW_RXONLY || adapter->flowcontrol == FLOW_BOTH)
+     if (adapter->flowcontrol == FLOW_RXONLY ||
+                             adapter->flowcontrol == FLOW_BOTH)

Especially in cases like this, it helps readability to align to open parenthesis like:

Quoted 3 lines

       if (adapter->flowcontrol == FLOW_RXONLY ||
           adapter->flowcontrol == FLOW_BOTH)

Thanks, noted. I'll bear it in mind for next time...

Quoted 13 lines

[]

drivers/staging/et131x/et1310_mac.c static inline void free_send_packet(struct et131x_adapter *adapter, · line 646

Quoted 8 lines
drivers/staging/et131x/et1310_mac.c +2 -1
@@ -641,7 +641,8 @@ static inline void free_send_packet(struct et131x_adapter *adapter,
                * they point to
                */
               do {
-                     desc = (struct tx_desc *)(adapter->tx_ring.tx_desc_ring +
+                     desc = (struct tx_desc *)
+                                 (adapter->tx_ring.tx_desc_ring +
                                               INDEX10(tcb->index_start));

Isn't this an unnecessary cast?
Perhaps it's better as:

Quoted 3 lines

                       u32 i10 = INDEX10(tcb->index_start);

                       desc = &adapter->tx_ring.tx_desc_ring[i10];

That sounds like a good idea. I'll add it to the list when I go through the tx/rx code for the driver.

Cheers,

Mark