public inbox for linux-pwm@vger.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Fabrice Gasnier" <fabrice.gasnier@st.com>,
	linux-pwm@vger.kernel.org
Subject: [PATCH 3/3] pwm: stm32: Pass breakinput instead of its values
Date: Wed, 16 Oct 2019 09:38:42 +0200	[thread overview]
Message-ID: <20191016073842.1300297-4-thierry.reding@gmail.com> (raw)
In-Reply-To: <20191016073842.1300297-1-thierry.reding@gmail.com>

Instead of passing the individual values of the breakpoint, pass a
pointer to the breakpoint.

Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 drivers/pwm/pwm-stm32.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 8f1f3371e1dd..9e500928c37d 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -491,11 +491,11 @@ static const struct pwm_ops stm32pwm_ops = {
 };
 
 static int stm32_pwm_set_breakinput(struct stm32_pwm *priv,
-				    int index, int level, int filter)
+				    const struct stm32_breakinput *bi)
 {
 	u32 bke, bkp, shift, mask, bdtr;
 
-	if (index == 0) {
+	if (bi->index == 0) {
 		bke = TIM_BDTR_BKE;
 		bkp = TIM_BDTR_BKP;
 		shift = TIM_BDTR_BKF_SHIFT;
@@ -509,10 +509,10 @@ static int stm32_pwm_set_breakinput(struct stm32_pwm *priv,
 
 	bdtr = bke;
 
-	if (level)
+	if (bi->level)
 		bdtr |= bkp;
 
-	bdtr |= (filter & TIM_BDTR_BKF_MASK) << shift;
+	bdtr |= (bi->filter & TIM_BDTR_BKF_MASK) << shift;
 
 	regmap_update_bits(priv->regmap, TIM_BDTR, mask, bdtr);
 
@@ -527,10 +527,7 @@ static int stm32_pwm_apply_breakinputs(struct stm32_pwm *priv)
 	int ret;
 
 	for (i = 0; i < priv->num_breakinputs; i++) {
-		ret = stm32_pwm_set_breakinput(priv,
-					       priv->breakinputs[i].index,
-					       priv->breakinputs[i].level,
-					       priv->breakinputs[i].filter);
+		ret = stm32_pwm_set_breakinput(priv, &priv->breakinputs[i]);
 		if (ret < 0)
 			return ret;
 	}
-- 
2.23.0

  parent reply	other threads:[~2019-10-16  7:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16  7:38 [PATCH 0/3] pwm: stm32: Minor cleanups Thierry Reding
2019-10-16  7:38 ` [PATCH 1/3] pwm: stm32: Remove clutter from ternary operator Thierry Reding
2019-10-16  8:26   ` Uwe Kleine-König
2019-10-16  9:30     ` Thierry Reding
2019-10-16  7:38 ` [PATCH 2/3] pwm: stm32: Remove confusing bitmask Thierry Reding
2019-10-16  8:31   ` Uwe Kleine-König
2019-10-16  9:50     ` Thierry Reding
2019-10-16 10:20       ` Fabrice Gasnier
2019-10-16 10:52         ` Uwe Kleine-König
2019-10-16  7:38 ` Thierry Reding [this message]
2019-10-16  8:33 ` [PATCH 0/3] pwm: stm32: Minor cleanups Uwe Kleine-König

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=20191016073842.1300297-4-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=fabrice.gasnier@st.com \
    --cc=linux-pwm@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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