Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp314483ybd; Sat, 22 Jun 2019 03:59:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFEeP31tcjDJ6Oauqev/qUAGBLVuje3TOZbrmPXTtNwqlNssR9A96QhissZct6XuPbK+Gr X-Received: by 2002:a63:18d:: with SMTP id 135mr11288285pgb.62.1561201165653; Sat, 22 Jun 2019 03:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561201165; cv=none; d=google.com; s=arc-20160816; b=usVMzFJ7onVxqR01dlH+mhm1GOsoXWNd781ysflb485llcYGNvAdebx4/flmFyid0k CyIEhkO3AQTrgdiXi04i/ajXq4UH6AoNbQkvABc3vXrWVe1vm3iCpVgTR4J/IjwxQF++ 2oo8ijL0oJiijpw7Jtoxjv+0frvUC7trhVbrzQg7eCU+poN7BHLCxDiE4v9SXC0cL1Am qmtZFSgLgdzYJjISpPI0jqUojDlmPybc8jqt49L/0UEhIu0wJxsAFW5T0vAWXfx1Opys unCgiu1zZi9N80HHaEaMbtLz7O8VeaJzC3AKL20kLTmVY9FzLWQY9hHeVPaqxWBQlnfE J6EQ== 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=PhKZBUTr2j77NO33fDADUjRIsyGcwD86ZhDfmu9CR8s=; b=of0zErAWo9W8QS6efyZsMrGioLUB9sKEFxGePSC2SstZMeyp1iAxRilTAwMpDjb9VG eCtMGZxMd2E3b/NQOasOpAnFRxctfR85dq3P59egUtVFL+yApUgshbZn9Db4Oe3o2sU3 dgMDEuZFvwzmPX+LHsMlMKIpiOEqZhTBhdtyow5JUJM+zbWk37KuahxwPgWvh0X9DGBv T+q4Y3zvlY4HosCCroRiVt1khkOyIAiw8P5R4UPjgPaUlFbuhgXnSvmJyyOxwGUhSigR 0CSBJJimxMyso2ax/HgEjxaMIDsInU1c3+lNi0lwmho692A0aFG3rAUf15tceYCg4rD3 Hdig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JflgTq93; 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 d12si5157738pla.121.2019.06.22.03.59.09; Sat, 22 Jun 2019 03:59:25 -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=JflgTq93; 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 S1726333AbfFVK7F (ORCPT + 99 others); Sat, 22 Jun 2019 06:59:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:56330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbfFVK7F (ORCPT ); Sat, 22 Jun 2019 06:59:05 -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 90F2E2070B; Sat, 22 Jun 2019 10:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561201144; bh=xCov3n+vVgxiEJrOvTFgrxXtp1jxZHWTifXs1Kued78=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JflgTq93DHvJsBs9KZsE4pfr6HhNO5f5igz5LyQ9l83Ad+iYEKNHNWkA56EYQkSxy XnK7Ud++qZ3+eHf+5ehYJ5m2ph4BkeOLwqG4lYnipWQaOAVFIzePGg7bNSdAYsZ28b W/cKvQq72CDGjwZPGvhL5oJVCaHsuK/YNYE0l41g= Date: Sat, 22 Jun 2019 11:58:58 +0100 From: Jonathan Cameron To: Dan Carpenter Cc: Melissa Wen , devel@driverdev.osuosl.org, Lars-Peter Clausen , Stefan Popa , Michael Hennerich , linux-iio@vger.kernel.org, Greg Kroah-Hartman , Barry Song <21cnbao@gmail.com>, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com, Peter Meerwald-Stadler , Hartmut Knaack Subject: Re: [PATCH] staging: iio: ad7150: use ternary operating to ensure 0/1 value Message-ID: <20190622115858.21ceef2d@archlinux> In-Reply-To: <20190617084033.GG28859@kadam> References: <20190614165059.7bifufvhxofy6ybu@smtp.gmail.com> <20190616111516.1af0d41b@archlinux> <20190617084033.GG28859@kadam> 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 Mon, 17 Jun 2019 11:40:34 +0300 Dan Carpenter wrote: > On Sun, Jun 16, 2019 at 11:15:16AM +0100, Jonathan Cameron wrote: > > 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. > > It's still my favourite... Why wouldn't people like it? It feels like > last week I just saw someone send a bunch of: > > - foo = (bar == baz) ? 1 : 0; > + foo = (bar == baz); > > patches and I thought it was an improvement at the time... That one is nice enough, it's the !! that Linus came out fairly strongly against though not sure I can find the particular email. That one is a fairly kernel specific idiom that I'll be honest I've rarely seen elsewhere ;) I remember wincing at the thread on this as it was an idiom I personally rather liked. In cases where it doesn't matter because foo doesn't need to 1 or 0 then what you have is nice and clean. I can't say it's one I care that much about, but I am happy if code that happens to be under cleanup anyway has this little bit made the 'preferred style'. There is something to said for consistency. Jonathan > > regards, > dan carpenter >