Use ARRAY_SIZE to calculate the size of an array to make code concise.
The semantic patch used can be found here:
https://github.com/coccinelle/coccinellery/commit/
9cbab452a3a2e18439e8386d6c4a68ee42c3ee2b
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
post_process:
/* call callback function for post-processed */
- if (pcmd->cmdcode < (sizeof(rtw_cmd_callback) /
- sizeof(struct _cmd_callback))) {
+ if (pcmd->cmdcode < ARRAY_SIZE(rtw_cmd_callback)) {
pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback;
if (!pcmd_callback) {
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_,
category = mgmt->u.action.category;
- for (i = 0;
- i < sizeof(OnAction23a_tbl) / sizeof(struct action_handler); i++) {
+ for (i = 0; i < ARRAY_SIZE(OnAction23a_tbl); i++) {
ptable = &OnAction23a_tbl[i];
if (category == ptable->num)
u32 i;
u8 platform = 0x04;
u8 board = pDM_Odm->BoardType;
- u32 ArrayLen = sizeof(Array_AGC_TAB_1T_8723A)/sizeof(u32);
+ u32 ArrayLen = ARRAY_SIZE(Array_AGC_TAB_1T_8723A);
u32 *Array = Array_AGC_TAB_1T_8723A;
hex = board;
u32 i = 0;
u8 platform = 0x04;
u8 board = pDM_Odm->BoardType;
- u32 ArrayLen = sizeof(Array_PHY_REG_1T_8723A)/sizeof(u32);
+ u32 ArrayLen = ARRAY_SIZE(Array_PHY_REG_1T_8723A);
u32 *Array = Array_PHY_REG_1T_8723A;
hex += board;
u32 i;
u8 platform = 0x04;
u8 board = pDM_Odm->BoardType;
- u32 ArrayLen = sizeof(Array_PHY_REG_MP_8723A)/sizeof(u32);
+ u32 ArrayLen = ARRAY_SIZE(Array_PHY_REG_MP_8723A);
u32 *Array = Array_PHY_REG_MP_8723A;
hex += board;
u32 i = 0;
u8 platform = 0x04;
u8 board = pDM_Odm->BoardType;
- u32 ArrayLen = sizeof(Array_MAC_REG_8723A)/sizeof(u32);
+ u32 ArrayLen = ARRAY_SIZE(Array_MAC_REG_8723A);
u32 *Array = Array_MAC_REG_8723A;
hex += board;