Switch from sign_extend32(FIELD_GET()) to the dedicated FIELD_GET_SIGNED() and don't calculate the fields length explicitly. Acked-by: Jonathan Cameron Signed-off-by: Yury Norov --- drivers/iio/temperature/mcp9600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/temperature/mcp9600.c b/drivers/iio/temperature/mcp9600.c index aa42c2b1a369..69baf654c9c0 100644 --- a/drivers/iio/temperature/mcp9600.c +++ b/drivers/iio/temperature/mcp9600.c @@ -297,7 +297,7 @@ static int mcp9600_read_thresh(struct iio_dev *indio_dev, * Temperature is stored in two’s complement format in * bits(15:2), LSB is 0.25 degree celsius. */ - *val = sign_extend32(FIELD_GET(MCP9600_ALERT_LIMIT_MASK, ret), 13); + *val = FIELD_GET_SIGNED(MCP9600_ALERT_LIMIT_MASK, ret); *val2 = 4; return IIO_VAL_FRACTIONAL; case IIO_EV_INFO_HYSTERESIS: -- 2.51.0