* [PATCH] Fix logical-not-parentheses warning
@ 2015-08-02 5:43 Tomer Barletz
2015-08-02 7:10 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Tomer Barletz @ 2015-08-02 5:43 UTC (permalink / raw)
To: clemens, perex, tiwai; +Cc: alsa-devel, linux-kernel, Tomer Barletz
Signed-off-by: Tomer Barletz <barletz@gmail.com>
---
sound/pci/oxygen/oxygen_mixer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 6492bca..4ca1266 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/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;
if (changed) {
chip->dac_mute = !value->value.integer.value[0];
chip->model.update_dac_mute(chip);
--
2.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix logical-not-parentheses warning
2015-08-02 5:43 [PATCH] Fix logical-not-parentheses warning Tomer Barletz
@ 2015-08-02 7:10 ` Takashi Iwai
2015-08-02 9:08 ` Tomer Barletz
0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2015-08-02 7:10 UTC (permalink / raw)
To: Tomer Barletz; +Cc: clemens, perex, alsa-devel, linux-kernel
On Sun, 02 Aug 2015 07:43:22 +0200,
Tomer Barletz wrote:
>
> Signed-off-by: Tomer Barletz <barletz@gmail.com>
This is rather a gcc5 problem that doesn't recognize the expression
correctly. Though, this change make things worse, so I'm willing to
take it. But please give the warning message itself in changelog
to show exactly what is the issue. The subject doesn't enough to
understand why this change is needed.
thanks,
Takashi
> ---
> sound/pci/oxygen/oxygen_mixer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
> index 6492bca..4ca1266 100644
> --- a/sound/pci/oxygen/oxygen_mixer.c
> +++ b/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;
> if (changed) {
> chip->dac_mute = !value->value.integer.value[0];
> chip->model.update_dac_mute(chip);
> --
> 2.4.3
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] Fix logical-not-parentheses warning
2015-08-02 7:10 ` Takashi Iwai
@ 2015-08-02 9:08 ` Tomer Barletz
2015-08-02 14:16 ` Joe Perches
2015-08-03 8:15 ` Takashi Iwai
0 siblings, 2 replies; 5+ messages in thread
From: Tomer Barletz @ 2015-08-02 9:08 UTC (permalink / raw)
To: clemens, perex, tiwai; +Cc: alsa-devel, linux-kernel, Tomer Barletz
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].
Signed-off-by: Tomer Barletz <barletz@gmail.com>
---
sound/pci/oxygen/oxygen_mixer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 6492bca..4ca1266 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/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;
if (changed) {
chip->dac_mute = !value->value.integer.value[0];
chip->model.update_dac_mute(chip);
--
2.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix logical-not-parentheses warning
2015-08-02 9:08 ` Tomer Barletz
@ 2015-08-02 14:16 ` Joe Perches
2015-08-03 8:15 ` Takashi Iwai
1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2015-08-02 14:16 UTC (permalink / raw)
To: Tomer Barletz; +Cc: clemens, perex, tiwai, alsa-devel, linux-kernel
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix logical-not-parentheses warning
2015-08-02 9:08 ` Tomer Barletz
2015-08-02 14:16 ` Joe Perches
@ 2015-08-03 8:15 ` Takashi Iwai
1 sibling, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2015-08-03 8:15 UTC (permalink / raw)
To: Tomer Barletz; +Cc: clemens, perex, alsa-devel, linux-kernel
On Sun, 02 Aug 2015 11:08:57 +0200,
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].
>
> Signed-off-by: Tomer Barletz <barletz@gmail.com>
Applied, thanks.
Takashi
> ---
> sound/pci/oxygen/oxygen_mixer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
> index 6492bca..4ca1266 100644
> --- a/sound/pci/oxygen/oxygen_mixer.c
> +++ b/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;
> if (changed) {
> chip->dac_mute = !value->value.integer.value[0];
> chip->model.update_dac_mute(chip);
> --
> 2.4.3
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-03 8:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-02 5:43 [PATCH] Fix logical-not-parentheses warning Tomer Barletz
2015-08-02 7:10 ` Takashi Iwai
2015-08-02 9:08 ` Tomer Barletz
2015-08-02 14:16 ` Joe Perches
2015-08-03 8:15 ` Takashi Iwai
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).