diff options
author | Joe Perches <joe@perches.com> | 2012-03-18 13:37:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-03-19 16:53:08 -0400 |
commit | c81f212450e4d85ed1ed3777316e8355caeb3848 (patch) | |
tree | 2ccf702e7fde4961519232d9bb57f7db67539d12 /drivers/net/ethernet/atheros/atlx | |
parent | a3f671b3152919e72af261333402c0f1272bdf59 (diff) |
atlx: Use ETH_ALEN
No need for yet another #define for this.
Convert NODE_ADDRESS_SIZE use to ETH_ALEN and remove #define.
Use memcpy instead of a loop to copy an address.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/atheros/atlx')
-rw-r--r-- | drivers/net/ethernet/atheros/atlx/atl2.c | 13 | ||||
-rw-r--r-- | drivers/net/ethernet/atheros/atlx/atl2.h | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/atheros/atlx/atlx.h | 1 |
3 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c index 071f4c858969..6762dc406b25 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c | |||
@@ -2258,7 +2258,7 @@ static int get_permanent_address(struct atl2_hw *hw) | |||
2258 | u32 Addr[2]; | 2258 | u32 Addr[2]; |
2259 | u32 i, Control; | 2259 | u32 i, Control; |
2260 | u16 Register; | 2260 | u16 Register; |
2261 | u8 EthAddr[NODE_ADDRESS_SIZE]; | 2261 | u8 EthAddr[ETH_ALEN]; |
2262 | bool KeyValid; | 2262 | bool KeyValid; |
2263 | 2263 | ||
2264 | if (is_valid_ether_addr(hw->perm_mac_addr)) | 2264 | if (is_valid_ether_addr(hw->perm_mac_addr)) |
@@ -2299,7 +2299,7 @@ static int get_permanent_address(struct atl2_hw *hw) | |||
2299 | *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *) &Addr[1]); | 2299 | *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *) &Addr[1]); |
2300 | 2300 | ||
2301 | if (is_valid_ether_addr(EthAddr)) { | 2301 | if (is_valid_ether_addr(EthAddr)) { |
2302 | memcpy(hw->perm_mac_addr, EthAddr, NODE_ADDRESS_SIZE); | 2302 | memcpy(hw->perm_mac_addr, EthAddr, ETH_ALEN); |
2303 | return 0; | 2303 | return 0; |
2304 | } | 2304 | } |
2305 | return 1; | 2305 | return 1; |
@@ -2334,7 +2334,7 @@ static int get_permanent_address(struct atl2_hw *hw) | |||
2334 | *(u32 *) &EthAddr[2] = LONGSWAP(Addr[0]); | 2334 | *(u32 *) &EthAddr[2] = LONGSWAP(Addr[0]); |
2335 | *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *)&Addr[1]); | 2335 | *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *)&Addr[1]); |
2336 | if (is_valid_ether_addr(EthAddr)) { | 2336 | if (is_valid_ether_addr(EthAddr)) { |
2337 | memcpy(hw->perm_mac_addr, EthAddr, NODE_ADDRESS_SIZE); | 2337 | memcpy(hw->perm_mac_addr, EthAddr, ETH_ALEN); |
2338 | return 0; | 2338 | return 0; |
2339 | } | 2339 | } |
2340 | /* maybe MAC-address is from BIOS */ | 2340 | /* maybe MAC-address is from BIOS */ |
@@ -2344,7 +2344,7 @@ static int get_permanent_address(struct atl2_hw *hw) | |||
2344 | *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *) &Addr[1]); | 2344 | *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *) &Addr[1]); |
2345 | 2345 | ||
2346 | if (is_valid_ether_addr(EthAddr)) { | 2346 | if (is_valid_ether_addr(EthAddr)) { |
2347 | memcpy(hw->perm_mac_addr, EthAddr, NODE_ADDRESS_SIZE); | 2347 | memcpy(hw->perm_mac_addr, EthAddr, ETH_ALEN); |
2348 | return 0; | 2348 | return 0; |
2349 | } | 2349 | } |
2350 | 2350 | ||
@@ -2358,8 +2358,6 @@ static int get_permanent_address(struct atl2_hw *hw) | |||
2358 | */ | 2358 | */ |
2359 | static s32 atl2_read_mac_addr(struct atl2_hw *hw) | 2359 | static s32 atl2_read_mac_addr(struct atl2_hw *hw) |
2360 | { | 2360 | { |
2361 | u16 i; | ||
2362 | |||
2363 | if (get_permanent_address(hw)) { | 2361 | if (get_permanent_address(hw)) { |
2364 | /* for test */ | 2362 | /* for test */ |
2365 | /* FIXME: shouldn't we use random_ether_addr() here? */ | 2363 | /* FIXME: shouldn't we use random_ether_addr() here? */ |
@@ -2371,8 +2369,7 @@ static s32 atl2_read_mac_addr(struct atl2_hw *hw) | |||
2371 | hw->perm_mac_addr[5] = 0x38; | 2369 | hw->perm_mac_addr[5] = 0x38; |
2372 | } | 2370 | } |
2373 | 2371 | ||
2374 | for (i = 0; i < NODE_ADDRESS_SIZE; i++) | 2372 | memcpy(hw->mac_addr, hw->perm_mac_addr, ETH_ALEN); |
2375 | hw->mac_addr[i] = hw->perm_mac_addr[i]; | ||
2376 | 2373 | ||
2377 | return 0; | 2374 | return 0; |
2378 | } | 2375 | } |
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.h b/drivers/net/ethernet/atheros/atlx/atl2.h index bf9016ebdd9b..3ebe19f7242b 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.h +++ b/drivers/net/ethernet/atheros/atlx/atl2.h | |||
@@ -47,7 +47,6 @@ extern int ethtool_ioctl(struct ifreq *ifr); | |||
47 | 47 | ||
48 | #define PCI_COMMAND_REGISTER PCI_COMMAND | 48 | #define PCI_COMMAND_REGISTER PCI_COMMAND |
49 | #define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE | 49 | #define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE |
50 | #define ETH_ADDR_LEN ETH_ALEN | ||
51 | 50 | ||
52 | #define ATL2_WRITE_REG(a, reg, value) (iowrite32((value), \ | 51 | #define ATL2_WRITE_REG(a, reg, value) (iowrite32((value), \ |
53 | ((a)->hw_addr + (reg)))) | 52 | ((a)->hw_addr + (reg)))) |
@@ -429,8 +428,8 @@ struct atl2_hw { | |||
429 | u8 flash_vendor; | 428 | u8 flash_vendor; |
430 | 429 | ||
431 | u8 dma_fairness; | 430 | u8 dma_fairness; |
432 | u8 mac_addr[NODE_ADDRESS_SIZE]; | 431 | u8 mac_addr[ETH_ALEN]; |
433 | u8 perm_mac_addr[NODE_ADDRESS_SIZE]; | 432 | u8 perm_mac_addr[ETH_ALEN]; |
434 | 433 | ||
435 | /* FIXME */ | 434 | /* FIXME */ |
436 | /* bool phy_preamble_sup; */ | 435 | /* bool phy_preamble_sup; */ |
diff --git a/drivers/net/ethernet/atheros/atlx/atlx.h b/drivers/net/ethernet/atheros/atlx/atlx.h index 14054b75aa62..448f5dcc02e6 100644 --- a/drivers/net/ethernet/atheros/atlx/atlx.h +++ b/drivers/net/ethernet/atheros/atlx/atlx.h | |||
@@ -484,7 +484,6 @@ | |||
484 | 484 | ||
485 | /* For checksumming, the sum of all words in the EEPROM should equal 0xBABA */ | 485 | /* For checksumming, the sum of all words in the EEPROM should equal 0xBABA */ |
486 | #define EEPROM_SUM 0xBABA | 486 | #define EEPROM_SUM 0xBABA |
487 | #define NODE_ADDRESS_SIZE 6 | ||
488 | 487 | ||
489 | struct atlx_spi_flash_dev { | 488 | struct atlx_spi_flash_dev { |
490 | const char *manu_name; /* manufacturer id */ | 489 | const char *manu_name; /* manufacturer id */ |