Message ID | 20180820173959.22380-1-dpfrey@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | iio: chemical: bme680: Remove field value defines | expand |
On Mon, Aug 20, 2018 at 10:39:59AM -0700, David Frey wrote: > Remove BME680_RUN_GAS_EN_BIT and BME680_NB_CONV_0_VAL field value > definitions because the fields are simply boolean and integer > respectively. > > Signed-off-by: David Frey <dpfrey@gmail.com> Reviewed-by: Himanshu Jha <himanshujha199640@gmail.com> Tested-by: Himanshu Jha <himanshujha199640@gmail.com> > --- > This patch applies on top of my "indent #defines consistently" v3 patch. > Appologies if I should have submitted this patch in a different way. If > I should have submitted this differently, I would appreciate a pointer > on what I should have done in this case. This applies cleanly so no worries I guess. Would have been better to send this patch as a separate thread since thread becomes complex and its hard to find the new patch in the nested series of replies. > BME680_RUN_GAS_EN_BIT was indeed somewhat wrongly formatted, but the > issue was not the indentation level, but rather that I should have > followed immediately after BME680_RUN_GAS_MASK. Once I moved it there, > I realized that neither this definition nor BME680_NB_CONV_0_VAL really > added any value and hence I removed both in this patch. My main intention was to make it explicit that we are selected NB_CONV_0 set point, and I didn't knew about FIELD_PREP helper macro until you pointed me out in the early review cycle. Now, it is much appropriate. Thanks
On Wed, 22 Aug 2018 16:14:05 +0530 Himanshu Jha <himanshujha199640@gmail.com> wrote: > On Mon, Aug 20, 2018 at 10:39:59AM -0700, David Frey wrote: > > Remove BME680_RUN_GAS_EN_BIT and BME680_NB_CONV_0_VAL field value > > definitions because the fields are simply boolean and integer > > respectively. > > > > Signed-off-by: David Frey <dpfrey@gmail.com> > Reviewed-by: Himanshu Jha <himanshujha199640@gmail.com> > Tested-by: Himanshu Jha <himanshujha199640@gmail.com> Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > > > --- > > This patch applies on top of my "indent #defines consistently" v3 patch. > > Appologies if I should have submitted this patch in a different way. If > > I should have submitted this differently, I would appreciate a pointer > > on what I should have done in this case. > > This applies cleanly so no worries I guess. > Would have been better to send this patch as a separate thread since > thread becomes complex and its hard to find the new patch in the > nested series of replies. > > > BME680_RUN_GAS_EN_BIT was indeed somewhat wrongly formatted, but the > > issue was not the indentation level, but rather that I should have > > followed immediately after BME680_RUN_GAS_MASK. Once I moved it there, > > I realized that neither this definition nor BME680_NB_CONV_0_VAL really > > added any value and hence I removed both in this patch. > > My main intention was to make it explicit that we are selected NB_CONV_0 > set point, and I didn't knew about FIELD_PREP helper macro until you > pointed me out in the early review cycle. > > Now, it is much appropriate. > > Thanks
diff --git a/drivers/iio/chemical/bme680.h b/drivers/iio/chemical/bme680.h index dd4247d364a0..48dc9e50e017 100644 --- a/drivers/iio/chemical/bme680.h +++ b/drivers/iio/chemical/bme680.h @@ -54,8 +54,6 @@ #define BME680_REG_CTRL_GAS_1 0x71 #define BME680_RUN_GAS_MASK BIT(4) #define BME680_NB_CONV_MASK GENMASK(3, 0) -#define BME680_RUN_GAS_EN_BIT BIT(4) -#define BME680_NB_CONV_0_VAL 0 #define BME680_REG_MEAS_STAT_0 0x1D #define BME680_GAS_MEAS_BIT BIT(6) diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c index cde08d57e7d5..01ca7ba64ea0 100644 --- a/drivers/iio/chemical/bme680_core.c +++ b/drivers/iio/chemical/bme680_core.c @@ -566,10 +566,11 @@ static int bme680_gas_config(struct bme680_data *data) return ret; } - /* Selecting the runGas and NB conversion settings for the sensor */ + /* Enable the gas sensor and select heater profile set-point 0 */ ret = regmap_update_bits(data->regmap, BME680_REG_CTRL_GAS_1, BME680_RUN_GAS_MASK | BME680_NB_CONV_MASK, - BME680_RUN_GAS_EN_BIT | BME680_NB_CONV_0_VAL); + FIELD_PREP(BME680_RUN_GAS_MASK, 1) | + FIELD_PREP(BME680_NB_CONV_MASK, 0)); if (ret < 0) dev_err(dev, "failed to write ctrl_gas_1 register\n");
Remove BME680_RUN_GAS_EN_BIT and BME680_NB_CONV_0_VAL field value definitions because the fields are simply boolean and integer respectively. Signed-off-by: David Frey <dpfrey@gmail.com> --- This patch applies on top of my "indent #defines consistently" v3 patch. Appologies if I should have submitted this patch in a different way. If I should have submitted this differently, I would appreciate a pointer on what I should have done in this case. BME680_RUN_GAS_EN_BIT was indeed somewhat wrongly formatted, but the issue was not the indentation level, but rather that I should have followed immediately after BME680_RUN_GAS_MASK. Once I moved it there, I realized that neither this definition nor BME680_NB_CONV_0_VAL really added any value and hence I removed both in this patch. drivers/iio/chemical/bme680.h | 2 -- drivers/iio/chemical/bme680_core.c | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-)