From 3dcb60cd926ebfc8f85603d226457c9a38794209 Mon Sep 17 00:00:00 2001 From: David Frey Date: Fri, 17 Aug 2018 12:03:18 -0700 Subject: [PATCH] iio: chemical: bme680: use FIELD_GET macro Use the FIELD_GET macro instead of explicit mask and shift. Signed-off-by: David Frey Reviewed-by: Himanshu Jha Tested-by: Himanshu Jha Signed-off-by: Jonathan Cameron --- drivers/iio/chemical/bme680_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c index 0ebe2d26ff1b..ced63e3035be 100644 --- a/drivers/iio/chemical/bme680_core.c +++ b/drivers/iio/chemical/bme680_core.c @@ -285,7 +285,7 @@ static int bme680_read_calib(struct bme680_data *data, dev_err(dev, "failed to read resistance heat range\n"); return ret; } - calib->res_heat_range = (tmp & BME680_RHRANGE_MASK) / 16; + calib->res_heat_range = FIELD_GET(BME680_RHRANGE_MASK, tmp); ret = regmap_read(data->regmap, BME680_REG_RES_HEAT_VAL, &tmp); if (ret < 0) { @@ -299,7 +299,7 @@ static int bme680_read_calib(struct bme680_data *data, dev_err(dev, "failed to read range software error\n"); return ret; } - calib->range_sw_err = (tmp & BME680_RSERROR_MASK) / 16; + calib->range_sw_err = FIELD_GET(BME680_RSERROR_MASK, tmp); return 0; }