diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-10-29 13:46:05 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-30 14:32:16 -0400 |
commit | 5a9147bb29d76b30787638882f6c310074c2e6f3 (patch) | |
tree | 0261e726485ed158fa57a20ff144244fd48c0227 /drivers | |
parent | 3077d78a74a62c5f531b005efdbcc01a3f2f09ca (diff) |
e1000e: fix sparse warnings
Fix sparse warnings from e1000e driver in net-2.6.24.
Added a sparse fix for module param arrays which can have int values
but only the array index needs to be unsigned. --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')
-rw-r--r-- | drivers/net/e1000e/ethtool.c | 4 | ||||
-rw-r--r-- | drivers/net/e1000e/param.c | 35 |
2 files changed, 20 insertions, 19 deletions
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 0666e62e9ad2..6a39784e7ee2 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -1680,8 +1680,8 @@ static int e1000_phys_id(struct net_device *netdev, u32 data) | |||
1680 | { | 1680 | { |
1681 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1681 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1682 | 1682 | ||
1683 | if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) | 1683 | if (!data) |
1684 | data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); | 1684 | data = INT_MAX; |
1685 | 1685 | ||
1686 | if (adapter->hw.phy.type == e1000_phy_ife) { | 1686 | if (adapter->hw.phy.type == e1000_phy_ife) { |
1687 | if (!adapter->blink_timer.function) { | 1687 | if (!adapter->blink_timer.function) { |
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c index e4e655efb23c..332789238b9c 100644 --- a/drivers/net/e1000e/param.c +++ b/drivers/net/e1000e/param.c | |||
@@ -52,10 +52,11 @@ MODULE_PARM_DESC(copybreak, | |||
52 | */ | 52 | */ |
53 | 53 | ||
54 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } | 54 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } |
55 | #define E1000_PARAM(X, desc) \ | 55 | #define E1000_PARAM(X, desc) \ |
56 | static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ | 56 | static int __devinitdata X[E1000_MAX_NIC+1] \ |
57 | static int num_##X; \ | 57 | = E1000_PARAM_INIT; \ |
58 | module_param_array_named(X, X, int, &num_##X, 0); \ | 58 | static unsigned int num_##X; \ |
59 | module_param_array_named(X, X, int, &num_##X, 0); \ | ||
59 | MODULE_PARM_DESC(X, desc); | 60 | MODULE_PARM_DESC(X, desc); |
60 | 61 | ||
61 | 62 | ||
@@ -124,9 +125,9 @@ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); | |||
124 | 125 | ||
125 | struct e1000_option { | 126 | struct e1000_option { |
126 | enum { enable_option, range_option, list_option } type; | 127 | enum { enable_option, range_option, list_option } type; |
127 | char *name; | 128 | const char *name; |
128 | char *err; | 129 | const char *err; |
129 | int def; | 130 | int def; |
130 | union { | 131 | union { |
131 | struct { /* range_option info */ | 132 | struct { /* range_option info */ |
132 | int min; | 133 | int min; |
@@ -139,8 +140,8 @@ struct e1000_option { | |||
139 | } arg; | 140 | } arg; |
140 | }; | 141 | }; |
141 | 142 | ||
142 | static int __devinit e1000_validate_option(int *value, | 143 | static int __devinit e1000_validate_option(unsigned int *value, |
143 | struct e1000_option *opt, | 144 | const struct e1000_option *opt, |
144 | struct e1000_adapter *adapter) | 145 | struct e1000_adapter *adapter) |
145 | { | 146 | { |
146 | if (*value == OPTION_UNSET) { | 147 | if (*value == OPTION_UNSET) { |
@@ -213,7 +214,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
213 | } | 214 | } |
214 | 215 | ||
215 | { /* Transmit Interrupt Delay */ | 216 | { /* Transmit Interrupt Delay */ |
216 | struct e1000_option opt = { | 217 | const struct e1000_option opt = { |
217 | .type = range_option, | 218 | .type = range_option, |
218 | .name = "Transmit Interrupt Delay", | 219 | .name = "Transmit Interrupt Delay", |
219 | .err = "using default of " | 220 | .err = "using default of " |
@@ -232,7 +233,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
232 | } | 233 | } |
233 | } | 234 | } |
234 | { /* Transmit Absolute Interrupt Delay */ | 235 | { /* Transmit Absolute Interrupt Delay */ |
235 | struct e1000_option opt = { | 236 | const struct e1000_option opt = { |
236 | .type = range_option, | 237 | .type = range_option, |
237 | .name = "Transmit Absolute Interrupt Delay", | 238 | .name = "Transmit Absolute Interrupt Delay", |
238 | .err = "using default of " | 239 | .err = "using default of " |
@@ -277,7 +278,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
277 | } | 278 | } |
278 | } | 279 | } |
279 | { /* Receive Absolute Interrupt Delay */ | 280 | { /* Receive Absolute Interrupt Delay */ |
280 | struct e1000_option opt = { | 281 | const struct e1000_option opt = { |
281 | .type = range_option, | 282 | .type = range_option, |
282 | .name = "Receive Absolute Interrupt Delay", | 283 | .name = "Receive Absolute Interrupt Delay", |
283 | .err = "using default of " | 284 | .err = "using default of " |
@@ -296,7 +297,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
296 | } | 297 | } |
297 | } | 298 | } |
298 | { /* Interrupt Throttling Rate */ | 299 | { /* Interrupt Throttling Rate */ |
299 | struct e1000_option opt = { | 300 | const struct e1000_option opt = { |
300 | .type = range_option, | 301 | .type = range_option, |
301 | .name = "Interrupt Throttling Rate (ints/sec)", | 302 | .name = "Interrupt Throttling Rate (ints/sec)", |
302 | .err = "using default of " | 303 | .err = "using default of " |
@@ -344,7 +345,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
344 | } | 345 | } |
345 | } | 346 | } |
346 | { /* Smart Power Down */ | 347 | { /* Smart Power Down */ |
347 | struct e1000_option opt = { | 348 | const struct e1000_option opt = { |
348 | .type = enable_option, | 349 | .type = enable_option, |
349 | .name = "PHY Smart Power Down", | 350 | .name = "PHY Smart Power Down", |
350 | .err = "defaulting to Disabled", | 351 | .err = "defaulting to Disabled", |
@@ -352,7 +353,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
352 | }; | 353 | }; |
353 | 354 | ||
354 | if (num_SmartPowerDownEnable > bd) { | 355 | if (num_SmartPowerDownEnable > bd) { |
355 | int spd = SmartPowerDownEnable[bd]; | 356 | unsigned int spd = SmartPowerDownEnable[bd]; |
356 | e1000_validate_option(&spd, &opt, adapter); | 357 | e1000_validate_option(&spd, &opt, adapter); |
357 | if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) | 358 | if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) |
358 | && spd) | 359 | && spd) |
@@ -360,7 +361,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
360 | } | 361 | } |
361 | } | 362 | } |
362 | { /* Kumeran Lock Loss Workaround */ | 363 | { /* Kumeran Lock Loss Workaround */ |
363 | struct e1000_option opt = { | 364 | const struct e1000_option opt = { |
364 | .type = enable_option, | 365 | .type = enable_option, |
365 | .name = "Kumeran Lock Loss Workaround", | 366 | .name = "Kumeran Lock Loss Workaround", |
366 | .err = "defaulting to Enabled", | 367 | .err = "defaulting to Enabled", |
@@ -368,7 +369,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
368 | }; | 369 | }; |
369 | 370 | ||
370 | if (num_KumeranLockLoss > bd) { | 371 | if (num_KumeranLockLoss > bd) { |
371 | int kmrn_lock_loss = KumeranLockLoss[bd]; | 372 | unsigned int kmrn_lock_loss = KumeranLockLoss[bd]; |
372 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); | 373 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); |
373 | if (hw->mac.type == e1000_ich8lan) | 374 | if (hw->mac.type == e1000_ich8lan) |
374 | e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, | 375 | e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, |