Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5e26dd5 authored by Jingoo Han's avatar Jingoo Han Committed by Jonathan Cameron
Browse files

staging: iio: replace strict_strto*() with kstrto*()



The usage of strict_strto*() is not preferred, because
strict_strto*() is obsolete. Thus, kstrto*() should be
used.

Previously, there were only strict_strtol(), strict_strtoul(),
strict_strtoull(), and strict_strtoll(). Thus, when converting
to the variables, only long, unsigned long, unsigned long long,
and long long can be used.

However, kstrto*() provides various functions handling all types
of variables. Therefore, the types of variables can be changed
properly.

Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 07914c84
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -624,9 +624,9 @@ static ssize_t sca3000_set_frequency(struct device *dev,
	struct sca3000_state *st = iio_priv(indio_dev);
	int ret, base_freq = 0;
	int ctrlval;
	long val;
	int val;

	ret = strict_strtol(buf, 10, &val);
	ret = kstrtoint(buf, 10, &val);
	if (ret)
		return ret;

@@ -931,12 +931,12 @@ static ssize_t sca3000_set_free_fall_mode(struct device *dev,
{
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct sca3000_state *st = iio_priv(indio_dev);
	long val;
	u8 val;
	int ret;
	u8 protect_mask = SCA3000_FREE_FALL_DETECT;

	mutex_lock(&st->lock);
	ret = strict_strtol(buf, 10, &val);
	ret = kstrtou8(buf, 10, &val);
	if (ret)
		goto error_ret;

+2 −2
Original line number Diff line number Diff line
@@ -177,11 +177,11 @@ static ssize_t sca3000_set_ring_int(struct device *dev,
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct sca3000_state *st = iio_priv(indio_dev);
	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
	long val;
	u8 val;
	int ret;

	mutex_lock(&st->lock);
	ret = strict_strtol(buf, 10, &val);
	ret = kstrtou8(buf, 10, &val);
	if (ret)
		goto error_ret;
	ret = sca3000_read_data_short(st, SCA3000_REG_ADDR_INT_MASK, 1);
+19 −19
Original line number Diff line number Diff line
@@ -412,13 +412,13 @@ static ssize_t adt7316_store_ad_channel(struct device *dev,
	struct iio_dev *dev_info = dev_to_iio_dev(dev);
	struct adt7316_chip_info *chip = iio_priv(dev_info);
	u8 config2;
	unsigned long data = 0;
	u8 data;
	int ret;

	if (!(chip->config2 & ADT7316_AD_SINGLE_CH_MODE))
		return -EPERM;

	ret = strict_strtoul(buf, 10, &data);
	ret = kstrtou8(buf, 10, &data);
	if (ret)
		return -EINVAL;

@@ -823,10 +823,10 @@ static ssize_t adt7316_store_DAC_2Vref_ch_mask(struct device *dev,
	struct iio_dev *dev_info = dev_to_iio_dev(dev);
	struct adt7316_chip_info *chip = iio_priv(dev_info);
	u8 dac_config;
	unsigned long data = 0;
	u8 data;
	int ret;

	ret = strict_strtoul(buf, 16, &data);
	ret = kstrtou8(buf, 16, &data);
	if (ret || data > ADT7316_DA_2VREF_CH_MASK)
		return -EINVAL;

@@ -878,13 +878,13 @@ static ssize_t adt7316_store_DAC_update_mode(struct device *dev,
	struct iio_dev *dev_info = dev_to_iio_dev(dev);
	struct adt7316_chip_info *chip = iio_priv(dev_info);
	u8 dac_config;
	unsigned long data;
	u8 data;
	int ret;

	if (!(chip->config3 & ADT7316_DA_EN_VIA_DAC_LDCA))
		return -EPERM;

	ret = strict_strtoul(buf, 10, &data);
	ret = kstrtou8(buf, 10, &data);
	if (ret || data > ADT7316_DA_EN_MODE_MASK)
		return -EINVAL;

@@ -933,7 +933,7 @@ static ssize_t adt7316_store_update_DAC(struct device *dev,
	struct iio_dev *dev_info = dev_to_iio_dev(dev);
	struct adt7316_chip_info *chip = iio_priv(dev_info);
	u8 ldac_config;
	unsigned long data;
	u8 data;
	int ret;

	if (chip->config3 & ADT7316_DA_EN_VIA_DAC_LDCA) {
@@ -941,7 +941,7 @@ static ssize_t adt7316_store_update_DAC(struct device *dev,
			ADT7316_DA_EN_MODE_LDAC)
			return -EPERM;

		ret = strict_strtoul(buf, 16, &data);
		ret = kstrtou8(buf, 16, &data);
		if (ret || data > ADT7316_LDAC_EN_DA_MASK)
			return -EINVAL;

@@ -1079,11 +1079,11 @@ static ssize_t adt7316_store_DAC_internal_Vref(struct device *dev,
	struct iio_dev *dev_info = dev_to_iio_dev(dev);
	struct adt7316_chip_info *chip = iio_priv(dev_info);
	u8 ldac_config;
	unsigned long data;
	u8 data;
	int ret;

	if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX) {
		ret = strict_strtoul(buf, 16, &data);
		ret = kstrtou8(buf, 16, &data);
		if (ret || data > 3)
			return -EINVAL;

@@ -1093,7 +1093,7 @@ static ssize_t adt7316_store_DAC_internal_Vref(struct device *dev,
		else if (data & 0x2)
			ldac_config |= ADT7516_DAC_CD_IN_VREF;
	} else {
		ret = strict_strtoul(buf, 16, &data);
		ret = kstrtou8(buf, 16, &data);
		if (ret)
			return -EINVAL;

@@ -1281,11 +1281,11 @@ static ssize_t adt7316_show_temp_offset(struct adt7316_chip_info *chip,
static ssize_t adt7316_store_temp_offset(struct adt7316_chip_info *chip,
		int offset_addr, const char *buf, size_t len)
{
	long data;
	int data;
	u8 val;
	int ret;

	ret = strict_strtol(buf, 10, &data);
	ret = kstrtoint(buf, 10, &data);
	if (ret || data > 127 || data < -128)
		return -EINVAL;

@@ -1442,7 +1442,7 @@ static ssize_t adt7316_store_DAC(struct adt7316_chip_info *chip,
		int channel, const char *buf, size_t len)
{
	u8 msb, lsb, offset;
	unsigned long data;
	u16 data;
	int ret;

	if (channel >= ADT7316_DA_MSB_DATA_REGS ||
@@ -1454,7 +1454,7 @@ static ssize_t adt7316_store_DAC(struct adt7316_chip_info *chip,

	offset = chip->dac_bits - 8;

	ret = strict_strtoul(buf, 10, &data);
	ret = kstrtou16(buf, 10, &data);
	if (ret || data >= (1 << chip->dac_bits))
		return -EINVAL;

@@ -1830,11 +1830,11 @@ static ssize_t adt7316_set_int_mask(struct device *dev,
{
	struct iio_dev *dev_info = dev_to_iio_dev(dev);
	struct adt7316_chip_info *chip = iio_priv(dev_info);
	unsigned long data;
	u16 data;
	int ret;
	u8 mask;

	ret = strict_strtoul(buf, 16, &data);
	ret = kstrtou16(buf, 16, &data);
	if (ret || data >= ADT7316_VDD_INT_MASK + 1)
		return -EINVAL;

@@ -1901,7 +1901,7 @@ static inline ssize_t adt7316_set_ad_bound(struct device *dev,
	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
	struct iio_dev *dev_info = dev_to_iio_dev(dev);
	struct adt7316_chip_info *chip = iio_priv(dev_info);
	long data;
	int data;
	u8 val;
	int ret;

@@ -1909,7 +1909,7 @@ static inline ssize_t adt7316_set_ad_bound(struct device *dev,
		this_attr->address > ADT7316_EX_TEMP_LOW)
		return -EPERM;

	ret = strict_strtol(buf, 10, &data);
	ret = kstrtoint(buf, 10, &data);
	if (ret)
		return -EINVAL;

+2 −2
Original line number Diff line number Diff line
@@ -81,9 +81,9 @@ static ssize_t ad9832_write(struct device *dev,
	struct ad9832_state *st = iio_priv(indio_dev);
	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
	int ret;
	long val;
	unsigned long val;

	ret = strict_strtoul(buf, 10, &val);
	ret = kstrtoul(buf, 10, &val);
	if (ret)
		goto error_ret;

+2 −2
Original line number Diff line number Diff line
@@ -70,9 +70,9 @@ static ssize_t ad9834_write(struct device *dev,
	struct ad9834_state *st = iio_priv(indio_dev);
	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
	int ret;
	long val;
	unsigned long val;

	ret = strict_strtoul(buf, 10, &val);
	ret = kstrtoul(buf, 10, &val);
	if (ret)
		goto error_ret;

Loading