From: David Laight <david.lai...@aculab.com>
Date: Thu, 17 Aug 2017 14:18:29 +0000

> From: Saeed Mahameed
>> Sent: 17 August 2017 14:30
>> To: David S. Miller
>> Cc: netdev@vger.kernel.org; Leon Romanovsky; Or Gerlitz; Saeed Mahameed
>> Subject: [net-next 11/15] net/mlx5e: Properly indent within conditional 
>> statements
>> 
>> From: Or Gerlitz <ogerl...@mellanox.com>
>> 
>> To fix these checkpatch complaints:
>> 
>> WARNING: suspect code indent for conditional statements (8, 24)
>> +       if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
>> [...]
>> +                       return PORT_FIBRE;
>> 
>> Signed-off-by: Or Gerlitz <ogerl...@mellanox.com>
>> Signed-off-by: Saeed Mahameed <sae...@mellanox.com>
>> ---
>>  .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 22 
>> +++++++++++-----------
>>  1 file changed, 11 insertions(+), 11 deletions(-)
>> 
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>> b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>> index a75ac4d11c5b..ed161312a773 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>> @@ -988,23 +988,23 @@ static u8 get_connector_port(u32 eth_proto, u8 
>> connector_type)
>>              return ptys2connector_type[connector_type];
>> 
>>      if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
>> -                     | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
>> -                     | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
>> -                     | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
>> -                    return PORT_FIBRE;
>> +        | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
>> +        | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
>> +        | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
>> +            return PORT_FIBRE;
> 
> Gah, that is why the rules are stupid.
> If anything the continuation lines want indenting a few more bytes.

And in fact, operators should be at the end rather the beginning of lines.
This statement therefore must be formatted like this:

        if (x & (A |
                 B |
                 C |
                 C))

The indentation shows the grouping, therefore each line after the first must
start exactly at the column after the inner openning parenthesis.

Please fix this properly.

Reply via email to