linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Christian Lamparter <chunkeey@gmail.com>
Cc: davem@davemloft.net, kuba@kernel.org,
	linux-kernel@vger.kernel.org,
	Christian Lamparter <chunkeey@googlemail.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 08/30] net: wireless: ath: carl9170: Mark 'ar9170_qmap' as __maybe_unused
Date: Mon, 17 Aug 2020 09:43:49 +0100	[thread overview]
Message-ID: <20200817084349.GS4354@dell> (raw)
In-Reply-To: <0a144311-2085-60b5-ea36-554c6efbf7e9@gmail.com>

On Fri, 14 Aug 2020, Christian Lamparter wrote:

> On 2020-08-14 18:40, Lee Jones wrote:
> > On Fri, 14 Aug 2020, Christian Lamparter wrote:
> > 
> > > On 2020-08-14 13:39, Lee Jones wrote:
> > > > 'ar9170_qmap' is used in some source files which include carl9170.h,
> > > > but not all of them.  Mark it as __maybe_unused to show that this is
> > > > not only okay, it's expected.
> > > > 
> > > > Fixes the following W=1 kernel build warning(s)
> > > 
> > > Is this W=1 really a "must" requirement? I find it strange having
> > 
> > Clean W=1 warnings is the dream, yes.
> But is it a requirement?

Depends how you define a requirement.

This is required to successfully and usefully enable W=1 warnings in
our testing builds without being overloaded with current issues.
Something I know a great number of maintainers have been either trying
to do, or at least wanting to do for a long time.

Being able to enable W=1 builds at the subsystem level is extremely
helpful in order to keep the kernel clean(er).  As most subsystems
don't (can't) have them enabled presently (due to being overwhelmed)
they will likely creep/increase.

So far, the following subsystems have been on-board with this (and are
now clean, or very nearly clean, as a result):

 ASoC
 backlight
 cpufreq
 dmaengine
 gpio
 hwmon
 iio
 mfd
 misc
 mmc
 pinctrl
 pwm
 regulator
 remoteproc
 scsi
 spi
 usb
 video

> > I would have thought most Maintainers would be on-board with this.
> From what I know: It's no changes For changes' sake. Because otherwise this
> would be pretty broken for maintainers. They could just write and revert the
> same code over and over to prob up their LOC and commit counter. Wouldn't
> you agree there?

I don't agree at all.  Why would anyone revert a fix?  That act would
be intentionally add a warning?  A fools errand I think.

> > The ones I've worked with thus far have certainly been thankful.  Many
> > had this on their own TODO lists.
> Question is, do you really want to be just the cleanup crew there? Since
> semantic patches came along and a lot of this has been automated.

I'm happy to put in the work.  Most people have been very grateful.

If this work can be automated, than that would be wonderful.  However,
18000 warnings (now down to 15000) tell me that this can not be the
case.

> I'm of course after something else. Like: "Isn't there a better way than
> manually slapping __maybe_unused there to suppress the warning and call it a
> day?" If you already went down these avenues and can confirm that there's no
> alternative than this, then "fine". But if there is a better
> method of doing this, then "let's go with that!".

So for these kinds of issues we have a choice.

In order of preference:

 1. Genuinely unused; remove it
 2. Used in a single location; move it to that location
 3. Used in multiple, but not all locations:
    a. Mark as __maybe_unused
    b. Locate or create a special header file between users
    b. Duplicate it and place it in all used locations

I went for 3a here, as 1 and 2 aren't valid.

> > > __maybe_unused in header files as this "suggests" that the
> > > definition is redundant.
> > 
> > Not true.
> > 
> > If it were redundant then we would remove the line entirely.
> So, why adding __maybe_unused then? I find it not very helpful to
> tell the compiler to "shut up" when you want it's opinion...
> This was the vibe I got from gcc's attribute unused help text.

Effectively, you're telling the compiler that it's not correct in
certain circumstances, like this one.  Here the variable is being
used, but not by all users who share the header file.  In other valid
cases of its use the variable may only be used when a given CONFIG_*
is enabled.

__always_unused however does just tell the compiler to shut-up. :)

