[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250821095657.GB19763@nxa18884-linux.ap.freescale.net>
Date: Thu, 21 Aug 2025 17:56:57 +0800
From: Peng Fan <peng.fan@....nxp.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Peng Fan <peng.fan@....com>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Sudeep Holla <sudeep.holla@....com>,
Cristian Marussi <cristian.marussi@....com>, imx@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] firmware: imx: Add stub functions for SCMI MISC API
Hi Arnd,
On Wed, Aug 20, 2025 at 03:55:20PM +0200, Arnd Bergmann wrote:
>On Thu, Aug 7, 2025, at 03:47, Peng Fan wrote:
>> To ensure successful builds when CONFIG_IMX_SCMI_MISC_DRV is not enabled,
>> this patch adds static inline stub implementations for the following
>> functions:
>>
>> - scmi_imx_misc_ctrl_get()
>> - scmi_imx_misc_ctrl_set()
>>
>> These stubs return -EOPNOTSUPP to indicate that the functionality is not
>> supported in the current configuration. This avoids potential build or
>> link errors in code that conditionally calls these functions based on
>> feature availability.
>>
>> Fixes: 540c830212ed ("firmware: imx: remove duplicate scmi_imx_misc_ctrl_get()")
>> Fixes: 0b4f8a68b292 ("firmware: imx: Add i.MX95 MISC driver")
>> Signed-off-by: Peng Fan <peng.fan@....com>
>> ---
>
>I don't think this does what you describe, at least not reliably:
>
>> +#if IS_ENABLED(CONFIG_IMX_SCMI_MISC_DRV)
>> int scmi_imx_misc_ctrl_get(u32 id, u32 *num, u32 *val);
>> int scmi_imx_misc_ctrl_set(u32 id, u32 val);
>> +#else
>> +static inline int scmi_imx_misc_ctrl_get(u32 id, u32 *num, u32 *val)
>> +{
>> + return -EOPNOTSUPP;
>> +}
>
>When a caller of this function is in a built-in driver but the
>IMX_SCMI_MISC_DRV code is in a loadable module, you still
>get a link failure, see 514b2262ade4 ("firmware: arm_scmi:
>Fix i.MX build dependency") for an example.
>
>As you still need the correct Kconfig dependencies, I
>think your patch here is not helpful.
The consumer driver still needs Kconfig dependcies, such as
depends on IMX_SCMI_MISC_DRV || !IMX_SCMI_MISC_DRV
So when IMX_SCMI_MISC_DRV is module built, the consumer driver will
also be module built.
But if IMX_SCMI_MISC_DRV is n, the consumer driver is y, there will be
link error.
The consumer driver is to support platform A and platform B.
Platform A does not require the real API in IMX_SCMI_MISC_DRV.
Platform B requires the real API in IMX_SCMI_MISC_DRV.
So when producing an image for platform A, IMX_SCMI_MISC_DRV could set
to n to make Image smaller. Introducing the stub API is mainly for this
case.
Hope this is clear
Thanks,
Peng
>
> Arnd
>
Powered by blists - more mailing lists