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>
This commit is contained in:
Stephen Hemminger 2007-10-29 10:46:05 -07:00 committed by Jeff Garzik
parent 3077d78a74
commit 5a9147bb29
2 changed files with 20 additions and 19 deletions

View file

@ -1680,8 +1680,8 @@ static int e1000_phys_id(struct net_device *netdev, u32 data)
{ {
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) if (!data)
data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); data = INT_MAX;
if (adapter->hw.phy.type == e1000_phy_ife) { if (adapter->hw.phy.type == e1000_phy_ife) {
if (!adapter->blink_timer.function) { if (!adapter->blink_timer.function) {

View file

@ -52,10 +52,11 @@ MODULE_PARM_DESC(copybreak,
*/ */
#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
#define E1000_PARAM(X, desc) \ #define E1000_PARAM(X, desc) \
static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ static int __devinitdata X[E1000_MAX_NIC+1] \
static int num_##X; \ = E1000_PARAM_INIT; \
module_param_array_named(X, X, int, &num_##X, 0); \ static unsigned int num_##X; \
module_param_array_named(X, X, int, &num_##X, 0); \
MODULE_PARM_DESC(X, desc); MODULE_PARM_DESC(X, desc);
@ -124,9 +125,9 @@ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
struct e1000_option { struct e1000_option {
enum { enable_option, range_option, list_option } type; enum { enable_option, range_option, list_option } type;
char *name; const char *name;
char *err; const char *err;
int def; int def;
union { union {
struct { /* range_option info */ struct { /* range_option info */
int min; int min;
@ -139,8 +140,8 @@ struct e1000_option {
} arg; } arg;
}; };
static int __devinit e1000_validate_option(int *value, static int __devinit e1000_validate_option(unsigned int *value,
struct e1000_option *opt, const struct e1000_option *opt,
struct e1000_adapter *adapter) struct e1000_adapter *adapter)
{ {
if (*value == OPTION_UNSET) { if (*value == OPTION_UNSET) {
@ -213,7 +214,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
} }
{ /* Transmit Interrupt Delay */ { /* Transmit Interrupt Delay */
struct e1000_option opt = { const struct e1000_option opt = {
.type = range_option, .type = range_option,
.name = "Transmit Interrupt Delay", .name = "Transmit Interrupt Delay",
.err = "using default of " .err = "using default of "
@ -232,7 +233,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
} }
} }
{ /* Transmit Absolute Interrupt Delay */ { /* Transmit Absolute Interrupt Delay */
struct e1000_option opt = { const struct e1000_option opt = {
.type = range_option, .type = range_option,
.name = "Transmit Absolute Interrupt Delay", .name = "Transmit Absolute Interrupt Delay",
.err = "using default of " .err = "using default of "
@ -277,7 +278,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
} }
} }
{ /* Receive Absolute Interrupt Delay */ { /* Receive Absolute Interrupt Delay */
struct e1000_option opt = { const struct e1000_option opt = {
.type = range_option, .type = range_option,
.name = "Receive Absolute Interrupt Delay", .name = "Receive Absolute Interrupt Delay",
.err = "using default of " .err = "using default of "
@ -296,7 +297,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
} }
} }
{ /* Interrupt Throttling Rate */ { /* Interrupt Throttling Rate */
struct e1000_option opt = { const struct e1000_option opt = {
.type = range_option, .type = range_option,
.name = "Interrupt Throttling Rate (ints/sec)", .name = "Interrupt Throttling Rate (ints/sec)",
.err = "using default of " .err = "using default of "
@ -344,7 +345,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
} }
} }
{ /* Smart Power Down */ { /* Smart Power Down */
struct e1000_option opt = { const struct e1000_option opt = {
.type = enable_option, .type = enable_option,
.name = "PHY Smart Power Down", .name = "PHY Smart Power Down",
.err = "defaulting to Disabled", .err = "defaulting to Disabled",
@ -352,7 +353,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
}; };
if (num_SmartPowerDownEnable > bd) { if (num_SmartPowerDownEnable > bd) {
int spd = SmartPowerDownEnable[bd]; unsigned int spd = SmartPowerDownEnable[bd];
e1000_validate_option(&spd, &opt, adapter); e1000_validate_option(&spd, &opt, adapter);
if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN)
&& spd) && spd)
@ -360,7 +361,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
} }
} }
{ /* Kumeran Lock Loss Workaround */ { /* Kumeran Lock Loss Workaround */
struct e1000_option opt = { const struct e1000_option opt = {
.type = enable_option, .type = enable_option,
.name = "Kumeran Lock Loss Workaround", .name = "Kumeran Lock Loss Workaround",
.err = "defaulting to Enabled", .err = "defaulting to Enabled",
@ -368,7 +369,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
}; };
if (num_KumeranLockLoss > bd) { if (num_KumeranLockLoss > bd) {
int kmrn_lock_loss = KumeranLockLoss[bd]; unsigned int kmrn_lock_loss = KumeranLockLoss[bd];
e1000_validate_option(&kmrn_lock_loss, &opt, adapter); e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
if (hw->mac.type == e1000_ich8lan) if (hw->mac.type == e1000_ich8lan)
e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw,