From: "Uwe Kleine-König" <ukleinek@kernel.org>
To: Sangyun Kim <sangyun.kim@snu.ac.kr>
Cc: nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com,
claudiu.beznea@tuxon.dev, linux-pwm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] pwm: atmel-tcb: Cache clock rates and mark chip as atomic
Date: Fri, 24 Apr 2026 12:46:00 +0200 [thread overview]
Message-ID: <aetJZzTHd4RBcytw@monoceros> (raw)
In-Reply-To: <20260422044940.tse3ek7jlv3x2dbt@nunu>
[-- Attachment #1: Type: text/plain, Size: 1370 bytes --]
Hello Sangyun,
On Wed, Apr 22, 2026 at 01:49:40PM +0900, Sangyun Kim wrote:
> > On Sun, Apr 19, 2026 at 05:08:38PM +0900, Sangyun Kim wrote:
> > > @@ -438,16 +441,33 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
> > > if (err)
> > > goto err_gclk;
> > >
> > > + err = clk_rate_exclusive_get(tcbpwmc->clk);
> > > + if (err)
> > > + goto err_disable_clk;
> > > +
> > > + err = clk_rate_exclusive_get(tcbpwmc->slow_clk);
> > > + if (err)
> > > + goto err_clk_unlock;
> > > +
> > > + tcbpwmc->rate = clk_get_rate(tcbpwmc->clk);
> > > + tcbpwmc->slow_rate = clk_get_rate(tcbpwmc->slow_clk);
> > > +
> >
> > Only one concern left: clk_get_rate() should only be called on enabled
> > clocks. I don't know the architecture details and how expensive it is to
> > have .clk enabled (or if it's enabled anyhow).
> >
> > If you're ok, I'd squash the following diff into your patch:
>
> That makes sense. clk_get_rate() should indeed only be used on enabled
> clocks, and your change is the simplest way to ensure correctness while
> respecting the clk API constraints. I’m happy with squashing your diff
> into my patch.
Just for the record: I did that, the result is already in Linus' tree
at https://git.kernel.org/linus/68637b68afcc3cb4d56aca14a3a1d1b47b879369
and will be part of v7.1-rc1.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2026-04-24 10:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 9:34 [PATCH] pwm: atmel-tcb: Fix sleeping function called from invalid context Sangyun Kim
2026-04-15 15:12 ` Uwe Kleine-König
2026-04-19 8:08 ` [PATCH v2] pwm: atmel-tcb: Cache clock rates and mark chip as atomic Sangyun Kim
2026-04-21 11:40 ` Uwe Kleine-König
2026-04-22 4:49 ` Sangyun Kim
2026-04-24 10:46 ` Uwe Kleine-König [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=aetJZzTHd4RBcytw@monoceros \
--to=ukleinek@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=sangyun.kim@snu.ac.kr \
/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