From: Takashi Iwai <tiwai@suse.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: alsa-devel@alsa-project.org, kuninori.morimoto.gx@renesas.com
Subject: Re: [PATCH 1/8] ALSA: pcm: add a helper function to constrain mask-type parameters
Date: Thu, 08 Jun 2017 09:35:24 +0200 [thread overview]
Message-ID: <s5hink72apv.wl-tiwai@suse.de> (raw)
In-Reply-To: <41daafb7-8185-9e3e-147b-22710c3ef885@sakamocchi.jp>
On Thu, 08 Jun 2017 09:28:37 +0200,
Takashi Sakamoto wrote:
>
> Hi,
>
> On Jun 8 2017 16:10, Takashi Iwai wrote:
> > On Thu, 08 Jun 2017 01:10:19 +0200,
> > Takashi Sakamoto wrote:
> >>
> >> Application of constraints to mask-type parameters for PCM substream is
> >> done in a call of snd_pcm_hw_refine(), while the function includes much
> >> codes and is not enough friendly to readers.
> >>
> >> This commit splits the codes to a separated function so that readers can
> >> get it easily. I leave desicion into compilers to merge the function into
> >> its callee.
> >>
> >> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> >> ---
> >> sound/core/pcm_native.c | 57 ++++++++++++++++++++++++++++++++-----------------
> >> 1 file changed, 38 insertions(+), 19 deletions(-)
> >>
> >> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> >> index 2bde07a4a87f..b3e8aab3915e 100644
> >> --- a/sound/core/pcm_native.c
> >> +++ b/sound/core/pcm_native.c
> >> ...
> >> + struct snd_mask __maybe_unused old_mask;
> >
> > Do we really need __maybe_unused? Drop it as much as possible.
> > IMO, it can be uglier than ifdef, since you don't know why it's
> > unused. With ifdef, at least, you have an idea about the condition.
>
> In kernel documentation[1], we can see below suggestion.
>
> "20) Conditional Compilation
> ...
> If you have a function or variable which may potentially go unused in a
> particular configuration, and the compiler would warn about its
> definition going unused, mark the definition as __maybe_unused rather
> than wrapping it in a preprocessor conditional. (However, if a
> function or variable *always* goes unused, delete it.)"
>
> I'll follow this.
It doesn't answer my question. Without __maybe_unused in your code,
do you get the compile warning? If yes, why?
Well, I see the usage already in your patch for the tracepoints.
But __maybe_unused is really ugly, and should be avoided as much as
possible.
The text above doesn't recommend to use it blindly. It's the last
resort.
thanks,
Takashi
next prev parent reply other threads:[~2017-06-08 7:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 23:10 [PATCH 0/8] ALSA: pcm: code refactoring for snd_pcm_hw_refine() Takashi Sakamoto
2017-06-07 23:10 ` [PATCH 1/8] ALSA: pcm: add a helper function to constrain mask-type parameters Takashi Sakamoto
2017-06-08 7:10 ` Takashi Iwai
2017-06-08 7:28 ` Takashi Sakamoto
2017-06-08 7:30 ` Takashi Sakamoto
2017-06-08 7:35 ` Takashi Iwai [this message]
2017-06-08 8:35 ` Takashi Sakamoto
2017-06-07 23:10 ` [PATCH 2/8] ALSA: pcm: add a helper function to constrain interval-type parameters Takashi Sakamoto
2017-06-07 23:10 ` [PATCH 3/8] ALSA: pcm: add a helper function to apply parameter rules Takashi Sakamoto
2017-06-07 23:10 ` [PATCH 4/8] ALSA: pcm: use goto statement instead of while statement to reduce indentation Takashi Sakamoto
2017-06-07 23:10 ` [PATCH 5/8] ALSA: pcm: remove function local variable with alternative evaluation Takashi Sakamoto
2017-06-07 23:10 ` [PATCH 6/8] ALSA: pcm: adaption of code formatting Takashi Sakamoto
2017-06-08 7:14 ` Takashi Iwai
2017-06-07 23:10 ` [PATCH 7/8] ALSA: pcm: use helper functions to check whether parameters are determined Takashi Sakamoto
2017-06-07 23:10 ` [PATCH 8/8] ALSA: pcm: add comment about application of rule to PCM parameters Takashi Sakamoto
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=s5hink72apv.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=o-takashi@sakamocchi.jp \
/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