[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e615dc68-31ea-6469-8017-a9886fcc6f6e@redhat.com>
Date: Thu, 29 Oct 2020 17:03:18 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: Coiby Xu <coiby.xu@...il.com>
Cc: Ingo Molnar <mingo@...hat.com>, Darren Hart <dvhart@...radead.org>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Andy Shevchenko <andy@...radead.org>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
"open list:X86 PLATFORM DRIVERS - ARCH"
<platform-driver-x86@...r.kernel.org>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] power: supply: olpc_battery: remove unnecessary
CONFIG_PM_SLEEP
Hi,
On 10/29/20 3:16 PM, Coiby Xu wrote:
> On Thu, Oct 29, 2020 at 12:09:23PM +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 10/29/20 11:59 AM, Coiby Xu wrote:
>>> Hi Hans,
>>>
>>> Thank you for reviewing this patch!
>>>
>>> On Thu, Oct 29, 2020 at 11:04:36AM +0100, Hans de Goede wrote:
>>>> Hi,
>>>>
>>>> On 10/29/20 8:41 AM, Coiby Xu wrote:
>>>>> SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.
>>>>
>>>> No it does not, when CONFIG_PM_SLEEP is not set then the
>>>> SET_SYSTEM_SLEEP_PM_OPS macro which SIMPLE_DEV_PM_OPS uses
>>>> is a no-op, so nothing will reference xo15_sci_resume leading to
>>>> a compiler warning when CONFIG_PM_SLEEP is not set.
>>>>
>>>> You could drop the ifdef and add __maybe_unused to the definition
>>>> of xo15_sci_resume, but that feels like needless churn, best to
>>>> just keep this as is IMHO.
>>>>
>>>
>>> Actually, this is a tree-wide change by some semi-automation scripts.
>>> Thank you for pointing out the issue to prevent me from releasing
>>> another ~150 emails to flood other mailing lists.
>>>
>>> Currently there are 929 drivers has device PM callbacks,
>>>
>>> $ grep -rI "\.pm = &" --include=*.c ./|wc -l
>>> 929
>>>
>>> I put all files having device PM callbacks into four categories
>>> based on weather a file has CONFIG_PM_SLEEP or PM macro like
>>> SET_SYSTEM_SLEEP_PM_OPS, here are the statistics,
>>>  1. have both CONFIG_PM_SLEEP and PM_OPS macro: 213
>>>  2. have CONFIG_PM_SLEEP but no PM_OPS macro: 19
>>>  3. have PM macro but not CONFIG_PM_SLEEP: 347
>>>  4. no PM macro or CONFIG_PM_SLEEP: 302
>>>
>>> Some drivers which have PM macro but not CONFIG_PM_SLEEP like
>>> sound/x86/intel_hdmi_audio.c indeed use __maybe_unused to eliminate
>>> the compiling warning. In 2011, there's a patch proposing to remove
>>> ONFIG_PM altogether but an objection was turning CONFIG_PM on would
>>> increase the kernel size [1]. So __maybe_unused also have this issue.
>>
>> I would expect the compiler to remove the unused function, it knows
>> it is unused, that is why __maybe_unused is necessary to suppress
>> the warning and compilers are pretty smart and agressive wrt remove
>> unnecessary code these days.
>>
> Then __maybe_unused is a good solution and there's also convincing
> reason to prefer __maybe_unused over CONFIG_PM_SLEEP according to
> Arnd Bergmann [2],
Ok, I would be happy to merge a patch for this which drops the #ifdef-s
and adds a __maybe_unused.
Regards,
Hans
Powered by blists - more mailing lists