diff mbox series

[11/22] rdmavt: Replace comments with C99 initializers

Message ID 20220326165909.506926-11-benni@stuerz.xyz (mailing list archive)
State New, archived
Headers show
Series [01/22] orion5x: Replace comments with C99 initializers | expand

Commit Message

Benjamin Stürz March 26, 2022, 4:58 p.m. UTC
This replaces comments with C99's designated
initializers because the kernel supports them now.

Signed-off-by: Benjamin Stürz <benni@stuerz.xyz>
---
 drivers/infiniband/sw/rdmavt/rc.c | 62 +++++++++++++++----------------
 1 file changed, 31 insertions(+), 31 deletions(-)

Comments

Leon Romanovsky March 27, 2022, 7:04 a.m. UTC | #1
On Sat, Mar 26, 2022 at 05:58:58PM +0100, Benjamin Stürz wrote:
> This replaces comments with C99's designated
> initializers because the kernel supports them now.
> 
> Signed-off-by: Benjamin Stürz <benni@stuerz.xyz>
> ---
>  drivers/infiniband/sw/rdmavt/rc.c | 62 +++++++++++++++----------------
>  1 file changed, 31 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rdmavt/rc.c b/drivers/infiniband/sw/rdmavt/rc.c
> index 4e5d4a27633c..121b8a23ac07 100644
> --- a/drivers/infiniband/sw/rdmavt/rc.c
> +++ b/drivers/infiniband/sw/rdmavt/rc.c
> @@ -10,37 +10,37 @@
>   * Convert the AETH credit code into the number of credits.
>   */
>  static const u16 credit_table[31] = {
> -	0,                      /* 0 */
> -	1,                      /* 1 */
> -	2,                      /* 2 */
> -	3,                      /* 3 */
> -	4,                      /* 4 */
> -	6,                      /* 5 */
> -	8,                      /* 6 */
> -	12,                     /* 7 */
> -	16,                     /* 8 */
> -	24,                     /* 9 */
> -	32,                     /* A */
> -	48,                     /* B */
> -	64,                     /* C */
> -	96,                     /* D */
> -	128,                    /* E */
> -	192,                    /* F */
> -	256,                    /* 10 */
> -	384,                    /* 11 */
> -	512,                    /* 12 */
> -	768,                    /* 13 */
> -	1024,                   /* 14 */
> -	1536,                   /* 15 */
> -	2048,                   /* 16 */
> -	3072,                   /* 17 */
> -	4096,                   /* 18 */
> -	6144,                   /* 19 */
> -	8192,                   /* 1A */
> -	12288,                  /* 1B */
> -	16384,                  /* 1C */
> -	24576,                  /* 1D */
> -	32768                   /* 1E */
> +	[0x00] = 0,
> +	[0x01] = 1,
> +	[0x02] = 2,
> +	[0x03] = 3,
> +	[0x04] = 4,
> +	[0x05] = 6,
> +	[0x06] = 8,
> +	[0x07] = 12,
> +	[0x08] = 16,
> +	[0x09] = 24,
> +	[0x0A] = 32,
> +	[0x0B] = 48,
> +	[0x0C] = 64,
> +	[0x0D] = 96,
> +	[0x0E] = 128,
> +	[0x0F] = 192,
> +	[0x10] = 256,
> +	[0x11] = 384,
> +	[0x12] = 512,
> +	[0x13] = 768,
> +	[0x14] = 1024,
> +	[0x15] = 1536,
> +	[0x16] = 2048,
> +	[0x17] = 3072,
> +	[0x18] = 4096,
> +	[0x19] = 6144,
> +	[0x1A] = 8192,
> +	[0x1B] = 12288,
> +	[0x1C] = 16384,
> +	[0x1D] = 24576,
> +	[0x1E] = 32768
>  };

I have hard time to see any value in this commit, why is this change needed?

Thanks

