diff options
author | Jérémy Lefaure <jeremy.lefaure@lse.epita.fr> | 2017-10-01 15:30:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-03 18:34:56 +0200 |
commit | 2595587d7e227a9181750110f50e02a2511821dd (patch) | |
tree | de11fa0d4540b41b08e47d4c81beb36a9aa9606f /drivers/staging/rtlwifi/phydm/phydm_debug.c | |
parent | 8dabf52ffb6445fa5bcc8b6d2ecb615f60d0dd12 (diff) |
staging: rtlwifi: use ARRAY_SIZE
Using the ARRAY_SIZE macro improves the readability of the code. Also,
it is useless to use a variable to store this constant calculated at
compile time.
Found with Coccinelle with the following semantic patch:
@r depends on (org || report)@
type T;
T[] E;
position p;
@@
(
(sizeof(E)@p /sizeof(*E))
|
(sizeof(E)@p /sizeof(E[...]))
|
(sizeof(E)@p /sizeof(T))
)
Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtlwifi/phydm/phydm_debug.c')
-rw-r--r-- | drivers/staging/rtlwifi/phydm/phydm_debug.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/rtlwifi/phydm/phydm_debug.c b/drivers/staging/rtlwifi/phydm/phydm_debug.c index a5f90afdae9b..d4dd0fd3d1c7 100644 --- a/drivers/staging/rtlwifi/phydm/phydm_debug.c +++ b/drivers/staging/rtlwifi/phydm/phydm_debug.c @@ -29,6 +29,7 @@ #include "mp_precomp.h" #include "phydm_precomp.h" +#include <linux/kernel.h> bool phydm_api_set_txagc(struct phy_dm_struct *, u32, enum odm_rf_radio_path, u8, bool); @@ -2107,8 +2108,7 @@ void phydm_cmd_parser(struct phy_dm_struct *dm, char input[][MAX_ARGV], /* Parsing Cmd ID */ if (input_num) { - phydm_ary_size = - sizeof(phy_dm_ary) / sizeof(struct phydm_command); + phydm_ary_size = ARRAY_SIZE(phy_dm_ary); for (i = 0; i < phydm_ary_size; i++) { if (strcmp(phy_dm_ary[i].name, input[0]) == 0) { id = phy_dm_ary[i].id; |