Commit 3e4224a9 authored by Uwe Kleine-König's avatar Uwe Kleine-König

pwm: stm32-lp: Simplify code to determine the pwmchip's parent device

There is already a pointer to the pwmchip, make use of it directly
instead of using the struct stm32_pwm_lp *priv just obtained from
it. This also has the advantage of not using struct stm32_pwm_lp::chip
any more which will be dropped soon.

Link: https://lore.kernel.org/r/9ad2399e1a683a6344b12d7f70498393b8f8b9de.1707900770.git.u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent 174821b7
...@@ -61,7 +61,7 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -61,7 +61,7 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm,
do_div(div, NSEC_PER_SEC); do_div(div, NSEC_PER_SEC);
if (!div) { if (!div) {
/* Clock is too slow to achieve requested period. */ /* Clock is too slow to achieve requested period. */
dev_dbg(priv->chip.dev, "Can't reach %llu ns\n", state->period); dev_dbg(chip->dev, "Can't reach %llu ns\n", state->period);
return -EINVAL; return -EINVAL;
} }
...@@ -69,7 +69,7 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -69,7 +69,7 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm,
while (div > STM32_LPTIM_MAX_ARR) { while (div > STM32_LPTIM_MAX_ARR) {
presc++; presc++;
if ((1 << presc) > STM32_LPTIM_MAX_PRESCALER) { if ((1 << presc) > STM32_LPTIM_MAX_PRESCALER) {
dev_err(priv->chip.dev, "max prescaler exceeded\n"); dev_err(chip->dev, "max prescaler exceeded\n");
return -EINVAL; return -EINVAL;
} }
div = prd >> presc; div = prd >> presc;
...@@ -130,7 +130,7 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -130,7 +130,7 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm,
(val & STM32_LPTIM_CMPOK_ARROK) == STM32_LPTIM_CMPOK_ARROK, (val & STM32_LPTIM_CMPOK_ARROK) == STM32_LPTIM_CMPOK_ARROK,
100, 1000); 100, 1000);
if (ret) { if (ret) {
dev_err(priv->chip.dev, "ARR/CMP registers write issue\n"); dev_err(chip->dev, "ARR/CMP registers write issue\n");
goto err; goto err;
} }
ret = regmap_write(priv->regmap, STM32_LPTIM_ICR, ret = regmap_write(priv->regmap, STM32_LPTIM_ICR,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment