aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/pasemi/pasemi_mac.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-08-01 19:17:49 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-02 15:33:54 -0400
commit1409a93274bb1b17f0b7a0b255a75e80899eec11 (patch)
tree778099b4c28e9089af438ca53f79613c43617069 /drivers/net/ethernet/pasemi/pasemi_mac.c
parent574e2af7c0af3273836def5e66f236521bb433c9 (diff)
ethernet: Convert mac address uses of 6 to ETH_ALEN
Use the normal #define to help grep find mac addresses and ensure that addresses are aligned. pasemi.h has an unaligned access to mac_addr, unchanged for now. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Olof Johansson <olof@lixom.net> # pasemi_mac pieces Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/pasemi/pasemi_mac.c')
-rw-r--r--drivers/net/ethernet/pasemi/pasemi_mac.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
index a5f0b5da6149..f21ae7b6c766 100644
--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
@@ -191,7 +191,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
191 struct device_node *dn = pci_device_to_OF_node(pdev); 191 struct device_node *dn = pci_device_to_OF_node(pdev);
192 int len; 192 int len;
193 const u8 *maddr; 193 const u8 *maddr;
194 u8 addr[6]; 194 u8 addr[ETH_ALEN];
195 195
196 if (!dn) { 196 if (!dn) {
197 dev_dbg(&pdev->dev, 197 dev_dbg(&pdev->dev,
@@ -201,8 +201,8 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
201 201
202 maddr = of_get_property(dn, "local-mac-address", &len); 202 maddr = of_get_property(dn, "local-mac-address", &len);
203 203
204 if (maddr && len == 6) { 204 if (maddr && len == ETH_ALEN) {
205 memcpy(mac->mac_addr, maddr, 6); 205 memcpy(mac->mac_addr, maddr, ETH_ALEN);
206 return 0; 206 return 0;
207 } 207 }
208 208
@@ -219,14 +219,15 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
219 return -ENOENT; 219 return -ENOENT;
220 } 220 }
221 221
222 if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[0], 222 if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
223 &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) != 6) { 223 &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
224 != ETH_ALEN) {
224 dev_warn(&pdev->dev, 225 dev_warn(&pdev->dev,
225 "can't parse mac address, not configuring\n"); 226 "can't parse mac address, not configuring\n");
226 return -EINVAL; 227 return -EINVAL;
227 } 228 }
228 229
229 memcpy(mac->mac_addr, addr, 6); 230 memcpy(mac->mac_addr, addr, ETH_ALEN);
230 231
231 return 0; 232 return 0;
232} 233}