From: claudiu beznea <claudiu.beznea@tuxon.dev>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Nicolas Ferre" <nicolas.ferre@microchip.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org,
kernel@pengutronix.de
Subject: Re: [PATCH] pwm: atmel: Don't use pwm consumer API
Date: Sat, 3 Feb 2024 17:46:13 +0200 [thread overview]
Message-ID: <9e5c0d29-dc4e-4864-ab1c-e65bbc25430f@tuxon.dev> (raw)
In-Reply-To: <20240129085627.2386470-2-u.kleine-koenig@pengutronix.de>
On 29.01.2024 10:56, Uwe Kleine-König wrote:
> Lowlevel driver callbacks are not supposed to use the consumer API
> functions. Currently this works, but with the upcoming locking changes
> this probably results in dead locks.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> ---
> drivers/pwm/pwm-atmel.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
> index 47bcc8a3bf9d..26573829e391 100644
> --- a/drivers/pwm/pwm-atmel.c
> +++ b/drivers/pwm/pwm-atmel.c
> @@ -294,19 +294,16 @@ static int atmel_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> const struct pwm_state *state)
> {
> struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip);
> - struct pwm_state cstate;
> unsigned long cprd, cdty;
> u32 pres, val;
> int ret;
>
> - pwm_get_state(pwm, &cstate);
> -
> if (state->enabled) {
> unsigned long clkrate = clk_get_rate(atmel_pwm->clk);
>
> - if (cstate.enabled &&
> - cstate.polarity == state->polarity &&
> - cstate.period == state->period) {
> + if (pwm->state.enabled &&
> + pwm->state.polarity == state->polarity &&
> + pwm->state.period == state->period) {
> u32 cmr = atmel_pwm_ch_readl(atmel_pwm, pwm->hwpwm, PWM_CMR);
>
> cprd = atmel_pwm_ch_readl(atmel_pwm, pwm->hwpwm,
> @@ -328,7 +325,7 @@ static int atmel_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>
> atmel_pwm_calculate_cdty(state, clkrate, cprd, pres, &cdty);
>
> - if (cstate.enabled) {
> + if (pwm->state.enabled) {
> atmel_pwm_disable(chip, pwm, false);
> } else {
> ret = clk_enable(atmel_pwm->clk);
> @@ -348,7 +345,7 @@ static int atmel_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWM_CMR, val);
> atmel_pwm_set_cprd_cdty(chip, pwm, cprd, cdty);
> atmel_pwm_writel(atmel_pwm, PWM_ENA, 1 << pwm->hwpwm);
> - } else if (cstate.enabled) {
> + } else if (pwm->state.enabled) {
> atmel_pwm_disable(chip, pwm, true);
> }
>
prev parent reply other threads:[~2024-02-03 15:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-29 8:56 [PATCH] pwm: atmel: Don't use pwm consumer API Uwe Kleine-König
2024-02-03 15:46 ` claudiu beznea [this message]
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=9e5c0d29-dc4e-4864-ab1c-e65bbc25430f@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=alexandre.belloni@bootlin.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pwm@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--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