[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1438524985.1301.26.camel@perches.com>
Date: Sun, 02 Aug 2015 07:16:25 -0700
From: Joe Perches <joe@...ches.com>
To: Tomer Barletz <barletz@...il.com>
Cc: clemens@...isch.de, perex@...ex.cz, tiwai@...e.com,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Fix logical-not-parentheses warning
On Sun, 2015-08-02 at 02:08 -0700, Tomer Barletz wrote:
> This fixes the following warning, that is seen with gcc 5.1:
> warning: logical not is only applied to the left hand side of
> comparison [-Wlogical-not-parentheses].
[]
> diff --git a/sound/pci/oxygen/oxygen_mixer.c
[]
>
@@ -88,7 +88,7 @@ static int dac_mute_put(struct snd_kcontrol *ctl,
> int changed;
>
> mutex_lock(&chip->mutex);
> - changed = !value->value.integer.value[0] != chip->dac_mute;
> + changed = (!value->value.integer.value[0]) != chip->dac_mute;
It seems this is because dac_mute's value is inverted
0 means true, 1 is false.
I think it'd be simpler if dac_mute was converted to a
standard bool (or perhaps renamed to not_muted) and
this test was rewritten.
Using !!value->value.integer.value[0] would also be
more readable and intelligible.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists