All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Jacob Bai <jacob.bai.au@gmail.com>
Cc: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/2] staging: rtl8192e: replace macro defines with variables
Date: Thu, 10 Nov 2022 14:01:01 +0300	[thread overview]
Message-ID: <Y2zZ7SXu+Wk6H68D@kadam> (raw)
In-Reply-To: <354847ce7b2f9ea4dc549bf13656192c1db7c231.1668075486.git.jacob.bai.au@gmail.com>

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@gmail.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


  reply	other threads:[~2022-11-10 11:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 10:35 [PATCH v5 0/2] staging: rtl8192e: trivial code cleanup patches Jacob Bai
2022-11-10 10:35 ` [PATCH v5 1/2] staging: rtl8192e: rename tables in r8192e_hwimg.c Jacob Bai
2022-11-10 11:24   ` Dan Carpenter
2022-11-10 10:35 ` [PATCH v5 2/2] staging: rtl8192e: replace macro defines with variables Jacob Bai
2022-11-10 11:01   ` Dan Carpenter [this message]
2022-11-10 11:07   ` Dan Carpenter
2022-11-10 19:09   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y2zZ7SXu+Wk6H68D@kadam \
    --to=error27@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jacob.bai.au@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.