Message ID | 20180817190319.13119-7-dpfrey@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | bme680 cleanup | expand |
On Fri, Aug 17, 2018 at 12:03:18PM -0700, David Frey wrote: > 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> Also, 0-day tested with build success! Thanks
On Sat, 18 Aug 2018 16:40:35 +0530 Himanshu Jha <himanshujha199640@gmail.com> wrote: > On Fri, Aug 17, 2018 at 12:03:18PM -0700, David Frey wrote: > > 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> > > Also, 0-day tested with build success! > > Thanks > Applied, Thanks, Jonathan
diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c index 7c7df40b615f..46afc93041f5 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; }
Use the FIELD_GET macro instead of explicit mask and shift. Signed-off-by: David Frey <dpfrey@gmail.com> --- drivers/iio/chemical/bme680_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)