Skip to contentSkip to conversation

iio: as3935: Remove unnecessary cast

PATCH In review Lars-Peter Clausen 2 participants 5 messages Dec 9, 2021 – Dec 16, 2021 2 messages not in the archive IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 iio: as3935: Remove unnecessary cast

buf is cast to a const char *, but buf is already a const char *, so the case is unnecessary.

---
 drivers/iio/proximity/as3935.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/proximity/as3935.c +1 -1
index d62766b6b39e..51f4f92ae84a 100644
@@ -133,7 +133,7 @@ static ssize_t as3935_sensor_sensitivity_store(struct device *dev,
 	unsigned long val;
 	int ret;
 
-	ret = kstrtoul((const char *) buf, 10, &val);
+	ret = kstrtoul(buf, 10, &val);
 	if (ret)
 		return -EINVAL;
 
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/3 iio: in2xx-adc: Remove unnecessary cast

buf is cast to a const char *, but buf is already a const char *, so the case is unnecessary.

---
 drivers/iio/adc/ina2xx-adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ina2xx-adc.c +1 -1
index 352f27657238..08f243f5b92b 100644
@@ -550,7 +550,7 @@ static ssize_t ina2xx_allow_async_readout_store(struct device *dev,
 	bool val;
 	int ret;
 
-	ret = strtobool((const char *) buf, &val);
+	ret = strtobool(buf, &val);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.30.2

A message that is not in the archive (sent off-list or not yet received): CAHp75Vd+NoRzbJAKX7kZ_JBF0fC6xZc2rkLezbuTozSsAp8X8A@mail.gmail.com

#3 lore raw

Re: [PATCH 2/3] iio: in2xx-adc: Remove unnecessary cast

Quoted 19 lines · Andy Shevchenko
Quoted 17 lines · Lars-Peter Clausen

buf is cast to a const char *, but buf is already a const char *, so the case is unnecessary.

---
  drivers/iio/adc/ina2xx-adc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ina2xx-adc.c +0 -0
index 352f27657238..08f243f5b92b 100644
@@ -550,7 +550,7 @@ static ssize_t ina2xx_allow_async_readout_store(struct
 device *dev,
         bool val;
         int ret;
 
Quoted 5 lines

drivers/iio/adc/ina2xx-adc.c static ssize_t ina2xx_allow_async_readout_store(struct device *dev, · line 553

Quoted 2 lines
drivers/iio/adc/ina2xx-adc.c +1 -1
-       ret = strtobool((const char *) buf, &val);
+       ret = strtobool(buf, &val);

While at it, please switch to kstrtobool().

This seems unrelated to this patch. And while worthwhile doing it should be in its own series.

#4 lore raw

PATCH 3/3 iio: vz89x: Remove unnecessary cast

In reply to Lars-Peter Clausen

The case to u8 * is unnecessary here since the expression is already of type u8 *.

---
 drivers/iio/chemical/vz89x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/chemical/vz89x.c +1 -1
index 23b22a5f5c1c..e7e1c74a351e 100644
@@ -242,7 +242,7 @@ static int vz89x_get_resistance_reading(struct vz89x_data *data,
 					struct iio_chan_spec const *chan,
 					int *val)
 {
-	u8 *tmp = (u8 *) &data->buffer[chan->address];
+	u8 *tmp = &data->buffer[chan->address];
 
 	switch (chan->scan_type.endianness) {
 	case IIO_LE:
Signature · 1 line
2.30.2

A message that is not in the archive (sent off-list or not yet received): CAHp75VdDB92KGALRhBoepmBZQiXqUK7n4AmpM4mbSxKDku0f8Q@mail.gmail.com

#6 lore raw
Quoted 20 lines · On Fri, 10 Dec 2021 00:13:49 +0200 Andy Shevchenko <[email protected]>…
Quoted 18 lines · Lars-Peter Clausen

buf is cast to a const char *, but buf is already a const char *, so the case is unnecessary.

---
 drivers/iio/proximity/as3935.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/proximity/ renamed from drivers/iio/proximity/as3935.c +0 -0

as3935.c
index d62766b6b39e..51f4f92ae84a 100644

drivers/iio/proximity/as3935.c +0 -0
@@ -133,7 +133,7 @@ static ssize_t as3935_sensor_sensitivity_store(struct
 device *dev,
        unsigned long val;
        int ret;
 
Quoted 9 lines

drivers/iio/proximity/as3935.c static ssize_t as3935_sensor_sensitivity_store(struct device *dev, · line 138

Quoted 4 lines
drivers/iio/proximity/as3935.c +1 -1
-       ret = kstrtoul((const char *) buf, 10, &val);
+       ret = kstrtoul(buf, 10, &val);
        if (ret)
                return -EINVAL;  

A bit out of scope, but this eventually should be

Agreed this could do with a follow up, as should the other one you point out, but in the spirit of single purpose series I've applied this set to the togreg branch of iio.git - pushed out as testing and look forward to the follow ups ;)

Jonathan

Quoted 10 lines

return ret;

Quoted 5 lines

--
2.30.2