From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Cassel <cassel@kernel.org>
Cc: Raphael Gallais-Pou <rgallaispou@gmail.com>,
Patrice Chotard <patrice.chotard@foss.st.com>,
linux-arm-kernel@lists.infradead.org, linux-ide@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ahci: st: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
Date: Fri, 10 Jan 2025 21:02:50 +0900 [thread overview]
Message-ID: <cfecaa65-f6bc-48c1-9295-9bfe18f13db3@kernel.org> (raw)
In-Reply-To: <Z4EDKUb+hO0ovV2i@x1-carbon>
On 1/10/25 20:23, Niklas Cassel wrote:
>>> -#ifdef CONFIG_PM_SLEEP
>>> static int st_ahci_suspend(struct device *dev)
>>> {
>>> struct ata_host *host = dev_get_drvdata(dev);
>>> @@ -221,9 +220,8 @@ static int st_ahci_resume(struct device *dev)
>>>
>>> return ahci_platform_resume_host(dev);
>>> }
>>> -#endif
>>
>> I do not think you can remove the ifdef here. Otherwise, there is going to be a
>> compilation warning when CONFIG_PM_SLEEP is not enabled. No ?
>
> Look at the pm_sleep_ptr macro:
> include/linux/pm.h:#define pm_sleep_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM_SLEEP), (_ptr))
>
> I would expect the function should be optimized out by the compiler
> using dead code elimination.
Indeed. Just tried and no warning. I was expecting a "defined but not used"
warning, but none showed up. So all good.
> Raphael, perhaps you could show the before and after output
> using ./scripts/bloat-o-meter ?
> (When the config is not enabled: before and after your patch.)
No need to do that I guess. But there are 17 other ata driver that set .pm
operations. What about these ? Don't they need the same treatment as ahci_st ?
15 of these also use SIMPLE_DEV_PM_OPS() which can be replaced with
DEFINE_SIMPLE_DEV_PM_OPS() also, no ?
Do you want us to do that cleanup ? (fine with me).
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2025-01-10 12:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 17:54 Raphael Gallais-Pou
2025-01-10 5:19 ` Damien Le Moal
2025-01-10 11:23 ` Niklas Cassel
2025-01-10 12:02 ` Damien Le Moal [this message]
2025-01-13 20:28 ` Raphaël Gallais-Pou
2025-01-14 0:59 ` Damien Le Moal
2025-01-15 8:28 ` Raphaël Gallais-Pou
2025-01-15 10:44 ` Niklas Cassel
2025-01-10 11:20 ` Niklas Cassel
2025-01-15 14:23 ` Niklas Cassel
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=cfecaa65-f6bc-48c1-9295-9bfe18f13db3@kernel.org \
--to=dlemoal@kernel.org \
--cc=cassel@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patrice.chotard@foss.st.com \
--cc=rgallaispou@gmail.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
all inboxes | Powered by JetHome®