提交 9257746f 编写于 作者: T Tomas Winkler 提交者: John W. Linville

iwlwifi: use strict_strtoul instead of simple_strtoul

This patch makes use of strict_srtoul in sysfs code.
Signed-off-by: NTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: NZhu Yi <yi.zhu@intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 8f4807a1
......@@ -3619,11 +3619,11 @@ static ssize_t store_debug_level(struct device *d,
const char *buf, size_t count)
{
struct iwl_priv *priv = d->driver_data;
char *p = (char *)buf;
u32 val;
unsigned long val;
int ret;
val = simple_strtoul(p, &p, 0);
if (p == buf)
ret = strict_strtoul(buf, 0, &val);
if (ret)
printk(KERN_INFO DRV_NAME
": %s is not in hex or decimal form.\n", buf);
else
......@@ -3695,11 +3695,11 @@ static ssize_t store_tx_power(struct device *d,
const char *buf, size_t count)
{
struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
char *p = (char *)buf;
u32 val;
unsigned long val;
int ret;
val = simple_strtoul(p, &p, 10);
if (p == buf)
ret = strict_strtoul(buf, 10, &val);
if (ret)
printk(KERN_INFO DRV_NAME
": %s is not in decimal form.\n", buf);
else
......@@ -3723,7 +3723,12 @@ static ssize_t store_flags(struct device *d,
const char *buf, size_t count)
{
struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
u32 flags = simple_strtoul(buf, NULL, 0);
unsigned long val;
u32 flags;
int ret = strict_strtoul(buf, 0, &val);
if (!ret)
return ret;
flags = (u32)val;
mutex_lock(&priv->mutex);
if (le32_to_cpu(priv->staging_rxon.flags) != flags) {
......@@ -3731,8 +3736,7 @@ static ssize_t store_flags(struct device *d,
if (iwl_scan_cancel_timeout(priv, 100))
IWL_WARNING("Could not cancel scan.\n");
else {
IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n",
flags);
IWL_DEBUG_INFO("Commit rxon.flags = 0x%04X\n", flags);
priv->staging_rxon.flags = cpu_to_le32(flags);
iwl4965_commit_rxon(priv);
}
......@@ -3758,7 +3762,12 @@ static ssize_t store_filter_flags(struct device *d,
const char *buf, size_t count)
{
struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
u32 filter_flags = simple_strtoul(buf, NULL, 0);
unsigned long val;
u32 filter_flags;
int ret = strict_strtoul(buf, 0, &val);
if (!ret)
return ret;
filter_flags = (u32)val;
mutex_lock(&priv->mutex);
if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) {
......@@ -3859,10 +3868,12 @@ static ssize_t store_retry_rate(struct device *d,
const char *buf, size_t count)
{
struct iwl_priv *priv = dev_get_drvdata(d);
long val;
int ret = strict_strtol(buf, 10, &val);
if (!ret)
return ret;
priv->retry_rate = simple_strtoul(buf, NULL, 0);
if (priv->retry_rate <= 0)
priv->retry_rate = 1;
priv->retry_rate = (val > 0) ? val : 1;
return count;
}
......@@ -3883,9 +3894,9 @@ static ssize_t store_power_level(struct device *d,
{
struct iwl_priv *priv = dev_get_drvdata(d);
int ret;
int mode;
unsigned long mode;
mode = simple_strtoul(buf, NULL, 0);
mutex_lock(&priv->mutex);
if (!iwl_is_ready(priv)) {
......@@ -3893,6 +3904,10 @@ static ssize_t store_power_level(struct device *d,
goto out;
}
ret = strict_strtoul(buf, 10, &mode);
if (!ret)
goto out;
ret = iwl_power_set_user_mode(priv, mode);
if (ret) {
IWL_DEBUG_MAC80211("failed setting power mode.\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册