If you have any better solutions, other than to let the compiler spout
useless warnings which taint the build log and hide other, more
important issues, then I'd be happy to hear them.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2020-08-17  8:44 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200814113933.1903438-1-lee.jones@linaro.org>
2020-08-14 11:39 ` [PATCH 05/30] net: wireless: atmel: atmel: Demote non-kerneldoc header to standard comment block Lee Jones
2020-08-27 12:16   ` [PATCH 05/30] " Kalle Valo
2020-08-14 11:39 ` [PATCH 07/30] net: wireless: broadcom: b43: main: Add braces around empty statements Lee Jones
2020-08-14 15:12   ` Kalle Valo
2020-08-14 16:43     ` Lee Jones
2020-08-14 17:25       ` Kalle Valo
2020-08-17  8:50         ` Lee Jones
2020-08-27  7:42           ` Kalle Valo
2020-08-27  8:49             ` Lee Jones
2020-08-14 11:39 ` [PATCH 08/30] net: wireless: ath: carl9170: Mark 'ar9170_qmap' as __maybe_unused Lee Jones
2020-08-14 15:14   ` Christian Lamparter
2020-08-14 16:40     ` Lee Jones
2020-08-14 17:25       ` Christian Lamparter
2020-08-17  8:43         ` Lee Jones [this message]
2020-08-17  8:26     ` Rasmus Villemoes
2020-08-17 12:59       ` Kalle Valo
2020-08-17 18:29         ` Christian Lamparter
2020-08-18  9:50         ` Lee Jones
2020-08-27  7:54           ` Kalle Valo
2020-08-27  9:33   ` [PATCH v2 08/30] net: wireless: ath: carl9170: Convert 'ar9170_qmap' to inline function Lee Jones
2020-08-28 20:28     ` Christian Lamparter
2020-08-31 13:56       ` Kalle Valo
2020-08-31 15:19     ` Kalle Valo
2020-08-14 11:39 ` [PATCH 09/30] net: wireless: ath: ath5k: pcu: Add a description for 'band' remove one for 'mode' Lee Jones
2020-08-17 10:20   ` Kalle Valo
2020-08-14 11:39 ` [PATCH 11/30] net: wireless: cisco: airo: Place brackets around empty statement Lee Jones
2020-08-14 11:39 ` [PATCH 12/30] net: wireless: cisco: airo: Fix a myriad of coding style issues Lee Jones
2020-08-14 15:15   ` Kalle Valo
2020-08-14 16:38     ` Lee Jones
2020-08-17 13:27       ` Kalle Valo
2020-08-17 18:27         ` Jesse Brandeburg
2020-08-17 20:04           ` Lee Jones
2020-08-17 21:35           ` Ondrej Zary
2020-08-27  7:49             ` Kalle Valo
2020-08-27 20:23               ` Ondrej Zary
2020-08-28  8:59                 ` Kalle Valo
2020-08-28 10:08                   ` Lee Jones
2020-08-28 12:37                     ` Kalle Valo
2020-08-28 21:34                   ` Ondrej Zary
2020-08-14 11:39 ` [PATCH 13/30] net: wireless: ath: wil6210: cfg80211: Demote non-kerneldoc headers to standard comment blocks Lee Jones
2020-08-14 11:39 ` [PATCH 14/30] net: wireless: intel: iwlegacy: common: Remove set but not used variable 'len' Lee Jones
2020-08-14 11:39 ` [PATCH 15/30] net: wireless: intel: iwlegacy: common: Demote kerneldoc headers to standard comment blocks Lee Jones
2020-08-14 11:39 ` [PATCH 16/30] net: wireless: intel: ipw2200: Remove set but unused variables 'rc' and 'w' Lee Jones
2020-08-14 11:39 ` [PATCH 17/30] net: wireless: broadcom: b43legacy: main: Provide braces around empty 'if' body Lee Jones
2020-08-14 11:39 ` [PATCH 20/30] net: wireless: ath: ath5k: base: Fix kerneldoc formatting issue Lee Jones
2020-08-14 11:39 ` [PATCH 22/30] net: wireless: broadcom: brcm80211: brcmfmac: fweh: Remove set but unused variable 'err' Lee Jones
2020-08-14 11:39 ` [PATCH 23/30] net: wireless: broadcom: brcm80211: brcmfmac: fweh: Fix docrot related function documentation issues Lee Jones
2020-08-14 11:39 ` [PATCH 24/30] net: wireless: broadcom: brcm80211: brcmsmac: mac80211_if: Demote a few non-conformant kerneldoc headers Lee Jones
2020-08-14 11:39 ` [PATCH 25/30] net: wireless: intel: ipw2x00: ipw2200: Demote lots of nonconformant kerneldoc comments Lee Jones
2020-08-14 11:39 ` [PATCH 26/30] net: wireless: broadcom: b43: phy_common: Demote non-conformant kerneldoc header Lee Jones
     [not found]   ` <CAJrvBf00yQQ7F1p1utBuq1oWc2RwnqXijBjaJ+FuxG0mS0TvOA@mail.gmail.com>
2020-08-14 16:36     ` Lee Jones
2020-08-17  8:06   ` Rafał Miłecki
2020-08-17  9:11     ` Lee Jones
2020-08-14 11:39 ` [PATCH 30/30] net: wireless: broadcom: b43: phy_n: Add empty braces around empty statements Lee Jones
     [not found] ` <87eeo88pdr.fsf@tynnyri.adurom.net>
2020-08-17  8:16   ` [PATCH 00/30] Rid W=1 warnings in Networking Lee Jones

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=20200817084349.GS4354@dell \
    --to=lee.jones@linaro.org \
    --cc=chunkeey@gmail.com \
    --cc=chunkeey@googlemail.com \
    --cc=davem@davemloft.net \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).