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

From: Niklas Söderlund

Date: Mon Oct 13 2025 - 03:32:13 EST


Hi Wolfram,

On 2025-10-13 09:22:17 +0200, Wolfram Sang wrote:
> 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;

Wops, indeed. Thanks for spotting it. Will wait for feedback on the
general idea and fix this in v2.

>
> > 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()'...

This is a good idea, I would prefer to it in a separate patch. I'm
always a bit scared touching this driver and making finding issues with
bisect easier is always a good idea :-)

>
> Happy hacking,
>
> Wolfram
>



--
Kind Regards,
Niklas Söderlund