diff options
author | Colin Ian King <colin.king@canonical.com> | 2018-01-07 09:51:46 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-01-26 13:25:15 -0500 |
commit | 4078ea37563383925075d30a4be68d97b552efcb (patch) | |
tree | ee36e109ec361e7ad59db9d0a0b3667a3156714d | |
parent | 865a4d987bce71a383079c1ec8e8b9fbd5431e45 (diff) |
ixgbevf: use ARRAY_SIZE for various array sizing calculations
Use the ARRAY_SIZE macro on various arrays to determine
size of the arrays. Improvement suggested by coccinelle.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/vf.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c index 64c93e8becc6..38d3a327c1bc 100644 --- a/drivers/net/ethernet/intel/ixgbevf/vf.c +++ b/drivers/net/ethernet/intel/ixgbevf/vf.c | |||
@@ -286,7 +286,7 @@ static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr) | |||
286 | ether_addr_copy(msg_addr, addr); | 286 | ether_addr_copy(msg_addr, addr); |
287 | 287 | ||
288 | ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, | 288 | ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, |
289 | sizeof(msgbuf) / sizeof(u32)); | 289 | ARRAY_SIZE(msgbuf)); |
290 | if (!ret_val) { | 290 | if (!ret_val) { |
291 | msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; | 291 | msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; |
292 | 292 | ||
@@ -456,8 +456,7 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, | |||
456 | ether_addr_copy(msg_addr, addr); | 456 | ether_addr_copy(msg_addr, addr); |
457 | 457 | ||
458 | ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, | 458 | ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, |
459 | sizeof(msgbuf) / sizeof(u32)); | 459 | ARRAY_SIZE(msgbuf)); |
460 | |||
461 | msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; | 460 | msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; |
462 | 461 | ||
463 | /* if nacked the address was rejected, use "perm_addr" */ | 462 | /* if nacked the address was rejected, use "perm_addr" */ |
@@ -574,7 +573,7 @@ static s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode) | |||
574 | msgbuf[1] = xcast_mode; | 573 | msgbuf[1] = xcast_mode; |
575 | 574 | ||
576 | err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, | 575 | err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, |
577 | sizeof(msgbuf) / sizeof(u32)); | 576 | ARRAY_SIZE(msgbuf)); |
578 | if (err) | 577 | if (err) |
579 | return err; | 578 | return err; |
580 | 579 | ||
@@ -614,7 +613,7 @@ static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, | |||
614 | msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT; | 613 | msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT; |
615 | 614 | ||
616 | err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, | 615 | err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, |
617 | sizeof(msgbuf) / sizeof(u32)); | 616 | ARRAY_SIZE(msgbuf)); |
618 | if (err) | 617 | if (err) |
619 | goto mbx_err; | 618 | goto mbx_err; |
620 | 619 | ||
@@ -826,7 +825,7 @@ static s32 ixgbevf_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size) | |||
826 | msgbuf[1] = max_size; | 825 | msgbuf[1] = max_size; |
827 | 826 | ||
828 | ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, | 827 | ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, |
829 | sizeof(msgbuf) / sizeof(u32)); | 828 | ARRAY_SIZE(msgbuf)); |
830 | if (ret_val) | 829 | if (ret_val) |
831 | return ret_val; | 830 | return ret_val; |
832 | if ((msgbuf[0] & IXGBE_VF_SET_LPE) && | 831 | if ((msgbuf[0] & IXGBE_VF_SET_LPE) && |
@@ -872,8 +871,7 @@ static int ixgbevf_negotiate_api_version_vf(struct ixgbe_hw *hw, int api) | |||
872 | msg[1] = api; | 871 | msg[1] = api; |
873 | msg[2] = 0; | 872 | msg[2] = 0; |
874 | 873 | ||
875 | err = ixgbevf_write_msg_read_ack(hw, msg, msg, | 874 | err = ixgbevf_write_msg_read_ack(hw, msg, msg, ARRAY_SIZE(msg)); |
876 | sizeof(msg) / sizeof(u32)); | ||
877 | if (!err) { | 875 | if (!err) { |
878 | msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; | 876 | msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; |
879 | 877 | ||
@@ -924,8 +922,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, | |||
924 | msg[0] = IXGBE_VF_GET_QUEUE; | 922 | msg[0] = IXGBE_VF_GET_QUEUE; |
925 | msg[1] = msg[2] = msg[3] = msg[4] = 0; | 923 | msg[1] = msg[2] = msg[3] = msg[4] = 0; |
926 | 924 | ||
927 | err = ixgbevf_write_msg_read_ack(hw, msg, msg, | 925 | err = ixgbevf_write_msg_read_ack(hw, msg, msg, ARRAY_SIZE(msg)); |
928 | sizeof(msg) / sizeof(u32)); | ||
929 | if (!err) { | 926 | if (!err) { |
930 | msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; | 927 | msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; |
931 | 928 | ||