linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Coiby Xu <coiby.xu@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	Andy Shevchenko <andy@kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/9] mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP
Date: Fri, 30 Oct 2020 22:22:42 +0800	[thread overview]
Message-ID: <20201030142242.r4jqhvtzh7hnahuv@Rk> (raw)
In-Reply-To: <CAHp75Vd6dV18x9BLOSSEqL-nVSRhAEc9zQCyOJF7P7tur86BDA@mail.gmail.com>

On Thu, Oct 29, 2020 at 07:04:44PM +0200, Andy Shevchenko wrote:
>On Thu, Oct 29, 2020 at 5:27 PM Lee Jones <lee.jones@linaro.org> wrote:
>> On Thu, 29 Oct 2020, Coiby Xu wrote:
>> > On Thu, Oct 29, 2020 at 01:00:29PM +0200, Andy Shevchenko wrote:
>> > > On Thu, Oct 29, 2020 at 06:06:41PM +0800, Coiby Xu wrote:
>> > > > SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.
>> > >
>> > > Have you compiled this with
>> > >     % make W=1 ...
>> > > ?
>> > >
>> >
>> > Sorry my bad. I thought I had run "make modules" with CONFIG_PM_SLEEP
>> > disabled. I'll run "make W=1 M=..." for each driver after adding
>> > __maybe_unused in v2.
>>
>> No, thank you.  Just keep it as it is.
>>
>> The current code is space saving.
>
>Perhaps you need to go thru __maybe_unused handling.
>There are pros and cons of each approach, but not above.
>
Can you elaborate on the pros and cons of each approach? There's
convincing reason to prefer __maybe_unused over CONFIG_PM_SLEEP
according to Arnd Bergmann [1],

> > By and large, drivers handle this by using a CONFIG_PM_SLEEP ifdef.
> >
> > Unless you can make an extremely convincing argument why not to do
> > so here, I'd like you to handle it that way instead.
>
> [adding linux-pm to Cc]
>
> The main reason is that everyone gets the #ifdef wrong, I run into
> half a dozen new build regressions with linux-next every week on
> average, the typical problems being:
>
> - testing CONFIG_PM_SLEEP instead of CONFIG_PM, leading to an unused
>   function warning
> - testing CONFIG_PM instead of CONFIG_PM_SLEEP, leading to a build
>   failure
> - calling a function outside of the #ifdef only from inside an
>   otherwise correct #ifdef, again leading to an unused function
>   warning
> - causing a warning inside of the #ifdef but only testing if that
>   is disabled, leading to a problem if the macro is set (this is
>   rare these days for CONFIG_PM as that is normally enabled)
>
> Using __maybe_unused avoids all of the above.

You option is valuable to me because I'm making a tree-wide change.

Currently there are 929 drivers having 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

[1] https://lore.kernel.org/patchwork/comment/919944/

>--
>With Best Regards,
>Andy Shevchenko

--
Best regards,
Coiby

  reply	other threads:[~2020-10-30 14:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 10:06 [PATCH 1/9] mfd: maxim: remove unnecessary CONFIG_PM_SLEEP Coiby Xu
2020-10-29 10:06 ` [PATCH 2/9] mfd: motorola-cpcap: " Coiby Xu
2020-10-29 10:06 ` [PATCH 3/9] mfd: intel_soc_pmic: " Coiby Xu
2020-10-29 11:00   ` Andy Shevchenko
2020-10-29 14:29     ` Coiby Xu
2020-10-29 15:27       ` Lee Jones
2020-10-29 17:04         ` Andy Shevchenko
2020-10-30 14:22           ` Coiby Xu [this message]
2020-10-30 14:34             ` Andy Shevchenko
2020-11-02  8:39           ` Lee Jones
2020-11-02 10:26             ` Andy Shevchenko
2020-11-02 10:51               ` Lee Jones
2020-10-29 10:06 ` [PATCH 4/9] mfd: max77620: " Coiby Xu
2020-10-29 10:06 ` [PATCH 5/9] mfd: stpmic1: " Coiby Xu
2020-10-29 10:06 ` [PATCH 6/9] mfd: stmfx: " Coiby Xu
2020-10-29 22:36   ` kernel test robot
2020-10-29 10:06 ` [PATCH 7/9] mfd: sec: " Coiby Xu
2020-10-29 10:06 ` [PATCH 8/9] mfd: max14577: " Coiby Xu
2020-10-29 10:06 ` [PATCH 9/9] mfd: sprd-sc27xx-spi: " Coiby Xu
2020-10-30  4:02   ` Chunyan Zhang
2020-10-30 14:53     ` Coiby Xu
2020-10-29 18:32 ` [PATCH 1/9] mfd: maxim: " Krzysztof Kozlowski
2020-10-30 15:01   ` Coiby Xu

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=20201030142242.r4jqhvtzh7hnahuv@Rk \
    --to=coiby.xu@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).