From: Andrew Davis <afd@ti.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: Lee Jones <lee@kernel.org>,
Thierry Reding <thierry.reding@kernel.org>,
<linux-pwm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<stable@vger.kernel.org>
Subject: Re: [PATCH v2 4/5] pwm: tiehrpwm: Enable runtime PM before registering PWM chip
Date: Mon, 23 Nov 2026 15:12:46 -0600 [thread overview]
Message-ID: <7788ac2a-1931-48bd-a775-61c818ffa03b@ti.com> (raw)
In-Reply-To: <awSFqWsxExNtTyjf@monoceros>
On 11/23/26 2:43 PM, Uwe Kleine-König wrote:
> [Fixed Thierry's email address, I suspect two of the three @ti addresses
> also don't work, but I don't know a better one for those.]
>
All 3 of the @ti addresses are gone, dropping them (all other than me).
> Hello,
>
> On Mon, Nov 23, 2026 at 11:49:27AM -0600, Andrew Davis wrote:
>> On 11/23/26 1:52 AM, Lee Jones wrote:
>>> ehrpwm_pwm_probe() calls pwmchip_add() before setting driver data and
>>> enabling runtime PM. Because pwmchip_add() immediately exposes the PWM
>>> channels to consumers while runtime PM is still disabled on the
>>> initially RPM_SUSPENDED device, a consumer invoking ehrpwm_pwm_apply()
>>> before pm_runtime_enable() runs causes guard(pm_runtime_active) to fail
>>> with -EACCES without resuming the device and accesses unclocked MMIO
>>> registers.
>>>
>>> Set driver data and enable runtime PM before calling pwmchip_add(),
>>> disable runtime PM on the error path, and disable runtime PM before
>>> unpreparing tbclk in ehrpwm_pwm_remove() to match.
>>
>> To match what?
>
> To match reverse probe order. Pretty common and IMHO the description is
> good enough.
>
>> The core of this change is moving pwmchip_add() after
>> pm_runtime_enable(), but in remove you switch clk and PM unwinding,
>> not pwm and PM unwinding. Both changes here are correct, but the
>> second is not explained in the commit message.
>
> The commit log says about remove "disable runtime PM before unpreparing
> tbclk" that pretty well mentions switch clk and PM unwinding?!
>
But that order was wrong before, and fixing that is unrelated to
the rest of this patch (which is clearly about enabling PM before
registering PWM). It is just mentioned in passing, basically "BTW
fix this unrelated issue while here". Which is fine, just pointing
out this could have been two patches for better logical splitting.
>> Would be better to have a patch before this one that switches clk_prepare(),
>> pm_runtime_enable(), and pwmchip_add() over to their DEVM equivalents. That
>> fixes the remove order issue, and removes the remove() function too.
>> Then this patch can simply move the pwmchip_add to after PM enable without
>> any other actions.
>
> For me the patch is fine, if someone invests the effort to convert to
> devm_* that can be done on top of this change.
>
Fair enough, I'll switch it over after this goes in.
Reviewed-by: Andrew Davis <afd@ti.com>
> Best regards
> Uwe
next prev parent reply other threads:[~2026-11-23 21:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 7:52 [PATCH v2 0/5] pwm: Fix various bugs reported by Sashiko Lee Jones
2026-11-23 7:52 ` [PATCH v2 1/5] pwm: mxs: Return early when disabling and fix error-path clock leak Lee Jones
2026-11-23 7:52 ` [PATCH v2 2/5] pwm: fsl-ftm: Enable ipg_clk around regcache_sync() during resume Lee Jones
2026-11-23 7:52 ` [PATCH v2 3/5] pwm: omap-dmtimer: Propagate get_pwm_status() errors in apply() Lee Jones
2026-11-23 7:52 ` [PATCH v2 4/5] pwm: tiehrpwm: Enable runtime PM before registering PWM chip Lee Jones
2026-11-23 17:49 ` Andrew Davis
2026-11-23 20:43 ` Uwe Kleine-König
2026-11-23 21:12 ` Andrew Davis [this message]
2026-11-23 7:52 ` [PATCH v2 5/5] pwm: img: Unregister PWM chip before disabling runtime PM and clocks Lee Jones
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=7788ac2a-1931-48bd-a775-61c818ffa03b@ti.com \
--to=afd@ti.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=thierry.reding@kernel.org \
--cc=ukleinek@kernel.org \
/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
all inboxes | Powered by JetHome®