From: Trevor Gamblin <tgamblin@baylibre.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Dmitry Rokosov" <ddrokosov@sberdevices.ru>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Cosmin Tanislav" <cosmin.tanislav@analog.com>,
"Chen-Yu Tsai" <wens@csie.org>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ray Jui" <rjui@broadcom.com>,
"Scott Branden" <sbranden@broadcom.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Kevin Hilman" <khilman@baylibre.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Saravanan Sekar" <sravanhome@gmail.com>,
"Orson Zhai" <orsonzhai@gmail.com>,
"Baolin Wang" <baolin.wang@linux.alibaba.com>,
"Chunyan Zhang" <zhang.lyra@gmail.com>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Jean-Baptiste Maneyrol" <jmaneyrol@invensense.com>,
"Crt Mori" <cmo@melexis.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Trevor Gamblin" <tgamblin@baylibre.com>
Subject: [PATCH v3 41/41] iio: trigger: stm32-timer-trigger: make use of regmap_clear_bits(), regmap_set_bits()
Date: Mon, 17 Jun 2024 09:50:21 -0400 [thread overview]
Message-ID: <20240617-review-v3-41-88d1338c4cca@baylibre.com> (raw)
In-Reply-To: <20240617-review-v3-0-88d1338c4cca@baylibre.com>
Instead of using regmap_update_bits() and passing the mask twice, use
regmap_set_bits().
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/trigger/stm32-timer-trigger.c | 34 +++++++++++++++----------------
1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c
index d76444030a28..0684329956d9 100644
--- a/drivers/iio/trigger/stm32-timer-trigger.c
+++ b/drivers/iio/trigger/stm32-timer-trigger.c
@@ -158,7 +158,7 @@ static int stm32_timer_start(struct stm32_timer_trigger *priv,
regmap_write(priv->regmap, TIM_PSC, prescaler);
regmap_write(priv->regmap, TIM_ARR, prd - 1);
- regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, TIM_CR1_ARPE);
+ regmap_set_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE);
/* Force master mode to update mode */
if (stm32_timer_is_trgo2_name(trig->name))
@@ -169,10 +169,10 @@ static int stm32_timer_start(struct stm32_timer_trigger *priv,
0x2 << TIM_CR2_MMS_SHIFT);
/* Make sure that registers are updated */
- regmap_update_bits(priv->regmap, TIM_EGR, TIM_EGR_UG, TIM_EGR_UG);
+ regmap_set_bits(priv->regmap, TIM_EGR, TIM_EGR_UG);
/* Enable controller */
- regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, TIM_CR1_CEN);
+ regmap_set_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN);
mutex_unlock(&priv->lock);
return 0;
@@ -189,19 +189,19 @@ static void stm32_timer_stop(struct stm32_timer_trigger *priv,
mutex_lock(&priv->lock);
/* Stop timer */
- regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0);
- regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, 0);
+ regmap_clear_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE);
+ regmap_clear_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN);
regmap_write(priv->regmap, TIM_PSC, 0);
regmap_write(priv->regmap, TIM_ARR, 0);
/* Force disable master mode */
if (stm32_timer_is_trgo2_name(trig->name))
- regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2, 0);
+ regmap_clear_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2);
else
- regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS, 0);
+ regmap_clear_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS);
/* Make sure that registers are updated */
- regmap_update_bits(priv->regmap, TIM_EGR, TIM_EGR_UG, TIM_EGR_UG);
+ regmap_set_bits(priv->regmap, TIM_EGR, TIM_EGR_UG);
if (priv->enabled) {
priv->enabled = false;
@@ -498,11 +498,9 @@ static int stm32_counter_write_raw(struct iio_dev *indio_dev,
priv->enabled = true;
clk_enable(priv->clk);
}
- regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN,
- TIM_CR1_CEN);
+ regmap_set_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN);
} else {
- regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN,
- 0);
+ regmap_clear_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN);
if (priv->enabled) {
priv->enabled = false;
clk_disable(priv->clk);
@@ -555,7 +553,7 @@ static int stm32_set_trigger_mode(struct iio_dev *indio_dev,
{
struct stm32_timer_trigger *priv = iio_priv(indio_dev);
- regmap_update_bits(priv->regmap, TIM_SMCR, TIM_SMCR_SMS, TIM_SMCR_SMS);
+ regmap_set_bits(priv->regmap, TIM_SMCR, TIM_SMCR_SMS);
return 0;
}
@@ -683,7 +681,7 @@ static ssize_t stm32_count_set_preset(struct iio_dev *indio_dev,
return ret;
/* TIMx_ARR register shouldn't be buffered (ARPE=0) */
- regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0);
+ regmap_clear_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE);
regmap_write(priv->regmap, TIM_ARR, preset);
return len;
@@ -757,9 +755,9 @@ static void stm32_timer_detect_trgo2(struct stm32_timer_trigger *priv)
* Master mode selection 2 bits can only be written and read back when
* timer supports it.
*/
- regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2, TIM_CR2_MMS2);
+ regmap_set_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2);
regmap_read(priv->regmap, TIM_CR2, &val);
- regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2, 0);
+ regmap_clear_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2);
priv->has_trgo2 = !!val;
}
@@ -820,7 +818,7 @@ static void stm32_timer_trigger_remove(struct platform_device *pdev)
/* Check if nobody else use the timer, then disable it */
regmap_read(priv->regmap, TIM_CCER, &val);
if (!(val & TIM_CCER_CCXE))
- regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, 0);
+ regmap_clear_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN);
if (priv->enabled)
clk_disable(priv->clk);
@@ -841,7 +839,7 @@ static int stm32_timer_trigger_suspend(struct device *dev)
regmap_read(priv->regmap, TIM_SMCR, &priv->bak.smcr);
/* Disable the timer */
- regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, 0);
+ regmap_clear_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN);
clk_disable(priv->clk);
}
--
2.45.2
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2024-06-17 15:01 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 13:49 [PATCH v3 00/41] iio: simplify with regmap_set_bits(), regmap_clear_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 01/41] iio: accel: fxls8962af-core: Make use of " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 02/41] iio: accel: kxsd9: Make use of regmap_clear_bits() Trevor Gamblin
2024-06-18 11:09 ` Linus Walleij
2024-06-22 9:43 ` Jonathan Cameron
2024-06-17 13:49 ` [PATCH v3 03/41] iio: accel: msa311: make " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 04/41] iio: adc: ad4130: " Trevor Gamblin
2024-06-17 14:42 ` Nuno Sá
2024-06-17 13:49 ` [PATCH v3 05/41] iio: adc: axp20x_adc: make use of regmap_set_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 06/41] iio: adc: axp288_adc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 07/41] iio: adc: bcm_iproc_adc: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 08/41] iio: adc: berlin2-adc: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 09/41] iio: adc: cpcap-adc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 10/41] iio: adc: fsl-imx25-gcq: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 11/41] iio: adc: ina2xx-adc: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 12/41] iio: adc: intel_mrfld_adc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 13/41] iio: adc: meson_saradc: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-20 9:41 ` George Stark
2024-06-17 13:49 ` [PATCH v3 14/41] iio: adc: mp2629_adc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 15/41] iio: adc: qcom-spmi-rradc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 16/41] iio: adc: rn5t618-adc: make use of regmap_set_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 17/41] iio: adc: sc27xx_adc: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 18/41] iio: adc: stm32-dfsdm-adc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 19/41] iio: dac: ltc2688: make use of regmap_set_bits() Trevor Gamblin
2024-06-17 14:43 ` Nuno Sá
2024-06-17 13:50 ` [PATCH v3 20/41] iio: dac: stm32-dac-core: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 21/41] iio: gyro: bmg160_core: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 22/41] iio: gyro: mpu3050-core: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-17 16:13 ` Jonathan Cameron
2024-06-17 13:50 ` [PATCH v3 23/41] iio: health: afe4403: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 24/41] iio: health: afe4404: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 25/41] iio: health: max30100: make use of regmap_set_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 26/41] iio: health: max30102: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 27/41] iio: imu: inv_icm42600: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-20 20:13 ` Jean-Baptiste Maneyrol
2024-06-17 13:50 ` [PATCH v3 28/41] iio: light: adux1020: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 29/41] iio: light: iqs621-als: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 30/41] iio: light: isl29018: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 31/41] iio: light: st_uvis25_core: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 32/41] iio: light: veml6030: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 33/41] iio: magnetometer: ak8974: make use of regmap_set_bits() Trevor Gamblin
2024-06-18 11:11 ` Linus Walleij
2024-06-17 13:50 ` [PATCH v3 34/41] iio: magnetometer: mmc35240: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 35/41] iio: pressure: bmp280-core: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 23:22 ` [PATCH v3 35/41] iio: pressure: bmp280-core: make use of Vasileios Amoiridis
2024-06-18 11:12 ` [PATCH v3 35/41] iio: pressure: bmp280-core: make use of regmap_clear_bits() Linus Walleij
2024-06-17 13:50 ` [PATCH v3 36/41] iio: proximity: sx9324: make use of regmap_set_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 37/41] iio: proximity: sx9360: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 38/41] iio: proximity: sx9500: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 39/41] iio: proximity: sx_common: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 40/41] iio: temperature: mlx90632: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 13:50 ` Trevor Gamblin [this message]
2024-06-17 15:17 ` [PATCH v3 00/41] iio: simplify with regmap_set_bits(), regmap_clear_bits() Uwe Kleine-König
2024-06-22 18:07 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240617-review-v3-41-88d1338c4cca@baylibre.com \
--to=tgamblin@baylibre.com \
--cc=Michael.Hennerich@analog.com \
--cc=alexandre.torgue@foss.st.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=cmo@melexis.com \
--cc=cosmin.tanislav@analog.com \
--cc=ddrokosov@sberdevices.ru \
--cc=festevam@gmail.com \
--cc=hdegoede@redhat.com \
--cc=imx@lists.linux.dev \
--cc=jbrunet@baylibre.com \
--cc=jic23@kernel.org \
--cc=jmaneyrol@invensense.com \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=neil.armstrong@linaro.org \
--cc=nuno.sa@analog.com \
--cc=orsonzhai@gmail.com \
--cc=rjui@broadcom.com \
--cc=s.hauer@pengutronix.de \
--cc=sbranden@broadcom.com \
--cc=shawnguo@kernel.org \
--cc=sravanhome@gmail.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=wens@csie.org \
--cc=zhang.lyra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®