Commit fdee2ca1 authored by Slawomir Stepien's avatar Slawomir Stepien Committed by Jonathan Cameron

staging: iio: adc: ad7280a: don't cast type inside switch expression

The type promotion will kick in, so the comparison will work.
Signed-off-by: default avatarSlawomir Stepien <sst@poczta.fm>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 2eb4c9f2
...@@ -601,7 +601,7 @@ static ssize_t ad7280_read_channel_config(struct device *dev, ...@@ -601,7 +601,7 @@ static ssize_t ad7280_read_channel_config(struct device *dev,
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
unsigned int val; unsigned int val;
switch ((u32)this_attr->address) { switch (this_attr->address) {
case AD7280A_CELL_OVERVOLTAGE: case AD7280A_CELL_OVERVOLTAGE:
val = 1000 + (st->cell_threshhigh * 1568) / 100; val = 1000 + (st->cell_threshhigh * 1568) / 100;
break; break;
...@@ -637,7 +637,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev, ...@@ -637,7 +637,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev,
if (ret) if (ret)
return ret; return ret;
switch ((u32)this_attr->address) { switch (this_attr->address) {
case AD7280A_CELL_OVERVOLTAGE: case AD7280A_CELL_OVERVOLTAGE:
case AD7280A_CELL_UNDERVOLTAGE: case AD7280A_CELL_UNDERVOLTAGE:
val = ((val - 1000) * 100) / 1568; /* LSB 15.68mV */ val = ((val - 1000) * 100) / 1568; /* LSB 15.68mV */
...@@ -653,7 +653,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev, ...@@ -653,7 +653,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev,
val = clamp(val, 0L, 0xFFL); val = clamp(val, 0L, 0xFFL);
mutex_lock(&st->lock); mutex_lock(&st->lock);
switch ((u32)this_attr->address) { switch (this_attr->address) {
case AD7280A_CELL_OVERVOLTAGE: case AD7280A_CELL_OVERVOLTAGE:
st->cell_threshhigh = val; st->cell_threshhigh = val;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment