Commit 12e5e452 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents f13b5468 31ba191b
...@@ -1649,7 +1649,7 @@ lan78xx_get_regs(struct net_device *netdev, struct ethtool_regs *regs, ...@@ -1649,7 +1649,7 @@ lan78xx_get_regs(struct net_device *netdev, struct ethtool_regs *regs,
struct lan78xx_net *dev = netdev_priv(netdev); struct lan78xx_net *dev = netdev_priv(netdev);
/* Read Device/MAC registers */ /* Read Device/MAC registers */
for (i = 0; i < (sizeof(lan78xx_regs) / sizeof(u32)); i++) for (i = 0; i < ARRAY_SIZE(lan78xx_regs); i++)
lan78xx_read_reg(dev, lan78xx_regs[i], &data[i]); lan78xx_read_reg(dev, lan78xx_regs[i], &data[i]);
if (!netdev->phydev) if (!netdev->phydev)
......
...@@ -283,7 +283,7 @@ static inline const char *bond_3ad_churn_desc(churn_state_t state) ...@@ -283,7 +283,7 @@ static inline const char *bond_3ad_churn_desc(churn_state_t state)
"none", "none",
"unknown" "unknown"
}; };
int max_size = sizeof(churn_description) / sizeof(churn_description[0]); int max_size = ARRAY_SIZE(churn_description);
if (state >= max_size) if (state >= max_size)
state = max_size - 1; state = max_size - 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment