From: "Markus Schneider-Pargmann" <msp@baylibre.com>
To: "Daniel Lezcano" <daniel.lezcano@linaro.org>,
"Markus Schneider-Pargmann (TI.com)" <msp@baylibre.com>,
"Thomas Gleixner" <tglx@linutronix.de>
Cc: "Vishal Mahaveer" <vishalm@ti.com>,
"Kevin Hilman" <khilman@baylibre.com>,
"Dhruva Gole" <d-gole@ti.com>,
"Sebin Francis" <sebin.francis@ti.com>,
"Kendall Willis" <k-willis@ti.com>,
"Akashdeep Kaur" <a-kaur@ti.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] clocksource/drivers/timer-ti-dm: Add clocksource support
Date: Fri, 30 Jan 2026 16:17:26 +0100 [thread overview]
Message-ID: <DG20V5TR0ZED.2K9YN3YBEPNJE@baylibre.com> (raw)
In-Reply-To: <9563edd5-aa0c-4a43-9a42-15fd34e1c918@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1841 bytes --]
Hi Daniel,
On Tue Jan 20, 2026 at 4:04 PM CET, Daniel Lezcano wrote:
> On 12/16/25 21:03, Markus Schneider-Pargmann (TI.com) wrote:
>> Add support for using the TI Dual-Mode Timer as a clocksource. The
>> driver automatically picks the first timer that is marked as always-on
>> on with the "ti,timer-alwon" property to be the clocksource.
>>
>> The timer can then be used for CPU independent time keeping.
>>
>> Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
>> ---
>
> [ ... ]
>
>> +static int omap_dm_timer_setup_clocksource(struct dmtimer *timer)
>> +{
>> + struct device *dev = &timer->pdev->dev;
>> + struct dmtimer_clocksource *clksrc;
>> + int err;
>> +
>> + __omap_dm_timer_init_regs(timer);
>> +
>> + timer->reserved = 1;
>> +
>> + clksrc = devm_kzalloc(dev, sizeof(*clksrc), GFP_KERNEL);
>> + if (!clksrc)
>> + return -ENOMEM;
>
> [ ... ]
>
>> + clksrc->timer = timer;
>> + timer->clksrc = clksrc;
>
> This is a cyclic dependency which is not desired in general.
>
> I suggest to have struct dmtimer_clocksource containing struct dmtimer timer
Thank you! Not many timers will probably have the clocksource part
setup, so I didn't like to embed struct dmtimer into
dmtimer_clocksource. I could have used different allocation routines in
probe to use either struct dmtimer_clocksource or struct dmtimer
directly depending on the use of clocksource, but I wasn't convinced by
that either.
For the code here I am only having the timer->clksrc pointer to
unregister the clocksource in cleanup. So I found
devm_add_action_or_reset()
which can call the clocksource_unregister and eliminate the need for the
pointer. This is also already used in the timer-nxp-stm.c driver.
So if you are happy with that, I would prefer that solution.
Best
Markus
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]
next prev parent reply other threads:[~2026-01-30 15:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 20:03 [PATCH v2 0/3] clocksource/drivers/timer-ti-dm: Add clocksource and clockevent support Markus Schneider-Pargmann (TI.com)
2025-12-16 20:03 ` [PATCH v2 1/3] clocksource/drivers/timer-ti-dm: Fix property name in comment Markus Schneider-Pargmann (TI.com)
2025-12-16 20:03 ` [PATCH v2 2/3] clocksource/drivers/timer-ti-dm: Add clocksource support Markus Schneider-Pargmann (TI.com)
2026-01-20 15:04 ` Daniel Lezcano
2026-01-30 15:17 ` Markus Schneider-Pargmann [this message]
2025-12-16 20:03 ` [PATCH v2 3/3] clocksource/drivers/timer-ti-dm: Add clockevent support Markus Schneider-Pargmann (TI.com)
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=DG20V5TR0ZED.2K9YN3YBEPNJE@baylibre.com \
--to=msp@baylibre.com \
--cc=a-kaur@ti.com \
--cc=d-gole@ti.com \
--cc=daniel.lezcano@linaro.org \
--cc=k-willis@ti.com \
--cc=khilman@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sebin.francis@ti.com \
--cc=tglx@linutronix.de \
--cc=vishalm@ti.com \
/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®