This patch fix "line over 80 characters" checkpatch.pl warnings. In cfg80211.c file some of these warnings were fixed by adding duplicate code in a separate function. Signed-off-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxx> --- drivers/staging/wlan-ng/cfg80211.c | 148 ++++++++++++++++-------------------- drivers/staging/wlan-ng/hfa384x.h | 2 +- drivers/staging/wlan-ng/p80211hdr.h | 3 +- 3 files changed, 68 insertions(+), 85 deletions(-) diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c index f46dfe6..8523cd5 100644 --- a/drivers/staging/wlan-ng/cfg80211.c +++ b/drivers/staging/wlan-ng/cfg80211.c @@ -97,6 +97,45 @@ static int prism2_domibset_pstr32(wlandevice_t *wlandev, return p80211req_dorequest(wlandev, (u8 *)&msg); } +static int prism2_key_index_to_did(u8 key_index, u32 *did) +{ + int err = 0; + + if (!did) { + err = -EINVAL; + goto exit; + } + + switch (key_index) { + case 0: + *did = + DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0; + break; + + case 1: + *did = + DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1; + break; + + case 2: + *did = + DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2; + break; + + case 3: + *did = + DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3; + break; + + default: + err = -EINVAL; + break; + } + +exit: + return err; +} + /* The interface functions, called by the cfg80211 layer */ static int prism2_change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, @@ -154,33 +193,15 @@ static int prism2_add_key(struct wiphy *wiphy, struct net_device *dev, case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: result = prism2_domibset_uint32(wlandev, - DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, - key_index); + DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, + key_index); if (result) goto exit; /* send key to driver */ - switch (key_index) { - case 0: - did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0; - break; - - case 1: - did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1; - break; - - case 2: - did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2; - break; - - case 3: - did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3; - break; - - default: - err = -EINVAL; + err = prism2_key_index_to_did(key_index, &did); + if (err) goto exit; - } result = prism2_domibset_pstr32(wlandev, did, params->key_len, params->key); @@ -243,31 +264,9 @@ static int prism2_del_key(struct wiphy *wiphy, struct net_device *dev, */ /* send key to driver */ - switch (key_index) { - case 0: - did = - DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0; - break; - - case 1: - did = - DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1; - break; - - case 2: - did = - DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2; - break; - - case 3: - did = - DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3; - break; - - default: - err = -EINVAL; + err = prism2_key_index_to_did(key_index, &did); + if (err) goto exit; - } result = prism2_domibset_pstr32(wlandev, did, 13, "0000000000000"); @@ -426,7 +425,8 @@ static int prism2_scan(struct wiphy *wiphy, msg2.beaconperiod.data, ie_buf, ie_len, - (msg2.signal.data - 65536) * 100, /* Conversion to signed type */ + /* Conversion to signed type */ + (msg2.signal.data - 65536) * 100, GFP_KERNEL ); @@ -463,8 +463,8 @@ static int prism2_set_wiphy_params(struct wiphy *wiphy, u32 changed) data = wiphy->rts_threshold; result = prism2_domibset_uint32(wlandev, - DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold, - data); + DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold, + data); if (result) { err = -EFAULT; goto exit; @@ -478,8 +478,8 @@ static int prism2_set_wiphy_params(struct wiphy *wiphy, u32 changed) data = wiphy->frag_threshold; result = prism2_domibset_uint32(wlandev, - DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold, - data); + DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold, + data); if (result) { err = -EFAULT; goto exit; @@ -508,8 +508,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev, if (channel) { chan = ieee80211_frequency_to_channel(channel->center_freq); result = prism2_domibset_uint32(wlandev, - DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel, - chan); + DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel, + chan); if (result) goto exit; } @@ -530,33 +530,15 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev, if (is_wep) { if (sme->key) { result = prism2_domibset_uint32(wlandev, - DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, - sme->key_idx); + DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, + sme->key_idx); if (result) goto exit; /* send key to driver */ - switch (sme->key_idx) { - case 0: - did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0; - break; - - case 1: - did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1; - break; - - case 2: - did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2; - break; - - case 3: - did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3; - break; - - default: - err = -EINVAL; + err = prism2_key_index_to_did(sme->key_idx, &did); + if (err) goto exit; - } result = prism2_domibset_pstr32(wlandev, did, sme->key_len, @@ -570,14 +552,14 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev, * seems reasonable anyways */ result = prism2_domibset_uint32(wlandev, - DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, - P80211ENUM_truth_true); + DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, + P80211ENUM_truth_true); if (result) goto exit; result = prism2_domibset_uint32(wlandev, - DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, - P80211ENUM_truth_true); + DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, + P80211ENUM_truth_true); if (result) goto exit; @@ -586,14 +568,14 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev, * and exclude unencrypted */ result = prism2_domibset_uint32(wlandev, - DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, - P80211ENUM_truth_false); + DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, + P80211ENUM_truth_false); if (result) goto exit; result = prism2_domibset_uint32(wlandev, - DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, - P80211ENUM_truth_false); + DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, + P80211ENUM_truth_false); if (result) goto exit; } diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h index cec6d0b..17495e2 100644 --- a/drivers/staging/wlan-ng/hfa384x.h +++ b/drivers/staging/wlan-ng/hfa384x.h @@ -1348,7 +1348,7 @@ typedef struct hfa384x { hfa384x_InfFrame_t *scanresults; - struct prism2sta_authlist authlist; /* Authenticated station list. */ + struct prism2sta_authlist authlist; /* Authenticated station list.*/ unsigned int accessmode; /* Access mode. */ struct prism2sta_accesslist allow; /* Allowed station list. */ struct prism2sta_accesslist deny; /* Denied station list. */ diff --git a/drivers/staging/wlan-ng/p80211hdr.h b/drivers/staging/wlan-ng/p80211hdr.h index 79d9b20..fa497f9 100644 --- a/drivers/staging/wlan-ng/p80211hdr.h +++ b/drivers/staging/wlan-ng/p80211hdr.h @@ -132,7 +132,8 @@ /*------------------------------------------------------------*/ #define WLAN_GET_FC_FTYPE(n) ((((u16)(n)) & (BIT(2) | BIT(3))) >> 2) -#define WLAN_GET_FC_FSTYPE(n) ((((u16)(n)) & (BIT(4)|BIT(5)|BIT(6)|BIT(7))) >> 4) +#define WLAN_GET_FC_FSTYPE(n) ((((u16)(n)) & \ + (BIT(4) | BIT(5) | BIT(6) | BIT(7))) >> 4) #define WLAN_GET_FC_TODS(n) ((((u16)(n)) & (BIT(8))) >> 8) #define WLAN_GET_FC_FROMDS(n) ((((u16)(n)) & (BIT(9))) >> 9) #define WLAN_GET_FC_ISWEP(n) ((((u16)(n)) & (BIT(14))) >> 14) -- 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel