staging: r8188eu: replace OnAction_tbl with switch-case

OnAction_tbl has only three entries. It's simpler to use a switch
statement instead of iterating over the table.

We can then remove the table itself and struct action_handler, which was
used only for the table entries.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220502200652.143665-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Martin Kaiser 2022-05-02 22:06:49 +02:00 committed by Greg Kroah-Hartman
parent 42e00fbbba
commit 11d2e7de0d
2 changed files with 10 additions and 17 deletions

View file

@ -32,12 +32,6 @@ static mlme_handler mlme_sta_tbl[] = {
OnAction,
};
static struct action_handler OnAction_tbl[] = {
{RTW_WLAN_CATEGORY_BACK, &OnAction_back},
{RTW_WLAN_CATEGORY_PUBLIC, on_action_public},
{RTW_WLAN_CATEGORY_P2P, &OnAction_p2p},
};
static u8 null_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
/**************************************************
@ -3877,9 +3871,7 @@ unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_fra
unsigned int OnAction(struct adapter *padapter, struct recv_frame *precv_frame)
{
int i;
unsigned char category;
struct action_handler *ptable;
unsigned char *frame_body;
u8 *pframe = precv_frame->rx_data;
@ -3887,10 +3879,16 @@ unsigned int OnAction(struct adapter *padapter, struct recv_frame *precv_frame)
category = frame_body[0];
for (i = 0; i < ARRAY_SIZE(OnAction_tbl); i++) {
ptable = &OnAction_tbl[i];
if (category == ptable->num)
ptable->func(padapter, precv_frame);
switch (category) {
case RTW_WLAN_CATEGORY_BACK:
OnAction_back(padapter, precv_frame);
break;
case RTW_WLAN_CATEGORY_PUBLIC:
on_action_public(padapter, precv_frame);
break;
case RTW_WLAN_CATEGORY_P2P:
OnAction_p2p(padapter, precv_frame);
break;
}
return _SUCCESS;
}

View file

@ -186,11 +186,6 @@ enum SCAN_STATE {
typedef unsigned int (*mlme_handler)(struct adapter *adapt, struct recv_frame *frame);
struct action_handler {
unsigned int num;
unsigned int (*func)(struct adapter *adapt, struct recv_frame *frame);
};
struct ss_res {
int state;
int bss_cnt;