From: "Arnd Bergmann" <arnd@arndb.de>
To: "Alexander Gordeev" <agordeev@linux.ibm.com>,
"Naresh Kamboju" <naresh.kamboju@linaro.org>,
"Russell King" <rmk+kernel@armlinux.org.uk>
Cc: "open list" <linux-kernel@vger.kernel.org>,
Netdev <netdev@vger.kernel.org>,
lkft-triage@lists.linaro.org,
"Linux Regressions" <regressions@lists.linux.dev>,
linux-s390@vger.kernel.org,
"David S . Miller" <davem@davemloft.net>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Jose Abreu" <joabreu@synopsys.com>,
"Benjamin Copeland" <benjamin.copeland@linaro.org>,
"Anders Roxell" <anders.roxell@linaro.org>,
"Dan Carpenter" <dan.carpenter@linaro.org>
Subject: Re: next-20250813 s390 allyesconfig undefined reference to `stmmac_simple_pm_ops'
Date: Tue, 19 Aug 2025 19:35:20 +0200 [thread overview]
Message-ID: <0666e47e-a675-47b6-9b6a-5d4e33f6bf5e@app.fastmail.com> (raw)
In-Reply-To: <20250819160049.4004887A48-agordeev@linux.ibm.com>
On Tue, Aug 19, 2025, at 18:00, Alexander Gordeev wrote:
> On Tue, Aug 19, 2025 at 03:07:56PM +0530, Naresh Kamboju wrote:
> CONFIG_PM is not defined on s390 and as result stmmac_simple_pm_ops ends up
> in _DISCARD_PM_OPS(). The below patch fixes the linking, but it is by no
> means a correct solution:
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index 5769165ee5ba..d475a77e4871 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -668,7 +668,7 @@ static struct pci_driver loongson_dwmac_driver = {
> .probe = loongson_dwmac_probe,
> .remove = loongson_dwmac_remove,
> .driver = {
> - .pm = &stmmac_simple_pm_ops,
> + .pm = &__static_stmmac_simple_pm_ops,
The correct solution is to make the PM_SLEEP versions use this
.pm = pm_sleep_ptr(stmmac_simple_pm_ops),
or the corresponding version for the PM_RUNTIME+PM_SLEEP drivers:
.pm = pm_ptr(stmmac_pltfrm_pm_ops),
By convention, the pm_ptr()/pm_sleep_ptr() macro should be
used for any driver using DEFINE_DEV_PM_OPS() or its variants,
though missing that does not produce a warning for non-exported
options and only wastes a few bytes of .data.
> #define _DISCARD_PM_OPS(name, license, ns) \
> - static __maybe_unused const struct dev_pm_ops __static_##name
> + __maybe_unused const struct dev_pm_ops __static_##name
This would cause a lot of link failures elsewhere, since _DISCARD_PM_OPS
needs to ensure the operations are discarded by the compiler, which does
not happen when they are defined as a global symbol.
The idea of making this a 'static __maybe_unused' symbol is that
the actual functions get discarded as well but don't need an individual
__maybe_unused annotation or an #ifdef around them to prevent a
warning for unused symbols.
Arnd
prev parent reply other threads:[~2025-08-19 17:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 9:37 Naresh Kamboju
2025-08-19 16:00 ` Alexander Gordeev
2025-08-19 17:35 ` Arnd Bergmann [this message]
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=0666e47e-a675-47b6-9b6a-5d4e33f6bf5e@app.fastmail.com \
--to=arnd@arndb.de \
--cc=agordeev@linux.ibm.com \
--cc=alexandre.torgue@foss.st.com \
--cc=anders.roxell@linaro.org \
--cc=benjamin.copeland@linaro.org \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=lkft-triage@lists.linaro.org \
--cc=naresh.kamboju@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=regressions@lists.linux.dev \
--cc=rmk+kernel@armlinux.org.uk \
/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®