staging: iio: adc: ad7816.c: Replace bit shifting with BIT macro
Challenge suggested by coccinelle. Prefer using BIT and replace bit shifting with the BIT(x) macro. Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
6082ac0412
commit
e7c3d05459
@@ -231,7 +231,7 @@ static ssize_t ad7816_show_value(struct device *dev,
|
||||
value = (s8)((data >> AD7816_TEMP_FLOAT_OFFSET) - 103);
|
||||
data &= AD7816_TEMP_FLOAT_MASK;
|
||||
if (value < 0)
|
||||
data = (1 << AD7816_TEMP_FLOAT_OFFSET) - data;
|
||||
data = BIT(AD7816_TEMP_FLOAT_OFFSET) - data;
|
||||
return sprintf(buf, "%d.%.2d\n", value, data * 25);
|
||||
}
|
||||
return sprintf(buf, "%u\n", data);
|
||||
|
||||
Reference in New Issue
Block a user