[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2zZ7SXu+Wk6H68D@kadam>
Date: Thu, 10 Nov 2022 14:01:01 +0300
From: Dan Carpenter <error27@...il.com>
To: Jacob Bai <jacob.bai.au@...il.com>
Cc: gregkh@...uxfoundation.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/2] staging: rtl8192e: replace macro defines with
variables
On Thu, Nov 10, 2022 at 09:35:11PM +1100, Jacob Bai wrote:
> remove marco defines of array length, use variables instead and
> initialize them from ARRAY_SIZE().
>
> Signed-off-by: Jacob Bai <jacob.bai.au@...il.com>
> ---
> .../staging/rtl8192e/rtl8192e/r8192E_hwimg.c | 31 ++++++++++------
> .../staging/rtl8192e/rtl8192e/r8192E_hwimg.h | 36 +++++++++----------
> .../staging/rtl8192e/rtl8192e/r8192E_phy.h | 20 -----------
> 3 files changed, 38 insertions(+), 49 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c
> index 8920283f340e..ec9e2de4c942 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c
> @@ -6,9 +6,10 @@
> */
> #include "r8192E_hwimg.h"
>
> -u32 RTL8192E_PHY_REG_ARRAY[RTL8192E_PHY_REG_ARRAY_LEN] = {0x0,};
> +u32 RTL8192E_PHY_REG_ARRAY[] = {0x0,};
> +u32 RTL8192E_PHY_REG_ARRAY_LEN = ARRAY_SIZE(RTL8192E_PHY_REG_ARRAY);
ARRAY is bad name for an array. It's like saying "int variable_i;"
It just makes the name longer but doesn't add any information.
Get rid of the RTL8192E_PHY_REG_ARRAY_LEN define. Use ARRAY_SIZE()
directly in the code. This is no need for a layer of indirection and
obfuscation.
regards,
dan carpenter
Powered by blists - more mailing lists