[PATCH 3/3] staging: et131x: Remove USE_FBR0 define and #ifdefs

2012-10-19 Thread Mark Einon
USE_FBR0 has always been defined, even in the original driver code.
Remove the define and #ifdef code to leave the code in the same state.

Signed-off-by: Mark Einon 
---
 drivers/staging/et131x/et131x.c |   58 +--
 1 file changed, 7 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 32f909a..c33cafd 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -176,20 +176,13 @@ MODULE_DESCRIPTION("10/100/1000 Base-T Ethernet Driver 
for the ET1310 by Agere S
 #define PARM_DMA_CACHE_DEF  0
 
 /* RX defines */
-#define USE_FBR0 1
 #define FBR_CHUNKS 32
 #define MAX_DESC_PER_RING_RX 1024
 
 /* number of RFDs - default and min */
-#ifdef USE_FBR0
 #define RFD_LOW_WATER_MARK 40
 #define NIC_DEFAULT_NUM_RFD1024
 #define NUM_FBRS   2
-#else
-#define RFD_LOW_WATER_MARK 20
-#define NIC_DEFAULT_NUM_RFD256
-#define NUM_FBRS   1
-#endif
 
 #define NIC_MIN_NUM_RFD64
 #define NUM_PACKETS_HANDLED256
@@ -871,7 +864,7 @@ static void et131x_rx_dma_enable(struct et131x_adapter 
*adapter)
csr |= 0x1000;
else if (adapter->rx_ring.fbr[0]->buffsize == 16384)
csr |= 0x1800;
-#ifdef USE_FBR0
+
csr |= 0x0400;  /* FBR0 enable */
if (adapter->rx_ring.fbr[1]->buffsize == 256)
csr |= 0x0100;
@@ -879,7 +872,6 @@ static void et131x_rx_dma_enable(struct et131x_adapter 
*adapter)
csr |= 0x0200;
else if (adapter->rx_ring.fbr[1]->buffsize == 1024)
csr |= 0x0300;
-#endif
writel(csr, >regs->rxdma.csr);
 
csr = readl(>regs->rxdma.csr);
@@ -1909,7 +1901,6 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
   ((rx_local->fbr[0]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
   _dma->fbr1_min_des);
 
-#ifdef USE_FBR0
/* Now's the best time to initialize FBR0 contents */
fbr_entry = (struct fbr_desc *) rx_local->fbr[1]->ring_virtaddr;
for (entry = 0; entry < rx_local->fbr[1]->num_entries; entry++) {
@@ -1933,7 +1924,6 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
writel(
   ((rx_local->fbr[1]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
   _dma->fbr0_min_des);
-#endif
 
/* Program the number of packets we will receive before generating an
 * interrupt.
@@ -2305,9 +2295,7 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
rx_ring = >rx_ring;
 
/* Alloc memory for the lookup table */
-#ifdef USE_FBR0
rx_ring->fbr[1] = kmalloc(sizeof(struct fbr_lookup), GFP_KERNEL);
-#endif
rx_ring->fbr[0] = kmalloc(sizeof(struct fbr_lookup), GFP_KERNEL);
 
/* The first thing we will do is configure the sizes of the buffer
@@ -2329,35 +2317,25 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
 */
 
if (adapter->registry_jumbo_packet < 2048) {
-#ifdef USE_FBR0
rx_ring->fbr[1]->buffsize = 256;
rx_ring->fbr[1]->num_entries = 512;
-#endif
rx_ring->fbr[0]->buffsize = 2048;
rx_ring->fbr[0]->num_entries = 512;
} else if (adapter->registry_jumbo_packet < 4096) {
-#ifdef USE_FBR0
rx_ring->fbr[1]->buffsize = 512;
rx_ring->fbr[1]->num_entries = 1024;
-#endif
rx_ring->fbr[0]->buffsize = 4096;
rx_ring->fbr[0]->num_entries = 512;
} else {
-#ifdef USE_FBR0
rx_ring->fbr[1]->buffsize = 1024;
rx_ring->fbr[1]->num_entries = 768;
-#endif
rx_ring->fbr[0]->buffsize = 16384;
rx_ring->fbr[0]->num_entries = 128;
}
 
-#ifdef USE_FBR0
adapter->rx_ring.psr_num_entries =
adapter->rx_ring.fbr[1]->num_entries +
adapter->rx_ring.fbr[0]->num_entries;
-#else
-   adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[0]->num_entries;
-#endif
 
/* Allocate an area of memory for Free Buffer Ring 1 */
bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) +
@@ -2381,7 +2359,6 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
(void *)((u8 *) rx_ring->fbr[0]->ring_virtaddr +
rx_ring->fbr[0]->offset);
 
-#ifdef USE_FBR0
/* Allocate an area of memory for Free Buffer Ring 0 */
bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) +
0xfff;
@@ -2403,7 +2380,7 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
rx_ring->fbr[1]->ring_virtaddr =
(void *)((u8 *) rx_ring->fbr[1]->ring_virtaddr +
   

[PATCH 3/3] staging: et131x: Remove USE_FBR0 define and #ifdefs

2012-10-19 Thread Mark Einon
USE_FBR0 has always been defined, even in the original driver code.
Remove the define and #ifdef code to leave the code in the same state.

Signed-off-by: Mark Einon mark.ei...@gmail.com
---
 drivers/staging/et131x/et131x.c |   58 +--
 1 file changed, 7 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 32f909a..c33cafd 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -176,20 +176,13 @@ MODULE_DESCRIPTION(10/100/1000 Base-T Ethernet Driver 
for the ET1310 by Agere S
 #define PARM_DMA_CACHE_DEF  0
 
 /* RX defines */
-#define USE_FBR0 1
 #define FBR_CHUNKS 32
 #define MAX_DESC_PER_RING_RX 1024
 
 /* number of RFDs - default and min */
-#ifdef USE_FBR0
 #define RFD_LOW_WATER_MARK 40
 #define NIC_DEFAULT_NUM_RFD1024
 #define NUM_FBRS   2
-#else
-#define RFD_LOW_WATER_MARK 20
-#define NIC_DEFAULT_NUM_RFD256
-#define NUM_FBRS   1
-#endif
 
 #define NIC_MIN_NUM_RFD64
 #define NUM_PACKETS_HANDLED256
@@ -871,7 +864,7 @@ static void et131x_rx_dma_enable(struct et131x_adapter 
*adapter)
csr |= 0x1000;
else if (adapter-rx_ring.fbr[0]-buffsize == 16384)
csr |= 0x1800;
-#ifdef USE_FBR0
+
csr |= 0x0400;  /* FBR0 enable */
if (adapter-rx_ring.fbr[1]-buffsize == 256)
csr |= 0x0100;
@@ -879,7 +872,6 @@ static void et131x_rx_dma_enable(struct et131x_adapter 
*adapter)
csr |= 0x0200;
else if (adapter-rx_ring.fbr[1]-buffsize == 1024)
csr |= 0x0300;
-#endif
writel(csr, adapter-regs-rxdma.csr);
 
csr = readl(adapter-regs-rxdma.csr);
@@ -1909,7 +1901,6 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
   ((rx_local-fbr[0]-num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
   rx_dma-fbr1_min_des);
 
-#ifdef USE_FBR0
/* Now's the best time to initialize FBR0 contents */
fbr_entry = (struct fbr_desc *) rx_local-fbr[1]-ring_virtaddr;
for (entry = 0; entry  rx_local-fbr[1]-num_entries; entry++) {
@@ -1933,7 +1924,6 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
writel(
   ((rx_local-fbr[1]-num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
   rx_dma-fbr0_min_des);
-#endif
 
/* Program the number of packets we will receive before generating an
 * interrupt.
@@ -2305,9 +2295,7 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
rx_ring = adapter-rx_ring;
 
/* Alloc memory for the lookup table */
-#ifdef USE_FBR0
rx_ring-fbr[1] = kmalloc(sizeof(struct fbr_lookup), GFP_KERNEL);
-#endif
rx_ring-fbr[0] = kmalloc(sizeof(struct fbr_lookup), GFP_KERNEL);
 
/* The first thing we will do is configure the sizes of the buffer
@@ -2329,35 +2317,25 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
 */
 
if (adapter-registry_jumbo_packet  2048) {
-#ifdef USE_FBR0
rx_ring-fbr[1]-buffsize = 256;
rx_ring-fbr[1]-num_entries = 512;
-#endif
rx_ring-fbr[0]-buffsize = 2048;
rx_ring-fbr[0]-num_entries = 512;
} else if (adapter-registry_jumbo_packet  4096) {
-#ifdef USE_FBR0
rx_ring-fbr[1]-buffsize = 512;
rx_ring-fbr[1]-num_entries = 1024;
-#endif
rx_ring-fbr[0]-buffsize = 4096;
rx_ring-fbr[0]-num_entries = 512;
} else {
-#ifdef USE_FBR0
rx_ring-fbr[1]-buffsize = 1024;
rx_ring-fbr[1]-num_entries = 768;
-#endif
rx_ring-fbr[0]-buffsize = 16384;
rx_ring-fbr[0]-num_entries = 128;
}
 
-#ifdef USE_FBR0
adapter-rx_ring.psr_num_entries =
adapter-rx_ring.fbr[1]-num_entries +
adapter-rx_ring.fbr[0]-num_entries;
-#else
-   adapter-rx_ring.psr_num_entries = adapter-rx_ring.fbr[0]-num_entries;
-#endif
 
/* Allocate an area of memory for Free Buffer Ring 1 */
bufsize = (sizeof(struct fbr_desc) * rx_ring-fbr[0]-num_entries) +
@@ -2381,7 +2359,6 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
(void *)((u8 *) rx_ring-fbr[0]-ring_virtaddr +
rx_ring-fbr[0]-offset);
 
-#ifdef USE_FBR0
/* Allocate an area of memory for Free Buffer Ring 0 */
bufsize = (sizeof(struct fbr_desc) * rx_ring-fbr[1]-num_entries) +
0xfff;
@@ -2403,7 +2380,7 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
rx_ring-fbr[1]-ring_virtaddr =
(void *)((u8 *) rx_ring-fbr[1]-ring_virtaddr +