mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 14:41:22 -05:00
iio: accel: adxl345: simplify measure enable
Simplify the function to enable or disable measurement. Replace the separate decision logic and call to regmap_update_bits() by a single call to regmap_assign_bits() taking a boolean argument directly. This is a refactoring change and should not impact functionality. Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com> Link: https://patch.msgid.link/20250610215933.84795-4-l.rubusch@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
5decafde4d
commit
f7f905f7a7
@@ -73,7 +73,6 @@
|
||||
#define ADXL345_BW_LOW_POWER BIT(4)
|
||||
#define ADXL345_BASE_RATE_NANO_HZ 97656250LL
|
||||
|
||||
#define ADXL345_POWER_CTL_STANDBY 0x00
|
||||
#define ADXL345_POWER_CTL_WAKEUP GENMASK(1, 0)
|
||||
#define ADXL345_POWER_CTL_SLEEP BIT(2)
|
||||
#define ADXL345_POWER_CTL_MEASURE BIT(3)
|
||||
|
||||
@@ -233,9 +233,8 @@ EXPORT_SYMBOL_NS_GPL(adxl345_is_volatile_reg, "IIO_ADXL345");
|
||||
*/
|
||||
static int adxl345_set_measure_en(struct adxl345_state *st, bool en)
|
||||
{
|
||||
unsigned int val = en ? ADXL345_POWER_CTL_MEASURE : ADXL345_POWER_CTL_STANDBY;
|
||||
|
||||
return regmap_write(st->regmap, ADXL345_REG_POWER_CTL, val);
|
||||
return regmap_assign_bits(st->regmap, ADXL345_REG_POWER_CTL,
|
||||
ADXL345_POWER_CTL_MEASURE, en);
|
||||
}
|
||||
|
||||
/* tap */
|
||||
|
||||
Reference in New Issue
Block a user