Skip to content

Commit d458cdf

Browse files
JoePerchesdavem330
authored andcommitted
net:drivers/net: Miscellaneous conversions to ETH_ALEN
Convert the memset/memcpy uses of 6 to ETH_ALEN where appropriate. Also convert some struct definitions and u8 array declarations of [6] to ETH_ALEN. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0b3d8e0 commit d458cdf

57 files changed

Lines changed: 146 additions & 149 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/net/ethernet/8390/ax88796.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ static int ax_init_dev(struct net_device *dev)
702702
for (i = 0; i < 16; i++)
703703
SA_prom[i] = SA_prom[i+i];
704704

705-
memcpy(dev->dev_addr, SA_prom, 6);
705+
memcpy(dev->dev_addr, SA_prom, ETH_ALEN);
706706
}
707707

708708
#ifdef CONFIG_AX88796_93CX6

‎drivers/net/ethernet/amd/atarilance.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,10 +586,10 @@ static unsigned long __init lance_probe1( struct net_device *dev,
586586
switch( lp->cardtype ) {
587587
case OLD_RIEBL:
588588
/* No ethernet address! (Set some default address) */
589-
memcpy( dev->dev_addr, OldRieblDefHwaddr, 6 );
589+
memcpy(dev->dev_addr, OldRieblDefHwaddr, ETH_ALEN);
590590
break;
591591
case NEW_RIEBL:
592-
lp->memcpy_f( dev->dev_addr, RIEBL_HWADDR_ADDR, 6 );
592+
lp->memcpy_f(dev->dev_addr, RIEBL_HWADDR_ADDR, ETH_ALEN);
593593
break;
594594
case PAM_CARD:
595595
i = IO->eeprom;

‎drivers/net/ethernet/amd/au1000_eth.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ static int au1000_probe(struct platform_device *pdev)
11381138
aup->phy1_search_mac0 = 1;
11391139
} else {
11401140
if (is_valid_ether_addr(pd->mac)) {
1141-
memcpy(dev->dev_addr, pd->mac, 6);
1141+
memcpy(dev->dev_addr, pd->mac, ETH_ALEN);
11421142
} else {
11431143
/* Set a random MAC since no valid provided by platform_data. */
11441144
eth_hw_addr_random(dev);

‎drivers/net/ethernet/amd/pcnet32.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
16751675
pr_cont(" warning: CSR address invalid,\n");
16761676
pr_info(" using instead PROM address of");
16771677
}
1678-
memcpy(dev->dev_addr, promaddr, 6);
1678+
memcpy(dev->dev_addr, promaddr, ETH_ALEN);
16791679
}
16801680
}
16811681

‎drivers/net/ethernet/apple/bmac.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,8 +1220,8 @@ static void bmac_reset_and_enable(struct net_device *dev)
12201220
if (skb != NULL) {
12211221
data = skb_put(skb, ETHERMINPACKET);
12221222
memset(data, 0, ETHERMINPACKET);
1223-
memcpy(data, dev->dev_addr, 6);
1224-
memcpy(data+6, dev->dev_addr, 6);
1223+
memcpy(data, dev->dev_addr, ETH_ALEN);
1224+
memcpy(data + ETH_ALEN, dev->dev_addr, ETH_ALEN);
12251225
bmac_transmit_packet(skb, dev);
12261226
}
12271227
spin_unlock_irqrestore(&bp->lock, flags);

‎drivers/net/ethernet/broadcom/b44.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ static int b44_get_invariants(struct b44 *bp)
21112111
* valid PHY address. */
21122112
bp->phy_addr &= 0x1F;
21132113

2114-
memcpy(bp->dev->dev_addr, addr, 6);
2114+
memcpy(bp->dev->dev_addr, addr, ETH_ALEN);
21152115

21162116
if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){
21172117
pr_err("Invalid MAC address found in EEPROM\n");

‎drivers/net/ethernet/broadcom/bnx2.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5761,8 +5761,8 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
57615761
if (!skb)
57625762
return -ENOMEM;
57635763
packet = skb_put(skb, pkt_size);
5764-
memcpy(packet, bp->dev->dev_addr, 6);
5765-
memset(packet + 6, 0x0, 8);
5764+
memcpy(packet, bp->dev->dev_addr, ETH_ALEN);
5765+
memset(packet + ETH_ALEN, 0x0, 8);
57665766
for (i = 14; i < pkt_size; i++)
57675767
packet[i] = (unsigned char) (i & 0xff);
57685768

@@ -8514,7 +8514,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
85148514

85158515
pci_set_drvdata(pdev, dev);
85168516

8517-
memcpy(dev->dev_addr, bp->mac_addr, 6);
8517+
memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN);
85188518

