Received: by 2002:a05:6a10:5594:0:0:0:0 with SMTP id ee20csp395838pxb; Mon, 25 Apr 2022 12:11:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXuFD5/QwDtmCQwhotRzEaRP1x6MvzRUYhLlv/wWf9ILsicqCloymDoxq9fwXgqCShc2a4 X-Received: by 2002:a17:907:33c2:b0:6f3:9aff:d532 with SMTP id zk2-20020a17090733c200b006f39affd532mr4880117ejb.394.1650913893169; Mon, 25 Apr 2022 12:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650913893; cv=none; d=google.com; s=arc-20160816; b=g5LJ+dXjPZ6Cs5z05aG/Mgn4tJbiXqYlRp7E5iwXWeqv0doafdsdcBNFUeGQjSo65Q ePvyLbr0hqPdAHhdWgP06f514xeTrflSSjRhrYBKBlW/q94ZNAatVIBTZwrm0yycnU2T JjpJtyLs+dToAEdQpsGo2aBvQb+Btx5p0HOSgjzkeDhkggdUNqJt5/4uzYW12X4ozlf3 FyAAcr8uakcgFT/EXfGzZ/pQTKujExYHJg0CGr/6NWP/sZs98WUnSGx61fRtSgsq1WTa Gd0iHBl3nmicHpsv+iNNnnt/z88LT4GFEsQ+82eceMx1ENn2oRss7Gqed9+5XI0e50bC lDyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=APT2SzKUccZDlrgJMpBFJofzOy6ehNX3NqtJir6PeAk=; b=Hnn27XTuDK/zAftlrwRw+L14jS7LgaRMDufilpCZez+pLH04WgO2HvyAVUlhKW3stY w/7eFC46kGPgnIi0fmvHbmmSUwv67adB3r2zFGl1Zwme/+8Ogb0ZEDScpCcAdKdg1p8V kbxxjsthBJlU8FdiewJJHaAL+28GX2M6FRyOz0ArSjpK8c+eJ6ZYmOtJ+T5VGnB5PsW5 PYbyhS7Xs4KBG1dOX3RwxvCNwxZ8iK2umm3DA6r3zUjpaCFqi/naA+sYTWB3kCvcT8kS vll4iSkzl9cWlyglAoDOMhsfGq9JswRCNdJIDY2rGAD9hdJAL1vu7xesuOHafOwYgycG e1Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GufuiX2x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g39-20020a056402322700b0041d76ccf69asi13119963eda.621.2022.04.25.12.11.08; Mon, 25 Apr 2022 12:11:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GufuiX2x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242986AbiDYPup (ORCPT + 99 others); Mon, 25 Apr 2022 11:50:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240505AbiDYPuo (ORCPT ); Mon, 25 Apr 2022 11:50:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55AED114817 for ; Mon, 25 Apr 2022 08:47:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB72C611B2 for ; Mon, 25 Apr 2022 15:47:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD159C385A9; Mon, 25 Apr 2022 15:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650901659; bh=WdBpjD1yXyhDqEeK8iUgg7PB1JkPjFb/f8Rj8q1+YVA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GufuiX2xN4lpzB8yU5JWUuH6udR+3LpyuyBAxrtcJGeslF/K+R6tnD/rcP4uhYv+S qb91942DVN08p8ZOPuCmLeUO89IYRyTelLeG4q3p0Gfq8M5N8CwN2MISEMv7TZ8TYM xN1hzAsqXkG1QEl0vZs4t46N9n/+ZLW7Kox25LwA= Date: Mon, 25 Apr 2022 17:47:35 +0200 From: Greg Kroah-Hartman To: Ian Cowan Cc: Sven Van Asbroeck , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: fieldbus: remove unnecessary double negation Message-ID: References: <20220425145440.146891-1-ian@linux.cowan.aero> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220425145440.146891-1-ian@linux.cowan.aero> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 25, 2022 at 10:54:40AM -0400, Ian Cowan wrote: > Remove the double negation (!!) from the code since this does nothing > and may create confusion on whether or not those values are negated. > > Signed-off-by: Ian Cowan > --- > drivers/staging/fieldbus/dev_core.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c > index 5aab734606ea..6766b2b13482 100644 > --- a/drivers/staging/fieldbus/dev_core.c > +++ b/drivers/staging/fieldbus/dev_core.c > @@ -28,7 +28,7 @@ static ssize_t online_show(struct device *dev, struct device_attribute *attr, > { > struct fieldbus_dev *fb = dev_get_drvdata(dev); > > - return sprintf(buf, "%d\n", !!fb->online); > + return sprintf(buf, "%d\n", fb->online); > } > static DEVICE_ATTR_RO(online); > > @@ -39,7 +39,7 @@ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, > > if (!fb->enable_get) > return -EINVAL; > - return sprintf(buf, "%d\n", !!fb->enable_get(fb)); > + return sprintf(buf, "%d\n", fb->enable_get(fb)); This is a common pattern to turn any value into a boolean (0/1). The fact that this is a boolean to start with makes this change not affect anything. So you should say that in the changelog, the values are obviously not negated. thanks, greg k-h