Re: [PATCH v3 3/3] memory: Add Broadcom STB memory controller driver
From: Krzysztof Kozlowski
Date: Tue Aug 16 2022 - 05:15:56 EST
On Sat, 13 Aug 2022 at 01:23, Florian Fainelli <f.fainelli@xxxxxxxxx> wrote:
>
> On 8/12/22 11:41, Krzysztof Kozlowski wrote:
> > On 12/08/2022 20:52, Florian Fainelli wrote:
> >
> >>>> unless you also implied enclosing those functions under an #if
> >>>> IS_ENABLED(CONFIG_PM) or something which is IMHO less preferable.
> >>>
> >>> Are you sure you added also pm_ptr()? I don't see such warnings with W=1
> >>> and final object does not have the functions (for a different driver but
> >>> same principle).
> >>
> >> Yes I am sure I added pm_ptr() see the v4 I just submitted. I don't see
> >> how the compiler cannot warn about the functions being unused the day
> >> they stop being referenced by the pm_ops structure which is eliminated?
> >
> > I don't have the answer how it exactly works (or which gcc version
> > introduced it), but I tested it and the functions were not present in
> > the object file, thus of course no warnings.
> >
> > The driver change I am referring to is:
> > https://lore.kernel.org/all/20220808174107.38676-15-paul@xxxxxxxxxxxxxxx/
> >
> > I think the only difference against your v4 is:
> > DEFINE_SIMPLE_DEV_PM_OPS
> > and lack of __maybe_unused on the functions.
> >
> > The DEFINE_SIMPLE_DEV_PM_OPS itself adds __maybe_unused for !CONFIG_PM
> > case, but I don't think it is relevant.
>
> It definitively is relevant here. SIMPLE_DEV_PM_OPS without
> __maybe_unused results in the following pre-processed code:
>
What I was referring to is "__maybe_unused" is not relevant here. The
DEFINE_SIMPLE_DEV_PM_OPS (with pm_ptr()) are the change you need.
Best regards,
Krzysztof