diff options
author | Claudiu Beznea <claudiu.beznea@gmail.com> | 2016-08-25 20:03:25 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-01 17:51:20 +0200 |
commit | 2f4791255808bd0d258400b4cf230c16ea8bdeae (patch) | |
tree | 0a0cb54a3bc1c4c9072836d4d7418d9bc5ad169b /drivers/staging/wlan-ng/p80211req.c | |
parent | 37f92cf0a5b82be433b8b24b7105bb9f878f7153 (diff) |
Staging: wlan-ng: removed duplicate code in p80211req.c
This patch removes duplicate code in p80211req_mibset_mibget()
by adding p80211req_handle_action() function.
Changes since v1:
Removed prototype of p80211req_handle_action() from the prototype
list and add directly the function definition.
Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wlan-ng/p80211req.c')
-rw-r--r-- | drivers/staging/wlan-ng/p80211req.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/staging/wlan-ng/p80211req.c b/drivers/staging/wlan-ng/p80211req.c index 3849637636a3..5c2b80164d99 100644 --- a/drivers/staging/wlan-ng/p80211req.c +++ b/drivers/staging/wlan-ng/p80211req.c @@ -77,6 +77,21 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev, struct p80211msg_dot11req_mibget *mib_msg, int isget); +static void p80211req_handle_action(struct wlandevice *wlandev, u32 *data, + int isget, u32 flag) +{ + if (isget) { + if (wlandev->hostwep & flag) + *data = P80211ENUM_truth_true; + else + *data = P80211ENUM_truth_false; + } else { + wlandev->hostwep &= ~flag; + if (*data == P80211ENUM_truth_true) + wlandev->hostwep |= flag; + } +} + /*---------------------------------------------------------------- * p80211req_dorequest * @@ -209,31 +224,15 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev, case DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked:{ u32 *data = (u32 *) mibitem->data; - if (isget) { - if (wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) - *data = P80211ENUM_truth_true; - else - *data = P80211ENUM_truth_false; - } else { - wlandev->hostwep &= ~(HOSTWEP_PRIVACYINVOKED); - if (*data == P80211ENUM_truth_true) - wlandev->hostwep |= HOSTWEP_PRIVACYINVOKED; - } + p80211req_handle_action(wlandev, data, isget, + HOSTWEP_PRIVACYINVOKED); break; } case DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted:{ u32 *data = (u32 *) mibitem->data; - if (isget) { - if (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) - *data = P80211ENUM_truth_true; - else - *data = P80211ENUM_truth_false; - } else { - wlandev->hostwep &= ~(HOSTWEP_EXCLUDEUNENCRYPTED); - if (*data == P80211ENUM_truth_true) - wlandev->hostwep |= HOSTWEP_EXCLUDEUNENCRYPTED; - } + p80211req_handle_action(wlandev, data, isget, + HOSTWEP_EXCLUDEUNENCRYPTED); break; } } |