Commit 4078ea37 authored by Colin Ian King's avatar Colin Ian King Committed by Jeff Kirsher

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: default avatarColin Ian King <colin.king@canonical.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 865a4d98
...@@ -286,7 +286,7 @@ static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr) ...@@ -286,7 +286,7 @@ static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
ether_addr_copy(msg_addr, addr); ether_addr_copy(msg_addr, addr);
ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf,
sizeof(msgbuf) / sizeof(u32)); ARRAY_SIZE(msgbuf));
if (!ret_val) { if (!ret_val) {
msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
...@@ -456,8 +456,7 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, ...@@ -456,8 +456,7 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,
ether_addr_copy(msg_addr, addr); ether_addr_copy(msg_addr, addr);
ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf,
sizeof(msgbuf) / sizeof(u32)); ARRAY_SIZE(msgbuf));
msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
/* if nacked the address was rejected, use "perm_addr" */ /* 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,7 +573,7 @@ static s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
msgbuf[1] = xcast_mode; msgbuf[1] = xcast_mode;
err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf,
sizeof(msgbuf) / sizeof(u32)); ARRAY_SIZE(msgbuf));
if (err) if (err)
return err; return err;
...@@ -614,7 +613,7 @@ static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, ...@@ -614,7 +613,7 @@ static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT; msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT;
err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf,
sizeof(msgbuf) / sizeof(u32)); ARRAY_SIZE(msgbuf));
if (err) if (err)
goto mbx_err; goto mbx_err;
...@@ -826,7 +825,7 @@ static s32 ixgbevf_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size) ...@@ -826,7 +825,7 @@ static s32 ixgbevf_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size)
msgbuf[1] = max_size; msgbuf[1] = max_size;
ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf,
sizeof(msgbuf) / sizeof(u32)); ARRAY_SIZE(msgbuf));
if (ret_val) if (ret_val)
return ret_val; return ret_val;
if ((msgbuf[0] & IXGBE_VF_SET_LPE) && 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,8 +871,7 @@ static int ixgbevf_negotiate_api_version_vf(struct ixgbe_hw *hw, int api)
msg[1] = api; msg[1] = api;
msg[2] = 0; msg[2] = 0;
err = ixgbevf_write_msg_read_ack(hw, msg, msg, err = ixgbevf_write_msg_read_ack(hw, msg, msg, ARRAY_SIZE(msg));
sizeof(msg) / sizeof(u32));
if (!err) { if (!err) {
msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
...@@ -924,8 +922,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, ...@@ -924,8 +922,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
msg[0] = IXGBE_VF_GET_QUEUE; msg[0] = IXGBE_VF_GET_QUEUE;
msg[1] = msg[2] = msg[3] = msg[4] = 0; msg[1] = msg[2] = msg[3] = msg[4] = 0;
err = ixgbevf_write_msg_read_ack(hw, msg, msg, err = ixgbevf_write_msg_read_ack(hw, msg, msg, ARRAY_SIZE(msg));
sizeof(msg) / sizeof(u32));
if (!err) { if (!err) {
msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
......
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