From patchwork Tue Sep 15 10:11:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 517786 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B68B314017E for ; Tue, 15 Sep 2015 20:11:22 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752547AbbIOKLV (ORCPT ); Tue, 15 Sep 2015 06:11:21 -0400 Received: from mga09.intel.com ([134.134.136.24]:11971 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752565AbbIOKLU (ORCPT ); Tue, 15 Sep 2015 06:11:20 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 15 Sep 2015 03:11:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,535,1437462000"; d="scan'208";a="789707916" Received: from black.fi.intel.com ([10.237.72.93]) by fmsmga001.fm.intel.com with ESMTP; 15 Sep 2015 03:11:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 00A6BCE; Tue, 15 Sep 2015 13:11:07 +0300 (EEST) From: Andy Shevchenko To: linux-i2c@vger.kernel.org, Wolfram Sang , mika.westerberg@intel.com Cc: Andy Shevchenko Subject: [PATCH 1/1] i2c: core: fix a code to suppress a warning Date: Tue, 15 Sep 2015 13:11:07 +0300 Message-Id: <1442311867-60185-1-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.5.1 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org There is a warning when compiling i2c-core.c drivers/i2c/i2c-core.c:2561:36: warning: dubious: x | !y Fix it by using ternary operator. Signed-off-by: Andy Shevchenko Reviewed-by: Alexander Sverdlin --- drivers/i2c/i2c-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 3a4c54e..d13a8a0 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -2591,7 +2591,7 @@ static u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count) static u8 i2c_smbus_msg_pec(u8 pec, struct i2c_msg *msg) { /* The address will be sent first */ - u8 addr = (msg->addr << 1) | !!(msg->flags & I2C_M_RD); + u8 addr = (msg->addr << 1) | ((msg->flags & I2C_M_RD) ? 1 : 0); pec = i2c_smbus_pec(pec, &addr, 1); /* The data buffer follows */