[3/3] pwm: stm32: Pass breakinput instead of its values
diff mbox series

Message ID 20191016073842.1300297-4-thierry.reding@gmail.com
State New
Headers show
Series
  • pwm: stm32: Minor cleanups
Related show

Commit Message

Thierry Reding Oct. 16, 2019, 7:38 a.m. UTC
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(-)

Patch
diff mbox series

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;
 	}