File gpxe-code-cleanups.patch of Package kvm
diff --git a/src/drivers/net/atl1e.c b/src/drivers/net/atl1e.c
index 664eba0..6c0b050 100644
--- a/src/drivers/net/atl1e.c
+++ b/src/drivers/net/atl1e.c
@@ -1296,14 +1296,14 @@ void atl1e_hw_set_mac_addr(struct atl1e_hw *hw)
*/
static int atl1e_get_permanent_address(struct atl1e_hw *hw)
{
- u32 addr[2];
+ union {
+ u32 dword[2];
+ u8 byte[8];
+ } hw_addr;
u32 i;
u32 twsi_ctrl_data;
u8 eth_addr[ETH_ALEN];
- /* init */
- addr[0] = addr[1] = 0;
-
if (!atl1e_check_eeprom_exist(hw)) {
/* eeprom exist */
twsi_ctrl_data = AT_READ_REG(hw, REG_TWSI_CTRL);
@@ -1320,10 +1320,11 @@ static int atl1e_get_permanent_address(struct atl1e_hw *hw)
}
/* maybe MAC-address is from BIOS */
- addr[0] = AT_READ_REG(hw, REG_MAC_STA_ADDR);
- addr[1] = AT_READ_REG(hw, REG_MAC_STA_ADDR + 4);
- *(u32 *) ð_addr[2] = swap32(addr[0]);
- *(u16 *) ð_addr[0] = swap16(*(u16 *)&addr[1]);
+ hw_addr.dword[0] = AT_READ_REG(hw, REG_MAC_STA_ADDR);
+ hw_addr.dword[1] = AT_READ_REG(hw, REG_MAC_STA_ADDR + 4);
+ for (i = 0; i < ETH_ALEN; i++) {
+ eth_addr[ETH_ALEN - i - 1] = hw_addr.byte[i];
+ }
memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
return 0;
diff --git a/src/drivers/net/ath5k/ath5k_qcu.c b/src/drivers/net/ath5k/ath5k_qcu.c
index a674b85..cb25029 100644
--- a/src/drivers/net/ath5k/ath5k_qcu.c
+++ b/src/drivers/net/ath5k/ath5k_qcu.c
@@ -268,7 +268,7 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah)
}
if (tq->tqi_ready_time &&
- (tq->tqi_type != AR5K_TX_QUEUE_ID_CAB))
+ (tq->tqi_type != AR5K_TX_QUEUE_CAB))
ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_ready_time,
AR5K_QCU_RDYTIMECFG_INTVAL) |
AR5K_QCU_RDYTIMECFG_ENABLE,
diff --git a/src/drivers/net/ns83820.c b/src/drivers/net/ns83820.c
index 44d875f..680f844 100644
--- a/src/drivers/net/ns83820.c
+++ b/src/drivers/net/ns83820.c
@@ -687,7 +687,7 @@ static int ns83820_poll(struct nic *nic, int retrieve)
// rx_ring[entry].link = 0;
rx_ring[entry].cmdsts = cpu_to_le32(CMDSTS_OWN);
- ns->cur_rx = ++ns->cur_rx % NR_RX_DESC;
+ ns->cur_rx = (ns->cur_rx + 1) % NR_RX_DESC;
if (ns->cur_rx == 0) /* We have wrapped the ring */
kick_rx();
diff --git a/src/drivers/net/tulip.c b/src/drivers/net/tulip.c
index e08e0d8..0fe80a8 100644
--- a/src/drivers/net/tulip.c
+++ b/src/drivers/net/tulip.c
@@ -1171,7 +1171,7 @@ static int tulip_poll(struct nic *nic, int retrieve)
if (rx_ring[tp->cur_rx].status & 0x00008000) {
/* return the descriptor and buffer to receive ring */
rx_ring[tp->cur_rx].status = 0x80000000;
- tp->cur_rx = (++tp->cur_rx) % RX_RING_SIZE;
+ tp->cur_rx = (tp->cur_rx + 1) % RX_RING_SIZE;
return 0;
}
@@ -1180,7 +1180,7 @@ static int tulip_poll(struct nic *nic, int retrieve)
/* return the descriptor and buffer to receive ring */
rx_ring[tp->cur_rx].status = 0x80000000;
- tp->cur_rx = (++tp->cur_rx) % RX_RING_SIZE;
+ tp->cur_rx = (tp->cur_rx + 1) % RX_RING_SIZE;
return 1;
}