mfd: Replace strict_strtoul() with kstrtoul() in ab* and att*
authorJingoo Han <jg1.han@samsung.com>
Tue, 4 Jun 2013 04:11:50 +0000 (13:11 +0900)
committerLee Jones <lee.jones@linaro.org>
Thu, 13 Jun 2013 09:51:56 +0000 (10:51 +0100)
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/aat2870-core.c
drivers/mfd/ab3100-core.c
drivers/mfd/ab8500-debugfs.c

index dfdb0a2b68351af46aef5728e7ccf30ff4f10e5e..d4f594517521b30e5bc3344208b21d03801ef14d 100644 (file)
@@ -312,8 +312,9 @@ static ssize_t aat2870_reg_write_file(struct file *file,
        while (*start == ' ')
                start++;
 
-       if (strict_strtoul(start, 16, &val))
-               return -EINVAL;
+       ret = kstrtoul(start, 16, &val);
+       if (ret)
+               return ret;
 
        ret = aat2870->write(aat2870, (u8)addr, (u8)val);
        if (ret)
index a9bb140bc86bac088d349af77f5480ebf8a0b7a5..ddc669d19530ee7a171547b78983adab6b4b7e0d 100644 (file)
@@ -491,7 +491,7 @@ static ssize_t ab3100_get_set_reg(struct file *file,
        char buf[32];
        ssize_t buf_size;
        int regp;
-       unsigned long user_reg;
+       u8 user_reg;
        int err;
        int i = 0;
 
@@ -514,34 +514,29 @@ static ssize_t ab3100_get_set_reg(struct file *file,
        /*
         * Advance pointer to end of string then terminate
         * the register string. This is needed to satisfy
-        * the strict_strtoul() function.
+        * the kstrtou8() function.
         */
        while ((i < buf_size) && (buf[i] != ' '))
                i++;
        buf[i] = '\0';
 
-       err = strict_strtoul(&buf[regp], 16, &user_reg);
+       err = kstrtou8(&buf[regp], 16, &user_reg);
        if (err)
                return err;
-       if (user_reg > 0xff)
-               return -EINVAL;
 
        /* Either we read or we write a register here */
        if (!priv->mode) {
                /* Reading */
-               u8 reg = (u8) user_reg;
                u8 regvalue;
 
-               ab3100_get_register_interruptible(ab3100, reg, &regvalue);
+               ab3100_get_register_interruptible(ab3100, user_reg, &regvalue);
 
                dev_info(ab3100->dev,
                         "debug read AB3100 reg[0x%02x]: 0x%02x\n",
-                        reg, regvalue);
+                        user_reg, regvalue);
        } else {
                int valp;
-               unsigned long user_value;
-               u8 reg = (u8) user_reg;
-               u8 value;
+               u8 user_value;
                u8 regvalue;
 
                /*
@@ -557,20 +552,17 @@ static ssize_t ab3100_get_set_reg(struct file *file,
                        i++;
                buf[i] = '\0';
 
-               err = strict_strtoul(&buf[valp], 16, &user_value);
+               err = kstrtou8(&buf[valp], 16, &user_value);
                if (err)
                        return err;
-               if (user_reg > 0xff)
-                       return -EINVAL;
 
-               value = (u8) user_value;
-               ab3100_set_register_interruptible(ab3100, reg, value);
-               ab3100_get_register_interruptible(ab3100, reg, &regvalue);
+               ab3100_set_register_interruptible(ab3100, user_reg, user_value);
+               ab3100_get_register_interruptible(ab3100, user_reg, &regvalue);
 
                dev_info(ab3100->dev,
                         "debug write reg[0x%02x] with 0x%02x, "
                         "after readback: 0x%02x\n",
-                        reg, value, regvalue);
+                        user_reg, user_value, regvalue);
        }
        return buf_size;
 }
index 37b7ce4c7c3be57b4c8ea30474ec1edee47f8ad5..11656c2c63cb41b640ebfb8a3e5e7af3efe8eea1 100644 (file)
@@ -2757,7 +2757,7 @@ static ssize_t show_irq(struct device *dev,
        unsigned int irq_index;
        int err;
 
-       err = strict_strtoul(attr->attr.name, 0, &name);
+       err = kstrtoul(attr->attr.name, 0, &name);
        if (err)
                return err;