Skip to contentSkip to conversation

scsi: replace strict_strtoul() with kstrtoul()

PATCH Superseded Jingoo Han 2 participants 2 messages Jun 3, 2013

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH v2 1/1 scsi: replace strict_strtoul() with kstrtoul()

The usage of strict_strtoul() is not preferred, because strict_strtoul() is obsolete. Thus, kstrtoul() should be used.

---
Changes since v1:
- Used return code from kstrtoul().

 drivers/scsi/pmcraid.c    |    6 ++++--
 drivers/scsi/scsi_sysfs.c |    6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/scsi/pmcraid.c +4 -2
index 8e1b737..39b42a4 100644
@@ -4203,9 +4203,11 @@ static ssize_t pmcraid_store_log_level(
 	struct Scsi_Host *shost;
 	struct pmcraid_instance *pinstance;
 	unsigned long val;
+	int ret;
 
-	if (strict_strtoul(buf, 10, &val))
-		return -EINVAL;
+	ret = kstrtoul(buf, 10, &val);
+	if (ret)
+		return ret;
 	/* log-level should be from 0 to 2 */
 	if (val > 2)
 		return -EINVAL;
drivers/scsi/scsi_sysfs.c +4 -2
index 931a7d9..4a8b675 100644
@@ -789,9 +789,11 @@ sdev_store_queue_ramp_up_period(struct device *dev,
 {
 	struct scsi_device *sdev = to_scsi_device(dev);
 	unsigned long period;
+	int ret;
 
-	if (strict_strtoul(buf, 10, &period))
-		return -EINVAL;
+	ret = kstrtoul(buf, 10, &period);
+	if (ret)
+		return ret;
 
 	sdev->queue_ramp_up_period = msecs_to_jiffies(period);
 	return period;
Signature · 1 line
1.7.10.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Jingoo Han

The usage of strict_strtoul() is not preferred, because strict_strtoul() is obsolete. Thus, kstrtoul() should be used.

Quoted 45 lines

---
Changes since v1:
- Used return code from kstrtoul().

 drivers/scsi/pmcraid.c    |    6 ++++--
 drivers/scsi/scsi_sysfs.c |    6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/scsi/pmcraid.c +4 -2
index 8e1b737..39b42a4 100644
@@ -4203,9 +4203,11 @@ static ssize_t pmcraid_store_log_level(
        struct Scsi_Host *shost;
        struct pmcraid_instance *pinstance;
        unsigned long val;
+       int ret;
 
-       if (strict_strtoul(buf, 10, &val))
-               return -EINVAL;
+       ret = kstrtoul(buf, 10, &val);
+       if (ret)
+               return ret;
        /* log-level should be from 0 to 2 */
        if (val > 2)
                return -EINVAL;
drivers/scsi/scsi_sysfs.c +4 -3
index 931a7d9..4a8b675 100644
@@ -789,9 +789,11 @@ sdev_store_queue_ramp_up_period(struct device *dev,
 {
        struct scsi_device *sdev = to_scsi_device(dev);
        unsigned long period;
+       int ret;
 
-       if (strict_strtoul(buf, 10, &period))
-               return -EINVAL;
+       ret = kstrtoul(buf, 10, &period);
+       if (ret)
+               return ret;
 
        sdev->queue_ramp_up_period = msecs_to_jiffies(period);
        return period;
--
Quoted 3 lines

1.7.10.4

--
With Best Regards,
Andy Shevchenko