mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] counter: ti-ecap-capture: use regmap_assign_bits() for conditional set/clear
@ 2026-09-24  8:34 Peng Fan (OSS)
  2026-09-24 10:11 ` Julien Panis
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan (OSS) @ 2026-09-24  8:34 UTC (permalink / raw)
  To: Vignesh Raghavendra, Julien Panis, William Breathitt Gray
  Cc: linux-kernel, Peng Fan, linux-iio, linux-omap

From: Peng Fan <peng.fan@nxp.com>

Replace if/else block using regmap_set_bits()/regmap_clear_bits() with
the simpler regmap_assign_bits() call.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/counter/ti-ecap-capture.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c
index d77a256f0ed31..1b79031544646 100644
--- a/drivers/counter/ti-ecap-capture.c
+++ b/drivers/counter/ti-ecap-capture.c
@@ -254,10 +254,8 @@ static int ecap_cnt_pol_write(struct counter_device *counter,
 	struct ecap_cnt_dev *ecap_dev = counter_priv(counter);
 
 	pm_runtime_get_sync(counter->parent);
-	if (pol == COUNTER_SIGNAL_POLARITY_NEGATIVE)
-		regmap_set_bits(ecap_dev->regmap, ECAP_ECCTL_REG, ECAP_CAPPOL_BIT(idx));
-	else
-		regmap_clear_bits(ecap_dev->regmap, ECAP_ECCTL_REG, ECAP_CAPPOL_BIT(idx));
+	regmap_assign_bits(ecap_dev->regmap, ECAP_ECCTL_REG, ECAP_CAPPOL_BIT(idx),
+			   pol == COUNTER_SIGNAL_POLARITY_NEGATIVE);
 	pm_runtime_put_sync(counter->parent);
 
 	return 0;
-- 
2.50.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] counter: ti-ecap-capture: use regmap_assign_bits() for conditional set/clear
  2026-09-24  8:34 [PATCH] counter: ti-ecap-capture: use regmap_assign_bits() for conditional set/clear Peng Fan (OSS)
@ 2026-09-24 10:11 ` Julien Panis
  0 siblings, 0 replies; 2+ messages in thread
From: Julien Panis @ 2026-09-24 10:11 UTC (permalink / raw)
  To: Peng Fan (OSS), Vignesh Raghavendra, William Breathitt Gray
  Cc: linux-kernel, Peng Fan, linux-iio, linux-omap

On 9/24/26 10:34, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Replace if/else block using regmap_set_bits()/regmap_clear_bits() with
> the simpler regmap_assign_bits() call.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>   drivers/counter/ti-ecap-capture.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c
> index d77a256f0ed31..1b79031544646 100644
> --- a/drivers/counter/ti-ecap-capture.c
> +++ b/drivers/counter/ti-ecap-capture.c
> @@ -254,10 +254,8 @@ static int ecap_cnt_pol_write(struct counter_device *counter,
>   	struct ecap_cnt_dev *ecap_dev = counter_priv(counter);
>   
>   	pm_runtime_get_sync(counter->parent);
> -	if (pol == COUNTER_SIGNAL_POLARITY_NEGATIVE)
> -		regmap_set_bits(ecap_dev->regmap, ECAP_ECCTL_REG, ECAP_CAPPOL_BIT(idx));
> -	else
> -		regmap_clear_bits(ecap_dev->regmap, ECAP_ECCTL_REG, ECAP_CAPPOL_BIT(idx));
> +	regmap_assign_bits(ecap_dev->regmap, ECAP_ECCTL_REG, ECAP_CAPPOL_BIT(idx),
> +			   pol == COUNTER_SIGNAL_POLARITY_NEGATIVE);
>   	pm_runtime_put_sync(counter->parent);
>   
>   	return 0;

Acked-by: Julien Panis <jpanis@baylibre.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-24 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24  8:34 [PATCH] counter: ti-ecap-capture: use regmap_assign_bits() for conditional set/clear Peng Fan (OSS)
2026-09-24 10:11 ` Julien Panis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®