summaryrefslogtreecommitdiffstats
path: root/drivers/iio/humidity/hts221_core.c
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo.bianconi83@gmail.com>2017-07-17 19:39:00 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2017-07-22 21:20:48 +0100
commite3e25446a3d2d1beb2443b65a919e59a060182d5 (patch)
tree93a6c8aa869999158593037712f0ca2a4644adff /drivers/iio/humidity/hts221_core.c
parentffebe74b7c95a41d2d0ac70a44d410e0efa37ad8 (diff)
downloadtalos-op-linux-e3e25446a3d2d1beb2443b65a919e59a060182d5.tar.gz
talos-op-linux-e3e25446a3d2d1beb2443b65a919e59a060182d5.zip
iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/humidity/hts221_core.c')
-rw-r--r--drivers/iio/humidity/hts221_core.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index f99adc44139e..dc55d9fbc702 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -285,30 +285,16 @@ hts221_sysfs_temp_oversampling_avail(struct device *dev,
return len;
}
-int hts221_power_on(struct hts221_hw *hw)
+int hts221_set_enable(struct hts221_hw *hw, bool enable)
{
int err;
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_ENABLE_MASK, true);
+ HTS221_ENABLE_MASK, enable);
if (err < 0)
return err;
- hw->enabled = true;
-
- return 0;
-}
-
-int hts221_power_off(struct hts221_hw *hw)
-{
- int err;
-
- err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
- HTS221_ENABLE_MASK, false);
- if (err < 0)
- return err;
-
- hw->enabled = false;
+ hw->enabled = enable;
return 0;
}
@@ -463,7 +449,7 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
u8 data[HTS221_DATA_SIZE];
int err;
- err = hts221_power_on(hw);
+ err = hts221_set_enable(hw, true);
if (err < 0)
return err;
@@ -473,7 +459,7 @@ static int hts221_read_oneshot(struct hts221_hw *hw, u8 addr, int *val)
if (err < 0)
return err;
- hts221_power_off(hw);
+ hts221_set_enable(hw, false);
*val = (s16)get_unaligned_le16(data);
OpenPOWER on IntegriCloud