diff options
author | Shannon Nelson <shannon.nelson@intel.com> | 2015-02-27 04:15:19 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2015-03-07 07:59:40 -0500 |
commit | 37a2973a058e08f8dcccb265d90176e6b6b55191 (patch) | |
tree | c7e65038d7cd0082942e16561963ef4006d7e4fc | |
parent | 1b5ef07e3dd3972d9111650fb6e0f5a566c741d8 (diff) |
i40e/i40evf: Refactor i40e_debug_aq and make some functions static
A sparse complaint in i40e_debug_aq in a funky buffer write goes away by
straightening out the code out to something less convoluted.
Also fix some other sparse warnings while we are at it, making some
functions static and using NULL instead of 0.
Change-ID: I93907534fe1f1f675830774b3d14ecf1c6ffc9a0
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_common.c | 50 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_nvm.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40evf/i40e_common.c | 44 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 2 |
6 files changed, 54 insertions, 54 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index 10f9451339ed..fc4817ab2bb3 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_common.c +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c | |||
@@ -85,9 +85,8 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc, | |||
85 | { | 85 | { |
86 | struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; | 86 | struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; |
87 | u16 len = le16_to_cpu(aq_desc->datalen); | 87 | u16 len = le16_to_cpu(aq_desc->datalen); |
88 | u8 *aq_buffer = (u8 *)buffer; | 88 | u8 *buf = (u8 *)buffer; |
89 | u32 data[4]; | 89 | u16 i = 0; |
90 | u32 i = 0; | ||
91 | 90 | ||
92 | if ((!(mask & hw->debug_mask)) || (desc == NULL)) | 91 | if ((!(mask & hw->debug_mask)) || (desc == NULL)) |
93 | return; | 92 | return; |
@@ -109,29 +108,30 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc, | |||
109 | le32_to_cpu(aq_desc->params.external.addr_low)); | 108 | le32_to_cpu(aq_desc->params.external.addr_low)); |
110 | 109 | ||
111 | if ((buffer != NULL) && (aq_desc->datalen != 0)) { | 110 | if ((buffer != NULL) && (aq_desc->datalen != 0)) { |
112 | memset(data, 0, sizeof(data)); | ||
113 | i40e_debug(hw, mask, "AQ CMD Buffer:\n"); | 111 | i40e_debug(hw, mask, "AQ CMD Buffer:\n"); |
114 | if (buf_len < len) | 112 | if (buf_len < len) |
115 | len = buf_len; | 113 | len = buf_len; |
116 | for (i = 0; i < len; i++) { | 114 | /* write the full 16-byte chunks */ |
117 | data[((i % 16) / 4)] |= | 115 | for (i = 0; i < (len - 16); i += 16) |
118 | ((u32)aq_buffer[i]) << (8 * (i % 4)); | 116 | i40e_debug(hw, mask, |
119 | if ((i % 16) == 15) { | 117 | "\t0x%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", |
120 | i40e_debug(hw, mask, | 118 | i, buf[i], buf[i + 1], buf[i + 2], |
121 | "\t0x%04X %08X %08X %08X %08X\n", | 119 | buf[i + 3], buf[i + 4], buf[i + 5], |
122 | i - 15, le32_to_cpu(data[0]), | 120 | buf[i + 6], buf[i + 7], buf[i + 8], |
123 | le32_to_cpu(data[1]), | 121 | buf[i + 9], buf[i + 10], buf[i + 11], |
124 | le32_to_cpu(data[2]), | 122 | buf[i + 12], buf[i + 13], buf[i + 14], |
125 | le32_to_cpu(data[3])); | 123 | buf[i + 15]); |
126 | memset(data, 0, sizeof(data)); | 124 | /* write whatever's left over without overrunning the buffer */ |
127 | } | 125 | if (i < len) { |
126 | char d_buf[80]; | ||
127 | int j = 0; | ||
128 | |||
129 | memset(d_buf, 0, sizeof(d_buf)); | ||
130 | j += sprintf(d_buf, "\t0x%04X ", i); | ||
131 | while (i < len) | ||
132 | j += sprintf(&d_buf[j], " %02X", buf[i++]); | ||
133 | i40e_debug(hw, mask, "%s\n", d_buf); | ||
128 | } | 134 | } |
129 | if ((i % 16) != 0) | ||
130 | i40e_debug(hw, mask, "\t0x%04X %08X %08X %08X %08X\n", | ||
131 | i - (i % 16), le32_to_cpu(data[0]), | ||
132 | le32_to_cpu(data[1]), | ||
133 | le32_to_cpu(data[2]), | ||
134 | le32_to_cpu(data[3])); | ||
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
@@ -3409,9 +3409,9 @@ i40e_status i40e_aq_add_rem_control_packet_filter(struct i40e_hw *hw, | |||
3409 | * is not passed then only register at 'reg_addr0' is read. | 3409 | * is not passed then only register at 'reg_addr0' is read. |
3410 | * | 3410 | * |
3411 | **/ | 3411 | **/ |
3412 | i40e_status i40e_aq_alternate_read(struct i40e_hw *hw, | 3412 | static i40e_status i40e_aq_alternate_read(struct i40e_hw *hw, |
3413 | u32 reg_addr0, u32 *reg_val0, | 3413 | u32 reg_addr0, u32 *reg_val0, |
3414 | u32 reg_addr1, u32 *reg_val1) | 3414 | u32 reg_addr1, u32 *reg_val1) |
3415 | { | 3415 | { |
3416 | struct i40e_aq_desc desc; | 3416 | struct i40e_aq_desc desc; |
3417 | struct i40e_aqc_alternate_write *cmd_resp = | 3417 | struct i40e_aqc_alternate_write *cmd_resp = |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 0937cf325e00..02672c31119f 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -7923,7 +7923,7 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, | |||
7923 | } | 7923 | } |
7924 | #endif /* HAVE_BRIDGE_ATTRIBS */ | 7924 | #endif /* HAVE_BRIDGE_ATTRIBS */ |
7925 | 7925 | ||
7926 | const struct net_device_ops i40e_netdev_ops = { | 7926 | static const struct net_device_ops i40e_netdev_ops = { |
7927 | .ndo_open = i40e_open, | 7927 | .ndo_open = i40e_open, |
7928 | .ndo_stop = i40e_close, | 7928 | .ndo_stop = i40e_close, |
7929 | .ndo_start_xmit = i40e_lan_xmit_frame, | 7929 | .ndo_start_xmit = i40e_lan_xmit_frame, |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c index 039018abad4a..89bd5b4d79cf 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c +++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c | |||
@@ -171,8 +171,8 @@ static i40e_status i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw) | |||
171 | * | 171 | * |
172 | * Reads one 16 bit word from the Shadow RAM using the GLNVM_SRCTL register. | 172 | * Reads one 16 bit word from the Shadow RAM using the GLNVM_SRCTL register. |
173 | **/ | 173 | **/ |
174 | i40e_status i40e_read_nvm_word_srctl(struct i40e_hw *hw, u16 offset, | 174 | static i40e_status i40e_read_nvm_word_srctl(struct i40e_hw *hw, u16 offset, |
175 | u16 *data) | 175 | u16 *data) |
176 | { | 176 | { |
177 | i40e_status ret_code = I40E_ERR_TIMEOUT; | 177 | i40e_status ret_code = I40E_ERR_TIMEOUT; |
178 | u32 sr_reg; | 178 | u32 sr_reg; |
@@ -237,8 +237,8 @@ i40e_status i40e_read_nvm_word(struct i40e_hw *hw, u16 offset, | |||
237 | * method. The buffer read is preceded by the NVM ownership take | 237 | * method. The buffer read is preceded by the NVM ownership take |
238 | * and followed by the release. | 238 | * and followed by the release. |
239 | **/ | 239 | **/ |
240 | i40e_status i40e_read_nvm_buffer_srctl(struct i40e_hw *hw, u16 offset, | 240 | static i40e_status i40e_read_nvm_buffer_srctl(struct i40e_hw *hw, u16 offset, |
241 | u16 *words, u16 *data) | 241 | u16 *words, u16 *data) |
242 | { | 242 | { |
243 | i40e_status ret_code = 0; | 243 | i40e_status ret_code = 0; |
244 | u16 index, word; | 244 | u16 index, word; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index d4b4aa7c204e..7327952b292f 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
@@ -1044,7 +1044,7 @@ void i40e_clean_rx_ring(struct i40e_ring *rx_ring) | |||
1044 | for (i = 0; i < rx_ring->count; i++) { | 1044 | for (i = 0; i < rx_ring->count; i++) { |
1045 | rx_bi = &rx_ring->rx_bi[i]; | 1045 | rx_bi = &rx_ring->rx_bi[i]; |
1046 | rx_bi->dma = 0; | 1046 | rx_bi->dma = 0; |
1047 | rx_bi->hdr_buf = 0; | 1047 | rx_bi->hdr_buf = NULL; |
1048 | } | 1048 | } |
1049 | } | 1049 | } |
1050 | } | 1050 | } |
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_common.c b/drivers/net/ethernet/intel/i40evf/i40e_common.c index 0335b3f08cc1..f07b9ff2b823 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_common.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_common.c | |||
@@ -85,9 +85,8 @@ void i40evf_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc, | |||
85 | { | 85 | { |
86 | struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; | 86 | struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; |
87 | u16 len = le16_to_cpu(aq_desc->datalen); | 87 | u16 len = le16_to_cpu(aq_desc->datalen); |
88 | u8 *aq_buffer = (u8 *)buffer; | 88 | u8 *buf = (u8 *)buffer; |
89 | u32 data[4]; | 89 | u16 i = 0; |
90 | u32 i = 0; | ||
91 | 90 | ||
92 | if ((!(mask & hw->debug_mask)) || (desc == NULL)) | 91 | if ((!(mask & hw->debug_mask)) || (desc == NULL)) |
93 | return; | 92 | return; |
@@ -109,29 +108,30 @@ void i40evf_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc, | |||
109 | le32_to_cpu(aq_desc->params.external.addr_low)); | 108 | le32_to_cpu(aq_desc->params.external.addr_low)); |
110 | 109 | ||
111 | if ((buffer != NULL) && (aq_desc->datalen != 0)) { | 110 | if ((buffer != NULL) && (aq_desc->datalen != 0)) { |
112 | memset(data, 0, sizeof(data)); | ||
113 | i40e_debug(hw, mask, "AQ CMD Buffer:\n"); | 111 | i40e_debug(hw, mask, "AQ CMD Buffer:\n"); |
114 | if (buf_len < len) | 112 | if (buf_len < len) |
115 | len = buf_len; | 113 | len = buf_len; |
116 | for (i = 0; i < len; i++) { | 114 | /* write the full 16-byte chunks */ |
117 | data[((i % 16) / 4)] |= | 115 | for (i = 0; i < (len - 16); i += 16) |
118 | ((u32)aq_buffer[i]) << (8 * (i % 4)); | 116 | i40e_debug(hw, mask, |
119 | if ((i % 16) == 15) { | 117 | "\t0x%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", |
120 | i40e_debug(hw, mask, | 118 | i, buf[i], buf[i + 1], buf[i + 2], |
121 | "\t0x%04X %08X %08X %08X %08X\n", | 119 | buf[i + 3], buf[i + 4], buf[i + 5], |
122 | i - 15, le32_to_cpu(data[0]), | 120 | buf[i + 6], buf[i + 7], buf[i + 8], |
123 | le32_to_cpu(data[1]), | 121 | buf[i + 9], buf[i + 10], buf[i + 11], |
124 | le32_to_cpu(data[2]), | 122 | buf[i + 12], buf[i + 13], buf[i + 14], |
125 | le32_to_cpu(data[3])); | 123 | buf[i + 15]); |
126 | memset(data, 0, sizeof(data)); | 124 | /* write whatever's left over without overrunning the buffer */ |
127 | } | 125 | if (i < len) { |
126 | char d_buf[80]; | ||
127 | int j = 0; | ||
128 | |||
129 | memset(d_buf, 0, sizeof(d_buf)); | ||
130 | j += sprintf(d_buf, "\t0x%04X ", i); | ||
131 | while (i < len) | ||
132 | j += sprintf(&d_buf[j], " %02X", buf[i++]); | ||
133 | i40e_debug(hw, mask, "%s\n", d_buf); | ||
128 | } | 134 | } |
129 | if ((i % 16) != 0) | ||
130 | i40e_debug(hw, mask, "\t0x%04X %08X %08X %08X %08X\n", | ||
131 | i - (i % 16), le32_to_cpu(data[0]), | ||
132 | le32_to_cpu(data[1]), | ||
133 | le32_to_cpu(data[2]), | ||
134 | le32_to_cpu(data[3])); | ||
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c index fe13ad2def46..021b0d4d8a35 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c | |||
@@ -542,7 +542,7 @@ void i40evf_clean_rx_ring(struct i40e_ring *rx_ring) | |||
542 | for (i = 0; i < rx_ring->count; i++) { | 542 | for (i = 0; i < rx_ring->count; i++) { |
543 | rx_bi = &rx_ring->rx_bi[i]; | 543 | rx_bi = &rx_ring->rx_bi[i]; |
544 | rx_bi->dma = 0; | 544 | rx_bi->dma = 0; |
545 | rx_bi->hdr_buf = 0; | 545 | rx_bi->hdr_buf = NULL; |
546 | } | 546 | } |
547 | } | 547 | } |
548 | } | 548 | } |