Staging: rtl8188eu: core: Use ARRAY_SIZE macro
authorShraddha Barke <shraddha.6596@gmail.com>
Thu, 8 Oct 2015 19:25:19 +0000 (00:55 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Oct 2015 03:45:38 +0000 (20:45 -0700)
ARRAY_SIZE is more concise to use when the size of an array is divided
by the size of its type.

Changes made using Coccinelle-

@@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
drivers/staging/rtl8188eu/core/rtw_rf.c

index 0270755ec54600d44c6c02f9a388e9683eb112d9..d8a0895aa86f35f2e24c7d857f8233f3467d4b64 100644 (file)
@@ -3926,7 +3926,7 @@ static unsigned int OnAction(struct adapter *padapter,
 
        category = frame_body[0];
 
-       for (i = 0; i < sizeof(OnAction_tbl)/sizeof(struct action_handler); i++) {
+       for (i = 0; i < ARRAY_SIZE(OnAction_tbl); i++) {
                ptable = &OnAction_tbl[i];
                if (category == ptable->num)
                        ptable->func(padapter, precv_frame);
index 1170dd001c1fefdad93ec400cce4f11086a84759..6983c572b358e356f856ffeed3c05bf8cc54da05 100644 (file)
@@ -52,7 +52,7 @@ static struct ch_freq ch_freq_map[] = {
        {216, 5080},/* Japan, means J16 */
 };
 
-static int ch_freq_map_num = (sizeof(ch_freq_map) / sizeof(struct ch_freq));
+static int ch_freq_map_num = ARRAY_SIZE(ch_freq_map);
 
 u32 rtw_ch2freq(u32 channel)
 {