Skip to content

Commit

Permalink
staging: rtl8192e: Comment cleanup (style/format)
Browse files Browse the repository at this point in the history
- Multiline comments use "network subsystem comment style"
- Merge short multiline comments
- Remove empty comments
- Remove function name comment at the end of small (<1 screen) functions
- Reformat 802.11 data frame format to use spaces and network format

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Mateusz Kulikowski authored and Greg Kroah-Hartman committed Apr 3, 2015
1 parent e725fb6 commit 14b40d9
Show file tree
Hide file tree
Showing 16 changed files with 318 additions and 289 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev)

static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg)
{
struct cmpk_intr_sta rx_intr_status; /* */
struct cmpk_intr_sta rx_intr_status;
struct r8192_priv *priv = rtllib_priv(dev);

DMESG("---> cmpk_Handle_Interrupt_Status()\n");
Expand Down
30 changes: 15 additions & 15 deletions drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,28 @@
struct cmpk_txfb {
u8 element_id;
u8 length;
u8 TID:4; /* */
u8 fail_reason:3; /* */
u8 TID:4;
u8 fail_reason:3;
u8 tok:1;
u8 reserve1:4; /* */
u8 pkt_type:2; /* */
u8 bandwidth:1; /* */
u8 qos_pkt:1; /* */
u8 reserve1:4;
u8 pkt_type:2;
u8 bandwidth:1;
u8 qos_pkt:1;

u8 reserve2; /* */
u8 retry_cnt; /* */
u16 pkt_id; /* */
u8 reserve2;
u8 retry_cnt;
u16 pkt_id;

u16 seq_num; /* */
u16 seq_num;
u8 s_rate;
u8 f_rate;

u8 s_rts_rate; /* */
u8 f_rts_rate; /* */
u16 pkt_length; /* */
u8 s_rts_rate;
u8 f_rts_rate;
u16 pkt_length;

u16 reserve3; /* */
u16 duration; /* */
u16 reserve3;
u16 duration;
};

struct cmpk_intr_sta {
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static u32 phy_FwRFSerialRead(struct net_device *dev,
}
return read_nic_dword(dev, RF_DATA);

} /* phy_FwRFSerialRead */
}

static void phy_FwRFSerialWrite(struct net_device *dev,
enum rf90_radio_path eRFPath,
Expand All @@ -325,7 +325,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev,
}
write_nic_dword(dev, QPNR, Data);

} /* phy_FwRFSerialWrite */
}


void rtl8192_phy_configmac(struct net_device *dev)
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/rtl8192e/rtl8192e/rtl_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,8 @@ static void rtl8192_rx_normal(struct net_device *dev)
goto done;
new_skb = dev_alloc_skb(priv->rxbuffersize);
/* if allocation of new skb failed - drop current packet
* and reuse skb */
* and reuse skb
*/
if (unlikely(!new_skb))
goto done;

Expand Down
5 changes: 2 additions & 3 deletions drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,11 +1221,10 @@ static iw_handler r8192_wx_handlers[] = {
IW_IOCTL(SIOCSIWENCODEEXT) = r8192_wx_set_enc_ext,
};

