aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgb
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-10-29 13:46:13 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-30 14:32:16 -0400
commit273dc74e1c7d9aa2eab2036153c8fe65593fb85e (patch)
tree9f854fce92cea3e9785ed67ced0801a09d3db2d2 /drivers/net/ixgb
parent5a9147bb29d76b30787638882f6c310074c2e6f3 (diff)
ixgb: fix sparse warnings
Fix sparse warnings in ixgb driver for net-2.6.24. Added a sparse fix for invalid declaration using non-constant value in ixgb_set_multi. Added a fix for the module param array index and allows int params in the array. --Auke Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ixgb')
-rw-r--r--drivers/net/ixgb/ixgb.h7
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c7
-rw-r--r--drivers/net/ixgb/ixgb_hw.c4
-rw-r--r--drivers/net/ixgb/ixgb_main.c11
-rw-r--r--drivers/net/ixgb/ixgb_param.c43
5 files changed, 37 insertions, 35 deletions
diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index 1eee8894c732..3d2e7217e9af 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -196,4 +196,11 @@ struct ixgb_adapter {
196 uint32_t alloc_rx_buff_failed; 196 uint32_t alloc_rx_buff_failed;
197 boolean_t have_msi; 197 boolean_t have_msi;
198}; 198};
199
200/* Exported from other modules */
201extern void ixgb_check_options(struct ixgb_adapter *adapter);
202extern void ixgb_set_ethtool_ops(struct net_device *netdev);
203extern char ixgb_driver_name[];
204extern const char ixgb_driver_version[];
205
199#endif /* _IXGB_H_ */ 206#endif /* _IXGB_H_ */
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index fddd5844168d..a267dd862520 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -32,9 +32,6 @@
32 32
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34 34
35extern char ixgb_driver_name[];
36extern char ixgb_driver_version[];
37
38extern int ixgb_up(struct ixgb_adapter *adapter); 35extern int ixgb_up(struct ixgb_adapter *adapter);
39extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog); 36extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog);
40extern void ixgb_reset(struct ixgb_adapter *adapter); 37extern void ixgb_reset(struct ixgb_adapter *adapter);
@@ -639,8 +636,8 @@ ixgb_phys_id(struct net_device *netdev, uint32_t data)
639{ 636{
640 struct ixgb_adapter *adapter = netdev_priv(netdev); 637 struct ixgb_adapter *adapter = netdev_priv(netdev);
641 638
642 if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) 639 if (!data)
643 data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); 640 data = INT_MAX;
644 641
645 if(!adapter->blink_timer.function) { 642 if(!adapter->blink_timer.function) {
646 init_timer(&adapter->blink_timer); 643 init_timer(&adapter->blink_timer);
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index ecbf45861c68..2c6367ace3cd 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -1174,7 +1174,7 @@ mac_addr_valid(uint8_t *mac_addr)
1174 * 1174 *
1175 * hw - Struct containing variables accessed by shared code 1175 * hw - Struct containing variables accessed by shared code
1176 *****************************************************************************/ 1176 *****************************************************************************/
1177boolean_t 1177static boolean_t
1178ixgb_link_reset(struct ixgb_hw *hw) 1178ixgb_link_reset(struct ixgb_hw *hw)
1179{ 1179{
1180 boolean_t link_status = FALSE; 1180 boolean_t link_status = FALSE;
@@ -1205,7 +1205,7 @@ ixgb_link_reset(struct ixgb_hw *hw)
1205 * 1205 *
1206 * hw - Struct containing variables accessed by shared code 1206 * hw - Struct containing variables accessed by shared code
1207 *****************************************************************************/ 1207 *****************************************************************************/
1208void 1208static void
1209ixgb_optics_reset(struct ixgb_hw *hw) 1209ixgb_optics_reset(struct ixgb_hw *hw)
1210{ 1210{
1211 if (hw->phy_type == ixgb_phy_type_txn17401) { 1211 if (hw->phy_type == ixgb_phy_type_txn17401) {
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index d444de58ba34..e564335b4b84 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -37,8 +37,8 @@ static char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver";
37#define DRIVERNAPI "-NAPI" 37#define DRIVERNAPI "-NAPI"
38#endif 38#endif
39#define DRV_VERSION "1.0.126-k2"DRIVERNAPI 39#define DRV_VERSION "1.0.126-k2"DRIVERNAPI
40char ixgb_driver_version[] = DRV_VERSION; 40const char ixgb_driver_version[] = DRV_VERSION;
41static char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 41static const char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
42 42
43/* ixgb_pci_tbl - PCI Device ID Table 43/* ixgb_pci_tbl - PCI Device ID Table
44 * 44 *
@@ -104,7 +104,6 @@ static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter,
104static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter); 104static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter);
105#endif 105#endif
106static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter); 106static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter);
107void ixgb_set_ethtool_ops(struct net_device *netdev);
108static void ixgb_tx_timeout(struct net_device *dev); 107static void ixgb_tx_timeout(struct net_device *dev);
109static void ixgb_tx_timeout_task(struct work_struct *work); 108static void ixgb_tx_timeout_task(struct work_struct *work);
110static void ixgb_vlan_rx_register(struct net_device *netdev, 109static void ixgb_vlan_rx_register(struct net_device *netdev,
@@ -123,9 +122,6 @@ static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
123static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev); 122static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev);
124static void ixgb_io_resume (struct pci_dev *pdev); 123static void ixgb_io_resume (struct pci_dev *pdev);
125 124
126/* Exported from other modules */
127extern void ixgb_check_options(struct ixgb_adapter *adapter);
128
129static struct pci_error_handlers ixgb_err_handler = { 125static struct pci_error_handlers ixgb_err_handler = {
130 .error_detected = ixgb_io_error_detected, 126 .error_detected = ixgb_io_error_detected,
131 .slot_reset = ixgb_io_slot_reset, 127 .slot_reset = ixgb_io_slot_reset,
@@ -1085,7 +1081,8 @@ ixgb_set_multi(struct net_device *netdev)
1085 rctl |= IXGB_RCTL_MPE; 1081 rctl |= IXGB_RCTL_MPE;
1086 IXGB_WRITE_REG(hw, RCTL, rctl); 1082 IXGB_WRITE_REG(hw, RCTL, rctl);
1087 } else { 1083 } else {
1088 uint8_t mta[netdev->mc_count * IXGB_ETH_LENGTH_OF_ADDRESS]; 1084 uint8_t mta[IXGB_MAX_NUM_MULTICAST_ADDRESSES *
1085 IXGB_ETH_LENGTH_OF_ADDRESS];
1089 1086
1090 IXGB_WRITE_REG(hw, RCTL, rctl); 1087 IXGB_WRITE_REG(hw, RCTL, rctl);
1091 1088
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
index 5d5ddabf4360..865d14d6e5a7 100644
--- a/drivers/net/ixgb/ixgb_param.c
+++ b/drivers/net/ixgb/ixgb_param.c
@@ -44,10 +44,11 @@
44 */ 44 */
45 45
46#define IXGB_PARAM_INIT { [0 ... IXGB_MAX_NIC] = OPTION_UNSET } 46#define IXGB_PARAM_INIT { [0 ... IXGB_MAX_NIC] = OPTION_UNSET }
47#define IXGB_PARAM(X, desc) \ 47#define IXGB_PARAM(X, desc) \
48 static int __devinitdata X[IXGB_MAX_NIC+1] = IXGB_PARAM_INIT; \ 48 static int __devinitdata X[IXGB_MAX_NIC+1] \
49 static int num_##X = 0; \ 49 = IXGB_PARAM_INIT; \
50 module_param_array_named(X, X, int, &num_##X, 0); \ 50 static unsigned int num_##X = 0; \
51 module_param_array_named(X, X, int, &num_##X, 0); \
51 MODULE_PARM_DESC(X, desc); 52 MODULE_PARM_DESC(X, desc);
52 53
53/* Transmit Descriptor Count 54/* Transmit Descriptor Count
@@ -178,8 +179,8 @@ IXGB_PARAM(IntDelayEnable, "Transmit Interrupt Delay Enable");
178 179
179struct ixgb_option { 180struct ixgb_option {
180 enum { enable_option, range_option, list_option } type; 181 enum { enable_option, range_option, list_option } type;
181 char *name; 182 const char *name;
182 char *err; 183 const char *err;
183 int def; 184 int def;
184 union { 185 union {
185 struct { /* range_option info */ 186 struct { /* range_option info */
@@ -197,7 +198,7 @@ struct ixgb_option {
197}; 198};
198 199
199static int __devinit 200static int __devinit
200ixgb_validate_option(int *value, struct ixgb_option *opt) 201ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt)
201{ 202{
202 if(*value == OPTION_UNSET) { 203 if(*value == OPTION_UNSET) {
203 *value = opt->def; 204 *value = opt->def;
@@ -266,7 +267,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
266 } 267 }
267 268
268 { /* Transmit Descriptor Count */ 269 { /* Transmit Descriptor Count */
269 struct ixgb_option opt = { 270 const struct ixgb_option opt = {
270 .type = range_option, 271 .type = range_option,
271 .name = "Transmit Descriptors", 272 .name = "Transmit Descriptors",
272 .err = "using default of " __MODULE_STRING(DEFAULT_TXD), 273 .err = "using default of " __MODULE_STRING(DEFAULT_TXD),
@@ -285,7 +286,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
285 tx_ring->count = ALIGN(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); 286 tx_ring->count = ALIGN(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
286 } 287 }
287 { /* Receive Descriptor Count */ 288 { /* Receive Descriptor Count */
288 struct ixgb_option opt = { 289 const struct ixgb_option opt = {
289 .type = range_option, 290 .type = range_option,
290 .name = "Receive Descriptors", 291 .name = "Receive Descriptors",
291 .err = "using default of " __MODULE_STRING(DEFAULT_RXD), 292 .err = "using default of " __MODULE_STRING(DEFAULT_RXD),
@@ -304,7 +305,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
304 rx_ring->count = ALIGN(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); 305 rx_ring->count = ALIGN(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);
305 } 306 }
306 { /* Receive Checksum Offload Enable */ 307 { /* Receive Checksum Offload Enable */
307 struct ixgb_option opt = { 308 const struct ixgb_option opt = {
308 .type = enable_option, 309 .type = enable_option,
309 .name = "Receive Checksum Offload", 310 .name = "Receive Checksum Offload",
310 .err = "defaulting to Enabled", 311 .err = "defaulting to Enabled",
@@ -312,7 +313,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
312 }; 313 };
313 314
314 if(num_XsumRX > bd) { 315 if(num_XsumRX > bd) {
315 int rx_csum = XsumRX[bd]; 316 unsigned int rx_csum = XsumRX[bd];
316 ixgb_validate_option(&rx_csum, &opt); 317 ixgb_validate_option(&rx_csum, &opt);
317 adapter->rx_csum = rx_csum; 318 adapter->rx_csum = rx_csum;
318 } else { 319 } else {
@@ -328,7 +329,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
328 { ixgb_fc_full, "Flow Control Enabled" }, 329 { ixgb_fc_full, "Flow Control Enabled" },
329 { ixgb_fc_default, "Flow Control Hardware Default" }}; 330 { ixgb_fc_default, "Flow Control Hardware Default" }};
330 331
331 struct ixgb_option opt = { 332 const struct ixgb_option opt = {
332 .type = list_option, 333 .type = list_option,
333 .name = "Flow Control", 334 .name = "Flow Control",
334 .err = "reading default settings from EEPROM", 335 .err = "reading default settings from EEPROM",
@@ -338,7 +339,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
338 }; 339 };
339 340
340 if(num_FlowControl > bd) { 341 if(num_FlowControl > bd) {
341 int fc = FlowControl[bd]; 342 unsigned int fc = FlowControl[bd];
342 ixgb_validate_option(&fc, &opt); 343 ixgb_validate_option(&fc, &opt);
343 adapter->hw.fc.type = fc; 344 adapter->hw.fc.type = fc;
344 } else { 345 } else {
@@ -346,7 +347,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
346 } 347 }
347 } 348 }
348 { /* Receive Flow Control High Threshold */ 349 { /* Receive Flow Control High Threshold */
349 struct ixgb_option opt = { 350 const struct ixgb_option opt = {
350 .type = range_option, 351 .type = range_option,
351 .name = "Rx Flow Control High Threshold", 352 .name = "Rx Flow Control High Threshold",
352 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTH), 353 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTH),
@@ -366,7 +367,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
366 "Ignoring RxFCHighThresh when no RxFC\n"); 367 "Ignoring RxFCHighThresh when no RxFC\n");
367 } 368 }
368 { /* Receive Flow Control Low Threshold */ 369 { /* Receive Flow Control Low Threshold */
369 struct ixgb_option opt = { 370 const struct ixgb_option opt = {
370 .type = range_option, 371 .type = range_option,
371 .name = "Rx Flow Control Low Threshold", 372 .name = "Rx Flow Control Low Threshold",
372 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTL), 373 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTL),
@@ -386,7 +387,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
386 "Ignoring RxFCLowThresh when no RxFC\n"); 387 "Ignoring RxFCLowThresh when no RxFC\n");
387 } 388 }
388 { /* Flow Control Pause Time Request*/ 389 { /* Flow Control Pause Time Request*/
389 struct ixgb_option opt = { 390 const struct ixgb_option opt = {
390 .type = range_option, 391 .type = range_option,
391 .name = "Flow Control Pause Time Request", 392 .name = "Flow Control Pause Time Request",
392 .err = "using default of "__MODULE_STRING(DEFAULT_FCPAUSE), 393 .err = "using default of "__MODULE_STRING(DEFAULT_FCPAUSE),
@@ -396,7 +397,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
396 }; 397 };
397 398
398 if(num_FCReqTimeout > bd) { 399 if(num_FCReqTimeout > bd) {
399 int pause_time = FCReqTimeout[bd]; 400 unsigned int pause_time = FCReqTimeout[bd];
400 ixgb_validate_option(&pause_time, &opt); 401 ixgb_validate_option(&pause_time, &opt);
401 adapter->hw.fc.pause_time = pause_time; 402 adapter->hw.fc.pause_time = pause_time;
402 } else { 403 } else {
@@ -419,7 +420,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
419 } 420 }
420 } 421 }
421 { /* Receive Interrupt Delay */ 422 { /* Receive Interrupt Delay */
422 struct ixgb_option opt = { 423 const struct ixgb_option opt = {
423 .type = range_option, 424 .type = range_option,
424 .name = "Receive Interrupt Delay", 425 .name = "Receive Interrupt Delay",
425 .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), 426 .err = "using default of " __MODULE_STRING(DEFAULT_RDTR),
@@ -436,7 +437,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
436 } 437 }
437 } 438 }
438 { /* Transmit Interrupt Delay */ 439 { /* Transmit Interrupt Delay */
439 struct ixgb_option opt = { 440 const struct ixgb_option opt = {
440 .type = range_option, 441 .type = range_option,
441 .name = "Transmit Interrupt Delay", 442 .name = "Transmit Interrupt Delay",
442 .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), 443 .err = "using default of " __MODULE_STRING(DEFAULT_TIDV),
@@ -454,7 +455,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
454 } 455 }
455 456
456 { /* Transmit Interrupt Delay Enable */ 457 { /* Transmit Interrupt Delay Enable */
457 struct ixgb_option opt = { 458 const struct ixgb_option opt = {
458 .type = enable_option, 459 .type = enable_option,
459 .name = "Tx Interrupt Delay Enable", 460 .name = "Tx Interrupt Delay Enable",
460 .err = "defaulting to Enabled", 461 .err = "defaulting to Enabled",
@@ -462,7 +463,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
462 }; 463 };
463 464
464 if(num_IntDelayEnable > bd) { 465 if(num_IntDelayEnable > bd) {
465 int ide = IntDelayEnable[bd]; 466 unsigned int ide = IntDelayEnable[bd];
466 ixgb_validate_option(&ide, &opt); 467 ixgb_validate_option(&ide, &opt);
467 adapter->tx_int_delay_enable = ide; 468 adapter->tx_int_delay_enable = ide;
468 } else { 469 } else {