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/atl2.c | |
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/atl2.c')
-rw-r--r-- | drivers/net/ethernet/atheros/atlx/atl2.c | 13 |
1 files changed, 5 insertions, 8 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 | } |