Re: [RFC] clocksource/drivers/sh_cmt: Always leave device running after probe

From: Wolfram Sang

Date: Mon Oct 13 2025 - 03:22:30 EST


Hi Niklas,

thanks for your work on these timers!

> For non-PREEMPT_RT builds this is not really an issue, but for
> PREEMPT_RT builds where normal spinlocks can sleep this might be an
> issue. Be cautious and always leave the power and clock running after
> probe.

I am not a super-duper PM expert but this sounds pretty reasonable to
me. Only minor comments:

> ret = -ETIMEDOUT;
> - goto err1;
> + return ret;

return -ETIMEDOUT;

> if (!(ch->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE))) {
> - pm_runtime_get_sync(&ch->cmt->pdev->dev);
> ret = sh_cmt_enable(ch);
> }

Curly braces can go.

> if (f && !(ch->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE))) {
> sh_cmt_disable(ch);
> - pm_runtime_put(&ch->cmt->pdev->dev);
> }

ditto.

And I don't if this is a seperate patch or not, but we could simplify
probe a little by using 'clk_prepare_enable()'...

Happy hacking,

Wolfram

Attachment: signature.asc
Description: PGP signature