[PATCH] drm/vc4: hdmi: Fix defined but not used warning
Linus Torvalds
torvalds at linux-foundation.org
Thu Sep 23 09:54:06 PDT 2021
On Thu, Sep 23, 2021 at 8:57 AM Maxime Ripard <maxime at cerno.tech> wrote:
>
> Since we select CONFIG_PM anyway, vc4_hdmi_runtime_suspend() and
> vc4_hdmi_runtime_suspend() will always be used and we can thus always
> assign them in struct dev_pm_ops without using the SET_RUNTIME_PM_OPS
> macro.
This cannot be true.
If CONFIG_PM is always enabled, then the patch is a no-op, and the
warning you quote cannot happen:
warning: 'vc4_hdmi_runtime_suspend' defined but not used [-Wunused-function]
So this patch is very obviously broken, the message is misleading, and
the claims in your commit message cannot _possibly_ be true.
Maxime, this kind of "respond to bug reports with random contents"
most not continue.
You need to actually look at what the reporter is reporting, and think
about the code. Because the above fix is broken, broken, broken.
The way people fix this is by either making the function definitions
be conditional on their uses - so that the compiler removes them
entirely - or mark them as __maybe_unused. Then a smart _linker_ can
actually remove the code if people use the smarter linker options.
But responding with a patch that claims something that clearly isn't
true is not a valid response.
Linus
More information about the linux-arm-kernel
mailing list