Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751638AbbHBOQa (ORCPT ); Sun, 2 Aug 2015 10:16:30 -0400 Received: from smtprelay0070.hostedemail.com ([216.40.44.70]:49040 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751535AbbHBOQ3 (ORCPT ); Sun, 2 Aug 2015 10:16:29 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3871:3872:3874:4321:4605:5007:6119:6261:7903:10004:10400:10848:11026:11232:11658:11914:12043:12114:12296:12517:12519:12740:13069:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: hand34_8fb1ec03f281c X-Filterd-Recvd-Size: 1744 Message-ID: <1438524985.1301.26.camel@perches.com> Subject: Re: [PATCH] Fix logical-not-parentheses warning From: Joe Perches To: Tomer Barletz Cc: clemens@ladisch.de, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Date: Sun, 02 Aug 2015 07:16:25 -0700 In-Reply-To: <1438506537-26743-1-git-send-email-barletz@gmail.com> References: <1438506537-26743-1-git-send-email-barletz@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.16.0-fta1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1093 Lines: 30 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/