diff mbox series

[v3,02/41] iio: accel: kxsd9: Make use of regmap_clear_bits()

Message ID 20240617-review-v3-2-88d1338c4cca@baylibre.com (mailing list archive)
State Not Applicable
Headers show
Series iio: simplify with regmap_set_bits(), regmap_clear_bits() | expand

Commit Message

Trevor Gamblin June 17, 2024, 1:49 p.m. UTC
Instead of using regmap_update_bits() and passing val = 0, use
regmap_clear_bits().

Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
 drivers/iio/accel/kxsd9.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Linus Walleij June 18, 2024, 11:09 a.m. UTC | #1
On Mon, Jun 17, 2024 at 3:49 PM Trevor Gamblin <tgamblin@baylibre.com> wrote:

> Instead of using regmap_update_bits() and passing val = 0, use
> regmap_clear_bits().
>
> Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Jonathan Cameron June 22, 2024, 9:43 a.m. UTC | #2
On Mon, 17 Jun 2024 09:49:42 -0400
Trevor Gamblin <tgamblin@baylibre.com> wrote:

> Instead of using regmap_update_bits() and passing val = 0, use
> regmap_clear_bits().
> 
> Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
> ---
>  drivers/iio/accel/kxsd9.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
> index ba99649fe195..03ce032e06ff 100644
> --- a/drivers/iio/accel/kxsd9.c
> +++ b/drivers/iio/accel/kxsd9.c
> @@ -370,10 +370,8 @@ static int kxsd9_power_down(struct kxsd9_state *st)
>  	 * make sure we conserve power even if there are others users on the
>  	 * regulators.
>  	 */
> -	ret = regmap_update_bits(st->map,
> -				 KXSD9_REG_CTRL_B,
> -				 KXSD9_CTRL_B_ENABLE,
> -				 0);
> +	ret = regmap_clear_bits(st->map, KXSD9_REG_CTRL_B,
> +				KXSD9_CTRL_B_ENABLE);
Now fits neatly on one line at precisely 80 chars.
I rewrapped whilst applying.

Jonathan

>  	if (ret)
>  		return ret;
>  
>
diff mbox series

Patch

diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
index ba99649fe195..03ce032e06ff 100644
--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -370,10 +370,8 @@  static int kxsd9_power_down(struct kxsd9_state *st)
 	 * make sure we conserve power even if there are others users on the
 	 * regulators.
 	 */
-	ret = regmap_update_bits(st->map,
-				 KXSD9_REG_CTRL_B,
-				 KXSD9_CTRL_B_ENABLE,
-				 0);
+	ret = regmap_clear_bits(st->map, KXSD9_REG_CTRL_B,
+				KXSD9_CTRL_B_ENABLE);
 	if (ret)
 		return ret;