Commit 2f479125 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Greg Kroah-Hartman

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: default avatarClaudiu Beznea <claudiu.beznea@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 37f92cf0
...@@ -77,6 +77,21 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev, ...@@ -77,6 +77,21 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev,
struct p80211msg_dot11req_mibget *mib_msg, struct p80211msg_dot11req_mibget *mib_msg,
int isget); 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 * p80211req_dorequest
* *
...@@ -209,31 +224,15 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev, ...@@ -209,31 +224,15 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev,
case DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked:{ case DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked:{
u32 *data = (u32 *) mibitem->data; u32 *data = (u32 *) mibitem->data;
if (isget) { p80211req_handle_action(wlandev, data, isget,
if (wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) 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;
}
break; break;
} }
case DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted:{ case DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted:{
u32 *data = (u32 *) mibitem->data; u32 *data = (u32 *) mibitem->data;
if (isget) { p80211req_handle_action(wlandev, data, isget,
if (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) 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;
}
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment