diff mbox series

[1/1] staging: iio: adc: ad7280a: don't cast type inside switch expression

Message ID 20181026165310.16545-1-sst@poczta.fm (mailing list archive)
State New, archived
Headers show
Series [1/1] staging: iio: adc: ad7280a: don't cast type inside switch expression | expand

Commit Message

Slawomir Stepien Oct. 26, 2018, 4:53 p.m. UTC
The type promotion will kick in, so the comparison will work.

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
---
 drivers/staging/iio/adc/ad7280a.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jonathan Cameron Oct. 28, 2018, 6:59 p.m. UTC | #1
On Fri, 26 Oct 2018 18:53:10 +0200
Slawomir Stepien <sst@poczta.fm> wrote:

> The type promotion will kick in, so the comparison will work.
> 
> Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Looks good to me.  Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/adc/ad7280a.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> index b736275c10f5..7de6be4f0c27 100644
> --- a/drivers/staging/iio/adc/ad7280a.c
> +++ b/drivers/staging/iio/adc/ad7280a.c
> @@ -610,7 +610,7 @@ static ssize_t ad7280_read_channel_config(struct device *dev,
>  	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
>  	unsigned int val;
>  
> -	switch ((u32)this_attr->address) {
> +	switch (this_attr->address) {
>  	case AD7280A_CELL_OVERVOLTAGE:
>  		val = 1000 + (st->cell_threshhigh * 1568) / 100;
>  		break;
> @@ -646,7 +646,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev,
>  	if (ret)
>  		return ret;
>  
> -	switch ((u32)this_attr->address) {
> +	switch (this_attr->address) {
>  	case AD7280A_CELL_OVERVOLTAGE:
>  	case AD7280A_CELL_UNDERVOLTAGE:
>  		val = ((val - 1000) * 100) / 1568; /* LSB 15.68mV */
> @@ -662,7 +662,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev,
>  	val = clamp(val, 0L, 0xFFL);
>  
>  	mutex_lock(&st->lock);
> -	switch ((u32)this_attr->address) {
> +	switch (this_attr->address) {
>  	case AD7280A_CELL_OVERVOLTAGE:
>  		st->cell_threshhigh = val;
>  		break;
diff mbox series

Patch

diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index b736275c10f5..7de6be4f0c27 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -610,7 +610,7 @@  static ssize_t ad7280_read_channel_config(struct device *dev,
 	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
 	unsigned int val;
 
-	switch ((u32)this_attr->address) {
+	switch (this_attr->address) {
 	case AD7280A_CELL_OVERVOLTAGE:
 		val = 1000 + (st->cell_threshhigh * 1568) / 100;
 		break;
@@ -646,7 +646,7 @@  static ssize_t ad7280_write_channel_config(struct device *dev,
 	if (ret)
 		return ret;
 
-	switch ((u32)this_attr->address) {
+	switch (this_attr->address) {
 	case AD7280A_CELL_OVERVOLTAGE:
 	case AD7280A_CELL_UNDERVOLTAGE:
 		val = ((val - 1000) * 100) / 1568; /* LSB 15.68mV */
@@ -662,7 +662,7 @@  static ssize_t ad7280_write_channel_config(struct device *dev,
 	val = clamp(val, 0L, 0xFFL);
 
 	mutex_lock(&st->lock);
-	switch ((u32)this_attr->address) {
+	switch (this_attr->address) {
 	case AD7280A_CELL_OVERVOLTAGE:
 		st->cell_threshhigh = val;
 		break;