linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Daniel Vetter <daniel.vetter@intel.com>,
	David Airlie <airlied@linux.ie>,
	linux-rpi-kernel@lists.infradead.org,
	Florian Fainelli <f.fainelli@gmail.com>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH] drm/vc4: hdmi: Fix defined but not used warning
Date: Fri, 24 Sep 2021 10:12:07 +0200	[thread overview]
Message-ID: <20210924081207.uey6f2fc7yj6ypmj@gilmour> (raw)
In-Reply-To: <CAHk-=wgKLVDW+c1G1Q1m7nE9o4oX_XyiOXx5+Yoih06JA4VY7Q@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2284 bytes --]

On Thu, Sep 23, 2021 at 09:54:06AM -0700, Linus Torvalds wrote:
> On Thu, Sep 23, 2021 at 8:57 AM Maxime Ripard <maxime@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.

I guess it could have been worded a bit better.

DRM_VC4 allows compilation through COMPILE_TEST and selects PM. Some
platforms don't define PM at all.

In the latter case, SET_RUNTIME_PM_OPS will be a nop, the functions
won't be used, and we'll get this warning.

> Maxime, this kind of "respond to bug reports with random contents"
> most not continue.

I'm not super familiar with how to deal with those kind of situations,
but it does address the warning on those platforms without affecting the
current operations of the driver. I don't see how it qualifies as
random.

> You need to actually look at what the reporter is reporting, and think
> about the code. Because the above fix is broken, broken, broken.

Like I said, this was a genuine attempt at fixing things. It's clear now
that you don't feel the same way and would prefer some other solution.
That's why we have review in the first place I guess? I fail to see what
that kind of personal comments brings to the discussion though.

> 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.

The initial point of selecting CONFIG_PM was to get rid of the #ifdef,
and for all practical purposes the code will always be used when the
driver will run so __maybe_unused didn't look like a proper solution
either.

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2021-09-24  8:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 15:57 [PATCH] drm/vc4: hdmi: Fix defined but not used warning Maxime Ripard
2021-09-23 16:24 ` Nathan Chancellor
2021-09-23 16:54 ` Linus Torvalds
2021-09-24  8:12   ` Maxime Ripard [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=20210924081207.uey6f2fc7yj6ypmj@gilmour \
    --to=maxime@cerno.tech \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=nathan@kernel.org \
    --cc=nsaenz@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --cc=torvalds@linux-foundation.org \
    --cc=tzimmermann@suse.de \
    /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).