diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-09-02 23:26:32 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-08 14:23:17 -0400 |
commit | 9257746f260fadf864df90bb9b439bf457e14266 (patch) | |
tree | d976f855bb65fea316568cda56cdc401299ed93a /drivers/net/wireless/iwlwifi/iwl-agn.c | |
parent | 8f4807a122d3ef680ae85c71f0b49ba8ec6d904a (diff) |
iwlwifi: use strict_strtoul instead of simple_strtoul
This patch makes use of strict_srtoul in sysfs code.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index df5763c77af6..b9798fa519ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -3619,11 +3619,11 @@ static ssize_t store_debug_level(struct device *d, | |||
3619 | const char *buf, size_t count) | 3619 | const char *buf, size_t count) |
3620 | { | 3620 | { |
3621 | struct iwl_priv *priv = d->driver_data; | 3621 | struct iwl_priv *priv = d->driver_data; |
3622 | char *p = (char *)buf; | 3622 | unsigned long val; |
3623 | u32 val; | 3623 | int ret; |
3624 | 3624 | ||
3625 | val = simple_strtoul(p, &p, 0); | 3625 | ret = strict_strtoul(buf, 0, &val); |
3626 | if (p == buf) | 3626 | if (ret) |
3627 | printk(KERN_INFO DRV_NAME | 3627 | printk(KERN_INFO DRV_NAME |
3628 | ": %s is not in hex or decimal form.\n", buf); | 3628 | ": %s is not in hex or decimal form.\n", buf); |
3629 | else | 3629 | else |
@@ -3695,11 +3695,11 @@ static ssize_t store_tx_power(struct device *d, | |||
3695 | const char *buf, size_t count) | 3695 | const char *buf, size_t count) |
3696 | { | 3696 | { |
3697 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; | 3697 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
3698 | char *p = (char *)buf; | 3698 | unsigned long val; |
3699 | u32 val; | 3699 | int ret; |
3700 | 3700 | ||
3701 | val = simple_strtoul(p, &p, 10); | 3701 | ret = strict_strtoul(buf, 10, &val); |
3702 | if (p == buf) | 3702 | if (ret) |
3703 | printk(KERN_INFO DRV_NAME | 3703 | printk(KERN_INFO DRV_NAME |
3704 | ": %s is not in decimal form.\n", buf); | 3704 | ": %s is not in decimal form.\n", buf); |
3705 | else | 3705 | else |
@@ -3723,7 +3723,12 @@ static ssize_t store_flags(struct device *d, | |||
3723 | const char *buf, size_t count) | 3723 | const char *buf, size_t count) |
3724 | { | 3724 | { |
3725 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; | 3725 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
3726 | u32 flags = simple_strtoul(buf, NULL, 0); | 3726 | unsigned long val; |
3727 | u32 flags; | ||
3728 | int ret = strict_strtoul(buf, 0, &val); | ||
3729 | if (!ret) | ||
3730 | return ret; | ||
3731 | flags = (u32)val; | ||
3727 | 3732 | ||
3728 | mutex_lock(&priv->mutex); | 3733 | mutex_lock(&priv->mutex); |
3729 | if (le32_to_cpu(priv->staging_rxon.flags) != flags) { | 3734 | if (le32_to_cpu(priv->staging_rxon.flags) != flags) { |
@@ -3731,8 +3736,7 @@ static ssize_t store_flags(struct device *d, | |||
3731 | if (iwl_scan_cancel_timeout(priv, 100)) | 3736 | if (iwl_scan_cancel_timeout(priv, 100)) |
3732 | IWL_WARNING("Could not cancel scan.\n"); | 3737 | IWL_WARNING("Could not cancel scan.\n"); |
3733 | else { | 3738 | else { |
3734 | IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", | 3739 | IWL_DEBUG_INFO("Commit rxon.flags = 0x%04X\n", flags); |
3735 | flags); | ||
3736 | priv->staging_rxon.flags = cpu_to_le32(flags); | 3740 | priv->staging_rxon.flags = cpu_to_le32(flags); |
3737 | iwl4965_commit_rxon(priv); | 3741 | iwl4965_commit_rxon(priv); |
3738 | } | 3742 | } |
@@ -3758,7 +3762,12 @@ static ssize_t store_filter_flags(struct device *d, | |||
3758 | const char *buf, size_t count) | 3762 | const char *buf, size_t count) |
3759 | { | 3763 | { |
3760 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; | 3764 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
3761 | u32 filter_flags = simple_strtoul(buf, NULL, 0); | 3765 | unsigned long val; |
3766 | u32 filter_flags; | ||
3767 | int ret = strict_strtoul(buf, 0, &val); | ||
3768 | if (!ret) | ||
3769 | return ret; | ||
3770 | filter_flags = (u32)val; | ||
3762 | 3771 | ||
3763 | mutex_lock(&priv->mutex); | 3772 | mutex_lock(&priv->mutex); |
3764 | if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { | 3773 | if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { |
@@ -3859,10 +3868,12 @@ static ssize_t store_retry_rate(struct device *d, | |||
3859 | const char *buf, size_t count) | 3868 | const char *buf, size_t count) |
3860 | { | 3869 | { |
3861 | struct iwl_priv *priv = dev_get_drvdata(d); | 3870 | struct iwl_priv *priv = dev_get_drvdata(d); |
3871 | long val; | ||
3872 | int ret = strict_strtol(buf, 10, &val); | ||
3873 | if (!ret) | ||
3874 | return ret; | ||
3862 | 3875 | ||
3863 | priv->retry_rate = simple_strtoul(buf, NULL, 0); | 3876 | priv->retry_rate = (val > 0) ? val : 1; |
3864 | if (priv->retry_rate <= 0) | ||
3865 | priv->retry_rate = 1; | ||
3866 | 3877 | ||
3867 | return count; | 3878 | return count; |
3868 | } | 3879 | } |
@@ -3883,9 +3894,9 @@ static ssize_t store_power_level(struct device *d, | |||
3883 | { | 3894 | { |
3884 | struct iwl_priv *priv = dev_get_drvdata(d); | 3895 | struct iwl_priv *priv = dev_get_drvdata(d); |
3885 | int ret; | 3896 | int ret; |
3886 | int mode; | 3897 | unsigned long mode; |
3898 | |||
3887 | 3899 | ||
3888 | mode = simple_strtoul(buf, NULL, 0); | ||
3889 | mutex_lock(&priv->mutex); | 3900 | mutex_lock(&priv->mutex); |
3890 | 3901 | ||
3891 | if (!iwl_is_ready(priv)) { | 3902 | if (!iwl_is_ready(priv)) { |
@@ -3893,6 +3904,10 @@ static ssize_t store_power_level(struct device *d, | |||
3893 | goto out; | 3904 | goto out; |
3894 | } | 3905 | } |
3895 | 3906 | ||
3907 | ret = strict_strtoul(buf, 10, &mode); | ||
3908 | if (!ret) | ||
3909 | goto out; | ||
3910 | |||
3896 | ret = iwl_power_set_user_mode(priv, mode); | 3911 | ret = iwl_power_set_user_mode(priv, mode); |
3897 | if (ret) { | 3912 | if (ret) { |
3898 | IWL_DEBUG_MAC80211("failed setting power mode.\n"); | 3913 | IWL_DEBUG_MAC80211("failed setting power mode.\n"); |