/*
* the following rule need to be following,
/* the following rule need to be following,
* Odd : get (world access),
* even : set (root access)
* */
*/
static const struct iw_priv_args r8192_private_args[] = {
{
SIOCIWFIRSTPRIV + 0x0,
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/rtl8192e/rtl819x_HTProc.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,8 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,

RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__);
/* unmark bEnableHT flag here is the same reason why unmarked in
* function rtllib_softmac_new_net. WB 2008.09.10*/
* function rtllib_softmac_new_net. WB 2008.09.10
*/
if (pNetwork->bssht.bdSupportHT) {
pHTInfo->bCurrentHTSupport = true;
pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer;
Expand Down
96 changes: 49 additions & 47 deletions drivers/staging/rtl8192e/rtllib.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,13 @@ struct ieee_param {

#define RTLLIB_DATA_LEN 2304
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
6.2.1.1.2.
The figure in section 7.1.2 suggests a body size of up to 2312
bytes is allowed, which is a bit confusing, I suspect this
represents the 2304 bytes of real data, plus a possible 8 bytes of
WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
* 6.2.1.1.2.
*
* The figure in section 7.1.2 suggests a body size of up to 2312
* bytes is allowed, which is a bit confusing, I suspect this
* represents the 2304 bytes of real data, plus a possible 8 bytes of
* WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro)
*/
#define RTLLIB_1ADDR_LEN 10
#define RTLLIB_2ADDR_LEN 16
#define RTLLIB_3ADDR_LEN 24
Expand Down Expand Up @@ -696,8 +697,7 @@ do { \
} \
} while (0)

/*
* To use the debug system;
/* To use the debug system;
*
* If you are defining a new debug classification, simply add it to the #define
* list here in the form of:
Expand All @@ -716,8 +716,6 @@ do { \
* % cat /proc/net/ipw/debug_level
*
* you simply need to add your entry to the ipw_debug_levels array.
*
*
*/

#define RTLLIB_DL_INFO (1<<0)
Expand Down Expand Up @@ -975,7 +973,8 @@ struct rtllib_rx_stats {
/* IEEE 802.11 requires that STA supports concurrent reception of at least
* three fragmented frames. This define can be increased to support more
* concurrent frames, but it should be noted that each entry can consume about
* 2 kB of RAM and increasing cache size will slow down frame reassembly. */
* 2 kB of RAM and increasing cache size will slow down frame reassembly.
*/
#define RTLLIB_FRAG_CACHE_LEN 4

struct rtllib_frag_entry {
Expand Down Expand Up @@ -1053,16 +1052,15 @@ struct rtllib_security {
} __packed;


/*
802.11 data frame from AP
,-------------------------------------------------------------------.
Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
|------|------|---------|---------|---------|------|---------|------|
Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
| | tion | (BSSID) | | | ence | data | |
`-------------------------------------------------------------------'
Total: 28-2340 bytes
*/
/* 802.11 data frame from AP
* ,-------------------------------------------------------------------.
* Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
* |------|------|---------|---------|---------|------|---------|------|
* Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
* | | tion | (BSSID) | | | ence | data | |
* `-------------------------------------------------------------------'
* Total: 28-2340 bytes
*/

/* Management Frame Information Element Types */
enum rtllib_mfie {
Expand Down Expand Up @@ -1100,7 +1098,8 @@ enum rtllib_mfie {

/* Minimal header; can be used for passing 802.11 frames with sufficient
* information to determine what type of underlying data type is actually
* stored in the data. */
* stored in the data.
*/
struct rtllib_pspoll_hdr {
__le16 frame_ctl;
__le16 aid;
Expand Down Expand Up @@ -1210,7 +1209,8 @@ struct rtllib_probe_response {
__le16 beacon_interval;
__le16 capability;
/* SSID, supported rates, FH params, DS params,
* CF params, IBSS params, TIM (if beacon), RSN */
* CF params, IBSS params, TIM (if beacon), RSN
*/
struct rtllib_info_element info_element[0];
} __packed;

Expand Down Expand Up @@ -1285,7 +1285,8 @@ union frameqos {
/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
* only use 8, and then use extended rates for the remaining supported
* rates. Other APs, however, stick all of their supported rates on the
* main rates information element... */
* main rates information element...
*/
#define MAX_RATES_LENGTH ((u8)12)
#define MAX_RATES_EX_LENGTH ((u8)16)
#define MAX_NETWORK_COUNT 96
Expand Down Expand Up @@ -1472,22 +1473,21 @@ struct rtllib_info_element_hdr {
u8 len;
} __packed;

/*
* These are the data types that can make up management packets
/* These are the data types that can make up management packets
*
u16 auth_algorithm;
u16 auth_sequence;
u16 beacon_interval;
u16 capability;
u8 current_ap[ETH_ALEN];
u16 listen_interval;
struct {
u16 association_id:14, reserved:2;
} __packed;
u32 time_stamp[2];
u16 reason;
u16 status;
*/
* u16 auth_algorithm;
* u16 auth_sequence;
* u16 beacon_interval;
* u16 capability;
* u8 current_ap[ETH_ALEN];
* u16 listen_interval;
* struct {
* u16 association_id:14, reserved:2;
* } __packed;
* u32 time_stamp[2];
* u16 reason;
* u16 status;
*/

#define RTLLIB_DEFAULT_TX_ESSID "Penguin"
#define RTLLIB_DEFAULT_BASIC_RATE 2
Expand Down Expand Up @@ -2085,14 +2085,16 @@ struct rtllib_device {
spinlock_t wpax_suitlist_lock;

int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
* of allocated Tx SKBs
*/
u32 config;

/* WEP and other encryption related settings at the device level */
int open_wep; /* Set to 1 to allow unencrypted frames */
int auth_mode;
int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
* WEP key changes */
* WEP key changes
*/

/* If the host performs {en,de}cryption, then set to 1 */
int host_encrypt;
Expand Down Expand Up @@ -2362,7 +2364,7 @@ struct rtllib_device {
/* OK this is complementing to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);

/* ask to the driver to retune the radio .
/* ask to the driver to retune the radio.
* This function can sleep. the driver should ensure
* the radio has been switched before return.
*/
Expand Down Expand Up @@ -2456,7 +2458,8 @@ struct rtllib_device {
void (*rtllib_rfkill_poll)(struct net_device *dev);

/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_rtllib */
* allocated beyond this structure by alloc_rtllib
*/
u8 priv[0];
};

Expand Down Expand Up @@ -2485,7 +2488,8 @@ struct rtllib_device {

/* The ieee802.11 stack will manage the netif queue
* wake/stop for the driver, taking care of 802.11
* fragmentation. See softmac.c for details. */
* fragmentation. See softmac.c for details.
*/
#define IEEE_SOFTMAC_TX_QUEUE (1<<7)

/* Uses only the softmac_data_hard_start_xmit
Expand Down Expand Up @@ -2522,11 +2526,9 @@ static inline int rtllib_is_empty_essid(const char *essid, int essid_len)

static inline int rtllib_is_valid_mode(struct rtllib_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
/* It is possible for both access points and our device to support
* combinations of modes, so as long as there is one valid combination
* of ap/device supported modes, then return success
*
*/
if ((mode & IEEE_A) &&
(ieee->modulation & RTLLIB_OFDM_MODULATION) &&
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/rtl8192e/rtllib_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info,

/* must not run ops->deinit() while there may be pending encrypt or
* decrypt operations. Use a list of delayed deinits to avoid needing
* locking. */
* locking.
*/

spin_lock_irqsave(info->lock, flags);
list_add(&tmp->list, &info->crypt_deinit_list);
Expand Down
3 changes: 1 addition & 2 deletions drivers/staging/rtl8192e/rtllib_crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* more details.
*/

/*
* This file defines the interface to the rtllib crypto module.
/* This file defines the interface to the rtllib crypto module.
*/
#ifndef RTLLIB_CRYPT_H
#define RTLLIB_CRYPT_H
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
* Flag (Include authentication header, M=3 (8-octet MIC),
* L=1 (2-octet Dlen))
* Nonce: 0x00 | A2 | PN
* Dlen */
* Dlen
*/
b0[0] = 0x59;
b0[1] = qc;
memcpy(b0 + 2, hdr->addr2, ETH_ALEN);
Expand Down
15 changes: 10 additions & 5 deletions drivers/staging/rtl8192e/rtllib_crypt_tkip.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
* avoided on little endian hosts. */
* avoided on little endian hosts.
*/
u16 *PPK = (u16 *) &WEPSeed[4];

/* Step 1 - make copy of TTAK and bring in TSC */
Expand All @@ -276,7 +277,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
PPK[5] += RotR1(PPK[4]);

/* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value
* WEPSeed[0..2] is transmitted as WEP IV */
* WEPSeed[0..2] is transmitted as WEP IV
*/
WEPSeed[0] = Hi8(IV16);
WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F;
WEPSeed[2] = Lo8(IV16);
Expand Down Expand Up @@ -470,7 +472,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
if (iv32 != tkey->rx_iv32) {
/* Previously cached Phase1 result was already
* lost, so it needs to be recalculated for the
* next packet. */
* next packet.
*/
tkey->rx_phase1_done = 0;
}
if (net_ratelimit()) {
Expand All @@ -485,7 +488,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
}

/* Update real counters only after Michael MIC verification has
* completed */
* completed
*/
tkey->rx_iv32_new = iv32;
tkey->rx_iv16_new = iv16;

Expand Down Expand Up @@ -639,7 +643,8 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,
}

/* Update TSC counters for RX now that the packet verification has
* completed. */
* completed.
*/
tkey->rx_iv32 = tkey->rx_iv32_new;
tkey->rx_iv16 = tkey->rx_iv16_new;

Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/rtl8192e/rtllib_crypt_wep.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)

/* Fluhrer, Mantin, and Shamir have reported weaknesses in the key
* scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N)
* can be used to speedup attacks, so avoid using them. */
* can be used to speedup attacks, so avoid using them.
*/
if ((wep->iv & 0xff00) == 0xff00) {
u8 B = (wep->iv >> 16) & 0xff;

Expand Down
Loading

0 comments on commit 14b40d9

Please sign in to comment.