summaryrefslogtreecommitdiff
path: root/drivers/iio/chemical
diff options
context:
space:
mode:
authorDavid Frey <dpfrey@gmail.com>2018-08-17 22:03:18 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-08-19 19:08:25 +0300
commit3dcb60cd926ebfc8f85603d226457c9a38794209 (patch)
tree661bd683992327d5a2fb3081f20ed5c962f8da91 /drivers/iio/chemical
parent8d3032c3692d247ad625863e949d419952db8cbd (diff)
downloadlinux-3dcb60cd926ebfc8f85603d226457c9a38794209.tar.xz
iio: chemical: bme680: use FIELD_GET macro
Use the FIELD_GET macro instead of explicit mask and shift. Signed-off-by: David Frey <dpfrey@gmail.com> Reviewed-by: Himanshu Jha <himanshujha199640@gmail.com> Tested-by: Himanshu Jha <himanshujha199640@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/chemical')
-rw-r--r--drivers/iio/chemical/bme680_core.c4
1 files 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;
}