Re: [PATCH v2] i2c: designware: call i2c_dw_read_clear_intrbits_slave() once

From: Jarkko Nikula
Date: Thu Oct 22 2020 - 09:50:19 EST


Hi

On 10/22/20 8:46 AM, Michael Wu wrote:
@@ -217,10 +214,8 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev)
if (!i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED,
&val))
dev_vdbg(dev->dev, "Byte %X acked!", val);
- } else {
+ } else
i2c_slave_event(dev->slave, I2C_SLAVE_STOP, &val);
- stat = i2c_dw_read_clear_intrbits_slave(dev);
- }
Minor nit. Please don't remove braces here since the upper part of if statement has them.

From Documentation/process/coding-style.rst:
"
This does not apply if only one branch of a conditional statement is a single
statement; in the latter case use braces in both branches:

.. code-block:: c

if (condition) {
do_this();
do_that();
} else {
otherwise();
}
"

Otherwise looks good to me.

Jarkko