[PATCH] s390: replace strict_strto*() with kstrto*()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Jingoo Han <jg1.han@xxxxxxxxxxx>
---
 drivers/s390/block/dasd_devmap.c |   32 ++++++++++++++++++++++++--------
 drivers/s390/cio/ccwgroup.c      |    2 +-
 drivers/s390/cio/cmf.c           |    2 +-
 drivers/s390/cio/css.c           |    2 +-
 drivers/s390/cio/device.c        |    2 +-
 drivers/s390/net/qeth_l3_sys.c   |    7 +++----
 drivers/s390/scsi/zfcp_aux.c     |    4 ++--
 drivers/s390/scsi/zfcp_sysfs.c   |   31 +++++++++++++++++++++++--------
 8 files changed, 56 insertions(+), 26 deletions(-)

diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index 58bc6eb..ef5943e 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -925,12 +925,16 @@ dasd_use_raw_store(struct device *dev, struct device_attribute *attr,
 	struct dasd_devmap *devmap;
 	ssize_t rc;
 	unsigned long val;
+	int err;
 
 	devmap = dasd_devmap_from_cdev(to_ccwdev(dev));
 	if (IS_ERR(devmap))
 		return PTR_ERR(devmap);
 
-	if ((strict_strtoul(buf, 10, &val) != 0) || val > 1)
+	err = kstrtoul(buf, 10, &val);
+	if (err)
+		return err;
+	if (val > 1)
 		return -EINVAL;
 
 	spin_lock(&dasd_devmap_lock);
@@ -1220,13 +1224,15 @@ dasd_expires_store(struct device *dev, struct device_attribute *attr,
 {
 	struct dasd_device *device;
 	unsigned long val;
+	int err;
 
 	device = dasd_device_from_cdev(to_ccwdev(dev));
 	if (IS_ERR(device))
 		return -ENODEV;
-
-	if ((strict_strtoul(buf, 10, &val) != 0) ||
-	    (val > DASD_EXPIRES_MAX) || val == 0) {
+	err = kstrtoul(buf, 10, &val);
+	if (err)
+		return err;
+	if ((val > DASD_EXPIRES_MAX) || val == 0)
 		dasd_put_device(device);
 		return -EINVAL;
 	}
@@ -1260,13 +1266,19 @@ dasd_retries_store(struct device *dev, struct device_attribute *attr,
 {
 	struct dasd_device *device;
 	unsigned long val;
+	int err;
 
 	device = dasd_device_from_cdev(to_ccwdev(dev));
 	if (IS_ERR(device))
 		return -ENODEV;
 
-	if ((strict_strtoul(buf, 10, &val) != 0) ||
-	    (val > DASD_RETRIES_MAX)) {
+	err = kstrtoul(buf, 10, &val);
+	if (err) {
+		dasd_put_device(device);
+		return err;
+	}
+
+	if (val > DASD_RETRIES_MAX) {
 		dasd_put_device(device);
 		return -EINVAL;
 	}
@@ -1302,13 +1314,17 @@ dasd_timeout_store(struct device *dev, struct device_attribute *attr,
 	struct dasd_device *device;
 	struct request_queue *q;
 	unsigned long val, flags;
+	int err;
 
 	device = dasd_device_from_cdev(to_ccwdev(dev));
 	if (IS_ERR(device) || !device->block)
 		return -ENODEV;
 
-	if ((strict_strtoul(buf, 10, &val) != 0) ||
-	    val > UINT_MAX / HZ) {
+	err = kstrtoul(buf, 10, &val);
+	if (err)
+		return err;
+
+	if (val > UINT_MAX / HZ) {
 		dasd_put_device(device);
 		return -EINVAL;
 	}
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 84846c2..959135a 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -137,7 +137,7 @@ static ssize_t ccwgroup_online_store(struct device *dev,
 	if (!try_module_get(gdrv->driver.owner))
 		return -EINVAL;
 
-	ret = strict_strtoul(buf, 0, &value);
+	ret = kstrtoul(buf, 0, &value);
 	if (ret)
 		goto out;
 
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 4495e06..23054f8 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -1182,7 +1182,7 @@ static ssize_t cmb_enable_store(struct device *dev,
 	int ret;
 	unsigned long val;
 
-	ret = strict_strtoul(buf, 16, &val);
+	ret = kstrtoul(buf, 16, &val);
 	if (ret)
 		return ret;
 
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 1ebe5d3..4eb2a54 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -740,7 +740,7 @@ css_cm_enable_store(struct device *dev, struct device_attribute *attr,
 	int ret;
 	unsigned long val;
 
-	ret = strict_strtoul(buf, 16, &val);
+	ret = kstrtoul(buf, 16, &val);
 	if (ret)
 		return ret;
 	mutex_lock(&css->mutex);
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 1ab5f6c..e4a7ab2 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -564,7 +564,7 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr,
 		ret = 0;
 	} else {
 		force = 0;
-		ret = strict_strtoul(buf, 16, &i);
+		ret = kstrtoul(buf, 16, &i);
 	}
 	if (ret)
 		goto out;
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index d1c8025..471a8de 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -208,11 +208,10 @@ static ssize_t qeth_l3_dev_sniffer_store(struct device *dev,
 		goto out;
 	}
 
-	rc = strict_strtoul(buf, 16, &i);
-	if (rc) {
-		rc = -EINVAL;
+	rc = kstrtoul(buf, 16, &i);
+	if (rc)
 		goto out;
-	}
+
 	switch (i) {
 	case 0:
 		card->options.sniffer = i;
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 1b9e4ae..8004b07 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -104,11 +104,11 @@ static void __init zfcp_init_device_setup(char *devstr)
 	strncpy(busid, token, ZFCP_BUS_ID_SIZE);
 
 	token = strsep(&str, ",");
-	if (!token || strict_strtoull(token, 0, (unsigned long long *) &wwpn))
+	if (!token || kstrtoull(token, 0, (unsigned long long *) &wwpn))
 		goto err_out;
 
 	token = strsep(&str, ",");
-	if (!token || strict_strtoull(token, 0, (unsigned long long *) &lun))
+	if (!token || kstrtoull(token, 0, (unsigned long long *) &lun))
 		goto err_out;
 
 	kfree(str_saved);
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 3f01bbf..3724d19 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -94,8 +94,12 @@ static ssize_t zfcp_sysfs_port_failed_store(struct device *dev,
 {
 	struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
 	unsigned long val;
+	int retval;
 
-	if (strict_strtoul(buf, 0, &val) || val != 0)
+	retval = kstrtoul(buf, 0, &val);
+	if (retval)
+		return retval;
+	if (val != 0)
 		return -EINVAL;
 
 	zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_RUNNING);
@@ -133,8 +137,12 @@ static ssize_t zfcp_sysfs_unit_failed_store(struct device *dev,
 	struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev);
 	unsigned long val;
 	struct scsi_device *sdev;
+	int retval;
 
-	if (strict_strtoul(buf, 0, &val) || val != 0)
+	retval = kstrtoul(buf, 0, &val);
+	if (retval)
+		return retval;
+	if (val != 0)
 		return -EINVAL;
 
 	sdev = zfcp_unit_sdev(unit);
@@ -184,7 +192,10 @@ static ssize_t zfcp_sysfs_adapter_failed_store(struct device *dev,
 	if (!adapter)
 		return -ENODEV;
 
-	if (strict_strtoul(buf, 0, &val) || val != 0) {
+	retval = kstrtoul(buf, 0, &val);
+	if (retval)
+		goto out;
+	if (val != 0) {
 		retval = -EINVAL;
 		goto out;
 	}
@@ -236,7 +247,8 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
 	if (!adapter)
 		return -ENODEV;
 
-	if (strict_strtoull(buf, 0, (unsigned long long *) &wwpn))
+	retval = kstrtoull(buf, 0, (unsigned long long *) &wwpn);
+	if (retval)
 		goto out;
 
 	port = zfcp_get_port_by_wwpn(adapter, wwpn);
@@ -297,8 +309,9 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
 	u64 fcp_lun;
 	int retval;
 
-	if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
-		return -EINVAL;
+	retval = kstrtoull(buf, 0, (unsigned long long *) &fcp_lun);
+	if (retval)
+		return retval;
 
 	retval = zfcp_unit_add(port, fcp_lun);
 	if (retval)
@@ -314,9 +327,11 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
 {
 	struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
 	u64 fcp_lun;
+	int retval;
 
-	if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
-		return -EINVAL;
+	retval = kstrtoull(buf, 0, (unsigned long long *) &fcp_lun);
+	if (retval)
+		return retval;
 
 	if (zfcp_unit_remove(port, fcp_lun))
 		return -EINVAL;
-- 
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux