LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: linuxarm@huawei.com, mauro.chehab@huawei.com,
Andrey Utkin <andrey_utkin@fastmail.com>,
Anton Sviridenko <anton@corp.bluecherry.net>,
Bluecherry Maintainers <maintainers@bluecherrydvr.com>,
Ismael Luceno <ismael@iodev.co.uk>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH 08/20] media: solo6x10: add _maybe_unused to currently unused functions
Date: Mon, 29 Nov 2021 09:44:06 +0100 [thread overview]
Message-ID: <20211129094406.39904314@coco.lan> (raw)
In-Reply-To: <YaE8aRz1OIJ+x5P5@archlinux-ax161>
Em Fri, 26 Nov 2021 12:58:33 -0700
Nathan Chancellor <nathan@kernel.org> escreveu:
> On Wed, Nov 24, 2021 at 08:13:11PM +0100, Mauro Carvalho Chehab wrote:
> > There are several unused helper macros there, meant to parse some
> > fields.
> >
> > While there's not wrong with that, it generates clang warnings
> > with W=1, causing build to break with CONFIG_WERROR.
> >
> > So, add __maybe_unused to fix such warnings.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
>
> I'll comment on this one patch but my opinion applies for all the
> patches adding '__maybe_unused' to truly unused functions.
>
> I agree with Laurent's comment [1]: unless this code is going to be used
> soon, it should be deleted and resurrected when it is actually needed.
> We have git for a reason and by adding this attribute, you are making it
> harder to catch and eliminate unused functions, as no compiler will
> catch them with an unused attribute (it is possible other static
> analysis tools will but I doubt those are run as frequently as compilers
> with W=1).
In this specific case (and on a few other patches on this series), those
macros are used to document a field. That's why I opted to keep it.
>
> However, you are the maintainer so if you really want to keep these
> around, I would recommend adding '__always_unused' instead of
> '__maybe_unused' for documentation and auditing purposes, even though
> they evaluate to the same thing:
>
> $ rg __always_unused | wc -l
> 337
>
> $ rg __maybe_unused | wc -l
> 4335
Good point. I'll use __always_unused on such patches.
>
> [1]: https://lore.kernel.org/r/YZtpnjPcGxVwhe61@pendragon.ideasonboard.com/
>
> Cheers,
> Nathan
>
> > ---
> >
> > To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> > See [PATCH 00/20] at: https://lore.kernel.org/all/cover.1637781097.git.mchehab+huawei@kernel.org/
> >
> > drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
> > index 0abcad4e84fa..85eaf5d00e9b 100644
> > --- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
> > +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
> > @@ -391,12 +391,12 @@ static int solo_send_desc(struct solo_enc_dev *solo_enc, int skip,
> > }
> >
> > /* Extract values from VOP header - VE_STATUSxx */
> > -static inline int vop_interlaced(const vop_header *vh)
> > +static inline __maybe_unused int vop_interlaced(const vop_header *vh)
> > {
> > return (__le32_to_cpu((*vh)[0]) >> 30) & 1;
> > }
> >
> > -static inline u8 vop_channel(const vop_header *vh)
> > +static inline __maybe_unused u8 vop_channel(const vop_header *vh)
> > {
> > return (__le32_to_cpu((*vh)[0]) >> 24) & 0x1F;
> > }
> > @@ -411,12 +411,12 @@ static inline u32 vop_mpeg_size(const vop_header *vh)
> > return __le32_to_cpu((*vh)[0]) & 0xFFFFF;
> > }
> >
> > -static inline u8 vop_hsize(const vop_header *vh)
> > +static inline u8 __maybe_unused vop_hsize(const vop_header *vh)
> > {
> > return (__le32_to_cpu((*vh)[1]) >> 8) & 0xFF;
> > }
> >
> > -static inline u8 vop_vsize(const vop_header *vh)
> > +static inline u8 __maybe_unused vop_vsize(const vop_header *vh)
> > {
> > return __le32_to_cpu((*vh)[1]) & 0xFF;
> > }
> > @@ -436,12 +436,12 @@ static inline u32 vop_jpeg_size(const vop_header *vh)
> > return __le32_to_cpu((*vh)[4]) & 0xFFFFF;
> > }
> >
> > -static inline u32 vop_sec(const vop_header *vh)
> > +static inline u32 __maybe_unused vop_sec(const vop_header *vh)
> > {
> > return __le32_to_cpu((*vh)[5]);
> > }
> >
> > -static inline u32 vop_usec(const vop_header *vh)
> > +static inline __maybe_unused u32 vop_usec(const vop_header *vh)
> > {
> > return __le32_to_cpu((*vh)[6]);
> > }
> > --
> > 2.33.1
> >
> >
Thanks,
Mauro
next prev parent reply other threads:[~2021-11-29 8:57 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 19:13 [PATCH 00/20] Solve the remaining issues with clang and W=1 on media Mauro Carvalho Chehab
2021-11-24 19:13 ` [PATCH 01/20] media: adv7842: get rid of two unused functions Mauro Carvalho Chehab
2021-11-26 18:54 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 02/20] media: saa7134-go7007: get rid of to_state() function Mauro Carvalho Chehab
2021-11-26 18:55 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 03/20] media: davinci: get rid of an unused function Mauro Carvalho Chehab
2021-11-26 18:56 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 04/20] media: drxd: drop offset var from DownloadMicrocode() Mauro Carvalho Chehab
2021-11-26 18:57 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 05/20] media: drxk: drop operation_mode from set_dvbt() Mauro Carvalho Chehab
2021-11-26 19:02 ` Nathan Chancellor
2021-11-29 8:33 ` [PATCH v2 " Mauro Carvalho Chehab
2021-11-24 19:13 ` [PATCH 06/20] media: m88ds3103: drop reg11 calculus from m88ds3103b_select_mclk() Mauro Carvalho Chehab
2021-11-26 19:40 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 07/20] media: si21xx: report eventual errors at set_frontend Mauro Carvalho Chehab
2021-11-26 19:45 ` Nathan Chancellor
2021-11-29 8:40 ` Mauro Carvalho Chehab
2021-11-24 19:13 ` [PATCH 08/20] media: solo6x10: add _maybe_unused to currently unused functions Mauro Carvalho Chehab
2021-11-25 21:18 ` Ismael Luceno
2021-11-26 19:58 ` Nathan Chancellor
2021-11-29 8:44 ` Mauro Carvalho Chehab [this message]
2021-11-24 19:13 ` [PATCH 09/20] media: si470x: fix printk warnings with clang Mauro Carvalho Chehab
2021-11-26 20:13 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 10/20] media: radio-si476x: drop a container_of() abstraction macro Mauro Carvalho Chehab
2021-11-26 20:14 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 11/20] media: lmedm04: don't ignore errors when setting a filter Mauro Carvalho Chehab
2021-11-26 20:16 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 12/20] media: au0828-i2c: drop a duplicated function Mauro Carvalho Chehab
2021-11-26 20:22 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 13/20] media: adv7604 add _maybe_unused to currently unused functions Mauro Carvalho Chehab
2021-11-24 19:13 ` [PATCH 14/20] media: adv7511: drop " Mauro Carvalho Chehab
2021-11-26 20:27 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 15/20] media: imx290: mark read reg function as __maybe_unused Mauro Carvalho Chehab
2021-11-24 19:13 ` [PATCH 16/20] media: davinci: vpbe_osd: " Mauro Carvalho Chehab
2021-11-24 19:13 ` [PATCH 17/20] media: qcom: camss: " Mauro Carvalho Chehab
2021-11-25 10:58 ` Robert Foss
2021-11-24 19:13 ` [PATCH 18/20] media: mtk-mdp: address a clang warning Mauro Carvalho Chehab
2021-11-24 19:21 ` Arnd Bergmann
2021-11-24 19:13 ` [PATCH 19/20] media: cobalt: drop an unused variable Mauro Carvalho Chehab
2021-11-26 20:29 ` Nathan Chancellor
2021-11-24 19:13 ` [PATCH 20/20] media: mxl5005s: drop some dead code Mauro Carvalho Chehab
2021-11-26 20:30 ` Nathan Chancellor
2021-11-24 19:23 ` [PATCH 00/20] Solve the remaining issues with clang and W=1 on media Arnd Bergmann
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=20211129094406.39904314@coco.lan \
--to=mchehab+huawei@kernel.org \
--cc=andrey_utkin@fastmail.com \
--cc=anton@corp.bluecherry.net \
--cc=ismael@iodev.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=llvm@lists.linux.dev \
--cc=maintainers@bluecherrydvr.com \
--cc=mauro.chehab@huawei.com \
--cc=mchehab@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--subject='Re: [PATCH 08/20] media: solo6x10: add _maybe_unused to currently unused functions' \
/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
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).