Commit a4a1a78e authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Wolfram Sang

i2c: cadence: Remove redundant expression in if clause

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: default avatarLars-Peter Clausen <lars@metafoo.de>
Reviewed-by: default avatarMichal Simek <michal.simek@amd.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 22649972
...@@ -612,9 +612,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) ...@@ -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 */ /* Determine hold_clear based on number of bytes to receive and hold flag */
if (!id->bus_hold_flag && if (!id->bus_hold_flag && id->recv_count <= CDNS_I2C_FIFO_DEPTH) {
((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) &&
(id->recv_count <= CDNS_I2C_FIFO_DEPTH)) {
if (cdns_i2c_readreg(CDNS_I2C_CR_OFFSET) & CDNS_I2C_CR_HOLD) { if (cdns_i2c_readreg(CDNS_I2C_CR_OFFSET) & CDNS_I2C_CR_HOLD) {
hold_clear = true; hold_clear = true;
if (id->quirks & CDNS_I2C_BROKEN_HOLD_BIT) if (id->quirks & CDNS_I2C_BROKEN_HOLD_BIT)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment