linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] staging: et131x: checkpatch fixes
@ 2011-06-05 17:35 Mark Einon
  2011-06-05 17:35 ` [PATCH 1/5] staging: et131x: et1310_address_map.h " Mark Einon
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Mark Einon @ 2011-06-05 17:35 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann

These have been build-tested only.

Mark Einon(5):
 staging: et131x: et1310_address_map.h checkpatch fixes
 staging: et131x: et1310_rx.c checkpatch fixes
 staging: et131x: et131x_adapter.h checkpatch fixes
 staging: et131x: et131x_initpci.c checkpatch fixes
 staging: et131x: et131x_netdev.c checkpatch fixes

 drivers/staging/et131x/et1310_address_map.h |   62 +++++-----
 drivers/staging/et131x/et1310_mac.c         |   26 ++--
 drivers/staging/et131x/et1310_phy.c         |    6 +-
 drivers/staging/et131x/et1310_rx.c          |  193 +++++++++++++--------------
 drivers/staging/et131x/et131x_adapter.h     |   10 +-
 drivers/staging/et131x/et131x_initpci.c     |   29 ++--
 drivers/staging/et131x/et131x_isr.c         |    2 +-
 drivers/staging/et131x/et131x_netdev.c      |  114 +++++++---------
 8 files changed, 216 insertions(+), 226 deletions(-)


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

* [PATCH 1/5] staging: et131x: et1310_address_map.h checkpatch fixes
  2011-06-05 17:35 [PATCH 0/5] staging: et131x: checkpatch fixes Mark Einon
@ 2011-06-05 17:35 ` Mark Einon
  2011-06-05 19:14   ` Alan Cox
  2011-06-05 17:35 ` [PATCH 2/5] staging: et131x: et1310_rx.c " Mark Einon
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Mark Einon @ 2011-06-05 17:35 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon, Mark Einon

From: Mark Einon <Mark.Einon@gmail.com>

Fixes multiple 'WARNING: do not add new typedefs'.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et1310_address_map.h |   62 +++++++++++++-------------
 drivers/staging/et131x/et1310_mac.c         |   24 +++++-----
 drivers/staging/et131x/et1310_phy.c         |    6 +-
 drivers/staging/et131x/et131x_adapter.h     |    2 +-
 drivers/staging/et131x/et131x_isr.c         |    2 +-
 5 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index 425e927..6f52627 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -701,7 +701,7 @@ struct txmac_regs {			/* Location: */
  * structure for Wake On Lan Source Address Lo reg in rxmac address map
  * located at address 0x4010
  */
-typedef union _RXMAC_WOL_SA_LO_t {
+union RXMAC_WOL_SA_LO_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -716,13 +716,13 @@ typedef union _RXMAC_WOL_SA_LO_t {
 		u32 sa3:8;	/* bits 24-31 */
 #endif
 	} bits;
-} RXMAC_WOL_SA_LO_t, *PRXMAC_WOL_SA_LO_t;
+};
 
 /*
  * structure for Wake On Lan Source Address Hi reg in rxmac address map
  * located at address 0x4014
  */
-typedef union _RXMAC_WOL_SA_HI_t {
+union RXMAC_WOL_SA_HI_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -735,7 +735,7 @@ typedef union _RXMAC_WOL_SA_HI_t {
 		u32 reserved:16;	/* bits 16-31 */
 #endif
 	} bits;
-} RXMAC_WOL_SA_HI_t, *PRXMAC_WOL_SA_HI_t;
+};
 
 /*
  * structure for Wake On Lan mask reg in rxmac address map
@@ -747,7 +747,7 @@ typedef union _RXMAC_WOL_SA_HI_t {
  * structure for Unicast Paket Filter Address 1 reg in rxmac address map
  * located at address 0x4068
  */
-typedef union _RXMAC_UNI_PF_ADDR1_t {
+union RXMAC_UNI_PF_ADDR1_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -762,13 +762,13 @@ typedef union _RXMAC_UNI_PF_ADDR1_t {
 		u32 addr1_3:8;	/* bits 24-31 */
 #endif
 	} bits;
-} RXMAC_UNI_PF_ADDR1_t, *PRXMAC_UNI_PF_ADDR1_t;
+};
 
 /*
  * structure for Unicast Paket Filter Address 2 reg in rxmac address map
  * located at address 0x406C
  */
-typedef union _RXMAC_UNI_PF_ADDR2_t {
+union RXMAC_UNI_PF_ADDR2_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -783,13 +783,13 @@ typedef union _RXMAC_UNI_PF_ADDR2_t {
 		u32 addr2_3:8;	/* bits 24-31 */
 #endif
 	} bits;
-} RXMAC_UNI_PF_ADDR2_t, *PRXMAC_UNI_PF_ADDR2_t;
+};
 
 /*
  * structure for Unicast Paket Filter Address 1 & 2 reg in rxmac address map
  * located at address 0x4070
  */
-typedef union _RXMAC_UNI_PF_ADDR3_t {
+union RXMAC_UNI_PF_ADDR3_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -804,7 +804,7 @@ typedef union _RXMAC_UNI_PF_ADDR3_t {
 		u32 addr2_1:8;	/* bits 24-31 */
 #endif
 	} bits;
-} RXMAC_UNI_PF_ADDR3_t, *PRXMAC_UNI_PF_ADDR3_t;
+};
 
 /*
  * structure for Multicast Hash reg in rxmac address map
@@ -888,13 +888,13 @@ typedef union _RXMAC_UNI_PF_ADDR3_t {
 /*
  * Rx MAC Module of JAGCore Address Mapping
  */
