Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1359223ybi; Sun, 16 Jun 2019 03:15:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOCOg8WhEYFCx7F9seu9EJoj6tR01TIUPwlK5AJJXtbOZenwxyL7TSsJwTUJQm47KGHhry X-Received: by 2002:a62:65c7:: with SMTP id z190mr108874403pfb.73.1560680153024; Sun, 16 Jun 2019 03:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560680153; cv=none; d=google.com; s=arc-20160816; b=uCPAn+GZG37VlSQ7R45cry86x1LPVYgXSGFd53ankrxJ/GoxSho2QdzEzAzlzuA/1b kk//DsdP6qOjIjTvWscbI2JQFkSqRjkBN+qxDU40gSZ+9MtbVkTkDH/1rPCgrgfGnXHd b1DBAFv5DPgE6ntbr2ilL8OcJ69Nmm7sAX4B8jlAMAsZO2MUTs1us3DTiznrJiU1jS6q ePZLuwYn++hbaODMcZ1j53QxDmgOgf3uVG6UDpHA4Jb2ndDIcXjBX3wVXkKYDf0dJDPV BtMmYZ4JzwA4QUeQG2ed142SsnxJXMWLbFokNyV0r8M287UrhrNSSEzJiLTSP6MvDt4i aIsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=0WLX4WW93TmlNS2Dw+jzwKGQtC0MeovgSkOY88M1X6A=; b=i6JQMZwHOC1CzsRZE3SurBaKRdDMr52Aujkbnb7EY5grL7Ts8CvJmt4TUwAJeOt7Wb S79PJq7jwifsHtsEU+nDO1T/SeqeertHGxeKJ8LU5a6P9RtIyfgwngdelGeDAOGgB9Dm F/eoTcwZ2xG/DpcGcO19DJJ3aT8m4jX8WNyTXXsNV94+3jK6iGlOX1p79yV41X77U7or YYA2VlBTKSvixZd6V48sSgdspk6VwLTOfOVV7N9pTVGpL3hxeIn78EATxI8rj8tTxjxZ TOeg1Cy+ckhmMJsAQCif8UqBfmvWmCKSKZ738o1SREjg7jvt2cB97J/Oscf2a3c2jbJb ThKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Je+DETy2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si75996pfl.121.2019.06.16.03.15.37; Sun, 16 Jun 2019 03:15:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Je+DETy2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727082AbfFPKPX (ORCPT + 99 others); Sun, 16 Jun 2019 06:15:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:59280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725766AbfFPKPW (ORCPT ); Sun, 16 Jun 2019 06:15:22 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E50762084A; Sun, 16 Jun 2019 10:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560680122; bh=116gNnnNy/e29WMtBdj5C75Li/l8wNZzUynmTfBEW/A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Je+DETy2uWBpOU5jANMAp8ZiIKDWT6Or26kBfzSkBvcVQxEXT1AKAuEv0Sg4GJ92U bSLcq6Gq2aYZJC3iq7xmeMVUYoeRkE8k3DuSzanaV882kjKhHiN3Utn7L8bJ+K9waL 8X45AtbYgjqFGlcUqxrCW1r9OTiLHSvoUCaqC02Y= Date: Sun, 16 Jun 2019 11:15:16 +0100 From: Jonathan Cameron To: Melissa Wen Cc: Lars-Peter Clausen , Michael Hennerich , Stefan Popa , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , Barry Song <21cnbao@gmail.com>, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com Subject: Re: [PATCH] staging: iio: ad7150: use ternary operating to ensure 0/1 value Message-ID: <20190616111516.1af0d41b@archlinux> In-Reply-To: <20190614165059.7bifufvhxofy6ybu@smtp.gmail.com> References: <20190614165059.7bifufvhxofy6ybu@smtp.gmail.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 14 Jun 2019 13:50:59 -0300 Melissa Wen wrote: > Remove idiom and use ternary operator for consistently trigger 0/1 value > on variable declaration. > > Signed-off-by: Melissa Wen Hi Melissa, In general I would consider this unnecessary churn as, whilst it's no longer a favoured idiom, it is extremely common in the kernel. However, as this is a staging cleanup, fair enough to make it as 'nice as possible'! Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > drivers/staging/iio/cdc/ad7150.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c > index 8234da4b8c65..25598bf124fb 100644 > --- a/drivers/staging/iio/cdc/ad7150.c > +++ b/drivers/staging/iio/cdc/ad7150.c > @@ -350,8 +350,8 @@ static ssize_t ad7150_show_timeout(struct device *dev, > > /* use the event code for consistency reasons */ > int chan = IIO_EVENT_CODE_EXTRACT_CHAN(this_attr->address); > - int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(this_attr->address) > - == IIO_EV_DIR_RISING); > + int rising = (IIO_EVENT_CODE_EXTRACT_DIR(this_attr->address) > + == IIO_EV_DIR_RISING) ? 1 : 0; > > switch (IIO_EVENT_CODE_EXTRACT_TYPE(this_attr->address)) { > case IIO_EV_TYPE_MAG_ADAPTIVE: