diff options
author | David S. Miller <davem@davemloft.net> | 2018-08-04 16:23:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-04 16:23:15 -0400 |
commit | 12e5e452aec3520f7a66718600eaa991b54098ad (patch) | |
tree | 1d5dc4ec0499658034e155b0e1d6b1b8d07ff6e9 | |
parent | f13b546847ff5862ea313f3e79010c52c3fe32b4 (diff) | |
parent | 31ba191bf5ab2975c1955f1adf771a5a0b57afaa (diff) |
Merge branch 'net-ARRAY_SIZE'
zhong jiang says:
====================
Use ARRAY_SIZE to replace computing the size
zhong jiang (2):
net:usb: Use ARRAY_SIZE instead of calculating the array size
include/net/bond_3ad: Simplify the code by using the ARRAY_SIZE
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/lan78xx.c | 2 | ||||
-rw-r--r-- | include/net/bond_3ad.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 4662fa0381f9..a9991c5f4736 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c | |||
@@ -1649,7 +1649,7 @@ lan78xx_get_regs(struct net_device *netdev, struct ethtool_regs *regs, | |||
1649 | struct lan78xx_net *dev = netdev_priv(netdev); | 1649 | struct lan78xx_net *dev = netdev_priv(netdev); |
1650 | 1650 | ||
1651 | /* Read Device/MAC registers */ | 1651 | /* Read Device/MAC registers */ |
1652 | for (i = 0; i < (sizeof(lan78xx_regs) / sizeof(u32)); i++) | 1652 | for (i = 0; i < ARRAY_SIZE(lan78xx_regs); i++) |
1653 | lan78xx_read_reg(dev, lan78xx_regs[i], &data[i]); | 1653 | lan78xx_read_reg(dev, lan78xx_regs[i], &data[i]); |
1654 | 1654 | ||
1655 | if (!netdev->phydev) | 1655 | if (!netdev->phydev) |
diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h index f358ad5e4214..fc3111515f5c 100644 --- a/include/net/bond_3ad.h +++ b/include/net/bond_3ad.h | |||
@@ -283,7 +283,7 @@ static inline const char *bond_3ad_churn_desc(churn_state_t state) | |||
283 | "none", | 283 | "none", |
284 | "unknown" | 284 | "unknown" |
285 | }; | 285 | }; |
286 | int max_size = sizeof(churn_description) / sizeof(churn_description[0]); | 286 | int max_size = ARRAY_SIZE(churn_description); |
287 | 287 | ||
288 | if (state >= max_size) | 288 | if (state >= max_size) |
289 | state = max_size - 1; | 289 | state = max_size - 1; |