-typedef struct _RXMAC_t {				/* Location: */
+struct RXMAC_t {					/* Location: */
 	u32 ctrl;					/*  0x4000 */
 	u32 crc0;					/*  0x4004 */
 	u32 crc12;					/*  0x4008 */
 	u32 crc34;					/*  0x400C */
-	RXMAC_WOL_SA_LO_t sa_lo;			/*  0x4010 */
-	RXMAC_WOL_SA_HI_t sa_hi;			/*  0x4014 */
+	union RXMAC_WOL_SA_LO_t sa_lo;			/*  0x4010 */
+	union RXMAC_WOL_SA_HI_t sa_hi;			/*  0x4014 */
 	u32 mask0_word0;				/*  0x4018 */
 	u32 mask0_word1;				/*  0x401C */
 	u32 mask0_word2;				/*  0x4020 */
@@ -915,9 +915,9 @@ typedef struct _RXMAC_t {				/* Location: */
 	u32 mask4_word1;				/*  0x405C */
 	u32 mask4_word2;				/*  0x4060 */
 	u32 mask4_word3;				/*  0x4064 */
-	RXMAC_UNI_PF_ADDR1_t uni_pf_addr1;		/*  0x4068 */
-	RXMAC_UNI_PF_ADDR2_t uni_pf_addr2;		/*  0x406C */
-	RXMAC_UNI_PF_ADDR3_t uni_pf_addr3;		/*  0x4070 */
+	union RXMAC_UNI_PF_ADDR1_t uni_pf_addr1;	/*  0x4068 */
+	union RXMAC_UNI_PF_ADDR2_t uni_pf_addr2;	/*  0x406C */
+	union RXMAC_UNI_PF_ADDR3_t uni_pf_addr3;	/*  0x4070 */
 	u32 multi_hash1;				/*  0x4074 */
 	u32 multi_hash2;				/*  0x4078 */
 	u32 multi_hash3;				/*  0x407C */
@@ -930,7 +930,7 @@ typedef struct _RXMAC_t {				/* Location: */
 
 	u32 mif_ctrl;					/*  0x4098 */
 	u32 err_reg;					/*  0x409C */
-} RXMAC_t, *PRXMAC_t;
+};
 
 /* END OF RXMAC REGISTER ADDRESS MAP */
 
@@ -1124,7 +1124,7 @@ typedef struct _RXMAC_t {				/* Location: */
  * structure for Mac Station Address, Part 1 reg in mac address map.
  * located at address 0x5040
  */
-typedef union _MAC_STATION_ADDR1_t {
+union MAC_STATION_ADDR1_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -1139,13 +1139,13 @@ typedef union _MAC_STATION_ADDR1_t {
 		u32 Octet6:8;	/* bits 24-31 */
 #endif
 	} bits;
-} MAC_STATION_ADDR1_t, *PMAC_STATION_ADDR1_t;
+};
 
 /*
  * structure for Mac Station Address, Part 2 reg in mac address map.
  * located at address 0x5044
  */
-typedef union _MAC_STATION_ADDR2_t {
+union MAC_STATION_ADDR2_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -1158,12 +1158,12 @@ typedef union _MAC_STATION_ADDR2_t {
 		u32 Octet2:8;	/* bits 24-31 */
 #endif
 	} bits;
-} MAC_STATION_ADDR2_t, *PMAC_STATION_ADDR2_t;
+};
 
 /*
  * MAC Module of JAGCore Address Mapping
  */
-typedef struct _MAC_t {					/* Location: */
+struct MAC_t {						/* Location: */
 	u32 cfg1;					/*  0x5000 */
 	u32 cfg2;					/*  0x5004 */
 	u32 ipg;					/*  0x5008 */
@@ -1180,9 +1180,9 @@ typedef struct _MAC_t {					/* Location: */
 	u32 mii_mgmt_indicator;				/*  0x5034 */
 	u32 if_ctrl;					/*  0x5038 */
 	u32 if_stat;					/*  0x503C */
-	MAC_STATION_ADDR1_t station_addr_1;		/*  0x5040 */
-	MAC_STATION_ADDR2_t station_addr_2;		/*  0x5044 */
-} MAC_t, *PMAC_t;
+	union MAC_STATION_ADDR1_t station_addr_1;	/*  0x5040 */
+	union MAC_STATION_ADDR2_t station_addr_2;	/*  0x5044 */
+};
 
 /* END OF MAC REGISTER ADDRESS MAP */
 
@@ -1448,7 +1448,7 @@ struct mmc_regs {		/* Location: */
 /*
  * JAGCore Address Mapping
  */
-typedef struct _ADDRESS_MAP_t {
+struct ADDRESS_MAP_t {
 	struct global_regs global;
 	/* unused section of global address map */
 	u8 unused_global[4096 - sizeof(struct global_regs)];
@@ -1461,12 +1461,12 @@ typedef struct _ADDRESS_MAP_t {
 	struct txmac_regs txmac;
 	/* unused section of txmac address map */
 	u8 unused_txmac[4096 - sizeof(struct txmac_regs)];
-	RXMAC_t rxmac;
+	struct RXMAC_t rxmac;
 	/* unused section of rxmac address map */
-	u8 unused_rxmac[4096 - sizeof(RXMAC_t)];
-	MAC_t mac;
+	u8 unused_rxmac[4096 - sizeof(struct RXMAC_t)];
+	struct MAC_t mac;
 	/* unused section of mac address map */
-	u8 unused_mac[4096 - sizeof(MAC_t)];
+	u8 unused_mac[4096 - sizeof(struct MAC_t)];
 	struct macstat_regs macstat;
 	/* unused section of mac stat address map */
 	u8 unused_mac_stat[4096 - sizeof(struct macstat_regs)];
@@ -1478,6 +1478,6 @@ typedef struct _ADDRESS_MAP_t {
 
 	u8 unused_exp_rom[4096];	/* MGS-size TBD */
 	u8 unused__[524288];	/* unused section of address map */
-} ADDRESS_MAP_t, *PADDRESS_MAP_t;
+};
 
 #endif /* _ET1310_ADDRESS_MAP_H_ */
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index 78f72fa..c634e35 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -104,9 +104,9 @@
  */
 void ConfigMACRegs1(struct et131x_adapter *etdev)
 {
-	struct _MAC_t __iomem *pMac = &etdev->regs->mac;
-	MAC_STATION_ADDR1_t station1;
-	MAC_STATION_ADDR2_t station2;
+	struct MAC_t __iomem *pMac = &etdev->regs->mac;
+	union MAC_STATION_ADDR1_t station1;
+	union MAC_STATION_ADDR2_t station2;
 	u32 ipg;
 
 	/* First we need to reset everything.  Write to MAC configuration
@@ -165,7 +165,7 @@ void ConfigMACRegs1(struct et131x_adapter *etdev)
 void ConfigMACRegs2(struct et131x_adapter *etdev)
 {
 	int32_t delay = 0;
-	struct _MAC_t __iomem *pMac = &etdev->regs->mac;
+	struct MAC_t __iomem *pMac = &etdev->regs->mac;
 	u32 cfg1;
 	u32 cfg2;
 	u32 ifctrl;
@@ -237,9 +237,9 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
 
 void ConfigRxMacRegs(struct et131x_adapter *etdev)
 {
-	struct _RXMAC_t __iomem *pRxMac = &etdev->regs->rxmac;
-	RXMAC_WOL_SA_LO_t sa_lo;
-	RXMAC_WOL_SA_HI_t sa_hi;
+	struct RXMAC_t __iomem *pRxMac = &etdev->regs->rxmac;
+	union RXMAC_WOL_SA_LO_t sa_lo;
+	union RXMAC_WOL_SA_HI_t sa_hi;
 	u32 pf_ctrl = 0;
 
 	/* Disable the MAC while it is being configured (also disable WOL) */
@@ -534,7 +534,7 @@ void HandleMacStatInterrupt(struct et131x_adapter *etdev)
 
 void SetupDeviceForMulticast(struct et131x_adapter *etdev)
 {
-	struct _RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
+	struct RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
 	uint32_t nIndex;
 	uint32_t result;
 	uint32_t hash1 = 0;
@@ -582,10 +582,10 @@ void SetupDeviceForMulticast(struct et131x_adapter *etdev)
 
 void SetupDeviceForUnicast(struct et131x_adapter *etdev)
 {
-	struct _RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
-	RXMAC_UNI_PF_ADDR1_t uni_pf1;
-	RXMAC_UNI_PF_ADDR2_t uni_pf2;
-	RXMAC_UNI_PF_ADDR3_t uni_pf3;
+	struct RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
+	union RXMAC_UNI_PF_ADDR1_t uni_pf1;
+	union RXMAC_UNI_PF_ADDR2_t uni_pf2;
+	union RXMAC_UNI_PF_ADDR3_t uni_pf3;
 	u32 pm_csr;
 
 	/* Set up unicast packet filter reg 3 to be the first two octets of
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 2798a2f..bc8d385 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -108,7 +108,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev);
 int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr,
 	      u8 xcvrReg, u16 *value)
 {
-	struct _MAC_t __iomem *mac = &etdev->regs->mac;
+	struct MAC_t __iomem *mac = &etdev->regs->mac;
 	int status = 0;
 	u32 delay;
 	u32 miiAddr;
@@ -176,7 +176,7 @@ int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr,
  */
 int MiWrite(struct et131x_adapter *etdev, u8 xcvrReg, u16 value)
 {
-	struct _MAC_t __iomem *mac = &etdev->regs->mac;
+	struct MAC_t __iomem *mac = &etdev->regs->mac;
 	int status = 0;
 	u8 xcvrAddr = etdev->Stats.xcvr_addr;
 	u32 delay;
@@ -590,7 +590,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)
 	/* Set the link status interrupt only.  Bad behavior when link status
 	 * and auto neg are set, we run into a nested interrupt problem
 	 */
-        imr |= 0x0105;
+	imr |= 0x0105;
 
 	MiWrite(etdev, (u8) offsetof(struct mi_regs, imr), imr);
 
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index c852f86..c9a119e 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -186,7 +186,7 @@ struct et131x_adapter {
 	u8 MCList[NIC_MAX_MCAST_LIST][ETH_ALEN];
 
 	/* Pointer to the device's PCI register space */
-	ADDRESS_MAP_t __iomem *regs;
+	struct ADDRESS_MAP_t __iomem *regs;
 
 	/* Registry parameters */
 	u8 SpeedDuplex;		/* speed/duplex */
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index f716e40..7c7b464 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -245,7 +245,7 @@ void et131x_isr_handler(struct work_struct *work)
 	struct et131x_adapter *etdev =
 		container_of(work, struct et131x_adapter, task);
 	u32 status = etdev->Stats.InterruptStatus;
-	ADDRESS_MAP_t __iomem *iomem = etdev->regs;
+	struct ADDRESS_MAP_t __iomem *iomem = etdev->regs;
 
 	/*
 	 * These first two are by far the most common.  Once handled, we clear
-- 
1.7.4.4


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

* [PATCH 2/5] staging: et131x: et1310_rx.c checkpatch fixes
  2011-06-05 17:35 [PATCH 0/5] staging: et131x: checkpatch fixes Mark Einon
  2011-06-05 17:35 ` [PATCH 1/5] staging: et131x: et1310_address_map.h " Mark Einon
@ 2011-06-05 17:35 ` Mark Einon
  2011-06-05 19:08   ` Alan Cox
  2011-06-05 17:35 ` [PATCH 3/5] staging: et131x: et131x_adapter.h " Mark Einon
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Mark Einon @ 2011-06-05 17:35 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon, Mark Einon

From: Mark Einon <Mark.Einon@gmail.com>

Fixes extern in .c file and formatting issues.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et1310_rx.c |  193 ++++++++++++++++++------------------
 1 files changed, 96 insertions(+), 97 deletions(-)

diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index fc6bd43..cd72a0b 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -88,7 +88,23 @@
 #include "et1310_rx.h"
 #include "et131x.h"
 
-void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd);
+static inline u32 bump_fbr(u32 *fbr, u32 limit)
+{
+	u32 v = *fbr;
+	v++;
+	/* This works for all cases where limit < 1024. The 1023 case
+	   works because 1023++ is 1024 which means the if condition is not
+	   taken but the carry of the bit into the wrap bit toggles the wrap
+	   value correctly */
+	if ((v & ET_DMA10_MASK) > limit) {
+		v &= ~ET_DMA10_MASK;
+		v ^= ET_DMA10_WRAP;
+	}
+	/* For the 1023 case */
+	v &= (ET_DMA10_MASK|ET_DMA10_WRAP);
+	*fbr = v;
+	return v;
+}
 
 /**
  * et131x_rx_dma_memory_alloc
@@ -246,7 +262,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
 					 &rx_ring->Fbr1MemPa[i]);
 
 		if (!rx_ring->Fbr1MemVa[i]) {
-		dev_err(&adapter->pdev->dev,
+			dev_err(&adapter->pdev->dev,
 				"Could not alloc memory\n");
 			return -ENOMEM;
 		}
@@ -491,7 +507,7 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
 	/* Free Packet Status Ring */
 	if (rx_ring->pPSRingVa) {
 		pktStatRingSize =
-		    sizeof(struct pkt_stat_desc) * adapter->rx_ring.PsrNumEntries;
+		  sizeof(struct pkt_stat_desc) * adapter->rx_ring.PsrNumEntries;
 
 		pci_free_consistent(adapter->pdev, pktStatRingSize,
 				    rx_ring->pPSRingVa, rx_ring->pPSRingPa);
@@ -708,6 +724,82 @@ void SetRxDmaTimer(struct et131x_adapter *etdev)
 }
 
 /**
+ * NICReturnRFD - Recycle a RFD and put it back onto the receive list
+ * @etdev: pointer to our adapter
+ * @rfd: pointer to the RFD
+ */
+void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
+{
+	struct rx_ring *rx_local = &etdev->rx_ring;
+	struct rxdma_regs __iomem *rx_dma = &etdev->regs->rxdma;
+	u16 bi = rfd->bufferindex;
+	u8 ri = rfd->ringindex;
+	unsigned long flags;
+
+	/* We don't use any of the OOB data besides status. Otherwise, we
+	 * need to clean up OOB data
+	 */
+	if (
+#ifdef USE_FBR0
+	    (ri == 0 && bi < rx_local->Fbr0NumEntries) ||
+#endif
+	    (ri == 1 && bi < rx_local->Fbr1NumEntries)) {
+		spin_lock_irqsave(&etdev->FbrLock, flags);
+
+		if (ri == 1) {
+			struct fbr_desc *next =
+			    (struct fbr_desc *) (rx_local->pFbr1RingVa) +
+					 INDEX10(rx_local->local_Fbr1_full);
+
+			/* Handle the Free Buffer Ring advancement here. Write
+			 * the PA / Buffer Index for the returned buffer into
+			 * the oldest (next to be freed)FBR entry
+			 */
+			next->addr_hi = rx_local->fbr[1]->bus_high[bi];
+			next->addr_lo = rx_local->fbr[1]->bus_low[bi];
+			next->word2 = bi;
+
+			writel(bump_fbr(&rx_local->local_Fbr1_full,
+				rx_local->Fbr1NumEntries - 1),
+				&rx_dma->fbr1_full_offset);
+		}
+#ifdef USE_FBR0
+		else {
+			struct fbr_desc *next = (struct fbr_desc *)
+				rx_local->pFbr0RingVa +
+					INDEX10(rx_local->local_Fbr0_full);
+
+			/* Handle the Free Buffer Ring advancement here. Write
+			 * the PA / Buffer Index for the returned buffer into
+			 * the oldest (next to be freed) FBR entry
+			 */
+			next->addr_hi = rx_local->fbr[0]->bus_high[bi];
+			next->addr_lo = rx_local->fbr[0]->bus_low[bi];
+			next->word2 = bi;
+
+			writel(bump_fbr(&rx_local->local_Fbr0_full,
+					rx_local->Fbr0NumEntries - 1),
+			       &rx_dma->fbr0_full_offset);
+		}
+#endif
+		spin_unlock_irqrestore(&etdev->FbrLock, flags);
+	} else {
+		dev_err(&etdev->pdev->dev,
+			  "NICReturnRFD illegal Buffer Index returned\n");
+	}
+
+	/* The processing on this RFD is done, so put it back on the tail of
+	 * our list
+	 */
+	spin_lock_irqsave(&etdev->rcv_lock, flags);
+	list_add_tail(&rfd->list_node, &rx_local->RecvList);
+	rx_local->nReadyRecv++;
+	spin_unlock_irqrestore(&etdev->rcv_lock, flags);
+
+	WARN_ON(rx_local->nReadyRecv > rx_local->NumRfd);
+}
+
+/**
  * et131x_rx_dma_disable - Stop of Rx_DMA on the ET1310
  * @etdev: pointer to our adapter structure
  */
@@ -776,7 +868,7 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev)
  * the packet to it, puts the RFD in the RecvPendList, and also returns
  * the pointer to the RFD.
  */
-struct rfd * nic_rx_pkts(struct et131x_adapter *etdev)
+struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
 {
 	struct rx_ring *rx_local = &etdev->rx_ring;
 	struct rx_status_block *status;
@@ -1059,96 +1151,3 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
 		etdev->rx_ring.UnfinishedReceives = false;
 }
 
-static inline u32 bump_fbr(u32 *fbr, u32 limit)
-{
-	u32 v = *fbr;
-	v++;
-	/* This works for all cases where limit < 1024. The 1023 case
-	   works because 1023++ is 1024 which means the if condition is not
-	   taken but the carry of the bit into the wrap bit toggles the wrap
-	   value correctly */
-	if ((v & ET_DMA10_MASK) > limit) {
-		v &= ~ET_DMA10_MASK;
-		v ^= ET_DMA10_WRAP;
-	}
-	/* For the 1023 case */
-	v &= (ET_DMA10_MASK|ET_DMA10_WRAP);
-	*fbr = v;
-	return v;
-}
-
-/**
- * NICReturnRFD - Recycle a RFD and put it back onto the receive list
- * @etdev: pointer to our adapter
- * @rfd: pointer to the RFD
- */
-void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
-{
-	struct rx_ring *rx_local = &etdev->rx_ring;
-	struct rxdma_regs __iomem *rx_dma = &etdev->regs->rxdma;
-	u16 bi = rfd->bufferindex;
-	u8 ri = rfd->ringindex;
-	unsigned long flags;
-
-	/* We don't use any of the OOB data besides status. Otherwise, we
-	 * need to clean up OOB data
-	 */
-	if (
-#ifdef USE_FBR0
-	    (ri == 0 && bi < rx_local->Fbr0NumEntries) ||
-#endif
-	    (ri == 1 && bi < rx_local->Fbr1NumEntries)) {
-		spin_lock_irqsave(&etdev->FbrLock, flags);
-
-		if (ri == 1) {
-			struct fbr_desc *next =
-			    (struct fbr_desc *) (rx_local->pFbr1RingVa) +
-					 INDEX10(rx_local->local_Fbr1_full);
-
-			/* Handle the Free Buffer Ring advancement here. Write
-			 * the PA / Buffer Index for the returned buffer into
-			 * the oldest (next to be freed)FBR entry
-			 */
-			next->addr_hi = rx_local->fbr[1]->bus_high[bi];
-			next->addr_lo = rx_local->fbr[1]->bus_low[bi];
-			next->word2 = bi;
-
-			writel(bump_fbr(&rx_local->local_Fbr1_full,
-				rx_local->Fbr1NumEntries - 1),
-				&rx_dma->fbr1_full_offset);
-		}
-#ifdef USE_FBR0
-		else {
-			struct fbr_desc *next = (struct fbr_desc *)
-				rx_local->pFbr0RingVa +
-					INDEX10(rx_local->local_Fbr0_full);
-
-			/* Handle the Free Buffer Ring advancement here. Write
-			 * the PA / Buffer Index for the returned buffer into
-			 * the oldest (next to be freed) FBR entry
-			 */
-			next->addr_hi = rx_local->fbr[0]->bus_high[bi];
-			next->addr_lo = rx_local->fbr[0]->bus_low[bi];
-			next->word2 = bi;
-
-			writel(bump_fbr(&rx_local->local_Fbr0_full,
-					rx_local->Fbr0NumEntries - 1),
-			       &rx_dma->fbr0_full_offset);
-		}
-#endif
-		spin_unlock_irqrestore(&etdev->FbrLock, flags);
-	} else {
-		dev_err(&etdev->pdev->dev,
-			  "NICReturnRFD illegal Buffer Index returned\n");
-	}
-
-	/* The processing on this RFD is done, so put it back on the tail of
-	 * our list
-	 */
-	spin_lock_irqsave(&etdev->rcv_lock, flags);
-	list_add_tail(&rfd->list_node, &rx_local->RecvList);
-	rx_local->nReadyRecv++;
-	spin_unlock_irqrestore(&etdev->rcv_lock, flags);
-
-	WARN_ON(rx_local->nReadyRecv > rx_local->NumRfd);
-}
-- 
1.7.4.4


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

* [PATCH 3/5] staging: et131x: et131x_adapter.h checkpatch fixes
  2011-06-05 17:35 [PATCH 0/5] staging: et131x: checkpatch fixes Mark Einon
  2011-06-05 17:35 ` [PATCH 1/5] staging: et131x: et1310_address_map.h " Mark Einon
  2011-06-05 17:35 ` [PATCH 2/5] staging: et131x: et1310_rx.c " Mark Einon
@ 2011-06-05 17:35 ` Mark Einon
  2011-06-05 19:11   ` Alan Cox
  2011-06-05 17:35 ` [PATCH 4/5] staging: et131x: et131x_initpci.c " Mark Einon
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Mark Einon @ 2011-06-05 17:35 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon, Mark Einon

From: Mark Einon <Mark.Einon@gmail.com>

Fixes a 'WARNING: do not add new typedefs' and line > 80 chars.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et1310_mac.c     |    2 +-
 drivers/staging/et131x/et131x_adapter.h |    8 ++++----
 drivers/staging/et131x/et131x_netdev.c  |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index c634e35..1425af2 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -452,7 +452,7 @@ void ConfigFlowControl(struct et131x_adapter *etdev)
  */
 void UpdateMacStatHostCounters(struct et131x_adapter *etdev)
 {
-	struct _ce_stats_t *stats = &etdev->Stats;
+	struct ce_stats_t *stats = &etdev->Stats;
 	struct macstat_regs __iomem *macstat =
 		&etdev->regs->macstat;
 
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index c9a119e..87905e7 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -67,7 +67,7 @@
  * Do not change these values: if changed, then change also in respective
  * TXdma and Rxdma engines
  */
-#define NUM_DESC_PER_RING_TX         512	/* TX Do not change these values */
+#define NUM_DESC_PER_RING_TX         512    /* TX Do not change these values */
 #define NUM_TCB                      64
 
 /*
@@ -98,7 +98,7 @@ struct rfd {
 #define FLOW_NONE	3
 
 /* Struct to define some device statistics */
-typedef struct _ce_stats_t {
+struct ce_stats_t {
 	/* Link Input/Output stats */
 	uint64_t ipackets;	/* # of in packets */
 	uint64_t opackets;	/* # of out packets */
@@ -143,7 +143,7 @@ typedef struct _ce_stats_t {
 
 	u32 SynchrounousIterations;
 	u32 InterruptStatus;
-} CE_STATS_t, *PCE_STATS_t;
+};
 
 
 /* The private adapter structure */
@@ -239,7 +239,7 @@ struct et131x_adapter {
 	u8 ReplicaPhyLoopbkPF;	/* Replica Enable Pass/Fail */
 
 	/* Stats */
-	CE_STATS_t Stats;
+	struct ce_stats_t Stats;
 
 	struct net_device_stats net_stats;
 	struct net_device_stats net_stats_prev;
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index b25bae2..5f6522c 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -161,7 +161,7 @@ struct net_device_stats *et131x_stats(struct net_device *netdev)
 {
 	struct et131x_adapter *adapter = netdev_priv(netdev);
 	struct net_device_stats *stats = &adapter->net_stats;
-	CE_STATS_t *devstat = &adapter->Stats;
+	struct ce_stats_t *devstat = &adapter->Stats;
 
 	stats->rx_packets = devstat->ipackets;
 	stats->tx_packets = devstat->opackets;
-- 
1.7.4.4


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

* [PATCH 4/5] staging: et131x: et131x_initpci.c checkpatch fixes
  2011-06-05 17:35 [PATCH 0/5] staging: et131x: checkpatch fixes Mark Einon
                   ` (2 preceding siblings ...)
  2011-06-05 17:35 ` [PATCH 3/5] staging: et131x: et131x_adapter.h " Mark Einon
@ 2011-06-05 17:35 ` Mark Einon
  2011-06-05 19:09   ` Alan Cox
  2011-06-06  6:00   ` Dan Carpenter
  2011-06-05 17:35 ` [PATCH 5/5] staging: et131x: et131x_netdev.c " Mark Einon
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 22+ messages in thread
From: Mark Einon @ 2011-06-05 17:35 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon, Mark Einon

From: Mark Einon <Mark.Einon@gmail.com>

Fixes 'WARNING: Avoid line continuations in quoted strings' and some formatting
issues.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et131x_initpci.c |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 50237ac..1dd2e5e 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -113,13 +113,13 @@
 static u32 et131x_speed_set;
 module_param(et131x_speed_set, uint, 0);
 MODULE_PARM_DESC(et131x_speed_set,
-		"Set Link speed and dublex manually (0-5)  [0]\n \
-		 1 : 10Mb   Half-Duplex\n \
-		 2 : 10Mb   Full-Duplex\n \
-		 3 : 100Mb  Half-Duplex\n \
-		 4 : 100Mb  Full-Duplex\n \
-		 5 : 1000Mb Full-Duplex\n \
-		 0 : Auto Speed Auto Dublex");
+		"Set Link speed and dublex manually (0-5)  [0]\n"
+		"1 : 10Mb   Half-Duplex\n"
+		"2 : 10Mb   Full-Duplex\n"
+		"3 : 100Mb  Half-Duplex\n"
+		"4 : 100Mb  Full-Duplex\n"
+		"5 : 1000Mb Full-Duplex\n"
+		"0 : Auto Speed Auto Dublex");
 
 /**
  * et131x_hwaddr_init - set up the MAC Address on the ET1310
@@ -539,7 +539,8 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev,
 
 	struct et131x_adapter *etdev;
 
-	/* Setup the fundamental net_device and private adapter structure elements  */
+	/* Setup the fundamental net_device and private adapter structure
+	 * elements  */
 	SET_NETDEV_DEV(netdev, &pdev->dev);
 
 	/* Allocate private adapter struct and copy in relevant information */
@@ -807,12 +808,12 @@ static struct pci_device_id et131x_pci_table[] __devinitdata = {
 MODULE_DEVICE_TABLE(pci, et131x_pci_table);
 
 static struct pci_driver et131x_driver = {
-      .name	= DRIVER_NAME,
-      .id_table	= et131x_pci_table,
-      .probe	= et131x_pci_setup,
-      .remove	= __devexit_p(et131x_pci_remove),
-      .suspend	= NULL,		/* et131x_pci_suspend */
-      .resume	= NULL,		/* et131x_pci_resume */
+	.name		= DRIVER_NAME,
+	.id_table	= et131x_pci_table,
+	.probe		= et131x_pci_setup,
+	.remove		= __devexit_p(et131x_pci_remove),
+	.suspend	= NULL,		/* et131x_pci_suspend */
+	.resume		= NULL,		/* et131x_pci_resume */
 };
 
 
-- 
1.7.4.4


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

* [PATCH 5/5] staging: et131x: et131x_netdev.c checkpatch fixes
  2011-06-05 17:35 [PATCH 0/5] staging: et131x: checkpatch fixes Mark Einon
                   ` (3 preceding siblings ...)
  2011-06-05 17:35 ` [PATCH 4/5] staging: et131x: et131x_initpci.c " Mark Einon
@ 2011-06-05 17:35 ` Mark Einon
  2011-06-05 19:10   ` Alan Cox
  2011-06-05 19:11 ` [PATCH 0/5] staging: et131x: " Alan Cox
  2011-06-06 18:06 ` [PATCH v2 0/7] " Mark Einon
  6 siblings, 1 reply; 22+ messages in thread
From: Mark Einon @ 2011-06-05 17:35 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon

Fixes multiple 'WARNING: externs should be avoided in .c files'.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et131x_netdev.c |  112 ++++++++++++++-----------------
 1 files changed, 51 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 5f6522c..7cc4b48 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -89,67 +89,6 @@
 #include "et131x.h"
 
 struct net_device_stats *et131x_stats(struct net_device *netdev);
-int et131x_open(struct net_device *netdev);
-int et131x_close(struct net_device *netdev);
-int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd);
-void et131x_multicast(struct net_device *netdev);
-int et131x_tx(struct sk_buff *skb, struct net_device *netdev);
-void et131x_tx_timeout(struct net_device *netdev);
-int et131x_change_mtu(struct net_device *netdev, int new_mtu);
-int et131x_set_mac_addr(struct net_device *netdev, void *new_mac);
-void et131x_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp);
-void et131x_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
-void et131x_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
-
-static const struct net_device_ops et131x_netdev_ops = {
-	.ndo_open		= et131x_open,
-	.ndo_stop		= et131x_close,
-	.ndo_start_xmit		= et131x_tx,
-	.ndo_set_multicast_list	= et131x_multicast,
-	.ndo_tx_timeout		= et131x_tx_timeout,
-	.ndo_change_mtu		= et131x_change_mtu,
-	.ndo_set_mac_address	= et131x_set_mac_addr,
-	.ndo_validate_addr	= eth_validate_addr,
-	.ndo_get_stats		= et131x_stats,
-	.ndo_do_ioctl		= et131x_ioctl,
-};
-
-/**
- * et131x_device_alloc
- *
- * Returns pointer to the allocated and initialized net_device struct for
- * this device.
- *
- * Create instances of net_device and wl_private for the new adapter and
- * register the device's entry points in the net_device structure.
- */
-struct net_device *et131x_device_alloc(void)
-{
-	struct net_device *netdev;
-
-	/* Alloc net_device and adapter structs */
-	netdev = alloc_etherdev(sizeof(struct et131x_adapter));
-
-	if (netdev == NULL) {
-		printk(KERN_ERR "et131x: Alloc of net_device struct failed\n");
-		return NULL;
-	}
-
-	/* Setup the function registration table (and other data) for a
-	 * net_device
-	 */
-	/* netdev->init               = &et131x_init; */
-	/* netdev->set_config = &et131x_config; */
-	netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
-	netdev->netdev_ops = &et131x_netdev_ops;
-
-	/* netdev->ethtool_ops        = &et131x_ethtool_ops; */
-
-	/* Poll? */
-	/* netdev->poll               = &et131x_poll; */
-	/* netdev->poll_controller    = &et131x_poll_controller; */
-	return netdev;
-}
 
 /**
  * et131x_stats - Return the current device statistics.
@@ -702,3 +641,54 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)
 	netif_wake_queue(netdev);
 	return result;
 }
+
+static const struct net_device_ops et131x_netdev_ops = {
+	.ndo_open		= et131x_open,
+	.ndo_stop		= et131x_close,
+	.ndo_start_xmit		= et131x_tx,
+	.ndo_set_multicast_list	= et131x_multicast,
+	.ndo_tx_timeout		= et131x_tx_timeout,
+	.ndo_change_mtu		= et131x_change_mtu,
+	.ndo_set_mac_address	= et131x_set_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+	.ndo_get_stats		= et131x_stats,
+	.ndo_do_ioctl		= et131x_ioctl,
+};
+
+/**
+ * et131x_device_alloc
+ *
+ * Returns pointer to the allocated and initialized net_device struct for
+ * this device.
+ *
+ * Create instances of net_device and wl_private for the new adapter and
+ * register the device's entry points in the net_device structure.
+ */
+struct net_device *et131x_device_alloc(void)
+{
+	struct net_device *netdev;
+
+	/* Alloc net_device and adapter structs */
+	netdev = alloc_etherdev(sizeof(struct et131x_adapter));
+
+	if (netdev == NULL) {
+		printk(KERN_ERR "et131x: Alloc of net_device struct failed\n");
+		return NULL;
+	}
+
+	/* Setup the function registration table (and other data) for a
+	 * net_device
+	 */
+	/* netdev->init               = &et131x_init; */
+	/* netdev->set_config = &et131x_config; */
+	netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
+	netdev->netdev_ops = &et131x_netdev_ops;
+
+	/* netdev->ethtool_ops        = &et131x_ethtool_ops; */
+
+	/* Poll? */
+	/* netdev->poll               = &et131x_poll; */
+	/* netdev->poll_controller    = &et131x_poll_controller; */
+	return netdev;
+}
+
-- 
1.7.4.4


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

* Re: [PATCH 2/5] staging: et131x: et1310_rx.c checkpatch fixes
  2011-06-05 17:35 ` [PATCH 2/5] staging: et131x: et1310_rx.c " Mark Einon
@ 2011-06-05 19:08   ` Alan Cox
  0 siblings, 0 replies; 22+ messages in thread
From: Alan Cox @ 2011-06-05 19:08 UTC (permalink / raw)
  To: Mark Einon; +Cc: gregkh, devel, linux-kernel, o.hartmann

On Sun,  5 Jun 2011 18:35:17 +0100
Mark Einon <mark.einon@gmail.com> wrote:

> From: Mark Einon <Mark.Einon@gmail.com>
> 
> Fixes extern in .c file and formatting issues.

Looks good to me

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

* Re: [PATCH 4/5] staging: et131x: et131x_initpci.c checkpatch fixes
  2011-06-05 17:35 ` [PATCH 4/5] staging: et131x: et131x_initpci.c " Mark Einon
@ 2011-06-05 19:09   ` Alan Cox
  2011-06-06  6:00   ` Dan Carpenter
  1 sibling, 0 replies; 22+ messages in thread
From: Alan Cox @ 2011-06-05 19:09 UTC (permalink / raw)
  To: Mark Einon; +Cc: gregkh, devel, linux-kernel, o.hartmann

On Sun,  5 Jun 2011 18:35:19 +0100
Mark Einon <mark.einon@gmail.com> wrote:

> From: Mark Einon <Mark.Einon@gmail.com>
> 
> Fixes 'WARNING: Avoid line continuations in quoted strings' and some formatting
> issues.
> 
> Signed-off-by: Mark Einon <mark.einon@gmail.com>


Looks fine

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

* Re: [PATCH 5/5] staging: et131x: et131x_netdev.c checkpatch fixes
  2011-06-05 17:35 ` [PATCH 5/5] staging: et131x: et131x_netdev.c " Mark Einon
@ 2011-06-05 19:10   ` Alan Cox
  0 siblings, 0 replies; 22+ messages in thread
From: Alan Cox @ 2011-06-05 19:10 UTC (permalink / raw)
  To: Mark Einon; +Cc: gregkh, devel, linux-kernel, o.hartmann

On Sun,  5 Jun 2011 18:35:20 +0100
Mark Einon <mark.einon@gmail.com> wrote:

> Fixes multiple 'WARNING: externs should be avoided in .c files'.


Looks fine

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

* Re: [PATCH 3/5] staging: et131x: et131x_adapter.h checkpatch fixes
  2011-06-05 17:35 ` [PATCH 3/5] staging: et131x: et131x_adapter.h " Mark Einon
@ 2011-06-05 19:11   ` Alan Cox
  0 siblings, 0 replies; 22+ messages in thread
From: Alan Cox @ 2011-06-05 19:11 UTC (permalink / raw)
  To: Mark Einon; +Cc: gregkh, devel, linux-kernel, o.hartmann

On Sun,  5 Jun 2011 18:35:18 +0100
Mark Einon <mark.einon@gmail.com> wrote:

> From: Mark Einon <Mark.Einon@gmail.com>
> 
> Fixes a 'WARNING: do not add new typedefs' and line > 80 chars.

Again with the structs the process has been to clean up the field names
to Linux style, then rename the struct so we know what is going on

Can you lose the _t and change the struct to live as adapter->stats ?

Alan

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

* Re: [PATCH 0/5] staging: et131x: checkpatch fixes
  2011-06-05 17:35 [PATCH 0/5] staging: et131x: checkpatch fixes Mark Einon
                   ` (4 preceding siblings ...)
  2011-06-05 17:35 ` [PATCH 5/5] staging: et131x: et131x_netdev.c " Mark Einon
@ 2011-06-05 19:11 ` Alan Cox
  2011-06-06 18:06 ` [PATCH v2 0/7] " Mark Einon
  6 siblings, 0 replies; 22+ messages in thread
From: Alan Cox @ 2011-06-05 19:11 UTC (permalink / raw)
  To: Mark Einon; +Cc: gregkh, devel, linux-kernel, o.hartmann

On Sun,  5 Jun 2011 18:35:15 +0100
Mark Einon <mark.einon@gmail.com> wrote:

> These have been build-tested only.

Comments individually - I can hopefully run test something in a week or
so depending on workload as I've got a laptop with the relevant card.

Alan

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

* Re: [PATCH 1/5] staging: et131x: et1310_address_map.h checkpatch fixes
  2011-06-05 17:35 ` [PATCH 1/5] staging: et131x: et1310_address_map.h " Mark Einon
@ 2011-06-05 19:14   ` Alan Cox
  0 siblings, 0 replies; 22+ messages in thread
From: Alan Cox @ 2011-06-05 19:14 UTC (permalink / raw)
  To: Mark Einon; +Cc: gregkh, devel, linux-kernel, o.hartmann

> +union RXMAC_WOL_SA_LO_t {
>  	u32 value;
>  	struct {
>  #ifdef _BIT_FIELDS_HTOL
> @@ -716,13 +716,13 @@ typedef union _RXMAC_WOL_SA_LO_t {
>  		u32 sa3:8;	/* bits 24-31 */

Pleease don't do it this way. If you look at the code we've been
systematically working through the unions turning them into definitions
in comments and sometimes bitmasks because almost none of the bit field
stuff is useful in these things anyway. Removing the typedefs without
doing it just muddles up what has and hasn't been done.

In fact in many cases the .value bit is the only bit used

Please keep to that style of describing the bits and knocking out fields
where it doesn't make sense.




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

* Re: [PATCH 4/5] staging: et131x: et131x_initpci.c checkpatch fixes
  2011-06-05 17:35 ` [PATCH 4/5] staging: et131x: et131x_initpci.c " Mark Einon
  2011-06-05 19:09   ` Alan Cox
@ 2011-06-06  6:00   ` Dan Carpenter
  1 sibling, 0 replies; 22+ messages in thread
From: Dan Carpenter @ 2011-06-06  6:00 UTC (permalink / raw)
  To: Mark Einon; +Cc: gregkh, devel, linux-kernel, o.hartmann

On Sun, Jun 05, 2011 at 06:35:19PM +0100, Mark Einon wrote:
> -	/* Setup the fundamental net_device and private adapter structure elements  */
> +	/* Setup the fundamental net_device and private adapter structure
> +	 * elements  */

This isn't the normal multi-line comment style.  I don't care, but
for next time.

regards,
dan carpenter

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

* [PATCH v2 0/7] staging: et131x: checkpatch fixes
  2011-06-05 17:35 [PATCH 0/5] staging: et131x: checkpatch fixes Mark Einon
                   ` (5 preceding siblings ...)
  2011-06-05 19:11 ` [PATCH 0/5] staging: et131x: " Alan Cox
@ 2011-06-06 18:06 ` Mark Einon
  2011-06-06 18:06   ` [PATCH v2 1/7] staging: et131x: checkpatch fixes for et1310_address_map.h (All 'do not add new typedefs') Mark Einon
                     ` (6 more replies)
  6 siblings, 7 replies; 22+ messages in thread
From: Mark Einon @ 2011-06-06 18:06 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, alan

These have been build-tested only, and modified following suggestions by Alan Cox.

Mark Einon(5):
 staging: et131x: checkpatch fixes for
 staging: et131x: et1310_rx.c checkpatch fixes
 staging: et131x: et131x_adapter.h checkpatch fixes
 staging: et131x: et131x_initpci.c checkpatch fixes
 staging: et131x: et131x_netdev.c checkpatch fixes
 staging: et131x: Fixes multiple 'WARNING: do not add new typedefs'.
 staging: et131x: Removing '_t' from ce_stats_t struct

 drivers/staging/et131x/et1310_address_map.h |  201 ++++++++++----------------
 drivers/staging/et131x/et1310_mac.c         |  122 ++++++++--------
 drivers/staging/et131x/et1310_phy.c         |   12 +-
 drivers/staging/et131x/et1310_rx.c          |  203 +++++++++++++--------------
 drivers/staging/et131x/et1310_tx.c          |    8 +-
 drivers/staging/et131x/et131x.h             |    2 +-
 drivers/staging/et131x/et131x_adapter.h     |   10 +-
 drivers/staging/et131x/et131x_initpci.c     |   29 ++--
 drivers/staging/et131x/et131x_isr.c         |    6 +-
 drivers/staging/et131x/et131x_netdev.c      |  116 +++++++--------
 10 files changed, 325 insertions(+), 384 deletions(-)


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

* [PATCH v2 1/7] staging: et131x: checkpatch fixes for et1310_address_map.h (All 'do not add new typedefs')
  2011-06-06 18:06 ` [PATCH v2 0/7] " Mark Einon
@ 2011-06-06 18:06   ` Mark Einon
  2011-06-06 18:06   ` [PATCH v2 2/7] staging: et131x: et1310_rx.c checkpatch fixes Mark Einon
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 22+ messages in thread
From: Mark Einon @ 2011-06-06 18:06 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, alan, Mark Einon, Mark Einon

From: Mark Einon <Mark.Einon@gmail.com>

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et1310_address_map.h |   62 +++++++++++++-------------
 drivers/staging/et131x/et1310_mac.c         |   24 +++++-----
 drivers/staging/et131x/et1310_phy.c         |    6 +-
 drivers/staging/et131x/et131x_adapter.h     |    2 +-
 drivers/staging/et131x/et131x_isr.c         |    2 +-
 5 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index 425e927..6f52627 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -701,7 +701,7 @@ struct txmac_regs {			/* Location: */
  * structure for Wake On Lan Source Address Lo reg in rxmac address map
  * located at address 0x4010
  */
-typedef union _RXMAC_WOL_SA_LO_t {
+union RXMAC_WOL_SA_LO_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -716,13 +716,13 @@ typedef union _RXMAC_WOL_SA_LO_t {
 		u32 sa3:8;	/* bits 24-31 */
 #endif
 	} bits;
-} RXMAC_WOL_SA_LO_t, *PRXMAC_WOL_SA_LO_t;
+};
 
 /*
  * structure for Wake On Lan Source Address Hi reg in rxmac address map
  * located at address 0x4014
  */
-typedef union _RXMAC_WOL_SA_HI_t {
+union RXMAC_WOL_SA_HI_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -735,7 +735,7 @@ typedef union _RXMAC_WOL_SA_HI_t {
 		u32 reserved:16;	/* bits 16-31 */
 #endif
 	} bits;
-} RXMAC_WOL_SA_HI_t, *PRXMAC_WOL_SA_HI_t;
+};
 
 /*
  * structure for Wake On Lan mask reg in rxmac address map
@@ -747,7 +747,7 @@ typedef union _RXMAC_WOL_SA_HI_t {
  * structure for Unicast Paket Filter Address 1 reg in rxmac address map
  * located at address 0x4068
  */
-typedef union _RXMAC_UNI_PF_ADDR1_t {
+union RXMAC_UNI_PF_ADDR1_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -762,13 +762,13 @@ typedef union _RXMAC_UNI_PF_ADDR1_t {
 		u32 addr1_3:8;	/* bits 24-31 */
 #endif
 	} bits;
-} RXMAC_UNI_PF_ADDR1_t, *PRXMAC_UNI_PF_ADDR1_t;
+};
 
 /*
  * structure for Unicast Paket Filter Address 2 reg in rxmac address map
  * located at address 0x406C
  */
-typedef union _RXMAC_UNI_PF_ADDR2_t {
+union RXMAC_UNI_PF_ADDR2_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -783,13 +783,13 @@ typedef union _RXMAC_UNI_PF_ADDR2_t {
 		u32 addr2_3:8;	/* bits 24-31 */
 #endif
 	} bits;
-} RXMAC_UNI_PF_ADDR2_t, *PRXMAC_UNI_PF_ADDR2_t;
+};
 
 /*
  * structure for Unicast Paket Filter Address 1 & 2 reg in rxmac address map
  * located at address 0x4070
  */
-typedef union _RXMAC_UNI_PF_ADDR3_t {
+union RXMAC_UNI_PF_ADDR3_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -804,7 +804,7 @@ typedef union _RXMAC_UNI_PF_ADDR3_t {
 		u32 addr2_1:8;	/* bits 24-31 */
 #endif
 	} bits;
-} RXMAC_UNI_PF_ADDR3_t, *PRXMAC_UNI_PF_ADDR3_t;
+};
 
 /*
  * structure for Multicast Hash reg in rxmac address map
@@ -888,13 +888,13 @@ typedef union _RXMAC_UNI_PF_ADDR3_t {
 /*
  * Rx MAC Module of JAGCore Address Mapping
  */
-typedef struct _RXMAC_t {				/* Location: */
+struct RXMAC_t {					/* Location: */
 	u32 ctrl;					/*  0x4000 */
 	u32 crc0;					/*  0x4004 */
 	u32 crc12;					/*  0x4008 */
 	u32 crc34;					/*  0x400C */
-	RXMAC_WOL_SA_LO_t sa_lo;			/*  0x4010 */
-	RXMAC_WOL_SA_HI_t sa_hi;			/*  0x4014 */
+	union RXMAC_WOL_SA_LO_t sa_lo;			/*  0x4010 */
+	union RXMAC_WOL_SA_HI_t sa_hi;			/*  0x4014 */
 	u32 mask0_word0;				/*  0x4018 */
 	u32 mask0_word1;				/*  0x401C */
 	u32 mask0_word2;				/*  0x4020 */
@@ -915,9 +915,9 @@ typedef struct _RXMAC_t {				/* Location: */
 	u32 mask4_word1;				/*  0x405C */
 	u32 mask4_word2;				/*  0x4060 */
 	u32 mask4_word3;				/*  0x4064 */
-	RXMAC_UNI_PF_ADDR1_t uni_pf_addr1;		/*  0x4068 */
-	RXMAC_UNI_PF_ADDR2_t uni_pf_addr2;		/*  0x406C */
-	RXMAC_UNI_PF_ADDR3_t uni_pf_addr3;		/*  0x4070 */
+	union RXMAC_UNI_PF_ADDR1_t uni_pf_addr1;	/*  0x4068 */
+	union RXMAC_UNI_PF_ADDR2_t uni_pf_addr2;	/*  0x406C */
+	union RXMAC_UNI_PF_ADDR3_t uni_pf_addr3;	/*  0x4070 */
 	u32 multi_hash1;				/*  0x4074 */
 	u32 multi_hash2;				/*  0x4078 */
 	u32 multi_hash3;				/*  0x407C */
@@ -930,7 +930,7 @@ typedef struct _RXMAC_t {				/* Location: */
 
 	u32 mif_ctrl;					/*  0x4098 */
 	u32 err_reg;					/*  0x409C */
-} RXMAC_t, *PRXMAC_t;
+};
 
 /* END OF RXMAC REGISTER ADDRESS MAP */
 
@@ -1124,7 +1124,7 @@ typedef struct _RXMAC_t {				/* Location: */
  * structure for Mac Station Address, Part 1 reg in mac address map.
  * located at address 0x5040
  */
-typedef union _MAC_STATION_ADDR1_t {
+union MAC_STATION_ADDR1_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -1139,13 +1139,13 @@ typedef union _MAC_STATION_ADDR1_t {
 		u32 Octet6:8;	/* bits 24-31 */
 #endif
 	} bits;
-} MAC_STATION_ADDR1_t, *PMAC_STATION_ADDR1_t;
+};
 
 /*
  * structure for Mac Station Address, Part 2 reg in mac address map.
  * located at address 0x5044
  */
-typedef union _MAC_STATION_ADDR2_t {
+union MAC_STATION_ADDR2_t {
 	u32 value;
 	struct {
 #ifdef _BIT_FIELDS_HTOL
@@ -1158,12 +1158,12 @@ typedef union _MAC_STATION_ADDR2_t {
 		u32 Octet2:8;	/* bits 24-31 */
 #endif
 	} bits;
-} MAC_STATION_ADDR2_t, *PMAC_STATION_ADDR2_t;
+};
 
 /*
  * MAC Module of JAGCore Address Mapping
  */
-typedef struct _MAC_t {					/* Location: */
+struct MAC_t {						/* Location: */
 	u32 cfg1;					/*  0x5000 */
 	u32 cfg2;					/*  0x5004 */
 	u32 ipg;					/*  0x5008 */
@@ -1180,9 +1180,9 @@ typedef struct _MAC_t {					/* Location: */
 	u32 mii_mgmt_indicator;				/*  0x5034 */
 	u32 if_ctrl;					/*  0x5038 */
 	u32 if_stat;					/*  0x503C */
-	MAC_STATION_ADDR1_t station_addr_1;		/*  0x5040 */
-	MAC_STATION_ADDR2_t station_addr_2;		/*  0x5044 */
-} MAC_t, *PMAC_t;
+	union MAC_STATION_ADDR1_t station_addr_1;	/*  0x5040 */
+	union MAC_STATION_ADDR2_t station_addr_2;	/*  0x5044 */
+};
 
 /* END OF MAC REGISTER ADDRESS MAP */
 
@@ -1448,7 +1448,7 @@ struct mmc_regs {		/* Location: */
 /*
  * JAGCore Address Mapping
  */
-typedef struct _ADDRESS_MAP_t {
+struct ADDRESS_MAP_t {
 	struct global_regs global;
 	/* unused section of global address map */
 	u8 unused_global[4096 - sizeof(struct global_regs)];
@@ -1461,12 +1461,12 @@ typedef struct _ADDRESS_MAP_t {
 	struct txmac_regs txmac;
 	/* unused section of txmac address map */
 	u8 unused_txmac[4096 - sizeof(struct txmac_regs)];
-	RXMAC_t rxmac;
+	struct RXMAC_t rxmac;
 	/* unused section of rxmac address map */
-	u8 unused_rxmac[4096 - sizeof(RXMAC_t)];
-	MAC_t mac;
+	u8 unused_rxmac[4096 - sizeof(struct RXMAC_t)];
+	struct MAC_t mac;
 	/* unused section of mac address map */
-	u8 unused_mac[4096 - sizeof(MAC_t)];
+	u8 unused_mac[4096 - sizeof(struct MAC_t)];
 	struct macstat_regs macstat;
 	/* unused section of mac stat address map */
 	u8 unused_mac_stat[4096 - sizeof(struct macstat_regs)];
@@ -1478,6 +1478,6 @@ typedef struct _ADDRESS_MAP_t {
 
 	u8 unused_exp_rom[4096];	/* MGS-size TBD */
 	u8 unused__[524288];	/* unused section of address map */
-} ADDRESS_MAP_t, *PADDRESS_MAP_t;
+};
 
 #endif /* _ET1310_ADDRESS_MAP_H_ */
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index 78f72fa..c634e35 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -104,9 +104,9 @@
  */
 void ConfigMACRegs1(struct et131x_adapter *etdev)
 {
-	struct _MAC_t __iomem *pMac = &etdev->regs->mac;
-	MAC_STATION_ADDR1_t station1;
-	MAC_STATION_ADDR2_t station2;
+	struct MAC_t __iomem *pMac = &etdev->regs->mac;
+	union MAC_STATION_ADDR1_t station1;
+	union MAC_STATION_ADDR2_t station2;
 	u32 ipg;
 
 	/* First we need to reset everything.  Write to MAC configuration
@@ -165,7 +165,7 @@ void ConfigMACRegs1(struct et131x_adapter *etdev)
 void ConfigMACRegs2(struct et131x_adapter *etdev)
 {
 	int32_t delay = 0;
-	struct _MAC_t __iomem *pMac = &etdev->regs->mac;
+	struct MAC_t __iomem *pMac = &etdev->regs->mac;
 	u32 cfg1;
 	u32 cfg2;
 	u32 ifctrl;
@@ -237,9 +237,9 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
 
 void ConfigRxMacRegs(struct et131x_adapter *etdev)
 {
-	struct _RXMAC_t __iomem *pRxMac = &etdev->regs->rxmac;
-	RXMAC_WOL_SA_LO_t sa_lo;
-	RXMAC_WOL_SA_HI_t sa_hi;
+	struct RXMAC_t __iomem *pRxMac = &etdev->regs->rxmac;
+	union RXMAC_WOL_SA_LO_t sa_lo;
+	union RXMAC_WOL_SA_HI_t sa_hi;
 	u32 pf_ctrl = 0;
 
 	/* Disable the MAC while it is being configured (also disable WOL) */
@@ -534,7 +534,7 @@ void HandleMacStatInterrupt(struct et131x_adapter *etdev)
 
 void SetupDeviceForMulticast(struct et131x_adapter *etdev)
 {
-	struct _RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
+	struct RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
 	uint32_t nIndex;
 	uint32_t result;
 	uint32_t hash1 = 0;
@@ -582,10 +582,10 @@ void SetupDeviceForMulticast(struct et131x_adapter *etdev)
 
 void SetupDeviceForUnicast(struct et131x_adapter *etdev)
 {
-	struct _RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
-	RXMAC_UNI_PF_ADDR1_t uni_pf1;
-	RXMAC_UNI_PF_ADDR2_t uni_pf2;
-	RXMAC_UNI_PF_ADDR3_t uni_pf3;
+	struct RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
+	union RXMAC_UNI_PF_ADDR1_t uni_pf1;
+	union RXMAC_UNI_PF_ADDR2_t uni_pf2;
+	union RXMAC_UNI_PF_ADDR3_t uni_pf3;
 	u32 pm_csr;
 
 	/* Set up unicast packet filter reg 3 to be the first two octets of
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 2798a2f..bc8d385 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -108,7 +108,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev);
 int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr,
 	      u8 xcvrReg, u16 *value)
 {
-	struct _MAC_t __iomem *mac = &etdev->regs->mac;
+	struct MAC_t __iomem *mac = &etdev->regs->mac;
 	int status = 0;
 	u32 delay;
 	u32 miiAddr;
@@ -176,7 +176,7 @@ int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr,
  */
 int MiWrite(struct et131x_adapter *etdev, u8 xcvrReg, u16 value)
 {
-	struct _MAC_t __iomem *mac = &etdev->regs->mac;
+	struct MAC_t __iomem *mac = &etdev->regs->mac;
 	int status = 0;
 	u8 xcvrAddr = etdev->Stats.xcvr_addr;
 	u32 delay;
@@ -590,7 +590,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)
 	/* Set the link status interrupt only.  Bad behavior when link status
 	 * and auto neg are set, we run into a nested interrupt problem
 	 */
-        imr |= 0x0105;
+	imr |= 0x0105;
 
 	MiWrite(etdev, (u8) offsetof(struct mi_regs, imr), imr);
 
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index c852f86..c9a119e 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -186,7 +186,7 @@ struct et131x_adapter {
 	u8 MCList[NIC_MAX_MCAST_LIST][ETH_ALEN];
 
 	/* Pointer to the device's PCI register space */
-	ADDRESS_MAP_t __iomem *regs;
+	struct ADDRESS_MAP_t __iomem *regs;
 
 	/* Registry parameters */
 	u8 SpeedDuplex;		/* speed/duplex */
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index f716e40..7c7b464 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -245,7 +245,7 @@ void et131x_isr_handler(struct work_struct *work)
 	struct et131x_adapter *etdev =
 		container_of(work, struct et131x_adapter, task);
 	u32 status = etdev->Stats.InterruptStatus;
-	ADDRESS_MAP_t __iomem *iomem = etdev->regs;
+	struct ADDRESS_MAP_t __iomem *iomem = etdev->regs;
 
 	/*
 	 * These first two are by far the most common.  Once handled, we clear
-- 
1.7.4.4


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

* [PATCH v2 2/7] staging: et131x: et1310_rx.c checkpatch fixes
  2011-06-06 18:06 ` [PATCH v2 0/7] " Mark Einon
  2011-06-06 18:06   ` [PATCH v2 1/7] staging: et131x: checkpatch fixes for et1310_address_map.h (All 'do not add new typedefs') Mark Einon
@ 2011-06-06 18:06   ` Mark Einon
  2011-06-06 18:07   ` [PATCH v2 3/7] staging: et131x: et131x_adapter.h " Mark Einon
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 22+ messages in thread
From: Mark Einon @ 2011-06-06 18:06 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, alan, Mark Einon, Mark Einon

From: Mark Einon <Mark.Einon@gmail.com>

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et1310_rx.c |  193 ++++++++++++++++++------------------
 1 files changed, 96 insertions(+), 97 deletions(-)

diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index fc6bd43..cd72a0b 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -88,7 +88,23 @@
 #include "et1310_rx.h"
 #include "et131x.h"
 
-void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd);
+static inline u32 bump_fbr(u32 *fbr, u32 limit)
+{
+	u32 v = *fbr;
+	v++;
+	/* This works for all cases where limit < 1024. The 1023 case
+	   works because 1023++ is 1024 which means the if condition is not
+	   taken but the carry of the bit into the wrap bit toggles the wrap
+	   value correctly */
+	if ((v & ET_DMA10_MASK) > limit) {
+		v &= ~ET_DMA10_MASK;
+		v ^= ET_DMA10_WRAP;
+	}
+	/* For the 1023 case */
+	v &= (ET_DMA10_MASK|ET_DMA10_WRAP);
+	*fbr = v;
+	return v;
+}
 
 /**
  * et131x_rx_dma_memory_alloc
@@ -246,7 +262,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
 					 &rx_ring->Fbr1MemPa[i]);
 
 		if (!rx_ring->Fbr1MemVa[i]) {
-		dev_err(&adapter->pdev->dev,
+			dev_err(&adapter->pdev->dev,
 				"Could not alloc memory\n");
 			return -ENOMEM;
 		}
@@ -491,7 +507,7 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
 	/* Free Packet Status Ring */
 	if (rx_ring->pPSRingVa) {
 		pktStatRingSize =
-		    sizeof(struct pkt_stat_desc) * adapter->rx_ring.PsrNumEntries;
+		  sizeof(struct pkt_stat_desc) * adapter->rx_ring.PsrNumEntries;
 
 		pci_free_consistent(adapter->pdev, pktStatRingSize,
 				    rx_ring->pPSRingVa, rx_ring->pPSRingPa);
@@ -708,6 +724,82 @@ void SetRxDmaTimer(struct et131x_adapter *etdev)
 }
 
 /**
+ * NICReturnRFD - Recycle a RFD and put it back onto the receive list
+ * @etdev: pointer to our adapter
+ * @rfd: pointer to the RFD
+ */
+void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
+{
+	struct rx_ring *rx_local = &etdev->rx_ring;
+	struct rxdma_regs __iomem *rx_dma = &etdev->regs->rxdma;
+	u16 bi = rfd->bufferindex;
+	u8 ri = rfd->ringindex;
+	unsigned long flags;
+
+	/* We don't use any of the OOB data besides status. Otherwise, we
+	 * need to clean up OOB data
+	 */
+	if (
+#ifdef USE_FBR0
+	    (ri == 0 && bi < rx_local->Fbr0NumEntries) ||
+#endif
+	    (ri == 1 && bi < rx_local->Fbr1NumEntries)) {
+		spin_lock_irqsave(&etdev->FbrLock, flags);
+
+		if (ri == 1) {
+			struct fbr_desc *next =
+			    (struct fbr_desc *) (rx_local->pFbr1RingVa) +
+					 INDEX10(rx_local->local_Fbr1_full);
+
+			/* Handle the Free Buffer Ring advancement here. Write
+			 * the PA / Buffer Index for the returned buffer into
+			 * the oldest (next to be freed)FBR entry
+			 */
+			next->addr_hi = rx_local->fbr[1]->bus_high[bi];
+			next->addr_lo = rx_local->fbr[1]->bus_low[bi];
+			next->word2 = bi;
+
+			writel(bump_fbr(&rx_local->local_Fbr1_full,
+				rx_local->Fbr1NumEntries - 1),
+				&rx_dma->fbr1_full_offset);
+		}
+#ifdef USE_FBR0
+		else {
+			struct fbr_desc *next = (struct fbr_desc *)
+				rx_local->pFbr0RingVa +
+					INDEX10(rx_local->local_Fbr0_full);
+
+			/* Handle the Free Buffer Ring advancement here. Write
+			 * the PA / Buffer Index for the returned buffer into
+			 * the oldest (next to be freed) FBR entry
+			 */
+			next->addr_hi = rx_local->fbr[0]->bus_high[bi];
+			next->addr_lo = rx_local->fbr[0]->bus_low[bi];
+			next->word2 = bi;
+
+			writel(bump_fbr(&rx_local->local_Fbr0_full,
+					rx_local->Fbr0NumEntries - 1),
+			       &rx_dma->fbr0_full_offset);
+		}
+#endif
+		spin_unlock_irqrestore(&etdev->FbrLock, flags);
+	} else {
+		dev_err(&etdev->pdev->dev,
+			  "NICReturnRFD illegal Buffer Index returned\n");
+	}
+
+	/* The processing on this RFD is done, so put it back on the tail of
+	 * our list
+	 */
+	spin_lock_irqsave(&etdev->rcv_lock, flags);
+	list_add_tail(&rfd->list_node, &rx_local->RecvList);
+	rx_local->nReadyRecv++;
+	spin_unlock_irqrestore(&etdev->rcv_lock, flags);
+
+	WARN_ON(rx_local->nReadyRecv > rx_local->NumRfd);
+}
+
+/**
  * et131x_rx_dma_disable - Stop of Rx_DMA on the ET1310
  * @etdev: pointer to our adapter structure
  */
@@ -776,7 +868,7 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev)
  * the packet to it, puts the RFD in the RecvPendList, and also returns
  * the pointer to the RFD.
  */
-struct rfd * nic_rx_pkts(struct et131x_adapter *etdev)
+struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
 {
 	struct rx_ring *rx_local = &etdev->rx_ring;
 	struct rx_status_block *status;
@@ -1059,96 +1151,3 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
 		etdev->rx_ring.UnfinishedReceives = false;
 }
 
-static inline u32 bump_fbr(u32 *fbr, u32 limit)
-{
-	u32 v = *fbr;
-	v++;
-	/* This works for all cases where limit < 1024. The 1023 case
-	   works because 1023++ is 1024 which means the if condition is not
-	   taken but the carry of the bit into the wrap bit toggles the wrap
-	   value correctly */
-	if ((v & ET_DMA10_MASK) > limit) {
-		v &= ~ET_DMA10_MASK;
-		v ^= ET_DMA10_WRAP;
-	}
-	/* For the 1023 case */
-	v &= (ET_DMA10_MASK|ET_DMA10_WRAP);
-	*fbr = v;
-	return v;
-}
-
-/**
- * NICReturnRFD - Recycle a RFD and put it back onto the receive list
- * @etdev: pointer to our adapter
- * @rfd: pointer to the RFD
- */
-void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
-{
-	struct rx_ring *rx_local = &etdev->rx_ring;
-	struct rxdma_regs __iomem *rx_dma = &etdev->regs->rxdma;
-	u16 bi = rfd->bufferindex;
-	u8 ri = rfd->ringindex;
-	unsigned long flags;
-
-	/* We don't use any of the OOB data besides status. Otherwise, we
-	 * need to clean up OOB data
-	 */
-	if (
-#ifdef USE_FBR0
-	    (ri == 0 && bi < rx_local->Fbr0NumEntries) ||
-#endif
-	    (ri == 1 && bi < rx_local->Fbr1NumEntries)) {
-		spin_lock_irqsave(&etdev->FbrLock, flags);
-
-		if (ri == 1) {
-			struct fbr_desc *next =
-			    (struct fbr_desc *) (rx_local->pFbr1RingVa) +
-					 INDEX10(rx_local->local_Fbr1_full);
-
-			/* Handle the Free Buffer Ring advancement here. Write
-			 * the PA / Buffer Index for the returned buffer into
-			 * the oldest (next to be freed)FBR entry
-			 */
-			next->addr_hi = rx_local->fbr[1]->bus_high[bi];
-			next->addr_lo = rx_local->fbr[1]->bus_low[bi];
-			next->word2 = bi;
-
-			writel(bump_fbr(&rx_local->local_Fbr1_full,
-				rx_local->Fbr1NumEntries - 1),
-				&rx_dma->fbr1_full_offset);
-		}
-#ifdef USE_FBR0
-		else {
-			struct fbr_desc *next = (struct fbr_desc *)
-				rx_local->pFbr0RingVa +
-					INDEX10(rx_local->local_Fbr0_full);
-
-			/* Handle the Free Buffer Ring advancement here. Write
-			 * the PA / Buffer Index for the returned buffer into
-			 * the oldest (next to be freed) FBR entry
-			 */
-			next->addr_hi = rx_local->fbr[0]->bus_high[bi];
-			next->addr_lo = rx_local->fbr[0]->bus_low[bi];
-			next->word2 = bi;
-
-			writel(bump_fbr(&rx_local->local_Fbr0_full,
-					rx_local->Fbr0NumEntries - 1),
-			       &rx_dma->fbr0_full_offset);
-		}
-#endif
-		spin_unlock_irqrestore(&etdev->FbrLock, flags);
-	} else {
-		dev_err(&etdev->pdev->dev,
-			  "NICReturnRFD illegal Buffer Index returned\n");
-	}
-
-	/* The processing on this RFD is done, so put it back on the tail of
-	 * our list
-	 */
-	spin_lock_irqsave(&etdev->rcv_lock, flags);
-	list_add_tail(&rfd->list_node, &rx_local->RecvList);
-	rx_local->nReadyRecv++;
-	spin_unlock_irqrestore(&etdev->rcv_lock, flags);
-
-	WARN_ON(rx_local->nReadyRecv > rx_local->NumRfd);
-}
-- 
1.7.4.4


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

* [PATCH v2 3/7] staging: et131x: et131x_adapter.h checkpatch fixes
  2011-06-06 18:06 ` [PATCH v2 0/7] " Mark Einon
  2011-06-06 18:06   ` [PATCH v2 1/7] staging: et131x: checkpatch fixes for et1310_address_map.h (All 'do not add new typedefs') Mark Einon
  2011-06-06 18:06   ` [PATCH v2 2/7] staging: et131x: et1310_rx.c checkpatch fixes Mark Einon
@ 2011-06-06 18:07   ` Mark Einon
  2011-06-06 18:07   ` [PATCH v2 4/7] staging: et131x: et131x_initpci.c " Mark Einon
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 22+ messages in thread
From: Mark Einon @ 2011-06-06 18:07 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, alan, Mark Einon, Mark Einon

From: Mark Einon <Mark.Einon@gmail.com>

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et1310_mac.c     |    2 +-
 drivers/staging/et131x/et131x_adapter.h |    8 ++++----
 drivers/staging/et131x/et131x_netdev.c  |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index c634e35..1425af2 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -452,7 +452,7 @@ void ConfigFlowControl(struct et131x_adapter *etdev)
  */
 void UpdateMacStatHostCounters(struct et131x_adapter *etdev)
 {
-	struct _ce_stats_t *stats = &etdev->Stats;
+	struct ce_stats_t *stats = &etdev->Stats;
 	struct macstat_regs __iomem *macstat =
 		&etdev->regs->macstat;
 
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index c9a119e..87905e7 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -67,7 +67,7 @@
  * Do not change these values: if changed, then change also in respective
  * TXdma and Rxdma engines
  */
-#define NUM_DESC_PER_RING_TX         512	/* TX Do not change these values */
+#define NUM_DESC_PER_RING_TX         512    /* TX Do not change these values */
 #define NUM_TCB                      64
 
 /*
@@ -98,7 +98,7 @@ struct rfd {
 #define FLOW_NONE	3
 
 /* Struct to define some device statistics */
-typedef struct _ce_stats_t {
+struct ce_stats_t {
 	/* Link Input/Output stats */
 	uint64_t ipackets;	/* # of in packets */
 	uint64_t opackets;	/* # of out packets */
@@ -143,7 +143,7 @@ typedef struct _ce_stats_t {
 
 	u32 SynchrounousIterations;
 	u32 InterruptStatus;
-} CE_STATS_t, *PCE_STATS_t;
+};
 
 
 /* The private adapter structure */
@@ -239,7 +239,7 @@ struct et131x_adapter {
 	u8 ReplicaPhyLoopbkPF;	/* Replica Enable Pass/Fail */
 
 	/* Stats */
-	CE_STATS_t Stats;
+	struct ce_stats_t Stats;
 
 	struct net_device_stats net_stats;
 	struct net_device_stats net_stats_prev;
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index b25bae2..5f6522c 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -161,7 +161,7 @@ struct net_device_stats *et131x_stats(struct net_device *netdev)
 {
 	struct et131x_adapter *adapter = netdev_priv(netdev);
 	struct net_device_stats *stats = &adapter->net_stats;
-	CE_STATS_t *devstat = &adapter->Stats;
+	struct ce_stats_t *devstat = &adapter->Stats;
 
 	stats->rx_packets = devstat->ipackets;
 	stats->tx_packets = devstat->opackets;
-- 
1.7.4.4


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

* [PATCH v2 4/7] staging: et131x: et131x_initpci.c checkpatch fixes
  2011-06-06 18:06 ` [PATCH v2 0/7] " Mark Einon
                     ` (2 preceding siblings ...)
  2011-06-06 18:07   ` [PATCH v2 3/7] staging: et131x: et131x_adapter.h " Mark Einon
@ 2011-06-06 18:07   ` Mark Einon
  2011-06-06 18:07   ` [PATCH v2 5/7] staging: et131x: et131x_netdev.c " Mark Einon
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 22+ messages in thread
From: Mark Einon @ 2011-06-06 18:07 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, alan, Mark Einon, Mark Einon

From: Mark Einon <Mark.Einon@gmail.com>

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et131x_initpci.c |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 50237ac..1dd2e5e 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -113,13 +113,13 @@
 static u32 et131x_speed_set;
 module_param(et131x_speed_set, uint, 0);
 MODULE_PARM_DESC(et131x_speed_set,
-		"Set Link speed and dublex manually (0-5)  [0]\n \
-		 1 : 10Mb   Half-Duplex\n \
-		 2 : 10Mb   Full-Duplex\n \
-		 3 : 100Mb  Half-Duplex\n \
-		 4 : 100Mb  Full-Duplex\n \
-		 5 : 1000Mb Full-Duplex\n \
-		 0 : Auto Speed Auto Dublex");
+		"Set Link speed and dublex manually (0-5)  [0]\n"
+		"1 : 10Mb   Half-Duplex\n"
+		"2 : 10Mb   Full-Duplex\n"
+		"3 : 100Mb  Half-Duplex\n"
+		"4 : 100Mb  Full-Duplex\n"
+		"5 : 1000Mb Full-Duplex\n"
+		"0 : Auto Speed Auto Dublex");
 
 /**
  * et131x_hwaddr_init - set up the MAC Address on the ET1310
@@ -539,7 +539,8 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev,
 
 	struct et131x_adapter *etdev;
 
-	/* Setup the fundamental net_device and private adapter structure elements  */
+	/* Setup the fundamental net_device and private adapter structure
+	 * elements  */
 	SET_NETDEV_DEV(netdev, &pdev->dev);
 
 	/* Allocate private adapter struct and copy in relevant information */
@@ -807,12 +808,12 @@ static struct pci_device_id et131x_pci_table[] __devinitdata = {
 MODULE_DEVICE_TABLE(pci, et131x_pci_table);
 
 static struct pci_driver et131x_driver = {
-      .name	= DRIVER_NAME,
-      .id_table	= et131x_pci_table,
-      .probe	= et131x_pci_setup,
-      .remove	= __devexit_p(et131x_pci_remove),
-      .suspend	= NULL,		/* et131x_pci_suspend */
-      .resume	= NULL,		/* et131x_pci_resume */
+	.name		= DRIVER_NAME,
+	.id_table	= et131x_pci_table,
+	.probe		= et131x_pci_setup,
+	.remove		= __devexit_p(et131x_pci_remove),
+	.suspend	= NULL,		/* et131x_pci_suspend */
+	.resume		= NULL,		/* et131x_pci_resume */
 };
 
 
-- 
1.7.4.4


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

* [PATCH v2 5/7] staging: et131x: et131x_netdev.c checkpatch fixes
  2011-06-06 18:06 ` [PATCH v2 0/7] " Mark Einon
                     ` (3 preceding siblings ...)
  2011-06-06 18:07   ` [PATCH v2 4/7] staging: et131x: et131x_initpci.c " Mark Einon
@ 2011-06-06 18:07   ` Mark Einon
  2011-06-06 18:07   ` [PATCH v2 6/7] staging: et131x: Fixes multiple 'WARNING: do not add new typedefs' Mark Einon
  2011-06-06 18:07   ` [PATCH v2 7/7] staging: et131x: Removing '_t' from ce_stats_t struct Mark Einon
  6 siblings, 0 replies; 22+ messages in thread
From: Mark Einon @ 2011-06-06 18:07 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, alan, Mark Einon

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et131x_netdev.c |  112 ++++++++++++++-----------------
 1 files changed, 51 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 5f6522c..7cc4b48 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -89,67 +89,6 @@
 #include "et131x.h"
 
 struct net_device_stats *et131x_stats(struct net_device *netdev);
-int et131x_open(struct net_device *netdev);
-int et131x_close(struct net_device *netdev);
-int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd);
-void et131x_multicast(struct net_device *netdev);
-int et131x_tx(struct sk_buff *skb, struct net_device *netdev);
-void et131x_tx_timeout(struct net_device *netdev);
-int et131x_change_mtu(struct net_device *netdev, int new_mtu);
-int et131x_set_mac_addr(struct net_device *netdev, void *new_mac);
-void et131x_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp);
-void et131x_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
-void et131x_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
-
-static const struct net_device_ops et131x_netdev_ops = {
-	.ndo_open		= et131x_open,
-	.ndo_stop		= et131x_close,
-	.ndo_start_xmit		= et131x_tx,
-	.ndo_set_multicast_list	= et131x_multicast,
-	.ndo_tx_timeout		= et131x_tx_timeout,
-	.ndo_change_mtu		= et131x_change_mtu,
-	.ndo_set_mac_address	= et131x_set_mac_addr,
-	.ndo_validate_addr	= eth_validate_addr,
-	.ndo_get_stats		= et131x_stats,
-	.ndo_do_ioctl		= et131x_ioctl,
-};
-
-/**
- * et131x_device_alloc
- *
- * Returns pointer to the allocated and initialized net_device struct for
- * this device.
- *
- * Create instances of net_device and wl_private for the new adapter and
- * register the device's entry points in the net_device structure.
- */
-struct net_device *et131x_device_alloc(void)
-{
-	struct net_device *netdev;
-
-	/* Alloc net_device and adapter structs */
-	netdev = alloc_etherdev(sizeof(struct et131x_adapter));
-
-	if (netdev == NULL) {
-		printk(KERN_ERR "et131x: Alloc of net_device struct failed\n");
-		return NULL;
-	}
-
-	/* Setup the function registration table (and other data) for a
-	 * net_device
-	 */
-	/* netdev->init               = &et131x_init; */
-	/* netdev->set_config = &et131x_config; */
-	netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
-	netdev->netdev_ops = &et131x_netdev_ops;
-
-	/* netdev->ethtool_ops        = &et131x_ethtool_ops; */
-
-	/* Poll? */
-	/* netdev->poll               = &et131x_poll; */
-	/* netdev->poll_controller    = &et131x_poll_controller; */
-	return netdev;
-}
 
 /**
  * et131x_stats - Return the current device statistics.
@@ -702,3 +641,54 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)
 	netif_wake_queue(netdev);
 	return result;
 }
+
+static const struct net_device_ops et131x_netdev_ops = {
+	.ndo_open		= et131x_open,
+	.ndo_stop		= et131x_close,
+	.ndo_start_xmit		= et131x_tx,
+	.ndo_set_multicast_list	= et131x_multicast,
+	.ndo_tx_timeout		= et131x_tx_timeout,
+	.ndo_change_mtu		= et131x_change_mtu,
+	.ndo_set_mac_address	= et131x_set_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+	.ndo_get_stats		= et131x_stats,
+	.ndo_do_ioctl		= et131x_ioctl,
+};
+
+/**
+ * et131x_device_alloc
+ *
+ * Returns pointer to the allocated and initialized net_device struct for
+ * this device.
+ *
+ * Create instances of net_device and wl_private for the new adapter and
+ * register the device's entry points in the net_device structure.
+ */
+struct net_device *et131x_device_alloc(void)
+{
+	struct net_device *netdev;
+
+	/* Alloc net_device and adapter structs */
+	netdev = alloc_etherdev(sizeof(struct et131x_adapter));
+
+	if (netdev == NULL) {
+		printk(KERN_ERR "et131x: Alloc of net_device struct failed\n");
+		return NULL;
+	}
+
+	/* Setup the function registration table (and other data) for a
+	 * net_device
+	 */
+	/* netdev->init               = &et131x_init; */
+	/* netdev->set_config = &et131x_config; */
+	netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
+	netdev->netdev_ops = &et131x_netdev_ops;
+
+	/* netdev->ethtool_ops        = &et131x_ethtool_ops; */
+
+	/* Poll? */
+	/* netdev->poll               = &et131x_poll; */
+	/* netdev->poll_controller    = &et131x_poll_controller; */
+	return netdev;
+}
+
-- 
1.7.4.4


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

* [PATCH v2 6/7] staging: et131x: Fixes multiple 'WARNING: do not add new typedefs'.
  2011-06-06 18:06 ` [PATCH v2 0/7] " Mark Einon
                     ` (4 preceding siblings ...)
  2011-06-06 18:07   ` [PATCH v2 5/7] staging: et131x: et131x_netdev.c " Mark Einon
@ 2011-06-06 18:07   ` Mark Einon
  2011-06-06 18:07   ` [PATCH v2 7/7] staging: et131x: Removing '_t' from ce_stats_t struct Mark Einon
  6 siblings, 0 replies; 22+ messages in thread
From: Mark Einon @ 2011-06-06 18:07 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, alan, Mark Einon

Removes unions, and uses definitions for bit manipulations.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et1310_address_map.h |  195 ++++++++++-----------------
 drivers/staging/et131x/et1310_mac.c         |   92 +++++++-------
 drivers/staging/et131x/et1310_phy.c         |    4 +-
 drivers/staging/et131x/et131x_adapter.h     |    2 +-
 drivers/staging/et131x/et131x_isr.c         |    2 +-
 5 files changed, 123 insertions(+), 172 deletions(-)

diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index 6f52627..a925300 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -700,42 +700,27 @@ struct txmac_regs {			/* Location: */
 /*
  * structure for Wake On Lan Source Address Lo reg in rxmac address map
  * located at address 0x4010
+ *
+ * 31-24: sa3
+ * 23-16: sa4
+ * 15-8: sa5
+ * 7-0: sa6
  */
-union RXMAC_WOL_SA_LO_t {
-	u32 value;
-	struct {
-#ifdef _BIT_FIELDS_HTOL
-		u32 sa3:8;	/* bits 24-31 */
-		u32 sa4:8;	/* bits 16-23 */
-		u32 sa5:8;	/* bits 8-15 */
-		u32 sa6:8;	/* bits 0-7 */
-#else
-		u32 sa6:8;	/* bits 0-7 */
-		u32 sa5:8;	/* bits 8-15 */
-		u32 sa4:8;	/* bits 16-23 */
-		u32 sa3:8;	/* bits 24-31 */
-#endif
-	} bits;
-};
+
+#define ET_WOL_LO_SA3_SHIFT 24
+#define ET_WOL_LO_SA4_SHIFT 16
+#define ET_WOL_LO_SA5_SHIFT 8
 
 /*
  * structure for Wake On Lan Source Address Hi reg in rxmac address map
  * located at address 0x4014
+ *
+ * 31-16: reserved
+ * 15-8: sa1
+ * 7-0: sa2
  */
-union RXMAC_WOL_SA_HI_t {
-	u32 value;
-	struct {
-#ifdef _BIT_FIELDS_HTOL
-		u32 reserved:16;	/* bits 16-31 */
-		u32 sa1:8;		/* bits 8-15 */
-		u32 sa2:8;		/* bits 0-7 */
-#else
-		u32 sa2:8;		/* bits 0-7 */
-		u32 sa1:8;		/* bits 8-15 */
-		u32 reserved:16;	/* bits 16-31 */
-#endif
-	} bits;
-};
+
+#define ET_WOL_HI_SA1_SHIFT 8
 
 /*
  * structure for Wake On Lan mask reg in rxmac address map
@@ -746,65 +731,45 @@ union RXMAC_WOL_SA_HI_t {
 /*
  * structure for Unicast Paket Filter Address 1 reg in rxmac address map
  * located at address 0x4068
+ *
+ * 31-24: addr1_3
+ * 23-16: addr1_4
+ * 15-8: addr1_5
+ * 7-0: addr1_6
  */
-union RXMAC_UNI_PF_ADDR1_t {
-	u32 value;
-	struct {
-#ifdef _BIT_FIELDS_HTOL
-		u32 addr1_3:8;	/* bits 24-31 */
-		u32 addr1_4:8;	/* bits 16-23 */
-		u32 addr1_5:8;	/* bits 8-15 */
-		u32 addr1_6:8;	/* bits 0-7 */
-#else
-		u32 addr1_6:8;	/* bits 0-7 */
-		u32 addr1_5:8;	/* bits 8-15 */
-		u32 addr1_4:8;	/* bits 16-23 */
-		u32 addr1_3:8;	/* bits 24-31 */
-#endif
-	} bits;
-};
+
+#define ET_UNI_PF_ADDR1_3_SHIFT 24
+#define ET_UNI_PF_ADDR1_4_SHIFT 16
+#define ET_UNI_PF_ADDR1_5_SHIFT 8
 
 /*
  * structure for Unicast Paket Filter Address 2 reg in rxmac address map
  * located at address 0x406C
+ *
+ * 31-24: addr2_3
+ * 23-16: addr2_4
+ * 15-8: addr2_5
+ * 7-0: addr2_6
  */
-union RXMAC_UNI_PF_ADDR2_t {
-	u32 value;
-	struct {
-#ifdef _BIT_FIELDS_HTOL
-		u32 addr2_3:8;	/* bits 24-31 */
-		u32 addr2_4:8;	/* bits 16-23 */
-		u32 addr2_5:8;	/* bits 8-15 */
-		u32 addr2_6:8;	/* bits 0-7 */
-#else
-		u32 addr2_6:8;	/* bits 0-7 */
-		u32 addr2_5:8;	/* bits 8-15 */
-		u32 addr2_4:8;	/* bits 16-23 */
-		u32 addr2_3:8;	/* bits 24-31 */
-#endif
-	} bits;
-};
+
+#define ET_UNI_PF_ADDR2_3_SHIFT 24
+#define ET_UNI_PF_ADDR2_4_SHIFT 16
+#define ET_UNI_PF_ADDR2_5_SHIFT 8
 
 /*
  * structure for Unicast Paket Filter Address 1 & 2 reg in rxmac address map
  * located at address 0x4070
+ *
+ * 31-24: addr2_1
+ * 23-16: addr2_2
+ * 15-8: addr1_1
+ * 7-0: addr1_2
  */
-union RXMAC_UNI_PF_ADDR3_t {
-	u32 value;
-	struct {
-#ifdef _BIT_FIELDS_HTOL
-		u32 addr2_1:8;	/* bits 24-31 */
-		u32 addr2_2:8;	/* bits 16-23 */
-		u32 addr1_1:8;	/* bits 8-15 */
-		u32 addr1_2:8;	/* bits 0-7 */
-#else
-		u32 addr1_2:8;	/* bits 0-7 */
-		u32 addr1_1:8;	/* bits 8-15 */
-		u32 addr2_2:8;	/* bits 16-23 */
-		u32 addr2_1:8;	/* bits 24-31 */
-#endif
-	} bits;
-};
+
+#define ET_UNI_PF_ADDR2_1_SHIFT 24
+#define ET_UNI_PF_ADDR2_2_SHIFT 16
+#define ET_UNI_PF_ADDR1_1_SHIFT 8
+
 
 /*
  * structure for Multicast Hash reg in rxmac address map
@@ -888,13 +853,13 @@ union RXMAC_UNI_PF_ADDR3_t {
 /*
  * Rx MAC Module of JAGCore Address Mapping
  */
-struct RXMAC_t {					/* Location: */
+struct rxmac_regs {					/* Location: */
 	u32 ctrl;					/*  0x4000 */
 	u32 crc0;					/*  0x4004 */
 	u32 crc12;					/*  0x4008 */
 	u32 crc34;					/*  0x400C */
-	union RXMAC_WOL_SA_LO_t sa_lo;			/*  0x4010 */
-	union RXMAC_WOL_SA_HI_t sa_hi;			/*  0x4014 */
+	u32 sa_lo;					/*  0x4010 */
+	u32 sa_hi;					/*  0x4014 */
 	u32 mask0_word0;				/*  0x4018 */
 	u32 mask0_word1;				/*  0x401C */
 	u32 mask0_word2;				/*  0x4020 */
@@ -915,9 +880,9 @@ struct RXMAC_t {					/* Location: */
 	u32 mask4_word1;				/*  0x405C */
 	u32 mask4_word2;				/*  0x4060 */
 	u32 mask4_word3;				/*  0x4064 */
-	union RXMAC_UNI_PF_ADDR1_t uni_pf_addr1;	/*  0x4068 */
-	union RXMAC_UNI_PF_ADDR2_t uni_pf_addr2;	/*  0x406C */
-	union RXMAC_UNI_PF_ADDR3_t uni_pf_addr3;	/*  0x4070 */
+	u32 uni_pf_addr1;				/*  0x4068 */
+	u32 uni_pf_addr2;				/*  0x406C */
+	u32 uni_pf_addr3;				/*  0x4070 */
 	u32 multi_hash1;				/*  0x4074 */
 	u32 multi_hash2;				/*  0x4078 */
 	u32 multi_hash3;				/*  0x407C */
@@ -1123,47 +1088,33 @@ struct RXMAC_t {					/* Location: */
 /*
  * structure for Mac Station Address, Part 1 reg in mac address map.
  * located at address 0x5040
+ *
+ * 31-24: Octet6
+ * 23-16: Octet5
+ * 15-8: Octet4
+ * 7-0: Octet3
  */
-union MAC_STATION_ADDR1_t {
-	u32 value;
-	struct {
-#ifdef _BIT_FIELDS_HTOL
-		u32 Octet6:8;	/* bits 24-31 */
-		u32 Octet5:8;	/* bits 16-23 */
-		u32 Octet4:8;	/* bits 8-15 */
-		u32 Octet3:8;	/* bits 0-7 */
-#else
-		u32 Octet3:8;	/* bits 0-7 */
-		u32 Octet4:8;	/* bits 8-15 */
-		u32 Octet5:8;	/* bits 16-23 */
-		u32 Octet6:8;	/* bits 24-31 */
-#endif
-	} bits;
-};
+
+#define ET_MAC_STATION_ADDR1_OC6_SHIFT 24
+#define ET_MAC_STATION_ADDR1_OC5_SHIFT 16
+#define ET_MAC_STATION_ADDR1_OC4_SHIFT 8
 
 /*
  * structure for Mac Station Address, Part 2 reg in mac address map.
  * located at address 0x5044
+ *
+ * 31-24: Octet2
+ * 23-16: Octet1
+ * 15-0: reserved
  */
-union MAC_STATION_ADDR2_t {
-	u32 value;
-	struct {
-#ifdef _BIT_FIELDS_HTOL
-		u32 Octet2:8;	/* bits 24-31 */
-		u32 Octet1:8;	/* bits 16-23 */
-		u32 reserved:16;	/* bits 0-15 */
-#else
-		u32 reserved:16;	/* bit 0-15 */
-		u32 Octet1:8;	/* bits 16-23 */
-		u32 Octet2:8;	/* bits 24-31 */
-#endif
-	} bits;
-};
+
+#define ET_MAC_STATION_ADDR2_OC2_SHIFT 24
+#define ET_MAC_STATION_ADDR2_OC1_SHIFT 16
 
 /*
  * MAC Module of JAGCore Address Mapping
  */
-struct MAC_t {						/* Location: */
+struct mac_regs {					/* Location: */
 	u32 cfg1;					/*  0x5000 */
 	u32 cfg2;					/*  0x5004 */
 	u32 ipg;					/*  0x5008 */
@@ -1180,8 +1131,8 @@ struct MAC_t {						/* Location: */
 	u32 mii_mgmt_indicator;				/*  0x5034 */
 	u32 if_ctrl;					/*  0x5038 */
 	u32 if_stat;					/*  0x503C */
-	union MAC_STATION_ADDR1_t station_addr_1;	/*  0x5040 */
-	union MAC_STATION_ADDR2_t station_addr_2;	/*  0x5044 */
+	u32 station_addr_1;				/*  0x5040 */
+	u32 station_addr_2;				/*  0x5044 */
 };
 
 /* END OF MAC REGISTER ADDRESS MAP */
@@ -1448,7 +1399,7 @@ struct mmc_regs {		/* Location: */
 /*
  * JAGCore Address Mapping
  */
-struct ADDRESS_MAP_t {
+struct address_map {
 	struct global_regs global;
 	/* unused section of global address map */
 	u8 unused_global[4096 - sizeof(struct global_regs)];
@@ -1461,12 +1412,12 @@ struct ADDRESS_MAP_t {
 	struct txmac_regs txmac;
 	/* unused section of txmac address map */
 	u8 unused_txmac[4096 - sizeof(struct txmac_regs)];
-	struct RXMAC_t rxmac;
+	struct rxmac_regs rxmac;
 	/* unused section of rxmac address map */
-	u8 unused_rxmac[4096 - sizeof(struct RXMAC_t)];
-	struct MAC_t mac;
+	u8 unused_rxmac[4096 - sizeof(struct rxmac_regs)];
+	struct mac_regs mac;
 	/* unused section of mac address map */
-	u8 unused_mac[4096 - sizeof(struct MAC_t)];
+	u8 unused_mac[4096 - sizeof(struct mac_regs)];
 	struct macstat_regs macstat;
 	/* unused section of mac stat address map */
 	u8 unused_mac_stat[4096 - sizeof(struct macstat_regs)];
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index 1425af2..5a745cf 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -104,9 +104,9 @@
  */
 void ConfigMACRegs1(struct et131x_adapter *etdev)
 {
-	struct MAC_t __iomem *pMac = &etdev->regs->mac;
-	union MAC_STATION_ADDR1_t station1;
-	union MAC_STATION_ADDR2_t station2;
+	struct mac_regs __iomem *pMac = &etdev->regs->mac;
+	u32 station1;
+	u32 station2;
 	u32 ipg;
 
 	/* First we need to reset everything.  Write to MAC configuration
@@ -136,14 +136,14 @@ void ConfigMACRegs1(struct et131x_adapter *etdev)
 	 * station address is used for generating and checking pause control
 	 * packets.
 	 */
-	station2.bits.Octet1 = etdev->addr[0];
-	station2.bits.Octet2 = etdev->addr[1];
-	station1.bits.Octet3 = etdev->addr[2];
-	station1.bits.Octet4 = etdev->addr[3];
-	station1.bits.Octet5 = etdev->addr[4];
-	station1.bits.Octet6 = etdev->addr[5];
-	writel(station1.value, &pMac->station_addr_1.value);
-	writel(station2.value, &pMac->station_addr_2.value);
+	station2 = (etdev->addr[1] << ET_MAC_STATION_ADDR2_OC2_SHIFT) |
+		   (etdev->addr[0] << ET_MAC_STATION_ADDR2_OC1_SHIFT);
+	station1 = (etdev->addr[5] << ET_MAC_STATION_ADDR1_OC6_SHIFT) |
+		   (etdev->addr[4] << ET_MAC_STATION_ADDR1_OC5_SHIFT) |
+		   (etdev->addr[3] << ET_MAC_STATION_ADDR1_OC4_SHIFT) |
+		    etdev->addr[2];
+	writel(station1, &pMac->station_addr_1);
+	writel(station2, &pMac->station_addr_2);
 
 	/* Max ethernet packet in bytes that will passed by the mac without
 	 * being truncated.  Allow the MAC to pass 4 more than our max packet
@@ -165,7 +165,7 @@ void ConfigMACRegs1(struct et131x_adapter *etdev)
 void ConfigMACRegs2(struct et131x_adapter *etdev)
 {
 	int32_t delay = 0;
-	struct MAC_t __iomem *pMac = &etdev->regs->mac;
+	struct mac_regs __iomem *pMac = &etdev->regs->mac;
 	u32 cfg1;
 	u32 cfg2;
 	u32 ifctrl;
@@ -237,9 +237,9 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
 
 void ConfigRxMacRegs(struct et131x_adapter *etdev)
 {
-	struct RXMAC_t __iomem *pRxMac = &etdev->regs->rxmac;
-	union RXMAC_WOL_SA_LO_t sa_lo;
-	union RXMAC_WOL_SA_HI_t sa_hi;
+	struct rxmac_regs __iomem *pRxMac = &etdev->regs->rxmac;
+	u32 sa_lo;
+	u32 sa_hi = 0;
 	u32 pf_ctrl = 0;
 
 	/* Disable the MAC while it is being configured (also disable WOL) */
@@ -280,15 +280,15 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev)
 	writel(0, &pRxMac->mask4_word3);
 
 	/* Lets setup the WOL Source Address */
-	sa_lo.bits.sa3 = etdev->addr[2];
-	sa_lo.bits.sa4 = etdev->addr[3];
-	sa_lo.bits.sa5 = etdev->addr[4];
-	sa_lo.bits.sa6 = etdev->addr[5];
-	writel(sa_lo.value, &pRxMac->sa_lo.value);
+	sa_lo = (etdev->addr[2] << ET_WOL_LO_SA3_SHIFT) |
+		(etdev->addr[3] << ET_WOL_LO_SA4_SHIFT) |
+		(etdev->addr[4] << ET_WOL_LO_SA5_SHIFT) |
+		 etdev->addr[5];
+	writel(sa_lo, &pRxMac->sa_lo);
 
-	sa_hi.bits.sa1 = etdev->addr[0];
-	sa_hi.bits.sa2 = etdev->addr[1];
-	writel(sa_hi.value, &pRxMac->sa_hi.value);
+	sa_hi = (u32) (etdev->addr[0] << ET_WOL_HI_SA1_SHIFT) |
+	               etdev->addr[1];
+	writel(sa_hi, &pRxMac->sa_hi);
 
 	/* Disable all Packet Filtering */
 	writel(0, &pRxMac->pf_ctrl);
@@ -298,9 +298,9 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev)
 		SetupDeviceForUnicast(etdev);
 		pf_ctrl |= 4;	/* Unicast filter */
 	} else {
-		writel(0, &pRxMac->uni_pf_addr1.value);
-		writel(0, &pRxMac->uni_pf_addr2.value);
-		writel(0, &pRxMac->uni_pf_addr3.value);
+		writel(0, &pRxMac->uni_pf_addr1);
+		writel(0, &pRxMac->uni_pf_addr2);
+		writel(0, &pRxMac->uni_pf_addr3);
 	}
 
 	/* Let's initialize the Multicast hash */
@@ -534,7 +534,7 @@ void HandleMacStatInterrupt(struct et131x_adapter *etdev)
 
 void SetupDeviceForMulticast(struct et131x_adapter *etdev)
 {
-	struct RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
+	struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac;
 	uint32_t nIndex;
 	uint32_t result;
 	uint32_t hash1 = 0;
@@ -582,10 +582,10 @@ void SetupDeviceForMulticast(struct et131x_adapter *etdev)
 
 void SetupDeviceForUnicast(struct et131x_adapter *etdev)
 {
-	struct RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
-	union RXMAC_UNI_PF_ADDR1_t uni_pf1;
-	union RXMAC_UNI_PF_ADDR2_t uni_pf2;
-	union RXMAC_UNI_PF_ADDR3_t uni_pf3;
+	struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac;
+	u32 uni_pf1;
+	u32 uni_pf2;
+	u32 uni_pf3;
 	u32 pm_csr;
 
 	/* Set up unicast packet filter reg 3 to be the first two octets of
@@ -597,25 +597,25 @@ void SetupDeviceForUnicast(struct et131x_adapter *etdev)
 	 * Set up unicast packet filter reg 3 to be the octets 2 - 5 of the
 	 * MAC address for first address
 	 */
-	uni_pf3.bits.addr1_1 = etdev->addr[0];
-	uni_pf3.bits.addr1_2 = etdev->addr[1];
-	uni_pf3.bits.addr2_1 = etdev->addr[0];
-	uni_pf3.bits.addr2_2 = etdev->addr[1];
+	uni_pf3 = (etdev->addr[0] << ET_UNI_PF_ADDR2_1_SHIFT) |
+		  (etdev->addr[1] << ET_UNI_PF_ADDR2_2_SHIFT) |
+		  (etdev->addr[0] << ET_UNI_PF_ADDR1_1_SHIFT) |
+		   etdev->addr[1];
 
-	uni_pf2.bits.addr2_3 = etdev->addr[2];
-	uni_pf2.bits.addr2_4 = etdev->addr[3];
-	uni_pf2.bits.addr2_5 = etdev->addr[4];
-	uni_pf2.bits.addr2_6 = etdev->addr[5];
+	uni_pf2 = (etdev->addr[2] << ET_UNI_PF_ADDR2_3_SHIFT) |
+		  (etdev->addr[3] << ET_UNI_PF_ADDR2_4_SHIFT) |
+		  (etdev->addr[4] << ET_UNI_PF_ADDR2_5_SHIFT) |
+		   etdev->addr[5];
 
-	uni_pf1.bits.addr1_3 = etdev->addr[2];
-	uni_pf1.bits.addr1_4 = etdev->addr[3];
-	uni_pf1.bits.addr1_5 = etdev->addr[4];
-	uni_pf1.bits.addr1_6 = etdev->addr[5];
+	uni_pf1 = (etdev->addr[2] << ET_UNI_PF_ADDR1_3_SHIFT) |
+		  (etdev->addr[3] << ET_UNI_PF_ADDR1_4_SHIFT) |
+		  (etdev->addr[4] << ET_UNI_PF_ADDR1_5_SHIFT) |
+		   etdev->addr[5];
 
 	pm_csr = readl(&etdev->regs->global.pm_csr);
 	if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) {
-		writel(uni_pf1.value, &rxmac->uni_pf_addr1.value);
-		writel(uni_pf2.value, &rxmac->uni_pf_addr2.value);
-		writel(uni_pf3.value, &rxmac->uni_pf_addr3.value);
+		writel(uni_pf1, &rxmac->uni_pf_addr1);
+		writel(uni_pf2, &rxmac->uni_pf_addr2);
+		writel(uni_pf3, &rxmac->uni_pf_addr3);
 	}
 }
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index bc8d385..190db0b 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -108,7 +108,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev);
 int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr,
 	      u8 xcvrReg, u16 *value)
 {
-	struct MAC_t __iomem *mac = &etdev->regs->mac;
+	struct mac_regs __iomem *mac = &etdev->regs->mac;
 	int status = 0;
 	u32 delay;
 	u32 miiAddr;
@@ -176,7 +176,7 @@ int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr,
  */
 int MiWrite(struct et131x_adapter *etdev, u8 xcvrReg, u16 value)
 {
-	struct MAC_t __iomem *mac = &etdev->regs->mac;
+	struct mac_regs __iomem *mac = &etdev->regs->mac;
 	int status = 0;
 	u8 xcvrAddr = etdev->Stats.xcvr_addr;
 	u32 delay;
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 87905e7..0cbf699 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -186,7 +186,7 @@ struct et131x_adapter {
 	u8 MCList[NIC_MAX_MCAST_LIST][ETH_ALEN];
 
 	/* Pointer to the device's PCI register space */
-	struct ADDRESS_MAP_t __iomem *regs;
+	struct address_map __iomem *regs;
 
 	/* Registry parameters */
 	u8 SpeedDuplex;		/* speed/duplex */
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index 7c7b464..11700b5 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -245,7 +245,7 @@ void et131x_isr_handler(struct work_struct *work)
 	struct et131x_adapter *etdev =
 		container_of(work, struct et131x_adapter, task);
 	u32 status = etdev->Stats.InterruptStatus;
-	struct ADDRESS_MAP_t __iomem *iomem = etdev->regs;
+	struct address_map __iomem *iomem = etdev->regs;
 
 	/*
 	 * These first two are by far the most common.  Once handled, we clear
-- 
1.7.4.4


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

* [PATCH v2 7/7] staging: et131x: Removing '_t' from ce_stats_t struct
  2011-06-06 18:06 ` [PATCH v2 0/7] " Mark Einon
                     ` (5 preceding siblings ...)
  2011-06-06 18:07   ` [PATCH v2 6/7] staging: et131x: Fixes multiple 'WARNING: do not add new typedefs' Mark Einon
@ 2011-06-06 18:07   ` Mark Einon
  2011-06-06 18:31     ` Joe Perches
  6 siblings, 1 reply; 22+ messages in thread
From: Mark Einon @ 2011-06-06 18:07 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, o.hartmann, alan, Mark Einon

Removing '_t' from ce_stats_t struct name and renaming et131x_adapter ce_stats member from
 'Stats' to 'stats'

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et1310_mac.c     |   30 +++++++++++++++---------------
 drivers/staging/et131x/et1310_phy.c     |    6 +++---
 drivers/staging/et131x/et1310_rx.c      |   10 +++++-----
 drivers/staging/et131x/et1310_tx.c      |    8 ++++----
 drivers/staging/et131x/et131x.h         |    2 +-
 drivers/staging/et131x/et131x_adapter.h |    4 ++--
 drivers/staging/et131x/et131x_isr.c     |    4 ++--
 drivers/staging/et131x/et131x_netdev.c  |    4 ++--
 8 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index 5a745cf..b1a7183 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -452,7 +452,7 @@ void ConfigFlowControl(struct et131x_adapter *etdev)
  */
 void UpdateMacStatHostCounters(struct et131x_adapter *etdev)
 {
-	struct ce_stats_t *stats = &etdev->Stats;
+	struct ce_stats *stats = &etdev->stats;
 	struct macstat_regs __iomem *macstat =
 		&etdev->regs->macstat;
 
@@ -503,33 +503,33 @@ void HandleMacStatInterrupt(struct et131x_adapter *etdev)
 	 * block indicates that one of the counters has wrapped.
 	 */
 	if (Carry1 & (1 << 14))
-		etdev->Stats.code_violations += COUNTER_WRAP_16_BIT;
+		etdev->stats.code_violations += COUNTER_WRAP_16_BIT;
 	if (Carry1 & (1 << 8))
-		etdev->Stats.alignment_err += COUNTER_WRAP_12_BIT;
+		etdev->stats.alignment_err += COUNTER_WRAP_12_BIT;
 	if (Carry1 & (1 << 7))
-		etdev->Stats.length_err += COUNTER_WRAP_16_BIT;
+		etdev->stats.length_err += COUNTER_WRAP_16_BIT;
 	if (Carry1 & (1 << 2))
-		etdev->Stats.other_errors += COUNTER_WRAP_16_BIT;
+		etdev->stats.other_errors += COUNTER_WRAP_16_BIT;
 	if (Carry1 & (1 << 6))
-		etdev->Stats.crc_err += COUNTER_WRAP_16_BIT;
+		etdev->stats.crc_err += COUNTER_WRAP_16_BIT;
 	if (Carry1 & (1 << 3))
-		etdev->Stats.rx_ov_flow += COUNTER_WRAP_16_BIT;
+		etdev->stats.rx_ov_flow += COUNTER_WRAP_16_BIT;
 	if (Carry1 & (1 << 0))
-		etdev->Stats.norcvbuf += COUNTER_WRAP_16_BIT;
+		etdev->stats.norcvbuf += COUNTER_WRAP_16_BIT;
 	if (Carry2 & (1 << 16))
-		etdev->Stats.max_pkt_error += COUNTER_WRAP_12_BIT;
+		etdev->stats.max_pkt_error += COUNTER_WRAP_12_BIT;
 	if (Carry2 & (1 << 15))
-		etdev->Stats.tx_uflo += COUNTER_WRAP_12_BIT;
+		etdev->stats.tx_uflo += COUNTER_WRAP_12_BIT;
 	if (Carry2 & (1 << 6))
-		etdev->Stats.first_collision += COUNTER_WRAP_12_BIT;
+		etdev->stats.first_collision += COUNTER_WRAP_12_BIT;
 	if (Carry2 & (1 << 8))
-		etdev->Stats.tx_deferred += COUNTER_WRAP_12_BIT;
+		etdev->stats.tx_deferred += COUNTER_WRAP_12_BIT;
 	if (Carry2 & (1 << 5))
-		etdev->Stats.excessive_collisions += COUNTER_WRAP_12_BIT;
+		etdev->stats.excessive_collisions += COUNTER_WRAP_12_BIT;
 	if (Carry2 & (1 << 4))
-		etdev->Stats.late_collisions += COUNTER_WRAP_12_BIT;
+		etdev->stats.late_collisions += COUNTER_WRAP_12_BIT;
 	if (Carry2 & (1 << 2))
-		etdev->Stats.collisions += COUNTER_WRAP_12_BIT;
+		etdev->stats.collisions += COUNTER_WRAP_12_BIT;
 }
 
 void SetupDeviceForMulticast(struct et131x_adapter *etdev)
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 190db0b..1df0d05 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -178,7 +178,7 @@ int MiWrite(struct et131x_adapter *etdev, u8 xcvrReg, u16 value)
 {
 	struct mac_regs __iomem *mac = &etdev->regs->mac;
 	int status = 0;
-	u8 xcvrAddr = etdev->Stats.xcvr_addr;
+	u8 xcvrAddr = etdev->stats.xcvr_addr;
 	u32 delay;
 	u32 miiAddr;
 	u32 miiCmd;
@@ -259,8 +259,8 @@ int et131x_xcvr_find(struct et131x_adapter *etdev)
 		xcvr_id = (u32) ((idr1 << 16) | idr2);
 
 		if (idr1 != 0 && idr1 != 0xffff) {
-			etdev->Stats.xcvr_id = xcvr_id;
-			etdev->Stats.xcvr_addr = xcvr_addr;
+			etdev->stats.xcvr_id = xcvr_id;
+			etdev->stats.xcvr_addr = xcvr_addr;
 			return 0;
 		}
 	}
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index cd72a0b..100ee9b4 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -971,7 +971,7 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
 	 * also counted here.
 	 */
 	if (len < (NIC_MIN_PACKET_SIZE + 4)) {
-		etdev->Stats.other_errors++;
+		etdev->stats.other_errors++;
 		len = 0;
 	}
 
@@ -1039,16 +1039,16 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
 			}
 
 			if (len > 0)
-				etdev->Stats.multircv++;
+				etdev->stats.multircv++;
 		} else if (word0 & ALCATEL_BROADCAST_PKT)
-			etdev->Stats.brdcstrcv++;
+			etdev->stats.brdcstrcv++;
 		else
 			/* Not sure what this counter measures in
 			 * promiscuous mode. Perhaps we should check
 			 * the MAC address to see if it is directed
 			 * to us in promiscuous mode.
 			 */
-			etdev->Stats.unircv++;
+			etdev->stats.unircv++;
 	}
 
 	if (len > 0) {
@@ -1132,7 +1132,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
 		}
 
 		/* Increment the number of packets we received */
-		etdev->Stats.ipackets++;
+		etdev->stats.ipackets++;
 
 		/* Set the status on the packet, either resources or success */
 		if (etdev->rx_ring.nReadyRecv < RFD_LOW_WATER_MARK) {
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index 4241d2a..b8f8dae 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -635,11 +635,11 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
 	struct net_device_stats *stats = &etdev->net_stats;
 
 	if (tcb->flags & fMP_DEST_BROAD)
-		atomic_inc(&etdev->Stats.brdcstxmt);
+		atomic_inc(&etdev->stats.brdcstxmt);
 	else if (tcb->flags & fMP_DEST_MULTI)
-		atomic_inc(&etdev->Stats.multixmt);
+		atomic_inc(&etdev->stats.multixmt);
 	else
-		atomic_inc(&etdev->Stats.unixmt);
+		atomic_inc(&etdev->stats.unixmt);
 
 	if (tcb->skb) {
 		stats->tx_bytes += tcb->skb->len;
@@ -673,7 +673,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
 	/* Add the TCB to the Ready Q */
 	spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
 
-	etdev->Stats.opackets++;
+	etdev->stats.opackets++;
 
 	if (etdev->tx_ring.tcb_qtail)
 		etdev->tx_ring.tcb_qtail->next = tcb;
diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h
index 8aa3365..e425147 100644
--- a/drivers/staging/et131x/et131x.h
+++ b/drivers/staging/et131x/et131x.h
@@ -108,7 +108,7 @@ void et131x_setphy_normal(struct et131x_adapter *adapter);
 int PhyMiRead(struct et131x_adapter *adapter, u8 xcvrAddr,
 	      u8 xcvrReg, u16 *value);
 #define MiRead(adapter, xcvrReg, value) \
-	PhyMiRead((adapter), (adapter)->Stats.xcvr_addr, (xcvrReg), (value))
+	PhyMiRead((adapter), (adapter)->stats.xcvr_addr, (xcvrReg), (value))
 
 int32_t MiWrite(struct et131x_adapter *adapter,
 		u8 xcvReg, u16 value);
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 0cbf699..c6657f4 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -98,7 +98,7 @@ struct rfd {
 #define FLOW_NONE	3
 
 /* Struct to define some device statistics */
-struct ce_stats_t {
+struct ce_stats {
 	/* Link Input/Output stats */
 	uint64_t ipackets;	/* # of in packets */
 	uint64_t opackets;	/* # of out packets */
@@ -239,7 +239,7 @@ struct et131x_adapter {
 	u8 ReplicaPhyLoopbkPF;	/* Replica Enable Pass/Fail */
 
 	/* Stats */
-	struct ce_stats_t Stats;
+	struct ce_stats stats;
 
 	struct net_device_stats net_stats;
 	struct net_device_stats net_stats_prev;
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index 11700b5..19d6726 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -222,7 +222,7 @@ irqreturn_t et131x_isr(int irq, void *dev_id)
 	 * DPC. We will clear the software copy of that in that
 	 * routine.
 	 */
-	adapter->Stats.InterruptStatus = status;
+	adapter->stats.InterruptStatus = status;
 
 	/* Schedule the ISR handler as a bottom-half task in the
 	 * kernel's tq_immediate queue, and mark the queue for
@@ -244,7 +244,7 @@ void et131x_isr_handler(struct work_struct *work)
 {
 	struct et131x_adapter *etdev =
 		container_of(work, struct et131x_adapter, task);
-	u32 status = etdev->Stats.InterruptStatus;
+	u32 status = etdev->stats.InterruptStatus;
 	struct address_map __iomem *iomem = etdev->regs;
 
 	/*
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 7cc4b48..2da5828 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -100,7 +100,7 @@ struct net_device_stats *et131x_stats(struct net_device *netdev)
 {
 	struct et131x_adapter *adapter = netdev_priv(netdev);
 	struct net_device_stats *stats = &adapter->net_stats;
-	struct ce_stats_t *devstat = &adapter->Stats;
+	struct ce_stats *devstat = &adapter->stats;
 
 	stats->rx_packets = devstat->ipackets;
 	stats->tx_packets = devstat->opackets;
@@ -218,7 +218,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
 
 	switch (cmd) {
 	case SIOCGMIIPHY:
-		data->phy_id = etdev->Stats.xcvr_addr;
+		data->phy_id = etdev->stats.xcvr_addr;
 		break;
 
 	case SIOCGMIIREG:
-- 
1.7.4.4


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

* Re: [PATCH v2 7/7] staging: et131x: Removing '_t' from ce_stats_t struct
  2011-06-06 18:07   ` [PATCH v2 7/7] staging: et131x: Removing '_t' from ce_stats_t struct Mark Einon
@ 2011-06-06 18:31     ` Joe Perches
  0 siblings, 0 replies; 22+ messages in thread
From: Joe Perches @ 2011-06-06 18:31 UTC (permalink / raw)
  To: Mark Einon; +Cc: gregkh, devel, linux-kernel, alan, o.hartmann

On Mon, 2011-06-06 at 19:07 +0100, Mark Einon wrote:
> Removing '_t' from ce_stats_t struct name and renaming et131x_adapter ce_stats member from
>  'Stats' to 'stats'
[]
> diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
[]
> @@ -452,7 +452,7 @@ void ConfigFlowControl(struct et131x_adapter *etdev)
>   */
>  void UpdateMacStatHostCounters(struct et131x_adapter *etdev)
>  {
> -	struct ce_stats_t *stats = &etdev->Stats;
> +	struct ce_stats *stats = &etdev->stats;
>  	struct macstat_regs __iomem *macstat =
>  		&etdev->regs->macstat;
>  
> @@ -503,33 +503,33 @@ void HandleMacStatInterrupt(struct et131x_adapter *etdev)

Might as well copy from UpdateMacStatHostCounters and add

	struct ce_stats *stats = &etdev->stats;

>  	 * block indicates that one of the counters has wrapped.
>  	 */
>  	if (Carry1 & (1 << 14))
> -		etdev->Stats.code_violations += COUNTER_WRAP_16_BIT;
> +		etdev->stats.code_violations += COUNTER_WRAP_16_BIT;

and change these to
		stats->foo += bar...

>  	if (Carry1 & (1 << 8))
> -		etdev->Stats.alignment_err += COUNTER_WRAP_12_BIT;
> +		etdev->stats.alignment_err += COUNTER_WRAP_12_BIT;
>  	if (Carry1 & (1 << 7))
> -		etdev->Stats.length_err += COUNTER_WRAP_16_BIT;
> +		etdev->stats.length_err += COUNTER_WRAP_16_BIT;
>  	if (Carry1 & (1 << 2))
> -		etdev->Stats.other_errors += COUNTER_WRAP_16_BIT;
> +		etdev->stats.other_errors += COUNTER_WRAP_16_BIT;
>  	if (Carry1 & (1 << 6))
> -		etdev->Stats.crc_err += COUNTER_WRAP_16_BIT;
> +		etdev->stats.crc_err += COUNTER_WRAP_16_BIT;
>  	if (Carry1 & (1 << 3))
> -		etdev->Stats.rx_ov_flow += COUNTER_WRAP_16_BIT;
> +		etdev->stats.rx_ov_flow += COUNTER_WRAP_16_BIT;
>  	if (Carry1 & (1 << 0))
> -		etdev->Stats.norcvbuf += COUNTER_WRAP_16_BIT;
> +		etdev->stats.norcvbuf += COUNTER_WRAP_16_BIT;
>  	if (Carry2 & (1 << 16))
> -		etdev->Stats.max_pkt_error += COUNTER_WRAP_12_BIT;
> +		etdev->stats.max_pkt_error += COUNTER_WRAP_12_BIT;
>  	if (Carry2 & (1 << 15))
> -		etdev->Stats.tx_uflo += COUNTER_WRAP_12_BIT;
> +		etdev->stats.tx_uflo += COUNTER_WRAP_12_BIT;
>  	if (Carry2 & (1 << 6))
> -		etdev->Stats.first_collision += COUNTER_WRAP_12_BIT;
> +		etdev->stats.first_collision += COUNTER_WRAP_12_BIT;
>  	if (Carry2 & (1 << 8))
> -		etdev->Stats.tx_deferred += COUNTER_WRAP_12_BIT;
> +		etdev->stats.tx_deferred += COUNTER_WRAP_12_BIT;
>  	if (Carry2 & (1 << 5))
> -		etdev->Stats.excessive_collisions += COUNTER_WRAP_12_BIT;
> +		etdev->stats.excessive_collisions += COUNTER_WRAP_12_BIT;
>  	if (Carry2 & (1 << 4))
> -		etdev->Stats.late_collisions += COUNTER_WRAP_12_BIT;
> +		etdev->stats.late_collisions += COUNTER_WRAP_12_BIT;
>  	if (Carry2 & (1 << 2))
> -		etdev->Stats.collisions += COUNTER_WRAP_12_BIT;
> +		etdev->stats.collisions += COUNTER_WRAP_12_BIT;
>  }



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

end of thread, other threads:[~2011-06-06 18:31 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-05 17:35 [PATCH 0/5] staging: et131x: checkpatch fixes Mark Einon
2011-06-05 17:35 ` [PATCH 1/5] staging: et131x: et1310_address_map.h " Mark Einon
2011-06-05 19:14   ` Alan Cox
2011-06-05 17:35 ` [PATCH 2/5] staging: et131x: et1310_rx.c " Mark Einon
2011-06-05 19:08   ` Alan Cox
2011-06-05 17:35 ` [PATCH 3/5] staging: et131x: et131x_adapter.h " Mark Einon
2011-06-05 19:11   ` Alan Cox
2011-06-05 17:35 ` [PATCH 4/5] staging: et131x: et131x_initpci.c " Mark Einon
2011-06-05 19:09   ` Alan Cox
2011-06-06  6:00   ` Dan Carpenter
2011-06-05 17:35 ` [PATCH 5/5] staging: et131x: et131x_netdev.c " Mark Einon
2011-06-05 19:10   ` Alan Cox
2011-06-05 19:11 ` [PATCH 0/5] staging: et131x: " Alan Cox
2011-06-06 18:06 ` [PATCH v2 0/7] " Mark Einon
2011-06-06 18:06   ` [PATCH v2 1/7] staging: et131x: checkpatch fixes for et1310_address_map.h (All 'do not add new typedefs') Mark Einon
2011-06-06 18:06   ` [PATCH v2 2/7] staging: et131x: et1310_rx.c checkpatch fixes Mark Einon
2011-06-06 18:07   ` [PATCH v2 3/7] staging: et131x: et131x_adapter.h " Mark Einon
2011-06-06 18:07   ` [PATCH v2 4/7] staging: et131x: et131x_initpci.c " Mark Einon
2011-06-06 18:07   ` [PATCH v2 5/7] staging: et131x: et131x_netdev.c " Mark Einon
2011-06-06 18:07   ` [PATCH v2 6/7] staging: et131x: Fixes multiple 'WARNING: do not add new typedefs' Mark Einon
2011-06-06 18:07   ` [PATCH v2 7/7] staging: et131x: Removing '_t' from ce_stats_t struct Mark Einon
2011-06-06 18:31     ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).