[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <da18cd22-9f9e-4166-8a91-d5b19470c693@bootlin.com>
Date: Fri, 31 Oct 2025 09:33:17 +0100
From: Thomas Richard <thomas.richard@...tlin.com>
To: Nishanth Menon <nm@...com>
Cc: Tero Kristo <kristo@...nel.org>, Santosh Shilimkar <ssantosh@...nel.org>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Gregory CLEMENT <gregory.clement@...tlin.com>,
Richard Genoud <richard.genoud@...tlin.com>, Udit Kumar <u-kumar1@...com>,
Prasanth Mantena <p-mantena@...com>, Abhash Kumar <a-kumar2@...com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] firmware: ti_sci: replace ifdeffery by pm_sleep_ptr()
macro
Hello Nishanth,
On 10/31/25 5:11 AM, Nishanth Menon wrote:
> On 10:35-20251014, Thomas Richard (TI.com) wrote:
>> Using pm_sleep_ptr() macro allows to remove ifdeffery and '__maybe_unused'
>> annotations.
>>
>> Signed-off-by: Thomas Richard (TI.com) <thomas.richard@...tlin.com>
>> ---
>> drivers/firmware/ti_sci.c | 18 ++++++++----------
>> 1 file changed, 8 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
>> index 49fd2ae01055d0f425062147422471f0fd49e4bd..99a2e0e2960f463918950fef8829409ec365ce70 100644
>> --- a/drivers/firmware/ti_sci.c
>> +++ b/drivers/firmware/ti_sci.c
>> @@ -3706,7 +3706,7 @@ static int ti_sci_prepare_system_suspend(struct ti_sci_info *info)
>> }
>> }
>>
>> -static int __maybe_unused ti_sci_suspend(struct device *dev)
>> +static int ti_sci_suspend(struct device *dev)
>> {
>> struct ti_sci_info *info = dev_get_drvdata(dev);
>> struct device *cpu_dev, *cpu_dev_max = NULL;
>> @@ -3746,7 +3746,7 @@ static int __maybe_unused ti_sci_suspend(struct device *dev)
>> return 0;
>> }
>>
>> -static int __maybe_unused ti_sci_suspend_noirq(struct device *dev)
>> +static int ti_sci_suspend_noirq(struct device *dev)
>> {
>> struct ti_sci_info *info = dev_get_drvdata(dev);
>> int ret = 0;
>> @@ -3758,7 +3758,7 @@ static int __maybe_unused ti_sci_suspend_noirq(struct device *dev)
>> return 0;
>> }
>>
>> -static int __maybe_unused ti_sci_resume_noirq(struct device *dev)
>> +static int ti_sci_resume_noirq(struct device *dev)
>> {
>> struct ti_sci_info *info = dev_get_drvdata(dev);
>> int ret = 0;
>> @@ -3780,7 +3780,7 @@ static int __maybe_unused ti_sci_resume_noirq(struct device *dev)
>> return 0;
>> }
>>
>> -static void __maybe_unused ti_sci_pm_complete(struct device *dev)
>> +static void ti_sci_pm_complete(struct device *dev)
>
> PTR_IF when CONFIG_PM_SLEEP is disabled will result in these static
> functions unused, no? should we leave __maybe_unused as is?
PTR_IF is ((cond) ? ptr : NULL)
If CONFIG_PM_SLEEP is disabled, after preprocessor step you will have
.suspend = 0 ? ti_sci_suspend : NULL,
So ti_sci_suspend() is still used. But as the condition is always false,
the compiler can do some optimization by removing ti_sci_suspend().
PTR_IF macro has a great documentation [1] which describes this use case.
[1]
https://elixir.bootlin.com/linux/v6.17.5/source/include/linux/util_macros.h#L85-L136
Best Regards,
Thomas
Powered by blists - more mailing lists