From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754386AbcLTRzq (ORCPT ); Tue, 20 Dec 2016 12:55:46 -0500 Received: from smtprelay0177.hostedemail.com ([216.40.44.177]:44294 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750927AbcLTRzo (ORCPT ); Tue, 20 Dec 2016 12:55:44 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1801:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3871:3872:4321:4605:5007:10004:10400:10848:11026:11232:11658:11914:12043:12294:12296:12438:12740:12760:12895:13069:13311:13357:13439:14180:14181:14659:14721:21060:21080:21433:30012:30054:30060:30070:30091,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,LFtime:2,LUA_SUMMARY:none X-HE-Tag: trees87_4e9fdd730f112 X-Filterd-Recvd-Size: 2214 Message-ID: <1482256538.1984.23.camel@perches.com> Subject: Re: [PATCH] i2c: uniphier[-f]: fix bool logic calculation From: Joe Perches To: Masahiro Yamada , linux-i2c@vger.kernel.org Cc: Linux Kernel Mailing List , linux-arm-kernel , Wolfram Sang Date: Tue, 20 Dec 2016 09:55:38 -0800 In-Reply-To: References: <1476851911-21729-1-git-send-email-yamada.masahiro@socionext.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.1-0ubuntu2 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 On Wed, 2016-12-21 at 01:20 +0900, Masahiro Yamada wrote: > Hi. > > I have not got any comment, but does this seem > a right thing to do? > This code is working, but it should not depend on how "bool" is > typedef'ed, or the bit position of I2C_M_RD. I think bool can be guaranteed to be _Bool. So a change not necessary as the original code has a c90 guarantee of the same result. 6.3.1.2 Boolean type 1 When any scalar value is converted to _Bool, the result is 0 if the value compares equal to 0; otherwise, the result is 1. > 2016-10-19 13:38 GMT+09:00 Masahiro Yamada : [] > > diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c [] > > @@ -309,7 +309,7 @@ static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap, > > struct i2c_msg *msg, bool stop) > > { > > struct uniphier_fi2c_priv *priv = i2c_get_adapdata(adap); > > - bool is_read = msg->flags & I2C_M_RD; > > + bool is_read = !!(msg->flags & I2C_M_RD); > > unsigned long time_left; > > > > dev_dbg(&adap->dev, "%s: addr=0x%02x, len=%d, stop=%d\n",