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>,
"Boris Brezillon" <bbrezillon@kernel.org>
Cc: Thierry Reding <thierry.reding@gmail.com>,
linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
kernel@pengutronix.de
Subject: Re: [PATCH 2/2] pwm: atmel-hlcdc: Don't use pwm consumer API
Date: Sat, 3 Feb 2024 17:47:45 +0200 [thread overview]
Message-ID: <9e337e19-9aaf-45c4-b2ee-09f77e1680fd@tuxon.dev> (raw)
In-Reply-To: <6e34607828b290cd64ca9f82df40872853069f07.1706269232.git.u.kleine-koenig@pengutronix.de>
On 26.01.2024 14:04, 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-hlcdc.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
> index 1f6fc9a9fcf3..2d64af045fc5 100644
> --- a/drivers/pwm/pwm-atmel-hlcdc.c
> +++ b/drivers/pwm/pwm-atmel-hlcdc.c
> @@ -183,9 +183,10 @@ static const struct atmel_hlcdc_pwm_errata atmel_hlcdc_pwm_sama5d3_errata = {
> static int atmel_hlcdc_pwm_suspend(struct device *dev)
> {
> struct atmel_hlcdc_pwm *atmel = dev_get_drvdata(dev);
> + struct pwm_device *pwm = &atmel->chip.pwms[0];
>
> /* Keep the periph clock enabled if the PWM is still running. */
> - if (!pwm_is_enabled(&atmel->chip.pwms[0]))
> + if (!pwm->state.enabled)
> clk_disable_unprepare(atmel->hlcdc->periph_clk);
>
> return 0;
> @@ -194,20 +195,17 @@ static int atmel_hlcdc_pwm_suspend(struct device *dev)
> static int atmel_hlcdc_pwm_resume(struct device *dev)
> {
> struct atmel_hlcdc_pwm *atmel = dev_get_drvdata(dev);
> - struct pwm_state state;
> + struct pwm_device *pwm = &atmel->chip.pwms[0];
> int ret;
>
> - pwm_get_state(&atmel->chip.pwms[0], &state);
> -
> /* Re-enable the periph clock it was stopped during suspend. */
> - if (!state.enabled) {
> + if (!pwm->state.enabled) {
> ret = clk_prepare_enable(atmel->hlcdc->periph_clk);
> if (ret)
> return ret;
> }
>
> - return atmel_hlcdc_pwm_apply(&atmel->chip, &atmel->chip.pwms[0],
> - &state);
> + return atmel_hlcdc_pwm_apply(&atmel->chip, pwm, &pwm->state);
> }
>
> static DEFINE_SIMPLE_DEV_PM_OPS(atmel_hlcdc_pwm_pm_ops,
prev parent reply other threads:[~2024-02-03 15:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 11:59 [PATCH 0/2] pwm: atmel-hlcdc: Two improvements Uwe Kleine-König
2024-01-26 12:04 ` [PATCH 1/2] pwm: atmel-hlcdc: Fix clock imbalance related to suspend support Uwe Kleine-König
2024-02-03 15:47 ` claudiu beznea
2024-01-26 12:04 ` [PATCH 2/2] pwm: atmel-hlcdc: Don't use pwm consumer API Uwe Kleine-König
2024-02-03 15:47 ` 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=9e337e19-9aaf-45c4-b2ee-09f77e1680fd@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=alexandre.belloni@bootlin.com \
--cc=bbrezillon@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pwm@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=thierry.reding@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).