Skip to contentSkip to conversation

Minor bnx2 patches

PATCH In review Benjamin Li 1 participant 5 messages Sep 17, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Minor bnx2 patches

These patches are some minor code cleanups. Nothing major.

Please feel free to comment. Thanks again.

-Ben

Benjamin Li (4):
bnx2: In bnx2_set_mac_link() return void rather then int
bnx2: Update MODULE_DESCRIPTION to include the 5716
bnx2: Remove name field from bnx2 structure
bnx2: Remove timer_interval field from the bnx2 structure

 drivers/net/bnx2.c |   20 ++++++++------------
 drivers/net/bnx2.h |    4 +---
 2 files changed, 9 insertions(+), 15 deletions(-)
#1 lore raw

NET-NEXT PATCH] bnx2: In bnx2_set_mac_link() return void rather then int

bnx2_set_mac_link() doesn't need to return any error codes. And all the callers don't check the return code. It is safe to change the return type to a void.

---
 drivers/net/bnx2.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/net/bnx2.c +1 -3
index 2486a65..192a24e 100644
@@ -1127,7 +1127,7 @@ bnx2_init_all_rx_contexts(struct bnx2 *bp)
 	}
 }
 
-static int
+static void
 bnx2_set_mac_link(struct bnx2 *bp)
 {
 	u32 val;
@@ -1193,8 +1193,6 @@ bnx2_set_mac_link(struct bnx2 *bp)
 
 	if (CHIP_NUM(bp) == CHIP_NUM_5709)
 		bnx2_init_all_rx_contexts(bp);
-
-	return 0;
 }
 
 static void
Signature · 1 line
1.5.6.4
#2 lore raw

PATCH 1/1 bnx2: Update MODULE_DESCRIPTION to include the 5716

---
 drivers/net/bnx2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/bnx2.c +1 -1
index 192a24e..a78b664 100644
@@ -69,7 +69,7 @@ static char version[] __devinitdata =
 	"Broadcom NetXtreme II Gigabit Ethernet Driver " DRV_MODULE_NAME " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
 
 MODULE_AUTHOR("Michael Chan <[email protected]>");
-MODULE_DESCRIPTION("Broadcom NetXtreme II BCM5706/5708/5709 Driver");
+MODULE_DESCRIPTION("Broadcom NetXtreme II BCM5706/5708/5709/5716 Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_MODULE_VERSION);
 
Signature · 1 line
1.5.6.4
#3 lore raw

PATCH 1/1 bnx2: Remove name field from bnx2 structure

The name of the board is only used during the initialization of the adapter. We can save the space of a pointer by not storing this information.

---
 drivers/net/bnx2.c |    3 +--
 drivers/net/bnx2.h |    2 --
 2 files changed, 1 insertions(+), 4 deletions(-)
drivers/net/bnx2.c +1 -2
index a78b664..8417766 100644
@@ -7718,7 +7718,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	memcpy(dev->dev_addr, bp->mac_addr, 6);
 	memcpy(dev->perm_addr, bp->mac_addr, 6);
-	bp->name = board_info[ent->driver_data].name;
 
 	dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
 	if (CHIP_NUM(bp) == CHIP_NUM_5709)
@@ -7745,7 +7744,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	printk(KERN_INFO "%s: %s (%c%d) %s found at mem %lx, "
 		"IRQ %d, node addr %s\n",
 		dev->name,
-		bp->name,
+		board_info[ent->driver_data].name,
 		((CHIP_ID(bp) & 0xf000) >> 12) + 'A',
 		((CHIP_ID(bp) & 0x0ff0) >> 4),
 		bnx2_bus_string(bp, str),
drivers/net/bnx2.h +0 -2
index c3c579f..cb47c98 100644
@@ -6701,8 +6701,6 @@ struct bnx2 {
 
 	/* End of fields used in the performance code paths. */
 
-	char			*name;
-
 	int			timer_interval;
 	int			current_interval;
 	struct			timer_list timer;
Signature · 1 line
1.5.6.4
#4 lore raw

PATCH 1/1 bnx2: Remove timer_interval field from the bnx2 structure

The timer_interval field is only assigned once, and never reassigned. We can safely replace all instances of the timer_interval with a constant value.

---
 drivers/net/bnx2.c |   11 +++++------
 drivers/net/bnx2.h |    2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)
drivers/net/bnx2.c +5 -6
index 8417766..1b5b152 100644
@@ -5598,7 +5598,7 @@ bnx2_5706_serdes_timer(struct bnx2 *bp)
 	} else if ((bp->link_up == 0) && (bp->autoneg & AUTONEG_SPEED)) {
 		u32 bmcr;
 
-		bp->current_interval = bp->timer_interval;
+		bp->current_interval = BNX2_TIMER_INTERVAL;
 
 		bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
 
@@ -5627,7 +5627,7 @@ bnx2_5706_serdes_timer(struct bnx2 *bp)
 			bp->phy_flags &= ~BNX2_PHY_FLAG_PARALLEL_DETECT;
 		}
 	} else
-		bp->current_interval = bp->timer_interval;
+		bp->current_interval = BNX2_TIMER_INTERVAL;
 
 	if (check_link) {
 		u32 val;
@@ -5672,11 +5672,11 @@ bnx2_5708_serdes_timer(struct bnx2 *bp)
 		} else {
 			bnx2_disable_forced_2g5(bp);
 			bp->serdes_an_pending = 2;
-			bp->current_interval = bp->timer_interval;
+			bp->current_interval = BNX2_TIMER_INTERVAL;
 		}
 
 	} else
-		bp->current_interval = bp->timer_interval;
+		bp->current_interval = BNX2_TIMER_INTERVAL;
 
 	spin_unlock(&bp->phy_lock);
 }
@@ -7514,7 +7514,6 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 
 	bp->stats_ticks = USEC_PER_SEC & BNX2_HC_STATS_TICKS_HC_STAT_TICKS;
 
-	bp->timer_interval =  HZ;
 	bp->current_interval =  HZ;
 
 	bp->phy_addr = 1;
@@ -7605,7 +7604,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 	bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX;
 
 	init_timer(&bp->timer);
-	bp->timer.expires = RUN_AT(bp->timer_interval);
+	bp->timer.expires = RUN_AT(BNX2_TIMER_INTERVAL);
 	bp->timer.data = (unsigned long) bp;
 	bp->timer.function = bnx2_timer;
 
drivers/net/bnx2.h +1 -1
index cb47c98..e534c1d 100644
@@ -6701,7 +6701,7 @@ struct bnx2 {
 
 	/* End of fields used in the performance code paths. */
 
-	int			timer_interval;
+#define BNX2_TIMER_INTERVAL			HZ
 	int			current_interval;
 	struct			timer_list timer;
 	struct work_struct	reset_task;
Signature · 1 line
1.5.6.4