85198519
dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
85208520
NETIF_F_TSO | NETIF_F_TSO_ECN |

‎drivers/net/ethernet/broadcom/cnic.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type,
393393

394394
csk->vlan_id = path_resp->vlan_id;
395395

396-
memcpy(csk->ha, path_resp->mac_addr, 6);
396+
memcpy(csk->ha, path_resp->mac_addr, ETH_ALEN);
397397
if (test_bit(SK_F_IPV6, &csk->flags))
398398
memcpy(&csk->src_ip[0], &path_resp->src.v6_addr,
399399
sizeof(struct in6_addr));
@@ -5572,7 +5572,7 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev)
55725572
if (cdev->max_fcoe_conn > BNX2X_FCOE_NUM_CONNECTIONS)
55735573
cdev->max_fcoe_conn = BNX2X_FCOE_NUM_CONNECTIONS;
55745574

5575-
memcpy(cdev->mac_addr, ethdev->iscsi_mac, 6);
5575+
memcpy(cdev->mac_addr, ethdev->iscsi_mac, ETH_ALEN);
55765576

55775577
cp->cnic_ops = &cnic_bnx2x_ops;
55785578
cp->start_hw = cnic_start_bnx2x_hw;

‎drivers/net/ethernet/broadcom/tg3.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13214,8 +13214,8 @@ static int tg3_run_loopback(struct tg3 *tp, u32 pktsz, bool tso_loopback)
1321413214
return -ENOMEM;
1321513215

1321613216
tx_data = skb_put(skb, tx_len);
13217-
memcpy(tx_data, tp->dev->dev_addr, 6);
13218-
memset(tx_data + 6, 0x0, 8);
13217+
memcpy(tx_data, tp->dev->dev_addr, ETH_ALEN);
13218+
memset(tx_data + ETH_ALEN, 0x0, 8);
1321913219

1322013220
tw32(MAC_RX_MTU_SIZE, tx_len + ETH_FCS_LEN);
1322113221

@@ -16661,8 +16661,8 @@ static int tg3_get_macaddr_sparc(struct tg3 *tp)
1666116661
int len;
1666216662

1666316663
addr = of_get_property(dp, "local-mac-address", &len);
16664-
if (addr && len == 6) {
16665-
memcpy(dev->dev_addr, addr, 6);
16664+
if (addr && len == ETH_ALEN) {
16665+
memcpy(dev->dev_addr, addr, ETH_ALEN);
1666616666
return 0;
1666716667
}
1666816668
return -ENODEV;
@@ -16672,7 +16672,7 @@ static int tg3_get_default_macaddr_sparc(struct tg3 *tp)
1667216672
{
1667316673
struct net_device *dev = tp->dev;
1667416674

16675-
memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
16675+
memcpy(dev->dev_addr, idprom->id_ethaddr, ETH_ALEN);
1667616676
return 0;
1667716677
}
1667816678
#endif

‎drivers/net/ethernet/chelsio/cxgb/pm3393.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac,
499499

500500
static int pm3393_macaddress_get(struct cmac *cmac, u8 mac_addr[6])
501501
{
502-
memcpy(mac_addr, cmac->instance->mac_addr, 6);
502+
memcpy(mac_addr, cmac->instance->mac_addr, ETH_ALEN);
503503
return 0;
504504
}
505505

@@ -526,7 +526,7 @@ static int pm3393_macaddress_set(struct cmac *cmac, u8 ma[6])
526526
*/
527527

528528
/* Store local copy */
529-
memcpy(cmac->instance->mac_addr, ma, 6);
529+
memcpy(cmac->instance->mac_addr, ma, ETH_ALEN);
530530

531531
lo = ((u32) ma[1] << 8) | (u32) ma[0];
532532
mid = ((u32) ma[3] << 8) | (u32) ma[2];

0 commit comments

Comments
 (0)