>  
>  /**
> -- 
> 2.35.1
> 
>
Dennis Dalessandro March 31, 2022, 5:41 p.m. UTC | #2
On 3/27/22 3:04 AM, Leon Romanovsky wrote:
> On Sat, Mar 26, 2022 at 05:58:58PM +0100, Benjamin Stürz wrote:
>> This replaces comments with C99's designated
>> initializers because the kernel supports them now.
>>
>> Signed-off-by: Benjamin Stürz <benni@stuerz.xyz>
>> ---
>>  drivers/infiniband/sw/rdmavt/rc.c | 62 +++++++++++++++----------------
>>  1 file changed, 31 insertions(+), 31 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/rdmavt/rc.c b/drivers/infiniband/sw/rdmavt/rc.c
>> index 4e5d4a27633c..121b8a23ac07 100644
>> --- a/drivers/infiniband/sw/rdmavt/rc.c
>> +++ b/drivers/infiniband/sw/rdmavt/rc.c
>> @@ -10,37 +10,37 @@
>>   * Convert the AETH credit code into the number of credits.
>>   */
>>  static const u16 credit_table[31] = {
>> -	0,                      /* 0 */
>> -	1,                      /* 1 */
>> -	2,                      /* 2 */
>> -	3,                      /* 3 */
>> -	4,                      /* 4 */
>> -	6,                      /* 5 */
>> -	8,                      /* 6 */
>> -	12,                     /* 7 */
>> -	16,                     /* 8 */
>> -	24,                     /* 9 */
>> -	32,                     /* A */
>> -	48,                     /* B */
>> -	64,                     /* C */
>> -	96,                     /* D */
>> -	128,                    /* E */
>> -	192,                    /* F */
>> -	256,                    /* 10 */
>> -	384,                    /* 11 */
>> -	512,                    /* 12 */
>> -	768,                    /* 13 */
>> -	1024,                   /* 14 */
>> -	1536,                   /* 15 */
>> -	2048,                   /* 16 */
>> -	3072,                   /* 17 */
>> -	4096,                   /* 18 */
>> -	6144,                   /* 19 */
>> -	8192,                   /* 1A */
>> -	12288,                  /* 1B */
>> -	16384,                  /* 1C */
>> -	24576,                  /* 1D */
>> -	32768                   /* 1E */
>> +	[0x00] = 0,
>> +	[0x01] = 1,
>> +	[0x02] = 2,
>> +	[0x03] = 3,
>> +	[0x04] = 4,
>> +	[0x05] = 6,
>> +	[0x06] = 8,
>> +	[0x07] = 12,
>> +	[0x08] = 16,
>> +	[0x09] = 24,
>> +	[0x0A] = 32,
>> +	[0x0B] = 48,
>> +	[0x0C] = 64,
>> +	[0x0D] = 96,
>> +	[0x0E] = 128,
>> +	[0x0F] = 192,
>> +	[0x10] = 256,
>> +	[0x11] = 384,
>> +	[0x12] = 512,
>> +	[0x13] = 768,
>> +	[0x14] = 1024,
>> +	[0x15] = 1536,
>> +	[0x16] = 2048,
>> +	[0x17] = 3072,
>> +	[0x18] = 4096,
>> +	[0x19] = 6144,
>> +	[0x1A] = 8192,
>> +	[0x1B] = 12288,
>> +	[0x1C] = 16384,
>> +	[0x1D] = 24576,
>> +	[0x1E] = 32768
>>  };
> 
> I have hard time to see any value in this commit, why is this change needed?
> 

I tend to agree. This doesn't really improve things. It's a NAK from me.

-Denny
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rdmavt/rc.c b/drivers/infiniband/sw/rdmavt/rc.c
index 4e5d4a27633c..121b8a23ac07 100644
--- a/drivers/infiniband/sw/rdmavt/rc.c
+++ b/drivers/infiniband/sw/rdmavt/rc.c
@@ -10,37 +10,37 @@ 
  * Convert the AETH credit code into the number of credits.
  */
 static const u16 credit_table[31] = {
-	0,                      /* 0 */
-	1,                      /* 1 */
-	2,                      /* 2 */
-	3,                      /* 3 */
-	4,                      /* 4 */
-	6,                      /* 5 */
-	8,                      /* 6 */
-	12,                     /* 7 */
-	16,                     /* 8 */
-	24,                     /* 9 */
-	32,                     /* A */
-	48,                     /* B */
-	64,                     /* C */
-	96,                     /* D */
-	128,                    /* E */
-	192,                    /* F */
-	256,                    /* 10 */
-	384,                    /* 11 */
-	512,                    /* 12 */
-	768,                    /* 13 */
-	1024,                   /* 14 */
-	1536,                   /* 15 */
-	2048,                   /* 16 */
-	3072,                   /* 17 */
-	4096,                   /* 18 */
-	6144,                   /* 19 */
-	8192,                   /* 1A */
-	12288,                  /* 1B */
-	16384,                  /* 1C */
-	24576,                  /* 1D */
-	32768                   /* 1E */
+	[0x00] = 0,
+	[0x01] = 1,
+	[0x02] = 2,
+	[0x03] = 3,
+	[0x04] = 4,
+	[0x05] = 6,
+	[0x06] = 8,
+	[0x07] = 12,
+	[0x08] = 16,
+	[0x09] = 24,
+	[0x0A] = 32,
+	[0x0B] = 48,
+	[0x0C] = 64,
+	[0x0D] = 96,
+	[0x0E] = 128,
+	[0x0F] = 192,
+	[0x10] = 256,
+	[0x11] = 384,
+	[0x12] = 512,
+	[0x13] = 768,
+	[0x14] = 1024,
+	[0x15] = 1536,
+	[0x16] = 2048,
+	[0x17] = 3072,
+	[0x18] = 4096,
+	[0x19] = 6144,
+	[0x1A] = 8192,
+	[0x1B] = 12288,
+	[0x1C] = 16384,
+	[0x1D] = 24576,
+	[0x1E] = 32768
 };
 
 /**