diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-10-29 13:46:19 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-30 14:32:17 -0400 |
commit | abec42a4f87795766f77e4595b7e540b5fc60e3f (patch) | |
tree | accf9def87efcf8b04728aaea44fdecdea0c559e /drivers/net | |
parent | 273dc74e1c7d9aa2eab2036153c8fe65593fb85e (diff) |
e1000: sparse warnings fixes
Fix sparse warnings and problems from e1000 driver.
Added a sparse fix for the module param array index
-- 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')
-rw-r--r-- | drivers/net/e1000/e1000.h | 8 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 29 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_hw.c | 4 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 7 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_param.c | 23 |
5 files changed, 36 insertions, 35 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index 781ed9968489..3b840283a9c3 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h | |||
@@ -351,4 +351,12 @@ enum e1000_state_t { | |||
351 | __E1000_DOWN | 351 | __E1000_DOWN |
352 | }; | 352 | }; |
353 | 353 | ||
354 | extern char e1000_driver_name[]; | ||
355 | extern const char e1000_driver_version[]; | ||
356 | |||
357 | extern void e1000_power_up_phy(struct e1000_adapter *); | ||
358 | extern void e1000_set_ethtool_ops(struct net_device *netdev); | ||
359 | extern void e1000_check_options(struct e1000_adapter *adapter); | ||
360 | |||
361 | |||
354 | #endif /* _E1000_H_ */ | 362 | #endif /* _E1000_H_ */ |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 6c9a643426f5..667f18bcc172 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -32,9 +32,6 @@ | |||
32 | 32 | ||
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | 34 | ||
35 | extern char e1000_driver_name[]; | ||
36 | extern char e1000_driver_version[]; | ||
37 | |||
38 | extern int e1000_up(struct e1000_adapter *adapter); | 35 | extern int e1000_up(struct e1000_adapter *adapter); |
39 | extern void e1000_down(struct e1000_adapter *adapter); | 36 | extern void e1000_down(struct e1000_adapter *adapter); |
40 | extern void e1000_reinit_locked(struct e1000_adapter *adapter); | 37 | extern void e1000_reinit_locked(struct e1000_adapter *adapter); |
@@ -733,16 +730,16 @@ err_setup: | |||
733 | 730 | ||
734 | #define REG_PATTERN_TEST(R, M, W) \ | 731 | #define REG_PATTERN_TEST(R, M, W) \ |
735 | { \ | 732 | { \ |
736 | uint32_t pat, value; \ | 733 | uint32_t pat, val; \ |
737 | uint32_t test[] = \ | 734 | const uint32_t test[] = \ |
738 | {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \ | 735 | {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \ |
739 | for (pat = 0; pat < ARRAY_SIZE(test); pat++) { \ | 736 | for (pat = 0; pat < ARRAY_SIZE(test); pat++) { \ |
740 | E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ | 737 | E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ |
741 | value = E1000_READ_REG(&adapter->hw, R); \ | 738 | val = E1000_READ_REG(&adapter->hw, R); \ |
742 | if (value != (test[pat] & W & M)) { \ | 739 | if (val != (test[pat] & W & M)) { \ |
743 | DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \ | 740 | DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \ |
744 | "0x%08X expected 0x%08X\n", \ | 741 | "0x%08X expected 0x%08X\n", \ |
745 | E1000_##R, value, (test[pat] & W & M)); \ | 742 | E1000_##R, val, (test[pat] & W & M)); \ |
746 | *data = (adapter->hw.mac_type < e1000_82543) ? \ | 743 | *data = (adapter->hw.mac_type < e1000_82543) ? \ |
747 | E1000_82542_##R : E1000_##R; \ | 744 | E1000_82542_##R : E1000_##R; \ |
748 | return 1; \ | 745 | return 1; \ |
@@ -752,12 +749,12 @@ err_setup: | |||
752 | 749 | ||
753 | #define REG_SET_AND_CHECK(R, M, W) \ | 750 | #define REG_SET_AND_CHECK(R, M, W) \ |
754 | { \ | 751 | { \ |
755 | uint32_t value; \ | 752 | uint32_t val; \ |
756 | E1000_WRITE_REG(&adapter->hw, R, W & M); \ | 753 | E1000_WRITE_REG(&adapter->hw, R, W & M); \ |
757 | value = E1000_READ_REG(&adapter->hw, R); \ | 754 | val = E1000_READ_REG(&adapter->hw, R); \ |
758 | if ((W & M) != (value & M)) { \ | 755 | if ((W & M) != (val & M)) { \ |
759 | DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\ | 756 | DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\ |
760 | "expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \ | 757 | "expected 0x%08X\n", E1000_##R, (val & M), (W & M)); \ |
761 | *data = (adapter->hw.mac_type < e1000_82543) ? \ | 758 | *data = (adapter->hw.mac_type < e1000_82543) ? \ |
762 | E1000_82542_##R : E1000_##R; \ | 759 | E1000_82542_##R : E1000_##R; \ |
763 | return 1; \ | 760 | return 1; \ |
@@ -1621,8 +1618,6 @@ e1000_get_sset_count(struct net_device *netdev, int sset) | |||
1621 | } | 1618 | } |
1622 | } | 1619 | } |
1623 | 1620 | ||
1624 | extern void e1000_power_up_phy(struct e1000_adapter *); | ||
1625 | |||
1626 | static void | 1621 | static void |
1627 | e1000_diag_test(struct net_device *netdev, | 1622 | e1000_diag_test(struct net_device *netdev, |
1628 | struct ethtool_test *eth_test, uint64_t *data) | 1623 | struct ethtool_test *eth_test, uint64_t *data) |
@@ -1859,8 +1854,8 @@ e1000_phys_id(struct net_device *netdev, uint32_t data) | |||
1859 | { | 1854 | { |
1860 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1855 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1861 | 1856 | ||
1862 | if (!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) | 1857 | if (!data) |
1863 | data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); | 1858 | data = INT_MAX; |
1864 | 1859 | ||
1865 | if (adapter->hw.mac_type < e1000_82571) { | 1860 | if (adapter->hw.mac_type < e1000_82571) { |
1866 | if (!adapter->blink_timer.function) { | 1861 | if (!adapter->blink_timer.function) { |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 8fa0fe4009d5..7c6888c58c21 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -8607,7 +8607,7 @@ e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index, | |||
8607 | 8607 | ||
8608 | DEBUGFUNC("e1000_read_ich8_data"); | 8608 | DEBUGFUNC("e1000_read_ich8_data"); |
8609 | 8609 | ||
8610 | if (size < 1 || size > 2 || data == 0x0 || | 8610 | if (size < 1 || size > 2 || data == NULL || |
8611 | index > ICH_FLASH_LINEAR_ADDR_MASK) | 8611 | index > ICH_FLASH_LINEAR_ADDR_MASK) |
8612 | return error; | 8612 | return error; |
8613 | 8613 | ||
@@ -8841,7 +8841,7 @@ e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t *data) | |||
8841 | * amount of NVM used in each bank is a *minimum* of 4 KBytes, but in fact the | 8841 | * amount of NVM used in each bank is a *minimum* of 4 KBytes, but in fact the |
8842 | * bank size may be 4, 8 or 64 KBytes | 8842 | * bank size may be 4, 8 or 64 KBytes |
8843 | *****************************************************************************/ | 8843 | *****************************************************************************/ |
8844 | int32_t | 8844 | static int32_t |
8845 | e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank) | 8845 | e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank) |
8846 | { | 8846 | { |
8847 | union ich8_hws_flash_status hsfsts; | 8847 | union ich8_hws_flash_status hsfsts; |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index f1ce348470cc..72deff0d4d90 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -37,8 +37,8 @@ static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | |||
37 | #define DRIVERNAPI "-NAPI" | 37 | #define DRIVERNAPI "-NAPI" |
38 | #endif | 38 | #endif |
39 | #define DRV_VERSION "7.3.20-k2"DRIVERNAPI | 39 | #define DRV_VERSION "7.3.20-k2"DRIVERNAPI |
40 | char e1000_driver_version[] = DRV_VERSION; | 40 | const char e1000_driver_version[] = DRV_VERSION; |
41 | static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; | 41 | static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
42 | 42 | ||
43 | /* e1000_pci_tbl - PCI Device ID Table | 43 | /* e1000_pci_tbl - PCI Device ID Table |
44 | * | 44 | * |
@@ -188,7 +188,6 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
188 | static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); | 188 | static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); |
189 | static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, | 189 | static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, |
190 | int cmd); | 190 | int cmd); |
191 | void e1000_set_ethtool_ops(struct net_device *netdev); | ||
192 | static void e1000_enter_82542_rst(struct e1000_adapter *adapter); | 191 | static void e1000_enter_82542_rst(struct e1000_adapter *adapter); |
193 | static void e1000_leave_82542_rst(struct e1000_adapter *adapter); | 192 | static void e1000_leave_82542_rst(struct e1000_adapter *adapter); |
194 | static void e1000_tx_timeout(struct net_device *dev); | 193 | static void e1000_tx_timeout(struct net_device *dev); |
@@ -213,8 +212,6 @@ static void e1000_shutdown(struct pci_dev *pdev); | |||
213 | static void e1000_netpoll (struct net_device *netdev); | 212 | static void e1000_netpoll (struct net_device *netdev); |
214 | #endif | 213 | #endif |
215 | 214 | ||
216 | extern void e1000_check_options(struct e1000_adapter *adapter); | ||
217 | |||
218 | #define COPYBREAK_DEFAULT 256 | 215 | #define COPYBREAK_DEFAULT 256 |
219 | static unsigned int copybreak __read_mostly = COPYBREAK_DEFAULT; | 216 | static unsigned int copybreak __read_mostly = COPYBREAK_DEFAULT; |
220 | module_param(copybreak, uint, 0644); | 217 | module_param(copybreak, uint, 0644); |
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index f485874a63f5..e6565ce686bc 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } | 46 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } |
47 | #define E1000_PARAM(X, desc) \ | 47 | #define E1000_PARAM(X, desc) \ |
48 | static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ | 48 | static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ |
49 | static int num_##X = 0; \ | 49 | static unsigned int num_##X; \ |
50 | module_param_array_named(X, X, int, &num_##X, 0); \ | 50 | module_param_array_named(X, X, int, &num_##X, 0); \ |
51 | MODULE_PARM_DESC(X, desc); | 51 | MODULE_PARM_DESC(X, desc); |
52 | 52 | ||
@@ -198,9 +198,9 @@ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); | |||
198 | 198 | ||
199 | struct e1000_option { | 199 | struct e1000_option { |
200 | enum { enable_option, range_option, list_option } type; | 200 | enum { enable_option, range_option, list_option } type; |
201 | char *name; | 201 | const char *name; |
202 | char *err; | 202 | const char *err; |
203 | int def; | 203 | int def; |
204 | union { | 204 | union { |
205 | struct { /* range_option info */ | 205 | struct { /* range_option info */ |
206 | int min; | 206 | int min; |
@@ -214,8 +214,9 @@ struct e1000_option { | |||
214 | }; | 214 | }; |
215 | 215 | ||
216 | static int __devinit | 216 | static int __devinit |
217 | e1000_validate_option(int *value, struct e1000_option *opt, | 217 | e1000_validate_option(unsigned int *value, |
218 | struct e1000_adapter *adapter) | 218 | const struct e1000_option *opt, |
219 | struct e1000_adapter *adapter) | ||
219 | { | 220 | { |
220 | if (*value == OPTION_UNSET) { | 221 | if (*value == OPTION_UNSET) { |
221 | *value = opt->def; | 222 | *value = opt->def; |
@@ -348,7 +349,7 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
348 | }; | 349 | }; |
349 | 350 | ||
350 | if (num_XsumRX > bd) { | 351 | if (num_XsumRX > bd) { |
351 | int rx_csum = XsumRX[bd]; | 352 | unsigned int rx_csum = XsumRX[bd]; |
352 | e1000_validate_option(&rx_csum, &opt, adapter); | 353 | e1000_validate_option(&rx_csum, &opt, adapter); |
353 | adapter->rx_csum = rx_csum; | 354 | adapter->rx_csum = rx_csum; |
354 | } else { | 355 | } else { |
@@ -374,7 +375,7 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
374 | }; | 375 | }; |
375 | 376 | ||
376 | if (num_FlowControl > bd) { | 377 | if (num_FlowControl > bd) { |
377 | int fc = FlowControl[bd]; | 378 | unsigned int fc = FlowControl[bd]; |
378 | e1000_validate_option(&fc, &opt, adapter); | 379 | e1000_validate_option(&fc, &opt, adapter); |
379 | adapter->hw.fc = adapter->hw.original_fc = fc; | 380 | adapter->hw.fc = adapter->hw.original_fc = fc; |
380 | } else { | 381 | } else { |
@@ -506,7 +507,7 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
506 | }; | 507 | }; |
507 | 508 | ||
508 | if (num_SmartPowerDownEnable > bd) { | 509 | if (num_SmartPowerDownEnable > bd) { |
509 | int spd = SmartPowerDownEnable[bd]; | 510 | unsigned int spd = SmartPowerDownEnable[bd]; |
510 | e1000_validate_option(&spd, &opt, adapter); | 511 | e1000_validate_option(&spd, &opt, adapter); |
511 | adapter->smart_power_down = spd; | 512 | adapter->smart_power_down = spd; |
512 | } else { | 513 | } else { |
@@ -522,7 +523,7 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
522 | }; | 523 | }; |
523 | 524 | ||
524 | if (num_KumeranLockLoss > bd) { | 525 | if (num_KumeranLockLoss > bd) { |
525 | int kmrn_lock_loss = KumeranLockLoss[bd]; | 526 | unsigned int kmrn_lock_loss = KumeranLockLoss[bd]; |
526 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); | 527 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); |
527 | adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss; | 528 | adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss; |
528 | } else { | 529 | } else { |
@@ -581,7 +582,7 @@ e1000_check_fiber_options(struct e1000_adapter *adapter) | |||
581 | static void __devinit | 582 | static void __devinit |
582 | e1000_check_copper_options(struct e1000_adapter *adapter) | 583 | e1000_check_copper_options(struct e1000_adapter *adapter) |
583 | { | 584 | { |
584 | int speed, dplx, an; | 585 | unsigned int speed, dplx, an; |
585 | int bd = adapter->bd_number; | 586 | int bd = adapter->bd_number; |
586 | 587 | ||
587 | { /* Speed */ | 588 | { /* Speed */ |