From patchwork Sat Jan 7 21:18:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 640214 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 308BBC46467 for ; Sat, 7 Jan 2023 21:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232641AbjAGVl7 (ORCPT ); Sat, 7 Jan 2023 16:41:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232675AbjAGVlv (ORCPT ); Sat, 7 Jan 2023 16:41:51 -0500 Received: from www381.your-server.de (www381.your-server.de [78.46.137.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BD5B30568 for ; Sat, 7 Jan 2023 13:41:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=WijF59gYFE7TyJcWQqc6Jvdfwgsz0L6hxpCmWfBEWw4=; b=gfWBTbNFq/frE6FJ/otkNBgR6h ZxivAsS8b7OMU3Q6Eo46b7AsUasgSxmkDElfCXmFTC2jz/Uysg+LN08dZ+NNGqzvDdiIgrWgDh4fJ USPMNEZrzfhbhMhjf/+FbGNv8JAnkCf09jrzWQoeIRyEAEkJnp4u0J8Zw8yi4W/IYKq3jBdmH2Oz5 b395q18UkU5YoAQGQ69zsw/qr8KU648fcMhaYisaV4KhLH6zBDfnobZokVvcKHIi44ud+CyHTulk4 b6fl4or/b5xxZRnpHbUc+Qhn5FNvvgP2CrC+8XQxS2w/8QUdJ9fxhkXIu4yq4mXpAknNVfAa46QFP o3T+M5ew==; Received: from sslproxy01.your-server.de ([78.46.139.224]) by www381.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pEGb9-000ITr-Uw; Sat, 07 Jan 2023 22:19:27 +0100 Received: from [2604:5500:c0e5:eb00:da5e:d3ff:feff:933b] (helo=lars-desktop.lan) by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pEGb9-000KM5-De; Sat, 07 Jan 2023 22:19:27 +0100 From: Lars-Peter Clausen To: Wolfram Sang Cc: Michal Simek , Shubhrajyoti Datta , linux-i2c@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 3/5] i2c: cadence: Remove redundant expression in if clause Date: Sat, 7 Jan 2023 13:18:12 -0800 Message-Id: <20230107211814.1179438-4-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230107211814.1179438-1-lars@metafoo.de> References: <20230107211814.1179438-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.7/26774/Sat Jan 7 09:54:43 2023) Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org In the mrecv() function the Cadence I2C driver has the following expression in an if clause. ((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) && (id->recv_count <= CDNS_I2C_FIFO_DEPTH)) Earlier in the same function when I2C_M_RECV_LEN is set the recv_count is initialized to a value that is larger than CDNS_I2C_FIFO_DEPTH. This means if the first expression is false the second expression is also false. Checking the first expression is thus redundant and can be removed. This slightly simplifies the logic. Signed-off-by: Lars-Peter Clausen Reviewed-by: Michal Simek --- drivers/i2c/busses/i2c-cadence.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index e2a4cb694cfb..b5d22e7282c2 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -612,9 +612,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) } /* Determine hold_clear based on number of bytes to receive and hold flag */ - if (!id->bus_hold_flag && - ((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) && - (id->recv_count <= CDNS_I2C_FIFO_DEPTH)) { + if (!id->bus_hold_flag && id->recv_count <= CDNS_I2C_FIFO_DEPTH) { if (cdns_i2c_readreg(CDNS_I2C_CR_OFFSET) & CDNS_I2C_CR_HOLD) { hold_clear = true; if (id->quirks & CDNS_I2C_BROKEN_HOLD_BIT)