Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
To: Zhipeng Wang <zhipeng.wang_1@nxp.com>
Cc: "daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
	"tglx@kernel.org" <tglx@kernel.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"chun-hung.wu@mediatek.com" <chun-hung.wu@mediatek.com>,
	"walter.chang@mediatek.com" <walter.chang@mediatek.com>,
	"jstultz@google.com" <jstultz@google.com>,
	"amergnat@baylibre.com" <amergnat@baylibre.com>,
	Aisheng Dong <aisheng.dong@nxp.com>,
	Jindong Yue <jindong.yue@nxp.com>,
	Xuegang Liu <xuegang.liu@nxp.com>,
	Greg Kroah-Hartman <gregkh@google.com>
Subject: Re: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
Date: Wed, 25 Mar 2026 15:42:57 +0100	[thread overview]
Message-ID: <28a09389-9fdf-49d8-84a6-4e68c40b5224@oss.qualcomm.com> (raw)
In-Reply-To: <AS8PR04MB84206959C00CFDC4C85B8BC2EB46A@AS8PR04MB8420.eurprd04.prod.outlook.com>


Hi Zhipeng,

On 3/10/26 09:41, Zhipeng Wang wrote:
>>
>>
>> Hi Zhipeng,
>>
>> On 3/9/26 06:31, Zhipeng Wang wrote:
>>> Hello Daniel,
>>>
>>> I'd be very happy to collaborate on this!
>>
>> Great, let me see if I can cook a patch in the next days
>>
>>> My availability: I can dedicate time to work on this over the next few weeks.
>> I'm happy to help with:
>>>      - Testing the new macros with IMX timer drivers
>>>      - Converting existing drivers as examples
>>>      - Reviewing and testing patches
>>>      - Documentation
>>
>> That's awesome, thanks
>>
>>> My understanding is that, based on your RFC, we should use two macros —
>> TIMER_OF_DECLARE_PDEV and TIMER_OF_DECLARE_PLATFORM_DRIVER.
>>
>> Yes, but also sort out the existing TIMER_OF_DECLARE macro vs MODULE in
>> order to prevent #ifdef MODULE in the drivers
>>
> Hi Daniel,
> 
> Yes, that's our goal.
> 
> I'll test the new macros (TIMER_OF_DECLARE_PLATFORM_DRIVER and
> TIMER_OF_DECLARE_EARLY_PLATFORM_DRIVER) with the IMX timer drivers
> once the patches are available.

I think I have an idea on how to achieve that. That will result in the 
removal of TIMER_OF_DECLARE() when all drivers will be changed to use 
the new macro.

The #ifdef MODULE macro is set when the driver is compiled as a module.

So we can do something like:

#ifdef MODULE

#define TIMER_OF_DECLARE_PDEV(name, compat, data, fn) \
         OF_DECLARE_1_RET(timer_pdev, name, compat, data, fn)


#else

#define TIMER_OF_DECLARE_PDEV(__name, compat, data, fn) \
         OF_DECLARE_1_RET(of_pdev_timer_match_table,
			__name, compat, data, fn)

static struct platform_driver __##__name##_timer_driver = {
         .probe = __##__name##_timer_probe,
         .driver = {
                 .name = name,
                 .of_match_table = of_pdev_timer_match_table,
         },
};
module_platform_driver(__##__name##_timer_driver);

#endif

So we deal with two tables, one for platform device non module and one 
module for modules.

The first one is called by the timer-of init routine. The other one is 
called by the probe function.

The drawback will be the match table will be common to all timer 
drivers. So probe will be a bit slower. May be there is an area of 
optimization here.


  reply	other threads:[~2026-03-25 14:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  8:12 [PATCH v4 0/4] clocksource: Add module support for timer drivers Zhipeng Wang
2026-03-04  8:12 ` [PATCH v4 1/4] clocksource/drivers/mmio: Export clocksource_mmio_init() Zhipeng Wang
2026-03-04  8:12 ` [PATCH v4 2/4] clocksource/drivers/timer-of: Remove __init markings Zhipeng Wang
2026-03-04  8:12 ` [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module Zhipeng Wang
2026-03-04 19:02   ` Daniel Lezcano
2026-03-06  5:46     ` [EXT] " Zhipeng Wang
2026-03-08 19:51       ` Daniel Lezcano
2026-03-09  5:31         ` Zhipeng Wang
2026-03-09  6:14           ` Trilok Soni
2026-03-09  9:38           ` Daniel Lezcano
2026-03-10  8:41             ` Zhipeng Wang
2026-03-25 14:42               ` Daniel Lezcano [this message]
2026-03-26 10:34                 ` Zhipeng Wang
2026-03-04  8:12 ` [PATCH v4 4/4] clocksource/drivers/imx-tpm: Support building imx-tpm driver as module Zhipeng Wang
2026-03-05 13:44   ` kernel test robot

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=28a09389-9fdf-49d8-84a6-4e68c40b5224@oss.qualcomm.com \
    --to=daniel.lezcano@oss.qualcomm.com \
    --cc=aisheng.dong@nxp.com \
    --cc=amergnat@baylibre.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chun-hung.wu@mediatek.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=festevam@gmail.com \
    --cc=gregkh@google.com \
    --cc=imx@lists.linux.dev \
    --cc=jindong.yue@nxp.com \
    --cc=jstultz@google.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=tglx@kernel.org \
    --cc=walter.chang@mediatek.com \
    --cc=xuegang.liu@nxp.com \
    --cc=zhipeng.wang_1@nxp.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