From 4c6f450cad1fa2f33df10ee23a27f1207f56ffab Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 7 Feb 2017 23:55:48 +0200 Subject: [PATCH] Add radio_work_is_connect() helper This avoids duplicated code to check for different types of connection radio work items. Signed-off-by: Jouni Malinen --- wpa_supplicant/wpa_supplicant.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 11046bb9a..f89a71a61 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -4367,6 +4367,13 @@ static void radio_work_free(struct wpa_radio_work *work) } +static int radio_work_is_connect(struct wpa_radio_work *work) +{ + return os_strcmp(work->type, "sme-connect") == 0 || + os_strcmp(work->type, "connect") == 0; +} + + static int radio_work_is_scan(struct wpa_radio_work *work) { return os_strcmp(work->type, "scan") == 0 || @@ -4403,8 +4410,7 @@ static struct wpa_radio_work * radio_work_get_next_work(struct wpa_radio *radio) return NULL; } - if (os_strcmp(active_work->type, "sme-connect") == 0 || - os_strcmp(active_work->type, "connect") == 0) { + if (radio_work_is_connect(active_work)) { /* * If the active work is either connect or sme-connect, * do not parallelize them with other radio works. @@ -4423,8 +4429,7 @@ static struct wpa_radio_work * radio_work_get_next_work(struct wpa_radio *radio) * If connect or sme-connect are enqueued, parallelize only * those operations ahead of them in the queue. */ - if (os_strcmp(tmp->type, "connect") == 0 || - os_strcmp(tmp->type, "sme-connect") == 0) + if (radio_work_is_connect(tmp)) break; /* Serialize parallel scan and p2p_scan operations on the same