Re: [PATCH V4] drivers: i2c: tegra: fix checkpatch defects

From: Peter Rosin
Date: Thu Jun 06 2019 - 16:50:10 EST


On 2019-06-06 09:35, Bitan Biswas wrote:
> Fix checkpatch.pl warning(s)/error(s)/check(s) in i2c-tegra.c
>
> Remove redundant BUG_ON calls or replace with WARN_ON_ONCE
> as needed. Replace BUG() with error handling code.
> Define I2C_ERR_UNEXPECTED_STATUS for error handling.
>
> Signed-off-by: Bitan Biswas <bbiswas@xxxxxxxxxx>
> ---
> drivers/i2c/busses/i2c-tegra.c | 67 +++++++++++++++++++++++-------------------
> 1 file changed, 37 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 76b7926..55a5d87 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -78,6 +78,7 @@
> #define I2C_ERR_NO_ACK 0x01
> #define I2C_ERR_ARBITRATION_LOST 0x02
> #define I2C_ERR_UNKNOWN_INTERRUPT 0x04
> +#define I2C_ERR_UNEXPECTED_STATUS 0x08

Use tabs like the the surrounding code. And perhaps convert all
these flags to use the BIT() macro?

>
> #define PACKET_HEADER0_HEADER_SIZE_SHIFT 28
> #define PACKET_HEADER0_PACKET_ID_SHIFT 16
> @@ -112,7 +113,7 @@
> #define I2C_CLKEN_OVERRIDE 0x090
> #define I2C_MST_CORE_CLKEN_OVR BIT(0)
>
> -#define I2C_CONFIG_LOAD_TIMEOUT 1000000
> +#define I2C_CONFIG_LOAD_TMOUT 1000000

Similar to xfer_tm already mentioned by Dmitry; just keep it as
..._TIMEOUT and ignore checkpatch on this issue. Or juggle the
code in some other way to pacify checkpatch. E.g. abbreviate
CONFIG instead? Or something. CONF is way easier to read than
TMOUT IMHO...

Cheers,
Peter