lkml.org 
[lkml]   [2021]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: r8188eu: use ARRAY_SIZE() macro and fix camelcase issues
On Tue, Nov 30, 2021 at 03:43:47AM +0530, Vihas Mak wrote:
> Fix camelcase warnings from checkpatch.pl and use ARRAY_SIZE()
> to make the code cleaner and avoid following cocci warnings:
>
> drivers/staging/r8188eu/hal/HalHWImg8188E_RF.c:142:51-52: WARNING: Use ARRAY_SIZE
> drivers/staging/r8188eu/hal/HalHWImg8188E_BB.c:174:52-53: WARNING: Use ARRAY_SIZE
> drivers/staging/r8188eu/hal/HalHWImg8188E_BB.c:450:52-53: WARNING: Use ARRAY_SIZE
> drivers/staging/r8188eu/hal/HalHWImg8188E_BB.c:655:49-50: WARNING: Use ARRAY_SIZE
> drivers/staging/r8188eu/hal/HalHWImg8188E_MAC.c:136:50-51: WARNING: Use ARRAY_SIZE
>
> Signed-off-by: Vihas Mak <makvihas@gmail.com>
> ---
> .../staging/r8188eu/hal/HalHWImg8188E_BB.c | 6 ++---
> .../staging/r8188eu/hal/HalHWImg8188E_MAC.c | 2 +-
> .../staging/r8188eu/hal/HalHWImg8188E_RF.c | 24 +++++++++----------
> 3 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/hal/HalHWImg8188E_BB.c b/drivers/staging/r8188eu/hal/HalHWImg8188E_BB.c
> index f6e4243e0..ce46b3651 100644
> --- a/drivers/staging/r8188eu/hal/HalHWImg8188E_BB.c
> +++ b/drivers/staging/r8188eu/hal/HalHWImg8188E_BB.c
> @@ -171,7 +171,7 @@ enum HAL_STATUS ODM_ReadAndConfig_AGC_TAB_1T_8188E(struct odm_dm_struct *dm_odm)
> {
> u32 hex = 0;
> u32 i = 0;
> - u32 arraylen = sizeof(array_agc_tab_1t_8188e) / sizeof(u32);
> + u32 arraylen = ARRAY_SIZE(array_agc_tab_1t_8188e);
> u32 *array = array_agc_tab_1t_8188e;

Get rid of both the "arraylen" and "array" variables. They only obscure
what the code is doing. You may need to do additional clean up to make
it work without making the lines too long...

Same for the rest.

If that is too complicated then it's fine too, just leave it as-is for
now. I know that sometimes people just want to silence the checkpatch
warnings but I prefer to keep the warning as a marker for bad code so
let's leave it until someone can fix this in the correct way.

regards,
dan carpenter

\
 
 \ /
  Last update: 2021-11-30 10:49    [W:0.027 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site