Re: [PATCH v5 2/2] staging: rtl8192e: replace macro defines with variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> ---
>  .../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





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux