lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250614144506.14d869fb@jic23-huawei>
Date: Sat, 14 Jun 2025 14:45:06 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Lothar Rubusch <l.rubusch@...il.com>
Cc: lars@...afoo.de, Michael.Hennerich@...log.com, dlechner@...libre.com,
 nuno.sa@...log.com, andy@...nel.org, corbet@....net,
 linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-doc@...r.kernel.org, eraretuya@...il.com
Subject: Re: [PATCH v9 03/11] iio: accel: adxl345: simplify measure enable

On Tue, 10 Jun 2025 21:59:25 +0000
Lothar Rubusch <l.rubusch@...il.com> wrote:

> 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@...il.com>
Another good stand along change.

Applied.

> ---
>  drivers/iio/accel/adxl345.h      | 1 -
>  drivers/iio/accel/adxl345_core.c | 5 ++---
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/accel/adxl345.h b/drivers/iio/accel/adxl345.h
> index 6c1f96406136..9385affdefe3 100644
> --- a/drivers/iio/accel/adxl345.h
> +++ b/drivers/iio/accel/adxl345.h
> @@ -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)
> diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c
> index 07abab82d093..cae9e37e216f 100644
> --- a/drivers/iio/accel/adxl345_core.c
> +++ b/drivers/iio/accel/adxl345_core.c
> @@ -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 */


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