Skip to contentSkip to conversation

staging: rtl8192e: Fix more checkpatch.pl warnings

PATCH In review Mateusz Kulikowski 3 participants 38 messages May 31, 2015 Staging

lore
Share & tools
lore
#0 lore raw

v5 cover staging: rtl8192e: Fix more checkpatch.pl warnings

Updated series of patches for rtl8192.
Rebased to latest staging-next (9535ebc5e). Built and target tested (tests like for v3 + download of 1Mb file over http).
Side note: quality/performance of this driver is still poor - it drops a lot of packets (at least when talking to 802.11N/ 2.4G / WPA2 network).

Changes from v4:
- Rework v4 02/35 patch (__aligned(2)): Threw away __aligned(2) as they don't look good. Instead:
+ Reorder local variables (if needed) - they are always aligned
+ Reorder members of unpacked structures if possible Alignment was verified with BUG_ON trap in ether_addr_copy and manually with pahole.
- Remove v4 04/35 patch (Mark unaligned memcpy)
- Fix v4 06/35 patch (ether_addr_equal_unaligned()): use ether_addr_equal()
- Rebase to latest staging-next

Notes from v4:

Changes from v3:
- Inserted #1 patch (accept const MAC address) - needed for review-fixes
- #2 reworked as suggested by Joe: where possible, broadcast/zero addresses are 'static const', re-indent MAC address (address in one line), use is_zero_ether_addr() instead of memcmp(). I left __aligned() in most places though.
- #3 updated comment to explicitly state that code was tested
- #4 was left as is - I will post ether_addr_copy_unaligned later on
- #5 patch was re-done - most of original formatting is left intact except where change was obvious/needed
- #8 Fixed indentation
- #21 Use netdev_dbg in few more places, drop function names in log messages
- #29 Removed condition that is always false
- #35 Fix another SPACING error that was not there when v3 was created

Notes from v3:

This series applies some of review comments by Dan (thanks!) as well as does further cleanups.

Further series will probably focus more on changing driver architecture into something that may get accepted into -wireless.

This series should apply cleanly to staging-testing(7192a5dd5) branches.
One changeset - #14 will not apply cleanly if the following patch will be applied:
[PATCH v2] staging: rtl8192e: Change cpu_to_le16 to le16_to_cpu
It should apply via 3-way merge (only one line of context is different)

Target tested on netbook with rtl8192e card vs Linus master (1a9f064f):
- Module load/unload
- Interface up/down
- Network scanning
- Connect to WPA2 network + ping route
I've found one bug in the driver (it happens also on master) - rtllib doesn't handle rmmod of active (WPA) r8192e_pci - module refcount drops below 0.

Built-tested for each patch in series on staging-testing

New changes (patch numbers are valid for v3):
- #6 Removal of rtllib_crypt.[ch] - unused files are bad
- #10 Simplification of rtllib_proces_probe_response - fixing LONG_LINES in process
- #24 Fix new checkpatch warnings (OOM_MESSAGE)
- #25 Remove another unused file (rtl_crypto.h)
- #26-#28 Replace ?: expression with min/max macros
- #29 Remove unused debug messages
- #30 Simplify/Optimize rtl8192_phy_checkBBAndRF()
- #31 Replace RT_TRACE(COMP_ERR,...) with netdev_* errors - this are error messages that were (and should be) displayed, with this patch it will be clearly visible where they belong (+log levels were changed to more appropriate).
- #32 Trivial reindentations
- #33 Simplify awkward WoL reporting in rtl8192E_suspend()

What happened to v2 changesets (patch numbers are valid for v2 unless noted):
- Patches 1-9 were already applied by Greg - Thanks!
- Patch 10 was split and reworked into v3 patches: 1, 2, 3
- Patches 11, 12 were cherry-picked into v3 patches 4, 5
- Patch 13 became a series of patches removing whole RTLLIB_* debug "system" (v3 patches 7-9, 11-19, 20). Where possible netdev_* was used, but in some cases it would look awkward so I left with pr_*
- Patch 14 was cherry-picked into v3 patch 21 (Again - thanks for patience Dan)
- Patches 15, 17, 18, 19, 20 were thrown out - they fix some LONG_LINE warnings, but it's not worth it as readability of code goes down - I will remove remaining warnings while refactoring the driver
- Patch 16 was cherry-picked into v3 patch 22
- Patch 21 was cherry-picked into v3 patch 23

Notes from v2:

New cleanup patchset for rtl8192e. It fixes (mostly) checkpatch.pl warnings. When applied, checkpatch.pl warning count drops to 34 (from 1111). It should apply cleanly to staging-next/testing (c610f7f7) branches.

Series was smoke tested on rtl8192e card vs staging-next:
- Module load/unload
- Interface up/down

Most of changes are related to checkpatch.pl with the exception of
- bugfix - staging: rtl8192e: Fix DeviceID in rtl8192_pci_findadapter() This is clearly (in my opinion) typo - I checked two rtl8192e cards from different vendors and both had DeviceID == 0x8192.
- Removal of unimplemented/unused iwpriv handlers - they just give false sense of hope to iwpriv user

Additional changes in v2:
- Fix (most) LONG_LINE warnings
- Replace memcpy() with custom macro - later __aligned(2) will be added to structures (where possible) - I prefer not to do this change before I have working hardware. Unfortunantely these cards are grumpy and refuse to enable radio in PC mPCIe slot (even after soldering W_DISABLE override and using two different antenna sets)
- Fix (most) remaining PREFER_PR_LEVEL warnings

Notes from v1:
This series of patches fixes another set of checkpatch.pl warnings.

Most of the patches are trivial, with the exception of #8, #7 and #5; Driver logic should not be affected.
Some of the patches cause LONG_LINE warnings, but fix has to wait until I do more driver refactorings (It's hard to keep line length when variable names have 30 characters).

Mateusz Kulikowski (34):
staging: rtl8192e: accept const MAC address
staging: rtl8192e: Make ethernet addresses properly aligned
staging: rtl8192e: Fix PREFER_ETHER_ADDR_COPY warnings
staging: rtl8192e: Fix DEEP_INDENTATION warning in
rtllib_parse_info_param()
staging: rtl8192e: Replace memcmp() with ether_addr_equal()
staging: rtl8192e: Remove rtllib_crypt.[ch]
staging: rtl8192e: Replace RTLLIB_DEBUG(DL_ERR) with netdev_*()
staging: rtl8192e: Remove RTLLIB_ERROR() and RTLLIB_WARNING()
staging: rtl8192e: Remove RTLLIB_DEBUG_WX()
staging: rtl8192e: Simplify rtllib_process_probe_response()
staging: rtl8192e: Remove RTLLIB_DEBUG_SCAN()
staging: rtl8192e: Remove RTLLIB_DEBUG_(FRAG|EAP|DROP|STATE|TX|RX)()
staging: rtl8192e: Remove RTLLIB_DEBUG_QOS()
staging: rtl8192e: Remove RTLLIB_DEBUG_MGMT()
staging: rtl8192e: Remove RTLLIB_DEBUG_INFO()
staging: rtl8192e: Remove RTLLIB_DEBUG()
staging: rtl8192e: Remove RTLLIB_DEBUG_DATA()
staging: rtl8192e: Remove remains of RTLLIB_*_DEBUG() (including proc
entry)
staging: rtl8192e: Remove assert() macro
staging: rtl8192e: Fix PREFER_PR_LEVEL warnings
staging: rtl8192e: Fix LONG_LINE warnings
staging: rtl8192e: Fix LONG_LING in rtllib_parse_info_param()
staging: rtl8192e: Remove unimplemented iwpriv handlers
staging: rtl8192e: Fix OOM_MESSAGE warnings
staging: rtl8192e: Remove unused rtl_crypto.h
staging: rtl8192e: Replace ?: with max_t
staging: rtl8192e: Replace ?: with min_t
staging: rtl8192e: Replace ?: with max
staging: rtl8192e: Remove unneeded RT_TRACE(COMP_ERR,...)
staging: rtl8192e: rtl8192_phy_checkBBAndRF(): Don't check MAC
staging: rtl8192e: Replace RT_TRACE(COMP_ERR, ...) with netdev_*
staging: rtl8192e: Fix trivial LONG_LINE errors
staging: rtl8192e: rtl8192E_suspend(): Fix WOL reporting
staging: rtl8192e: Fix SPACING error

 drivers/staging/rtl8192e/dot11d.h                  |    4 +-
 drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c |   25 +-
 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c     |   58 +-
 .../staging/rtl8192e/rtl8192e/r8192E_firmware.c    |   43 +-
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c     |  116 ++-
 drivers/staging/rtl8192e/rtl8192e/rtl_cam.c        |   22 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_cam.h        |    4 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c       |   80 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h       |    1 -
 drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h     |  382 --------
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c         |  274 ++++--
 drivers/staging/rtl8192e/rtl8192e/rtl_pm.c         |    6 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_ps.c         |    6 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c         |  107 +--
 drivers/staging/rtl8192e/rtl819x_BAProc.c          |  149 ++-
 drivers/staging/rtl8192e/rtl819x_HTProc.c          |   54 +-
 drivers/staging/rtl8192e/rtl819x_Qos.h             |    4 +-
 drivers/staging/rtl8192e/rtl819x_TS.h              |    2 +-
 drivers/staging/rtl8192e/rtl819x_TSProc.c          |   75 +-
 drivers/staging/rtl8192e/rtllib.h                  |   86 +-
 drivers/staging/rtl8192e/rtllib_crypt.c            |  254 -----
 drivers/staging/rtl8192e/rtllib_crypt.h            |   34 -
 drivers/staging/rtl8192e/rtllib_crypt_ccmp.c       |    2 +-
 drivers/staging/rtl8192e/rtllib_crypt_tkip.c       |   89 +-
 drivers/staging/rtl8192e/rtllib_debug.h            |    8 -
 drivers/staging/rtl8192e/rtllib_module.c           |   63 +-
 drivers/staging/rtl8192e/rtllib_rx.c               | 1011 +++++++++++---------
 drivers/staging/rtl8192e/rtllib_softmac.c          |  165 ++--
 drivers/staging/rtl8192e/rtllib_softmac_wx.c       |   18 +-
 drivers/staging/rtl8192e/rtllib_tx.c               |   78 +-
 drivers/staging/rtl8192e/rtllib_wx.c               |   51 +-
 31 files changed, 1260 insertions(+), 2011 deletions(-)
 delete mode 100644 drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h
 delete mode 100644 drivers/staging/rtl8192e/rtllib_crypt.c
 delete mode 100644 drivers/staging/rtl8192e/rtllib_crypt.h
Signature · 1 line
1.8.4.1
#1 lore raw

PATCH v5 1/34 staging: rtl8192e: accept const MAC address

Make set_swcam, setKey and rtllib_probe_resp parameter (MAC address) const.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 4 ++--
 drivers/staging/rtl8192e/rtl8192e/rtl_cam.h | 4 ++--
 drivers/staging/rtl8192e/rtllib_softmac.c   | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +2 -2
index 41b025e..0ffade4 100644
@@ -81,7 +81,7 @@ void EnableHWSecurityConfig8192(struct net_device *dev)
 }
 
 void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
-	       u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh)
+	       const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rtllib_device *ieee = priv->rtllib;
@@ -100,7 +100,7 @@ void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
 }
 
 void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
-	    u8 *MacAddr, u8 DefaultKey, u32 *KeyContent)
+	    const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent)
 {
 	u32 TargetCommand = 0;
 	u32 TargetContent = 0;
drivers/staging/rtl8192e/rtl8192e/rtl_cam.h +2 -2
index 3c4c0e6..864a7f6 100644
@@ -31,9 +31,9 @@ struct net_device;
 void CamResetAllEntry(struct net_device *dev);
 void EnableHWSecurityConfig8192(struct net_device *dev);
 void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
-	    u8 *MacAddr, u8 DefaultKey, u32 *KeyContent);
+	    const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent);
 void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
-	       u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh);
+	       const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh);
 void CamPrintDbgReg(struct net_device *dev);
 
 u32 read_cam(struct net_device *dev, u8 addr);
drivers/staging/rtl8192e/rtllib_softmac.c +2 -1
index 98afd3b..cd758fe 100644
@@ -832,7 +832,8 @@ inline struct sk_buff *rtllib_authentication_req(struct rtllib_network *beacon,
 	return skb;
 }
 
-static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest)
+static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee,
+					 const u8 *dest)
 {
 	u8 *tag;
 	int beacon_size;
Signature · 1 line
1.8.4.1
#2 lore raw

PATCH v5 2/34 staging: rtl8192e: Make ethernet addresses properly aligned

In reply to Mateusz Kulikowski

Reorder ethernet addresses allocated on stack or in non-packed structures to keep them aligned(2).
Use ETH_ALEN as array length in places where it was hardcoded to 6.

Alignment verified using pahole where possible and target-tested with BUG_ON() trap in ether_addr_copy.

---
 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c |  3 +--
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c   |  6 ++----
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c     |  4 ++--
 drivers/staging/rtl8192e/rtl819x_Qos.h         |  4 ++--
 drivers/staging/rtl8192e/rtl819x_TS.h          |  2 +-
 drivers/staging/rtl8192e/rtllib.h              | 10 +++++-----
 drivers/staging/rtl8192e/rtllib_crypt_tkip.c   |  3 ++-
 drivers/staging/rtl8192e/rtllib_rx.c           |  6 +++++-
 drivers/staging/rtl8192e/rtllib_softmac.c      |  4 ++--
 drivers/staging/rtl8192e/rtllib_tx.c           |  3 ++-
 10 files changed, 24 insertions(+), 21 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +1 -2
index aad5cc9..926fca7 100644
@@ -316,12 +316,11 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val)
 static void rtl8192_read_eeprom_info(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
-
+	const u8 bMac_Tmp_Addr[ETH_ALEN] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x01};
 	u8 tempval;
 	u8 ICVer8192, ICVer8256;
 	u16 i, usValue, IC_Version;
 	u16 EEPROMId;
-	u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x01};
 
 	RT_TRACE(COMP_INIT, "====> rtl8192_read_eeprom_info\n");
 
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +2 -4
index 6d60ac4..6f339cd 100644
@@ -2573,8 +2573,7 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	int ret = -1;
 	struct rtllib_device *ieee = priv->rtllib;
 	u32 key[4];
-	u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-	u8 zero_addr[6] = {0};
+	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 	struct iw_point *p = &wrq->u.data;
 	struct ieee_param *ipw = NULL;
 
@@ -2611,8 +2610,7 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 				}
 
 				if (ieee->pairwise_key_type) {
-					if (memcmp(ieee->ap_mac_addr, zero_addr,
-					    6) == 0)
+					if (is_zero_ether_addr(ieee->ap_mac_addr))
 						ieee->iw_mode = IW_MODE_ADHOC;
 					memcpy((u8 *)key, ipw->u.crypt.key, 16);
 					EnableHWSecurityConfig8192(dev);
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +2 -2
index 8d6a109..43702df 100644
@@ -987,8 +987,8 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
 
 	ret = rtllib_wx_set_encode_ext(ieee, info, wrqu, extra);
 	{
-		u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-		u8 zero[6] = {0};
+		const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+		const u8 zero[ETH_ALEN] = {0};
 		u32 key[4] = {0};
 		struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
 		struct iw_point *encoding = &wrqu->encoding;
drivers/staging/rtl8192e/rtl819x_Qos.h +2 -2
index 55ef7ec..b3e7dae 100644
@@ -255,8 +255,8 @@ union qos_tclas {
 		u8		Priority;
 		u8		ClassifierType;
 		u8		Mask;
-		u8		SrcAddr[6];
-		u8		DstAddr[6];
+		u8		SrcAddr[ETH_ALEN];
+		u8		DstAddr[ETH_ALEN];
 		u16		Type;
 	} TYPE0_ETH;
 
drivers/staging/rtl8192e/rtl819x_TS.h +1 -1
index 8601b1a..b3e721b 100644
@@ -35,7 +35,7 @@ struct ts_common_info {
 	struct list_head		List;
 	struct timer_list		SetupTimer;
 	struct timer_list		InactTimer;
-	u8				Addr[6];
+	u8				Addr[ETH_ALEN];
 	union tspec_body TSpec;
 	union qos_tclas TClass[TCLAS_NUM];
 	u8				TClasProc;
drivers/staging/rtl8192e/rtllib.h +5 -5
index bfec4fd..411363c 100644
@@ -1531,7 +1531,7 @@ struct rtllib_network {
 	u16	CcxRmState[2];
 	bool	bMBssidValid;
 	u8	MBssidMask;
-	u8	MBssid[6];
+	u8	MBssid[ETH_ALEN];
 	bool	bWithCcxVerNum;
 	u8	BssCcxVerNumber;
 	/* These are network statistics */
@@ -1866,7 +1866,7 @@ struct rt_link_detect {
 
 struct sw_cam_table {
 
-	u8				macaddr[6];
+	u8				macaddr[ETH_ALEN];
 	bool				bused;
 	u8				key_buf[16];
 	u16				key_type;
@@ -1912,10 +1912,10 @@ enum ratr_table_mode_8192s {
 
 #define	NUM_PMKID_CACHE		16
 struct rt_pmkid_list {
-	u8 bUsed;
-	u8 Bssid[6];
+	u8 Bssid[ETH_ALEN];
 	u8 PMKID[16];
 	u8 SsidBuf[33];
+	u8 bUsed;
 	u8 *ssid_octet;
 	u16 ssid_length;
 };
@@ -2083,7 +2083,7 @@ struct rtllib_device {
 	u8 *wpa_ie;
 	size_t wps_ie_len;
 	u8 *wps_ie;
-	u8 ap_mac_addr[6];
+	u8 ap_mac_addr[ETH_ALEN];
 	u16 pairwise_key_type;
 	u16 group_key_type;
 
drivers/staging/rtl8192e/rtllib_crypt_tkip.c +2 -1
index 656b4b3..cdad066 100644
@@ -52,7 +52,8 @@ struct rtllib_tkip_data {
 	struct crypto_blkcipher *tx_tfm_arc4;
 	struct crypto_hash *tx_tfm_michael;
 	/* scratch buffers for virt_to_page() (crypto API) */
-	u8 rx_hdr[16], tx_hdr[16];
+	u8 rx_hdr[16];
+	u8 tx_hdr[16];
 };
 
 static void *rtllib_tkip_init(int key_idx)
drivers/staging/rtl8192e/rtllib_rx.c +5 -1
index bb789cc..3228bfd 100644
@@ -1258,7 +1258,11 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
 	struct rx_ts_record *pTS = NULL;
 	u16 fc, sc, SeqNum = 0;
 	u8 type, stype, multicast = 0, unicast = 0, nr_subframes = 0, TID = 0;
-	u8 dst[ETH_ALEN], src[ETH_ALEN], bssid[ETH_ALEN] = {0}, *payload;
+	u8 *payload;
+	u8 dst[ETH_ALEN];
+	u8 src[ETH_ALEN];
+	u8 bssid[ETH_ALEN] = {0};
+
 	size_t hdrlen = 0;
 	bool bToOtherSTA = false;
 	int ret = 0, i = 0;
drivers/staging/rtl8192e/rtllib_softmac.c +2 -2
index cd758fe..051105d 100644
@@ -1957,9 +1957,9 @@ static inline void rtllib_rx_auth_rq(struct rtllib_device *ieee,
 static inline void rtllib_rx_assoc_rq(struct rtllib_device *ieee,
 				      struct sk_buff *skb)
 {
-
 	u8 dest[ETH_ALEN];
 
+
 	ieee->softmac_stats.rx_ass_rq++;
 	if (assoc_rq_parse(skb, dest) != -1)
 		rtllib_resp_to_assoc_rq(ieee, dest);
@@ -2912,7 +2912,7 @@ exit:
 
 struct sk_buff *rtllib_get_beacon_(struct rtllib_device *ieee)
 {
-	u8 broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+	const u8 broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
 	struct sk_buff *skb;
 	struct rtllib_probe_response *b;
drivers/staging/rtl8192e/rtllib_tx.c +2 -1
index 3b15963..b177d7b 100644
@@ -579,8 +579,9 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 		.seq_ctl = 0,
 		.qos_ctl = 0
 	};
-	u8 dest[ETH_ALEN], src[ETH_ALEN];
 	int qos_actived = ieee->current_network.qos_data.active;
+	u8 dest[ETH_ALEN];
+	u8 src[ETH_ALEN];
 	struct lib80211_crypt_data *crypt = NULL;
 	struct cb_desc *tcb_desc;
 	u8 bIsMulticast = false;
Signature · 1 line
1.8.4.1
#3 lore raw

PATCH v5 3/34 staging: rtl8192e: Fix PREFER_ETHER_ADDR_COPY warnings

In reply to Mateusz Kulikowski

Replace memcpy() with ether_addr_copy() where possible to make checkpatch.pl happy.
Change was target tested (download 1Mb file over WPA2 network) with BUG trap for unaligned addresses in ether_addr_copy()

---
 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c |  2 +-
 drivers/staging/rtl8192e/rtl819x_BAProc.c      | 13 +++---
 drivers/staging/rtl8192e/rtllib_crypt_tkip.c   | 19 ++++----
 drivers/staging/rtl8192e/rtllib_rx.c           | 46 +++++++++---------
 drivers/staging/rtl8192e/rtllib_softmac.c      | 64 +++++++++++++-------------
 drivers/staging/rtl8192e/rtllib_softmac_wx.c   |  4 +-
 drivers/staging/rtl8192e/rtllib_tx.c           | 24 +++++-----
 7 files changed, 89 insertions(+), 83 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +1 -1
index 926fca7..f9c6153 100644
@@ -382,7 +382,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 			*(u16 *)(&dev->dev_addr[i]) = usValue;
 		}
 	} else {
-		memcpy(dev->dev_addr, bMac_Tmp_Addr, 6);
+		ether_addr_copy(dev->dev_addr, bMac_Tmp_Addr);
 	}
 
 	RT_TRACE(COMP_INIT, "Permanent Address = %pM\n",
drivers/staging/rtl8192e/rtl819x_BAProc.c +7 -6
index 26258ea..5b72bce 100644
@@ -18,6 +18,7 @@
 ******************************************************************************/
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
+#include <linux/etherdevice.h>
 #include "rtllib.h"
 #include "rtl819x_BA.h"
 
@@ -103,10 +104,10 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
 	BAReq = (struct rtllib_hdr_3addr *)skb_put(skb,
 		 sizeof(struct rtllib_hdr_3addr));
 
-	memcpy(BAReq->addr1, Dst, ETH_ALEN);
-	memcpy(BAReq->addr2, ieee->dev->dev_addr, ETH_ALEN);
+	ether_addr_copy(BAReq->addr1, Dst);
+	ether_addr_copy(BAReq->addr2, ieee->dev->dev_addr);
 
-	memcpy(BAReq->addr3, ieee->current_network.bssid, ETH_ALEN);
+	ether_addr_copy(BAReq->addr3, ieee->current_network.bssid);
 	BAReq->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT);
 
 	tag = (u8 *)skb_put(skb, 9);
@@ -167,9 +168,9 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,
 	Delba = (struct rtllib_hdr_3addr *) skb_put(skb,
 		 sizeof(struct rtllib_hdr_3addr));
 
-	memcpy(Delba->addr1, dst, ETH_ALEN);
-	memcpy(Delba->addr2, ieee->dev->dev_addr, ETH_ALEN);
-	memcpy(Delba->addr3, ieee->current_network.bssid, ETH_ALEN);
+	ether_addr_copy(Delba->addr1, dst);
+	ether_addr_copy(Delba->addr2, ieee->dev->dev_addr);
+	ether_addr_copy(Delba->addr3, ieee->current_network.bssid);
 	Delba->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT);
 
 	tag = (u8 *)skb_put(skb, 6);
drivers/staging/rtl8192e/rtllib_crypt_tkip.c +10 -9
index cdad066..6b20479 100644
@@ -21,6 +21,7 @@
 #include <linux/crypto.h>
 #include <linux/scatterlist.h>
 #include <linux/crc32.h>
+#include <linux/etherdevice.h>
 
 #include "rtllib.h"
 
@@ -533,20 +534,20 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
 	switch (le16_to_cpu(hdr11->frame_ctl) &
 		(RTLLIB_FCTL_FROMDS | RTLLIB_FCTL_TODS)) {
 	case RTLLIB_FCTL_TODS:
-		memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */
-		memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */
+		ether_addr_copy(hdr, hdr11->addr3); /* DA */
+		ether_addr_copy(hdr + ETH_ALEN, hdr11->addr2); /* SA */
 		break;
 	case RTLLIB_FCTL_FROMDS:
-		memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */
-		memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */
+		ether_addr_copy(hdr, hdr11->addr1); /* DA */
+		ether_addr_copy(hdr + ETH_ALEN, hdr11->addr3); /* SA */
 		break;
 	case RTLLIB_FCTL_FROMDS | RTLLIB_FCTL_TODS:
-		memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */
-		memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */
+		ether_addr_copy(hdr, hdr11->addr3); /* DA */
+		ether_addr_copy(hdr + ETH_ALEN, hdr11->addr4); /* SA */
 		break;
 	case 0:
-		memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */
-		memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */
+		ether_addr_copy(hdr, hdr11->addr1); /* DA */
+		ether_addr_copy(hdr + ETH_ALEN, hdr11->addr2); /* SA */
 		break;
 	}
 
@@ -599,7 +600,7 @@ static void rtllib_michael_mic_failure(struct net_device *dev,
 	else
 		ev.flags |= IW_MICFAILURE_PAIRWISE;
 	ev.src_addr.sa_family = ARPHRD_ETHER;
-	memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN);
+	ether_addr_copy(ev.src_addr.sa_data, hdr->addr2);
 	memset(&wrqu, 0, sizeof(wrqu));
 	wrqu.data.length = sizeof(ev);
 	wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
drivers/staging/rtl8192e/rtllib_rx.c +25 -21

93 lines not on this page · raw message

drivers/staging/rtl8192e/rtllib_softmac.c +32 -32

149 lines not on this page · raw message

drivers/staging/rtl8192e/rtllib_softmac_wx.c +2 -2
index 9715a79..90c7bde 100644
@@ -160,7 +160,7 @@ int rtllib_wx_set_wap(struct rtllib_device *ieee,
 
 	if (is_zero_ether_addr(temp->sa_data)) {
 		spin_lock_irqsave(&ieee->lock, flags);
-		memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+		ether_addr_copy(ieee->current_network.bssid, temp->sa_data);
 		ieee->wap_set = 0;
 		spin_unlock_irqrestore(&ieee->lock, flags);
 		ret = -1;
@@ -177,7 +177,7 @@ int rtllib_wx_set_wap(struct rtllib_device *ieee,
 	spin_lock_irqsave(&ieee->lock, flags);
 
 	ieee->cannot_notify = false;
-	memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+	ether_addr_copy(ieee->current_network.bssid, temp->sa_data);
 	ieee->wap_set = !is_zero_ether_addr(temp->sa_data);
 
 	spin_unlock_irqrestore(&ieee->lock, flags);
drivers/staging/rtl8192e/rtllib_tx.c +12 -12
index b177d7b..b09d5d0 100644
@@ -609,8 +609,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 			goto success;
 		}
 		/* Save source and destination addresses */
-		memcpy(dest, skb->data, ETH_ALEN);
-		memcpy(src, skb->data+ETH_ALEN, ETH_ALEN);
+		ether_addr_copy(dest, skb->data);
+		ether_addr_copy(src, skb->data + ETH_ALEN);
 
 		memset(skb->cb, 0, sizeof(skb->cb));
 		ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
@@ -695,22 +695,22 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 			/* To DS: Addr1 = BSSID, Addr2 = SA,
 			 * Addr3 = DA
 			 */
-			memcpy(&header.addr1, ieee->current_network.bssid,
-			       ETH_ALEN);
-			memcpy(&header.addr2, &src, ETH_ALEN);
+			ether_addr_copy(header.addr1,
+					ieee->current_network.bssid);
+			ether_addr_copy(header.addr2, src);
 			if (IsAmsdu)
-				memcpy(&header.addr3,
-				       ieee->current_network.bssid, ETH_ALEN);
+				ether_addr_copy(header.addr3,
+						ieee->current_network.bssid);
 			else
-				memcpy(&header.addr3, &dest, ETH_ALEN);
+				ether_addr_copy(header.addr3, dest);
 		} else if (ieee->iw_mode == IW_MODE_ADHOC) {
 			/* not From/To DS: Addr1 = DA, Addr2 = SA,
 			 * Addr3 = BSSID
 			 */
-			memcpy(&header.addr1, dest, ETH_ALEN);
-			memcpy(&header.addr2, src, ETH_ALEN);
-			memcpy(&header.addr3, ieee->current_network.bssid,
-			       ETH_ALEN);
+			ether_addr_copy(header.addr1, dest);
+			ether_addr_copy(header.addr2, src);
+			ether_addr_copy(header.addr3,
+					ieee->current_network.bssid);
 		}
 
 		bIsMulticast = is_multicast_ether_addr(header.addr1);
Signature · 1 line
1.8.4.1
#4 lore raw

PATCH v5 4/34 staging: rtl8192e: Fix DEEP_INDENTATION warning in rtllib_parse_info_param()

In reply to Mateusz Kulikowski

Move MFIE_TYPE_GENERIC handler to rtllib_parse_mife_generic() function. Code was not altered significantly, therefore in some places it generates LONG_LINE checkpatch.pl warnings.

---
 drivers/staging/rtl8192e/rtllib_rx.c | 397 ++++++++++++++++++-----------------
 1 file changed, 210 insertions(+), 187 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +210 -187
index bde80c8..f8f1920 100644
@@ -1739,6 +1739,213 @@ static inline void rtllib_extract_country_ie(
 
 }
 
+static void rtllib_parse_mife_generic(struct rtllib_device *ieee,
+				      struct rtllib_info_element *info_element,
+				      struct rtllib_network *network,
+				      u16 *tmp_htcap_len,
+				      u16 *tmp_htinfo_len)
+{
+	u16 ht_realtek_agg_len = 0;
+	u8  ht_realtek_agg_buf[MAX_IE_LEN];
+
+	if (!rtllib_parse_qos_info_param_IE(info_element, network))
+		return;
+	if (info_element->len >= 4 &&
+	    info_element->data[0] == 0x00 &&
+	    info_element->data[1] == 0x50 &&
+	    info_element->data[2] == 0xf2 &&
+	    info_element->data[3] == 0x01) {
+		network->wpa_ie_len = min(info_element->len + 2,
+					  MAX_WPA_IE_LEN);
+		memcpy(network->wpa_ie, info_element, network->wpa_ie_len);
+		return;
+	}
+	if (info_element->len == 7 &&
+	    info_element->data[0] == 0x00 &&
+	    info_element->data[1] == 0xe0 &&
+	    info_element->data[2] == 0x4c &&
+	    info_element->data[3] == 0x01 &&
+	    info_element->data[4] == 0x02)
+		network->Turbo_Enable = 1;
+
+	if (*tmp_htcap_len == 0) {
+		if (info_element->len >= 4 &&
+		   info_element->data[0] == 0x00 &&
+		   info_element->data[1] == 0x90 &&
+		   info_element->data[2] == 0x4c &&
+		   info_element->data[3] == 0x033) {
+
+			*tmp_htcap_len = min_t(u8, info_element->len,
+					       MAX_IE_LEN);
+			if (*tmp_htcap_len != 0) {
+				network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
+				network->bssht.bdHTCapLen = min_t(u16, *tmp_htcap_len, sizeof(network->bssht.bdHTCapBuf));
+				memcpy(network->bssht.bdHTCapBuf,
+				       info_element->data,
+				       network->bssht.bdHTCapLen);
+			}
+		}
+		if (*tmp_htcap_len != 0) {
+			network->bssht.bdSupportHT = true;
+			network->bssht.bdHT1R = ((((struct ht_capab_ele *)(network->bssht.bdHTCapBuf))->MCS[1]) == 0);
+		} else {
+			network->bssht.bdSupportHT = false;
+			network->bssht.bdHT1R = false;
+		}
+	}
+
+
+	if (*tmp_htinfo_len == 0) {
+		if (info_element->len >= 4 &&
+		    info_element->data[0] == 0x00 &&
+		    info_element->data[1] == 0x90 &&
+		    info_element->data[2] == 0x4c &&
+		    info_element->data[3] == 0x034) {
+			*tmp_htinfo_len = min_t(u8, info_element->len,
+						MAX_IE_LEN);
+			if (*tmp_htinfo_len != 0) {
+				network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
+				network->bssht.bdHTInfoLen = min_t(u16, *tmp_htinfo_len, sizeof(network->bssht.bdHTInfoBuf));
+				memcpy(network->bssht.bdHTInfoBuf,
+				       info_element->data,
+				       network->bssht.bdHTInfoLen);
+			}
+
+		}
+	}
+
+	if (ieee->aggregation) {
+		if (network->bssht.bdSupportHT) {
+			if (info_element->len >= 4 &&
+			    info_element->data[0] == 0x00 &&
+			    info_element->data[1] == 0xe0 &&
+			    info_element->data[2] == 0x4c &&
+			    info_element->data[3] == 0x02) {
+				ht_realtek_agg_len = min_t(u8,
+							   info_element->len,
+							   MAX_IE_LEN);
+				memcpy(ht_realtek_agg_buf,
+				       info_element->data,
+				       info_element->len);
+			}
+			if (ht_realtek_agg_len >= 5) {
+				network->realtek_cap_exit = true;
+				network->bssht.bdRT2RTAggregation = true;
+
+				if ((ht_realtek_agg_buf[4] == 1) &&
+				    (ht_realtek_agg_buf[5] & 0x02))
+					network->bssht.bdRT2RTLongSlotTime = true;
+
+				if ((ht_realtek_agg_buf[4] == 1) &&
+				    (ht_realtek_agg_buf[5] & RT_HT_CAP_USE_92SE))
+					network->bssht.RT2RT_HT_Mode |= RT_HT_CAP_USE_92SE;
+			}
+		}
+		if (ht_realtek_agg_len >= 5) {
+			if ((ht_realtek_agg_buf[5] & RT_HT_CAP_USE_SOFTAP))
+				network->bssht.RT2RT_HT_Mode |= RT_HT_CAP_USE_SOFTAP;
+		}
+	}
+
+	if ((info_element->len >= 3 &&
+	     info_element->data[0] == 0x00 &&
+	     info_element->data[1] == 0x05 &&
+	     info_element->data[2] == 0xb5) ||
+	     (info_element->len >= 3 &&
+	     info_element->data[0] == 0x00 &&
+	     info_element->data[1] == 0x0a &&
+	     info_element->data[2] == 0xf7) ||
+	     (info_element->len >= 3 &&
+	     info_element->data[0] == 0x00 &&
+	     info_element->data[1] == 0x10 &&
+	     info_element->data[2] == 0x18)) {
+		network->broadcom_cap_exist = true;
+	}
+	if (info_element->len >= 3 &&
+	    info_element->data[0] == 0x00 &&
+	    info_element->data[1] == 0x0c &&
+	    info_element->data[2] == 0x43)
+		network->ralink_cap_exist = true;
+	if ((info_element->len >= 3 &&
+	     info_element->data[0] == 0x00 &&
+	     info_element->data[1] == 0x03 &&
+	     info_element->data[2] == 0x7f) ||
+	     (info_element->len >= 3 &&
+	     info_element->data[0] == 0x00 &&
+	     info_element->data[1] == 0x13 &&
+	     info_element->data[2] == 0x74))
+		network->atheros_cap_exist = true;
+
+	if ((info_element->len >= 3 &&
+	     info_element->data[0] == 0x00 &&
+	     info_element->data[1] == 0x50 &&
+	     info_element->data[2] == 0x43))
+		network->marvell_cap_exist = true;
+	if (info_element->len >= 3 &&
+	    info_element->data[0] == 0x00 &&
+	    info_element->data[1] == 0x40 &&
+	    info_element->data[2] == 0x96)
+		network->cisco_cap_exist = true;
+
+
+	if (info_element->len >= 3 &&
+	    info_element->data[0] == 0x00 &&
+	    info_element->data[1] == 0x0a &&
+	    info_element->data[2] == 0xf5)
+		network->airgo_cap_exist = true;
+
+	if (info_element->len > 4 &&
+	    info_element->data[0] == 0x00 &&
+	    info_element->data[1] == 0x40 &&
+	    info_element->data[2] == 0x96 &&
+	    info_element->data[3] == 0x01) {
+		if (info_element->len == 6) {
+			memcpy(network->CcxRmState, &info_element[4], 2);
+			if (network->CcxRmState[0] != 0)
+				network->bCcxRmEnable = true;
+			else
+				network->bCcxRmEnable = false;
+			network->MBssidMask = network->CcxRmState[1] & 0x07;
+			if (network->MBssidMask != 0) {
+				network->bMBssidValid = true;
+				network->MBssidMask = 0xff << (network->MBssidMask);
+				ether_addr_copy(network->MBssid,
+						network->bssid);
+				network->MBssid[5] &= network->MBssidMask;
+			} else {
+				network->bMBssidValid = false;
+			}
+		} else {
+			network->bCcxRmEnable = false;
+		}
+	}
+	if (info_element->len > 4  &&
+	    info_element->data[0] == 0x00 &&
+	    info_element->data[1] == 0x40 &&
+	    info_element->data[2] == 0x96 &&
+	    info_element->data[3] == 0x03) {
+		if (info_element->len == 5) {
+			network->bWithCcxVerNum = true;
+			network->BssCcxVerNumber = info_element->data[4];
+		} else {
+			network->bWithCcxVerNum = false;
+			network->BssCcxVerNumber = 0;
+		}
+	}
+	if (info_element->len > 4  &&
+	    info_element->data[0] == 0x00 &&
+	    info_element->data[1] == 0x50 &&
+	    info_element->data[2] == 0xf2 &&
+	    info_element->data[3] == 0x04) {
+		RTLLIB_DEBUG_MGMT("MFIE_TYPE_WZC: %d bytes\n",
+				  info_element->len);
+		network->wzc_ie_len = min(info_element->len+2,
+					  MAX_WZC_IE_LEN);
+		memcpy(network->wzc_ie, info_element,
+		       network->wzc_ie_len);
+	}
+}
+
 int rtllib_parse_info_param(struct rtllib_device *ieee,
 		struct rtllib_info_element *info_element,
 		u16 length,
@@ -1749,8 +1956,6 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 	short offset;
 	u16	tmp_htcap_len = 0;
 	u16	tmp_htinfo_len = 0;
-	u16 ht_realtek_agg_len = 0;
-	u8  ht_realtek_agg_buf[MAX_IE_LEN];
 	char rates_str[64];
 	char *p;
 
@@ -1903,191 +2108,9 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 		case MFIE_TYPE_GENERIC:
 			RTLLIB_DEBUG_MGMT("MFIE_TYPE_GENERIC: %d bytes\n",
 					     info_element->len);
-			if (!rtllib_parse_qos_info_param_IE(info_element,
-							       network))
-				break;
-			if (info_element->len >= 4 &&
-			    info_element->data[0] == 0x00 &&
-			    info_element->data[1] == 0x50 &&
-			    info_element->data[2] == 0xf2 &&
-			    info_element->data[3] == 0x01) {
-				network->wpa_ie_len = min(info_element->len + 2,
-							  MAX_WPA_IE_LEN);
-				memcpy(network->wpa_ie, info_element,
-				       network->wpa_ie_len);
-				break;
-			}
-			if (info_element->len == 7 &&
-			    info_element->data[0] == 0x00 &&
-			    info_element->data[1] == 0xe0 &&
-			    info_element->data[2] == 0x4c &&
-			    info_element->data[3] == 0x01 &&
-			    info_element->data[4] == 0x02)
-				network->Turbo_Enable = 1;
-
-			if (tmp_htcap_len == 0) {
-				if (info_element->len >= 4 &&
-				   info_element->data[0] == 0x00 &&
-				   info_element->data[1] == 0x90 &&
-				   info_element->data[2] == 0x4c &&
-				   info_element->data[3] == 0x033) {
-
-					tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN);
-					if (tmp_htcap_len != 0) {
-						network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
-						network->bssht.bdHTCapLen = min_t(u16, tmp_htcap_len, sizeof(network->bssht.bdHTCapBuf));
-						memcpy(network->bssht.bdHTCapBuf, info_element->data, network->bssht.bdHTCapLen);
-					}
-				}
-				if (tmp_htcap_len != 0) {
-					network->bssht.bdSupportHT = true;
-					network->bssht.bdHT1R = ((((struct ht_capab_ele *)(network->bssht.bdHTCapBuf))->MCS[1]) == 0);
-				} else {
-					network->bssht.bdSupportHT = false;
-					network->bssht.bdHT1R = false;
-				}
-			}
-
-
-			if (tmp_htinfo_len == 0) {
-				if (info_element->len >= 4 &&
-				    info_element->data[0] == 0x00 &&
-				    info_element->data[1] == 0x90 &&
-				    info_element->data[2] == 0x4c &&
-				    info_element->data[3] == 0x034) {
-					tmp_htinfo_len = min_t(u8, info_element->len, MAX_IE_LEN);
-					if (tmp_htinfo_len != 0) {
-						network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
-						network->bssht.bdHTInfoLen = min_t(u16, tmp_htinfo_len, sizeof(network->bssht.bdHTInfoBuf));
-						memcpy(network->bssht.bdHTInfoBuf, info_element->data, network->bssht.bdHTInfoLen);
-					}
-
-				}
-			}
-
-			if (ieee->aggregation) {
-				if (network->bssht.bdSupportHT) {
-					if (info_element->len >= 4 &&
-					    info_element->data[0] == 0x00 &&
-					    info_element->data[1] == 0xe0 &&
-					    info_element->data[2] == 0x4c &&
-					    info_element->data[3] == 0x02) {
-						ht_realtek_agg_len = min_t(u8, info_element->len, MAX_IE_LEN);
-						memcpy(ht_realtek_agg_buf, info_element->data, info_element->len);
-					}
-					if (ht_realtek_agg_len >= 5) {
-						network->realtek_cap_exit = true;
-						network->bssht.bdRT2RTAggregation = true;
-
-						if ((ht_realtek_agg_buf[4] == 1) && (ht_realtek_agg_buf[5] & 0x02))
-							network->bssht.bdRT2RTLongSlotTime = true;
-
-						if ((ht_realtek_agg_buf[4] == 1) && (ht_realtek_agg_buf[5] & RT_HT_CAP_USE_92SE))
-							network->bssht.RT2RT_HT_Mode |= RT_HT_CAP_USE_92SE;
-					}
-				}
-				if (ht_realtek_agg_len >= 5) {
-					if ((ht_realtek_agg_buf[5] & RT_HT_CAP_USE_SOFTAP))
-						network->bssht.RT2RT_HT_Mode |= RT_HT_CAP_USE_SOFTAP;
-				}
-			}
-
-			if ((info_element->len >= 3 &&
-			     info_element->data[0] == 0x00 &&
-			     info_element->data[1] == 0x05 &&
-			     info_element->data[2] == 0xb5) ||
-			     (info_element->len >= 3 &&
-			     info_element->data[0] == 0x00 &&
-			     info_element->data[1] == 0x0a &&
-			     info_element->data[2] == 0xf7) ||
-			     (info_element->len >= 3 &&
-			     info_element->data[0] == 0x00 &&
-			     info_element->data[1] == 0x10 &&
-			     info_element->data[2] == 0x18)) {
-				network->broadcom_cap_exist = true;
-			}
-			if (info_element->len >= 3 &&
-			    info_element->data[0] == 0x00 &&
-			    info_element->data[1] == 0x0c &&
-			    info_element->data[2] == 0x43)
-				network->ralink_cap_exist = true;
-			if ((info_element->len >= 3 &&
-			     info_element->data[0] == 0x00 &&
-			     info_element->data[1] == 0x03 &&
-			     info_element->data[2] == 0x7f) ||
-			     (info_element->len >= 3 &&
-			     info_element->data[0] == 0x00 &&
-			     info_element->data[1] == 0x13 &&
-			     info_element->data[2] == 0x74))
-				network->atheros_cap_exist = true;
-
-			if ((info_element->len >= 3 &&
-			     info_element->data[0] == 0x00 &&
-			     info_element->data[1] == 0x50 &&
-			     info_element->data[2] == 0x43))
-				network->marvell_cap_exist = true;
-			if (info_element->len >= 3 &&
-			    info_element->data[0] == 0x00 &&
-			    info_element->data[1] == 0x40 &&
-			    info_element->data[2] == 0x96)
-				network->cisco_cap_exist = true;
-
-
-			if (info_element->len >= 3 &&
-			    info_element->data[0] == 0x00 &&
-			    info_element->data[1] == 0x0a &&
-			    info_element->data[2] == 0xf5)
-				network->airgo_cap_exist = true;
-
-			if (info_element->len > 4 &&
-			    info_element->data[0] == 0x00 &&
-			    info_element->data[1] == 0x40 &&
-			    info_element->data[2] == 0x96 &&
-			    info_element->data[3] == 0x01) {
-				if (info_element->len == 6) {
-					memcpy(network->CcxRmState, &info_element[4], 2);
-					if (network->CcxRmState[0] != 0)
-						network->bCcxRmEnable = true;
-					else
-						network->bCcxRmEnable = false;
-					network->MBssidMask = network->CcxRmState[1] & 0x07;
-					if (network->MBssidMask != 0) {
-						network->bMBssidValid = true;
-						network->MBssidMask = 0xff << (network->MBssidMask);
-						ether_addr_copy(network->MBssid, network->bssid);
-						network->MBssid[5] &= network->MBssidMask;
-					} else {
-						network->bMBssidValid = false;
-					}
-				} else {
-					network->bCcxRmEnable = false;
-				}
-			}
-			if (info_element->len > 4  &&
-			    info_element->data[0] == 0x00 &&
-			    info_element->data[1] == 0x40 &&
-			    info_element->data[2] == 0x96 &&
-			    info_element->data[3] == 0x03) {
-				if (info_element->len == 5) {
-					network->bWithCcxVerNum = true;
-					network->BssCcxVerNumber = info_element->data[4];
-				} else {
-					network->bWithCcxVerNum = false;
-					network->BssCcxVerNumber = 0;
-				}
-			}
-			if (info_element->len > 4  &&
-			    info_element->data[0] == 0x00 &&
-			    info_element->data[1] == 0x50 &&
-			    info_element->data[2] == 0xf2 &&
-			    info_element->data[3] == 0x04) {
-				RTLLIB_DEBUG_MGMT("MFIE_TYPE_WZC: %d bytes\n",
-						     info_element->len);
-				network->wzc_ie_len = min(info_element->len+2,
-							  MAX_WZC_IE_LEN);
-				memcpy(network->wzc_ie, info_element,
-						network->wzc_ie_len);
-			}
+			rtllib_parse_mife_generic(ieee, info_element, network,
+						  &tmp_htcap_len,
+						  &tmp_htinfo_len);
 			break;
 
 		case MFIE_TYPE_RSN:
Signature · 1 line
1.8.4.1
#5 lore raw

PATCH v5 5/34 staging: rtl8192e: Replace memcmp() with ether_addr_equal()

In reply to Mateusz Kulikowski

Use dedicated macro to compare ethernet addresses in probe_rq_parse().

---
 drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_softmac.c +1 -1
index 2f562de..5d69f98b 100644
@@ -1853,7 +1853,7 @@ static short probe_rq_parse(struct rtllib_device *ieee, struct sk_buff *skb,
 		return -1; /* corrupted */
 
 	bssid_match =
-	  (memcmp(header->addr3, ieee->current_network.bssid, ETH_ALEN) != 0) &&
+	  (!ether_addr_equal(header->addr3, ieee->current_network.bssid)) &&
 	  (!is_broadcast_ether_addr(header->addr3));
 	if (bssid_match)
 		return -1;
Signature · 1 line
1.8.4.1
#6 lore raw

PATCH v5 6/34 staging: rtl8192e: Remove rtllib_crypt.[ch]

In reply to Mateusz Kulikowski

It is neither compiled nor used in rtl8192e.

---
 drivers/staging/rtl8192e/rtllib_crypt.c | 254 --------------------------------
 drivers/staging/rtl8192e/rtllib_crypt.h |  34 -----
 2 files changed, 288 deletions(-)
 delete mode 100644 drivers/staging/rtl8192e/rtllib_crypt.c
 delete mode 100644 drivers/staging/rtl8192e/rtllib_crypt.h
drivers/staging/rtl8192e/rtllib_crypt.c deleted +0 -254
deleted file mode 100644
index 1e6ae9b..0000000
@@ -1,254 +0,0 @@
-/*
- * Host AP crypto routines
- *
- * Copyright (c) 2002-2003, Jouni Malinen <[email protected]>
- * Portions Copyright (C) 2004, Intel Corporation <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation. See README and COPYING for
- * more details.
- *
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-
-#include "rtllib.h"
-
-struct rtllib_crypto_alg {
-	struct list_head list;
-	struct lib80211_crypto_ops *ops;
-};
-
-
-struct rtllib_crypto {
-	struct list_head algs;
-	spinlock_t lock;
-};
-
-static struct rtllib_crypto *hcrypt;
-
-void rtllib_crypt_deinit_entries(struct lib80211_crypt_info *info,
-					   int force)
-{
-	struct list_head *ptr, *n;
-	struct lib80211_crypt_data *entry;
-
-	for (ptr = info->crypt_deinit_list.next, n = ptr->next;
-	     ptr != &info->crypt_deinit_list; ptr = n, n = ptr->next) {
-		entry = list_entry(ptr, struct lib80211_crypt_data, list);
-
-		if (atomic_read(&entry->refcnt) != 0 && !force)
-			continue;
-
-		list_del(ptr);
-
-		if (entry->ops)
-			entry->ops->deinit(entry->priv);
-		kfree(entry);
-	}
-}
-EXPORT_SYMBOL(rtllib_crypt_deinit_entries);
-
-void rtllib_crypt_deinit_handler(unsigned long data)
-{
-	struct lib80211_crypt_info *info = (struct lib80211_crypt_info *)data;
-	unsigned long flags;
-
-	spin_lock_irqsave(info->lock, flags);
-	rtllib_crypt_deinit_entries(info, 0);
-	if (!list_empty(&info->crypt_deinit_list)) {
-		printk(KERN_DEBUG
-		       "%s: entries remaining in delayed crypt deletion list\n",
-		       info->name);
-		info->crypt_deinit_timer.expires = jiffies + HZ;
-		add_timer(&info->crypt_deinit_timer);
-	}
-	spin_unlock_irqrestore(info->lock, flags);
-
-}
-EXPORT_SYMBOL(rtllib_crypt_deinit_handler);
-
-void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info,
-				 struct lib80211_crypt_data **crypt)
-{
-	struct lib80211_crypt_data *tmp;
-	unsigned long flags;
-
-	if (*crypt == NULL)
-		return;
-
-	tmp = *crypt;
-	*crypt = NULL;
-
-	/* must not run ops->deinit() while there may be pending encrypt or
-	 * decrypt operations. Use a list of delayed deinits to avoid needing
-	 * locking.
-	 */
-
-	spin_lock_irqsave(info->lock, flags);
-	list_add(&tmp->list, &info->crypt_deinit_list);
-	if (!timer_pending(&info->crypt_deinit_timer)) {
-		info->crypt_deinit_timer.expires = jiffies + HZ;
-		add_timer(&info->crypt_deinit_timer);
-	}
-	spin_unlock_irqrestore(info->lock, flags);
-}
-EXPORT_SYMBOL(rtllib_crypt_delayed_deinit);
-
-int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops)
-{
-	unsigned long flags;
-	struct rtllib_crypto_alg *alg;
-
-	if (hcrypt == NULL)
-		return -1;
-
-	alg = kzalloc(sizeof(*alg), GFP_KERNEL);
-	if (alg == NULL)
-		return -ENOMEM;
-
-	alg->ops = ops;
-
-	spin_lock_irqsave(&hcrypt->lock, flags);
-	list_add(&alg->list, &hcrypt->algs);
-	spin_unlock_irqrestore(&hcrypt->lock, flags);
-
-	printk(KERN_DEBUG "rtllib_crypt: registered algorithm '%s'\n",
-	       ops->name);
-
-	return 0;
-}
-EXPORT_SYMBOL(rtllib_register_crypto_ops);
-
-int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops)
-{
-	unsigned long flags;
-	struct list_head *ptr;
-	struct rtllib_crypto_alg *del_alg = NULL;
-
-	if (hcrypt == NULL)
-		return -1;
-
-	spin_lock_irqsave(&hcrypt->lock, flags);
-	for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) {
-		struct rtllib_crypto_alg *alg =
-			(struct rtllib_crypto_alg *) ptr;
-		if (alg->ops == ops) {
-			list_del(&alg->list);
-			del_alg = alg;
-			break;
-		}
-	}
-	spin_unlock_irqrestore(&hcrypt->lock, flags);
-
-	if (del_alg) {
-		printk(KERN_DEBUG "rtllib_crypt: unregistered algorithm '%s'\n",
-		       ops->name);
-		kfree(del_alg);
-	}
-
-	return del_alg ? 0 : -1;
-}
-EXPORT_SYMBOL(rtllib_unregister_crypto_ops);
-
-
-struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name)
-{
-	unsigned long flags;
-	struct list_head *ptr;
-	struct rtllib_crypto_alg *found_alg = NULL;
-
-	if (hcrypt == NULL)
-		return NULL;
-
-	spin_lock_irqsave(&hcrypt->lock, flags);
-	for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) {
-		struct rtllib_crypto_alg *alg =
-			(struct rtllib_crypto_alg *) ptr;
-		if (strcmp(alg->ops->name, name) == 0) {
-			found_alg = alg;
-			break;
-		}
-	}
-	spin_unlock_irqrestore(&hcrypt->lock, flags);
-
-	if (found_alg)
-		return found_alg->ops;
-	else
-		return NULL;
-}
-EXPORT_SYMBOL(rtllib_get_crypto_ops);
-
-
-static void *rtllib_crypt_null_init(int keyidx) { return (void *) 1; }
-static void rtllib_crypt_null_deinit(void *priv) {}
-
-static struct lib80211_crypto_ops rtllib_crypt_null = {
-	.name			= "NULL",
-	.init			= rtllib_crypt_null_init,
-	.deinit			= rtllib_crypt_null_deinit,
-	.encrypt_mpdu		= NULL,
-	.decrypt_mpdu		= NULL,
-	.encrypt_msdu		= NULL,
-	.decrypt_msdu		= NULL,
-	.set_key		= NULL,
-	.get_key		= NULL,
-	.extra_mpdu_prefix_len	= 0,
-	.extra_mpdu_postfix_len	= 0,
-	.extra_msdu_prefix_len	= 0,
-	.extra_msdu_postfix_len	= 0,
-	.owner			= THIS_MODULE,
-};
-
-
-int __init rtllib_crypto_init(void)
-{
-	int ret = -ENOMEM;
-
-	hcrypt = kzalloc(sizeof(*hcrypt), GFP_KERNEL);
-	if (!hcrypt)
-		goto out;
-
-	INIT_LIST_HEAD(&hcrypt->algs);
-	spin_lock_init(&hcrypt->lock);
-
-	ret = lib80211_register_crypto_ops(&rtllib_crypt_null);
-	if (ret < 0) {
-		kfree(hcrypt);
-		hcrypt = NULL;
-	}
-out:
-	return ret;
-}
-
-
-void __exit rtllib_crypto_deinit(void)
-{
-	struct list_head *ptr, *n;
-
-	if (hcrypt == NULL)
-		return;
-
-	for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs;
-	     ptr = n, n = ptr->next) {
-		struct rtllib_crypto_alg *alg =
-			(struct rtllib_crypto_alg *) ptr;
-		list_del(ptr);
-		printk(KERN_DEBUG
-		       "rtllib_crypt: unregistered algorithm '%s' (deinit)\n",
-		       alg->ops->name);
-		kfree(alg);
-	}
-
-	kfree(hcrypt);
-}
-
-module_init(rtllib_crypto_init);
-module_exit(rtllib_crypto_deinit);
-
-MODULE_LICENSE("GPL");
drivers/staging/rtl8192e/rtllib_crypt.h deleted +0 -34
deleted file mode 100644
index b8cf59f..0000000
@@ -1,34 +0,0 @@
-/*
- * Original code based on Host AP (software wireless LAN access point) driver
- * for Intersil Prism2/2.5/3.
- *
- * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
- * <[email protected]>
- * Copyright (c) 2002-2003, Jouni Malinen <[email protected]>
- *
- * Adaption to a generic IEEE 802.11 stack by James Ketrenos
- * <[email protected]>
- *
- * Copyright (c) 2004, Intel Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation. See README and COPYING for
- * more details.
- */
-
-/* This file defines the interface to the rtllib crypto module.
- */
-#ifndef RTLLIB_CRYPT_H
-#define RTLLIB_CRYPT_H
-
-#include <linux/skbuff.h>
-
-int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops);
-int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
-struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name);
-void rtllib_crypt_deinit_entries(struct lib80211_crypt_info *info, int force);
-void rtllib_crypt_deinit_handler(unsigned long data);
-void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info,
-				 struct lib80211_crypt_data **crypt);
-#endif
Signature · 1 line
1.8.4.1
#7 lore raw

PATCH v5 7/34 staging: rtl8192e: Replace RTLLIB_DEBUG(DL_ERR) with netdev_*()

In reply to Mateusz Kulikowski

Replace all RTLLIB_DEBUG(RTLLIB_DL_ERR, *) calls with netdev_err() for errors that really should be reported to user.
Use netdev_warn() for the rest.
Rephrase some of the messages to make them more readable/compact.

---
 drivers/staging/rtl8192e/rtl819x_BAProc.c    | 79 +++++++++++++---------------
 drivers/staging/rtl8192e/rtl819x_HTProc.c    | 23 ++++----
 drivers/staging/rtl8192e/rtl819x_TSProc.c    | 19 ++++---
 drivers/staging/rtl8192e/rtllib_rx.c         | 15 ++++--
 drivers/staging/rtl8192e/rtllib_softmac.c    |  6 +--
 drivers/staging/rtl8192e/rtllib_softmac_wx.c |  6 +--
 6 files changed, 75 insertions(+), 73 deletions(-)
drivers/staging/rtl8192e/rtl819x_BAProc.c +38 -41
index 5b72bce..7d72c19 100644
@@ -88,12 +88,12 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
 		     "========>%s(), frame(%d) sentd to: %pM, ieee->dev:%p\n",
 		     __func__, type, Dst, ieee->dev);
 	if (pBA == NULL) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR, "pBA is NULL\n");
+		netdev_warn(ieee->dev, "pBA is NULL\n");
 		return NULL;
 	}
 	skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr));
 	if (skb == NULL) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc skb for ADDBA_REQ\n");
+		netdev_err(ieee->dev, "Can't alloc skb for ADDBA_REQ\n");
 		return NULL;
 	}
 
@@ -159,7 +159,7 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,
 
 	skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr));
 	if (skb == NULL) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc skb for ADDBA_REQ\n");
+		netdev_err(ieee->dev, "Can't alloc skb for DELBA_REQ\n");
 		return NULL;
 	}
 
@@ -247,10 +247,9 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb)
 	struct rx_ts_record *pTS = NULL;
 
 	if (skb->len < sizeof(struct rtllib_hdr_3addr) + 9) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     " Invalid skb len in BAREQ(%d / %d)\n",
-			     (int)skb->len,
-			     (int)(sizeof(struct rtllib_hdr_3addr) + 9));
+		netdev_warn(ieee->dev, "Invalid skb len in BAREQ(%d / %d)\n",
+			    (int)skb->len,
+			    (int)(sizeof(struct rtllib_hdr_3addr) + 9));
 		return -1;
 	}
 
@@ -270,24 +269,24 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb)
 	    (ieee->pHTInfo->bCurrentHTSupport == false) ||
 	    (ieee->pHTInfo->IOTAction & HT_IOT_ACT_REJECT_ADDBA_REQ)) {
 		rc = ADDBA_STATUS_REFUSED;
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n",
-			     ieee->current_network.qos_data.active,
-			     ieee->pHTInfo->bCurrentHTSupport);
+		netdev_warn(ieee->dev,
+			    "Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n",
+			    ieee->current_network.qos_data.active,
+			    ieee->pHTInfo->bCurrentHTSupport);
 		goto OnADDBAReq_Fail;
 	}
 	if (!GetTs(ieee, (struct ts_common_info **)(&pTS), dst,
 	    (u8)(pBaParamSet->field.TID), RX_DIR, true)) {
 		rc = ADDBA_STATUS_REFUSED;
-		RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS in %s()\n", __func__);
+		netdev_warn(ieee->dev, "%s(): can't get TS\n", __func__);
 		goto OnADDBAReq_Fail;
 	}
 	pBA = &pTS->RxAdmittedBARecord;
 
 	if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) {
 		rc = ADDBA_STATUS_INVALID_PARAM;
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "BA Policy is not correct in %s()\n", __func__);
+		netdev_warn(ieee->dev, "%s(): BA Policy is not correct\n",
+			    __func__);
 		goto OnADDBAReq_Fail;
 	}
 
@@ -334,10 +333,9 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)
 	u16			ReasonCode;
 
 	if (skb->len < sizeof(struct rtllib_hdr_3addr) + 9) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "Invalid skb len in BARSP(%d / %d)\n",
-			     (int)skb->len,
-			     (int)(sizeof(struct rtllib_hdr_3addr) + 9));
+		netdev_warn(ieee->dev, "Invalid skb len in BARSP(%d / %d)\n",
+			    (int)skb->len,
+			    (int)(sizeof(struct rtllib_hdr_3addr) + 9));
 		return -1;
 	}
 	rsp = (struct rtllib_hdr_3addr *)skb->data;
@@ -353,11 +351,11 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)
 	if (ieee->current_network.qos_data.active == 0  ||
 	    ieee->pHTInfo->bCurrentHTSupport == false ||
 	    ieee->pHTInfo->bCurrentAMPDUEnable == false) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n",
-			     ieee->current_network.qos_data.active,
-			     ieee->pHTInfo->bCurrentHTSupport,
-			     ieee->pHTInfo->bCurrentAMPDUEnable);
+		netdev_warn(ieee->dev,
+			    "reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n",
+			    ieee->current_network.qos_data.active,
+			    ieee->pHTInfo->bCurrentHTSupport,
+			    ieee->pHTInfo->bCurrentAMPDUEnable);
 		ReasonCode = DELBA_REASON_UNKNOWN_BA;
 		goto OnADDBARsp_Reject;
 	}
@@ -365,7 +363,7 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)
 
 	if (!GetTs(ieee, (struct ts_common_info **)(&pTS), dst,
 		   (u8)(pBaParamSet->field.TID), TX_DIR, false)) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS in %s()\n", __func__);
+		netdev_warn(ieee->dev, "%s(): can't get TS\n", __func__);
 		ReasonCode = DELBA_REASON_UNKNOWN_BA;
 		goto OnADDBARsp_Reject;
 	}
@@ -381,8 +379,9 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)
 		return -1;
 	} else if ((pPendingBA->bValid == false) ||
 		   (*pDialogToken != pPendingBA->DialogToken)) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "OnADDBARsp(): Recv ADDBA Rsp. BA invalid, DELBA!\n");
+		netdev_warn(ieee->dev,
+			    "%s(): Recv ADDBA Rsp. BA invalid, DELBA!\n",
+			    __func__);
 		ReasonCode = DELBA_REASON_UNKNOWN_BA;
 		goto OnADDBARsp_Reject;
 	} else {
@@ -435,19 +434,18 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb)
 	u8 *dst = NULL;
 
 	if (skb->len < sizeof(struct rtllib_hdr_3addr) + 6) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "Invalid skb len in DELBA(%d / %d)\n",
-			     (int)skb->len,
-			     (int)(sizeof(struct rtllib_hdr_3addr) + 6));
+		netdev_warn(ieee->dev, "Invalid skb len in DELBA(%d / %d)\n",
+			    (int)skb->len,
+			    (int)(sizeof(struct rtllib_hdr_3addr) + 6));
 		return -1;
 	}
 
 	if (ieee->current_network.qos_data.active == 0  ||
 		ieee->pHTInfo->bCurrentHTSupport == false) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "received DELBA while QOS or HT is not supported(%d, %d)\n",
-			     ieee->current_network. qos_data.active,
-			     ieee->pHTInfo->bCurrentHTSupport);
+		netdev_warn(ieee->dev,
+			    "received DELBA while QOS or HT is not supported(%d, %d)\n",
+			    ieee->current_network. qos_data.active,
+			    ieee->pHTInfo->bCurrentHTSupport);
 		return -1;
 	}
 
@@ -463,10 +461,10 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb)
 
 		if (!GetTs(ieee, (struct ts_common_info **)&pRxTs, dst,
 		    (u8)pDelBaParamSet->field.TID, RX_DIR, false)) {
-			RTLLIB_DEBUG(RTLLIB_DL_ERR,
-				     "can't get TS for RXTS in %s().dst: %pM TID:%d\n",
-				     __func__, dst,
-				     (u8)pDelBaParamSet->field.TID);
+			netdev_warn(ieee->dev,
+				    "%s(): can't get TS for RXTS. dst:%pM TID:%d\n",
+				    __func__, dst,
+				    (u8)pDelBaParamSet->field.TID);
 			return -1;
 		}
 
@@ -476,9 +474,8 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb)
 
 		if (!GetTs(ieee, (struct ts_common_info **)&pTxTs, dst,
 			   (u8)pDelBaParamSet->field.TID, TX_DIR, false)) {
-			RTLLIB_DEBUG(RTLLIB_DL_ERR,
-				     "can't get TS for TXTS in %s()\n",
-				     __func__);
+			netdev_warn(ieee->dev, "%s(): can't get TS for TXTS\n",
+				    __func__);
 			return -1;
 		}
 
drivers/staging/rtl8192e/rtl819x_HTProc.c +11 -12
index 7f10311..2c365d3 100644
@@ -291,8 +291,8 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap,
 	struct ht_capab_ele *pCapELE = NULL;
 
 	if ((posHTCap == NULL) || (pHT == NULL)) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "posHTCap or pHTInfo can't be null in HTConstructCapabilityElement()\n");
+		netdev_warn(ieee->dev,
+			    "%s(): posHTCap and pHTInfo are null\n", __func__);
 		return;
 	}
 	memset(posHTCap, 0, *len);
@@ -373,8 +373,9 @@ void HTConstructInfoElement(struct rtllib_device *ieee, u8 *posHTInfo,
 	struct ht_info_ele *pHTInfoEle = (struct ht_info_ele *)posHTInfo;
 
 	if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "posHTInfo or pHTInfoEle can't be null in HTConstructInfoElement()\n");
+		netdev_warn(ieee->dev,
+			    "%s(): posHTInfo and pHTInfoEle are null\n",
+			    __func__);
 		return;
 	}
 
@@ -413,8 +414,7 @@ void HTConstructRT2RTAggElement(struct rtllib_device *ieee, u8 *posRT2RTAgg,
 				u8 *len)
 {
 	if (posRT2RTAgg == NULL) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "posRT2RTAgg can't be null in HTConstructRT2RTAggElement()\n");
+		netdev_warn(ieee->dev, "%s(): posRT2RTAgg is null\n", __func__);
 		return;
 	}
 	memset(posRT2RTAgg, 0, *len);
@@ -437,8 +437,7 @@ static u8 HT_PickMCSRate(struct rtllib_device *ieee, u8 *pOperateMCS)
 	u8 i;
 
 	if (pOperateMCS == NULL) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "pOperateMCS can't be null in HT_PickMCSRate()\n");
+		netdev_warn(ieee->dev, "%s(): pOperateMCS is null\n", __func__);
 		return false;
 	}
 
@@ -472,8 +471,9 @@ u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet,
 	u8		availableMcsRate[16];
 
 	if (pMCSRateSet == NULL || pMCSFilter == NULL) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "pMCSRateSet or pMCSFilter can't be null in HTGetHighestMCSRate()\n");
+		netdev_warn(ieee->dev,
+			    "%s(): pMCSRateSet and pMCSFilter are null\n",
+			    __func__);
 		return false;
 	}
 	for (i = 0; i < 16; i++)
@@ -538,8 +538,7 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
 	static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};
 
 	if (pHTInfo->bCurrentHTSupport == false) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "<=== HTOnAssocRsp(): HT_DISABLE\n");
+		netdev_warn(ieee->dev, "%s(): HT_DISABLE\n", __func__);
 		return;
 	}
 	RTLLIB_DEBUG(RTLLIB_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n");
drivers/staging/rtl8192e/rtl819x_TSProc.c +9 -10
index 7d77d05..974f03e 100644
@@ -78,8 +78,9 @@ static void RxPktPendingTimeout(unsigned long data)
 		pRxTs->RxTimeoutIndicateSeq = 0xffff;
 
 		if (index > REORDER_WIN_SIZE) {
-			RTLLIB_DEBUG(RTLLIB_DL_ERR,
-				     "RxReorderIndicatePacket(): Rx Reorder struct buffer full!!\n");
+			netdev_warn(ieee->dev,
+				    "%s(): Rx Reorder struct buffer full\n",
+				    __func__);
 			spin_unlock_irqrestore(&(ieee->reorder_spinlock),
 					       flags);
 			return;
@@ -318,17 +319,15 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 	enum direction_value Dir;
 
 	if (is_multicast_ether_addr(Addr)) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "ERR! get TS for Broadcast or Multicast\n");
+		netdev_warn(ieee->dev, "Get TS for Broadcast or Multicast\n");
 		return false;
 	}
 	if (ieee->current_network.qos_data.supported == 0) {
 		UP = 0;
 	} else {
 		if (!IsACValid(TID)) {
-			RTLLIB_DEBUG(RTLLIB_DL_ERR,
-				     "ERR! in %s(), TID(%d) is not valid\n",
-				     __func__, TID);
+			netdev_warn(ieee->dev, "%s(): TID(%d) is not valid\n",
+				    __func__, TID);
 			return false;
 		}
 
@@ -413,9 +412,9 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 		return true;
 	}
 
-	RTLLIB_DEBUG(RTLLIB_DL_ERR,
-		     "ERR!!in function %s() There is not enough dir=%d(0=up down=1) TS record to be used!!",
-		     __func__, Dir);
+	netdev_warn(ieee->dev,
+		    "There is not enough dir=%d(0=up down=1) TS record to be used!",
+		    Dir);
 	return false;
 }
 
drivers/staging/rtl8192e/rtllib_rx.c +11 -4
index f8f1920..3dc0583 100644
@@ -654,7 +654,9 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
 			 * indicate all the packets in struct buffer and get
 			 * reorder entries.
 			 */
-			RTLLIB_DEBUG(RTLLIB_DL_ERR, "RxReorderIndicatePacket(): There is no reorder entry!! Packet is dropped!!\n");
+			netdev_err(ieee->dev,
+				   "%s(): There is no reorder entry! Packet is dropped!\n",
+				   __func__);
 			{
 				int i;
 
@@ -676,7 +678,9 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
 				SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) {
 			/* This protect struct buffer from overflow. */
 			if (index >= REORDER_WIN_SIZE) {
-				RTLLIB_DEBUG(RTLLIB_DL_ERR, "RxReorderIndicatePacket(): Buffer overflow!!\n");
+				netdev_err(ieee->dev,
+					   "%s(): Buffer overflow!\n",
+					   __func__);
 				bPktInBuf = true;
 				break;
 			}
@@ -707,7 +711,9 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
 		pTS->RxTimeoutIndicateSeq = 0xffff;
 
 		if (index > REORDER_WIN_SIZE) {
-			RTLLIB_DEBUG(RTLLIB_DL_ERR, "RxReorderIndicatePacket(): Rx Reorder struct buffer full!!\n");
+			netdev_err(ieee->dev,
+				   "%s(): Rx Reorder struct buffer full!\n",
+				   __func__);
 			spin_unlock_irqrestore(&(ieee->reorder_spinlock),
 					       flags);
 			return;
@@ -911,7 +917,8 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee,
 			pRxTS->RxLastFragNum = frag;
 			pRxTS->RxLastSeqNum = WLAN_GET_SEQ_SEQ(sc);
 		} else {
-			RTLLIB_DEBUG(RTLLIB_DL_ERR, "ERR!!%s(): No TS!! Skip the check!!\n", __func__);
+			netdev_warn(ieee->dev, "%s(): No TS! Skip the check!\n",
+				    __func__);
 			return -1;
 		}
 	}
drivers/staging/rtl8192e/rtllib_softmac.c +3 -3
index 5d69f98b..4ce3525 100644
@@ -2200,8 +2200,8 @@ static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *sk
 	u8 category = 0;
 
 	if (act == NULL) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "error to get payload of action frame\n");
+		netdev_warn(ieee->dev,
+			    "Error getting payload of action frame\n");
 		return;
 	}
 
@@ -3074,7 +3074,7 @@ void rtllib_softmac_init(struct rtllib_device *ieee)
 		ieee->seq_ctrl[i] = 0;
 	ieee->pDot11dInfo = kzalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC);
 	if (!ieee->pDot11dInfo)
-		RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc memory for DOT11D\n");
+		netdev_err(ieee->dev, "Can't alloc memory for DOT11D\n");
 	ieee->LinkDetectInfo.SlotIndex = 0;
 	ieee->LinkDetectInfo.SlotNum = 2;
 	ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0;
drivers/staging/rtl8192e/rtllib_softmac_wx.c +3 -3
index 90c7bde..d5e13a5 100644
@@ -575,9 +575,9 @@ int rtllib_wx_set_power(struct rtllib_device *ieee,
 	if ((!ieee->sta_wake_up) ||
 	    (!ieee->enter_sleep_state) ||
 	    (!ieee->ps_is_queue_empty)) {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "%s(): PS mode is tried to be use but driver missed a callback\n\n",
-			     __func__);
+		netdev_warn(ieee->dev,
+			    "%s(): PS mode is tried to be use but driver missed a callback\n",
+			    __func__);
 		return -1;
 	}
 
Signature · 1 line
1.8.4.1
#8 lore raw

PATCH v5 8/34 staging: rtl8192e: Remove RTLLIB_ERROR() and RTLLIB_WARNING()

In reply to Mateusz Kulikowski

Use pr_* where needed (rtllib init code).

---
 drivers/staging/rtl8192e/rtllib.h        | 2 --
 drivers/staging/rtl8192e/rtllib_module.c | 8 +++-----
 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -2
index 411363c..42c37f8 100644
@@ -701,8 +701,6 @@ do {								\
 #define RTLLIB_DL_TRACE	   (1<<29)
 #define RTLLIB_DL_DATA	   (1<<30)
 #define RTLLIB_DL_ERR	   (1<<31)
-#define RTLLIB_ERROR(f, a...) pr_err("rtllib: " f, ## a)
-#define RTLLIB_WARNING(f, a...) pr_warn("rtllib: " f, ## a)
 #define RTLLIB_DEBUG_INFO(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)
 
 #define RTLLIB_DEBUG_WX(f, a...)     RTLLIB_DEBUG(RTLLIB_DL_WX, f, ## a)
drivers/staging/rtl8192e/rtllib_module.c +3 -5
index 32cc8df..b8c7df5 100644
@@ -107,7 +107,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
 
 	dev = alloc_etherdev(sizeof(struct rtllib_device) + sizeof_priv);
 	if (!dev) {
-		RTLLIB_ERROR("Unable to network device.\n");
+		pr_err("Unable to allocate net_device.\n");
 		return NULL;
 	}
 	ieee = (struct rtllib_device *)netdev_priv_rsl(dev);
@@ -116,8 +116,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
 
 	err = rtllib_networks_allocate(ieee);
 	if (err) {
-		RTLLIB_ERROR("Unable to allocate beacon storage: %d\n",
-				err);
+		pr_err("Unable to allocate beacon storage: %d\n", err);
 		goto failed;
 	}
 	rtllib_networks_initialize(ieee);
@@ -240,8 +239,7 @@ static int __init rtllib_init(void)
 	rtllib_debug_level = debug;
 	rtllib_proc = proc_mkdir(DRV_NAME, init_net.proc_net);
 	if (rtllib_proc == NULL) {
-		RTLLIB_ERROR("Unable to create " DRV_NAME
-				" proc directory\n");
+		pr_err("Unable to create " DRV_NAME " proc directory\n");
 		return -EIO;
 	}
 	e = proc_create("debug_level", S_IRUGO | S_IWUSR, rtllib_proc, &fops);
Signature · 1 line
1.8.4.1
#9 lore raw

PATCH v5 9/34 staging: rtl8192e: Remove RTLLIB_DEBUG_WX()

In reply to Mateusz Kulikowski

Use netdev_dbg() instead of RTLLIB_DEBUG_WX().
Rewrite some messages to be more readable.

---
 drivers/staging/rtl8192e/rtllib.h    |  1 -
 drivers/staging/rtl8192e/rtllib_wx.c | 33 ++++++++++++++++-----------------
 2 files changed, 16 insertions(+), 18 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
index 42c37f8..392bcd5 100644
@@ -703,7 +703,6 @@ do {								\
 #define RTLLIB_DL_ERR	   (1<<31)
 #define RTLLIB_DEBUG_INFO(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)
 
-#define RTLLIB_DEBUG_WX(f, a...)     RTLLIB_DEBUG(RTLLIB_DL_WX, f, ## a)
 #define RTLLIB_DEBUG_SCAN(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_SCAN, f, ## a)
 #define RTLLIB_DEBUG_STATE(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_STATE, f, ## a)
 #define RTLLIB_DEBUG_MGMT(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a)
drivers/staging/rtl8192e/rtllib_wx.c +16 -17
index 6234aae..c2c5f0d 100644
@@ -266,7 +266,7 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee,
 	int i = 0;
 	int err = 0;
 
-	RTLLIB_DEBUG_WX("Getting scan\n");
+	netdev_dbg(ieee->dev, "Getting scan\n");
 	down(&ieee->wx_sem);
 	spin_lock_irqsave(&ieee->lock, flags);
 
@@ -293,7 +293,7 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee,
 	wrqu->data.length = ev -  extra;
 	wrqu->data.flags = 0;
 
-	RTLLIB_DEBUG_WX("exit: %d networks returned.\n", i);
+	netdev_dbg(ieee->dev, "%s(): %d networks returned.\n", __func__, i);
 
 	return err;
 }
@@ -311,7 +311,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 	int i, key, key_provided, len;
 	struct lib80211_crypt_data **crypt;
 
-	RTLLIB_DEBUG_WX("SET_ENCODE\n");
+	netdev_dbg(ieee->dev, "%s()\n", __func__);
 
 	key = erq->flags & IW_ENCODE_INDEX;
 	if (key) {
@@ -324,16 +324,16 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 		key = ieee->crypt_info.tx_keyidx;
 	}
 
-	RTLLIB_DEBUG_WX("Key: %d [%s]\n", key, key_provided ?
+	netdev_dbg(ieee->dev, "Key: %d [%s]\n", key, key_provided ?
 			   "provided" : "default");
 	crypt = &ieee->crypt_info.crypt[key];
 	if (erq->flags & IW_ENCODE_DISABLED) {
 		if (key_provided && *crypt) {
-			RTLLIB_DEBUG_WX("Disabling encryption on key %d.\n",
-					   key);
+			netdev_dbg(ieee->dev,
+				   "Disabling encryption on key %d.\n", key);
 			lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
 		} else
-			RTLLIB_DEBUG_WX("Disabling encryption.\n");
+			netdev_dbg(ieee->dev, "Disabling encryption.\n");
 
 		/* Check all the keys to see if any are still configured,
 		 * and if no key index was provided, de-init them all
@@ -405,9 +405,9 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 		if (len > erq->length)
 			memset(sec.keys[key] + erq->length, 0,
 			       len - erq->length);
-		RTLLIB_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n",
-				   key, escape_essid(sec.keys[key], len),
-				   erq->length, len);
+		netdev_dbg(ieee->dev, "Setting key %d to '%s' (%d:%d bytes)\n",
+			   key, escape_essid(sec.keys[key], len), erq->length,
+			   len);
 		sec.key_sizes[key] = len;
 		(*crypt)->ops->set_key(sec.keys[key], len, NULL,
 				       (*crypt)->priv);
@@ -436,8 +436,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 
 		/* No key data - just set the default TX key index */
 		if (key_provided) {
-			RTLLIB_DEBUG_WX("Setting key %d to default Tx key.\n",
-					key);
+			netdev_dbg(ieee->dev,
+				   "Setting key %d as default Tx key.\n", key);
 			ieee->crypt_info.tx_keyidx = key;
 			sec.active_key = key;
 			sec.flags |= SEC_ACTIVE_KEY;
@@ -449,7 +449,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 			  WLAN_AUTH_SHARED_KEY;
 	sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
 	sec.flags |= SEC_AUTH_MODE;
-	RTLLIB_DEBUG_WX("Auth: %s\n", sec.auth_mode == WLAN_AUTH_OPEN ?
+	netdev_dbg(ieee->dev, "Auth: %s\n", sec.auth_mode == WLAN_AUTH_OPEN ?
 			   "OPEN" : "SHARED KEY");
 
 	/* For now we just support WEP, so only set that security level...
@@ -485,7 +485,7 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,
 	int len, key;
 	struct lib80211_crypt_data *crypt;
 
-	RTLLIB_DEBUG_WX("GET_ENCODE\n");
+	netdev_dbg(ieee->dev, "%s()\n", __func__);
 
 	if (ieee->iw_mode == IW_MODE_MONITOR)
 		return -1;
@@ -592,8 +592,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
 		module = "rtllib_crypt_ccmp";
 		break;
 	default:
-		RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n",
-				   dev->name, ext->alg);
+		netdev_dbg(ieee->dev, "Unknown crypto alg %d\n", ext->alg);
 		ret = -EINVAL;
 		goto done;
 	}
@@ -673,7 +672,7 @@ done:
 	 if (ieee->reset_on_keychange &&
 	    ieee->iw_mode != IW_MODE_INFRA &&
 	    ieee->reset_port && ieee->reset_port(dev)) {
-		RTLLIB_DEBUG_WX("%s: reset_port failed\n", dev->name);
+		netdev_dbg(ieee->dev, "Port reset failed\n");
 		return -EINVAL;
 	}
 	return ret;
Signature · 1 line
1.8.4.1
maintainer
#10 lore raw

Re: [PATCH v5 09/34] staging: rtl8192e: Remove RTLLIB_DEBUG_WX()

Quoted 44 lines · Mateusz Kulikowski

Use netdev_dbg() instead of RTLLIB_DEBUG_WX().
Rewrite some messages to be more readable.

---
 drivers/staging/rtl8192e/rtllib.h    |  1 -
 drivers/staging/rtl8192e/rtllib_wx.c | 33 ++++++++++++++++-----------------
 2 files changed, 16 insertions(+), 18 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
index 42c37f8..392bcd5 100644
@@ -703,7 +703,6 @@ do {								\
 #define RTLLIB_DL_ERR	   (1<<31)
 #define RTLLIB_DEBUG_INFO(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)
 
-#define RTLLIB_DEBUG_WX(f, a...)     RTLLIB_DEBUG(RTLLIB_DL_WX, f, ## a)
 #define RTLLIB_DEBUG_SCAN(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_SCAN, f, ## a)
 #define RTLLIB_DEBUG_STATE(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_STATE, f, ## a)
 #define RTLLIB_DEBUG_MGMT(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a)
drivers/staging/rtl8192e/rtllib_wx.c +2 -2
index 6234aae..c2c5f0d 100644
@@ -266,7 +266,7 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee,
 	int i = 0;
 	int err = 0;
 
-	RTLLIB_DEBUG_WX("Getting scan\n");
+	netdev_dbg(ieee->dev, "Getting scan\n");
 	down(&ieee->wx_sem);
 	spin_lock_irqsave(&ieee->lock, flags);
 
@@ -293,7 +293,7 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee,
 	wrqu->data.length = ev -  extra;
 	wrqu->data.flags = 0;
 
-	RTLLIB_DEBUG_WX("exit: %d networks returned.\n", i);
+	netdev_dbg(ieee->dev, "%s(): %d networks returned.\n", __func__, i);
 
 	return err;
 }

drivers/staging/rtl8192e/rtllib_wx.c int rtllib_wx_set_encode(struct rtllib_device *ieee, · line 314

Quoted 5 lines
drivers/staging/rtl8192e/rtllib_wx.c +1 -1
@@ -311,7 +311,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 	int i, key, key_provided, len;
 	struct lib80211_crypt_data **crypt;
 
-	RTLLIB_DEBUG_WX("SET_ENCODE\n");
+	netdev_dbg(ieee->dev, "%s()\n", __func__);

Why are you adding __func__? Stuff like this, that is obviously a "trace" function can just be deleted.

No error message should be showing the function name as it should be "obvious" as to what driver / device that this message came from, which is wht the netdev_* calls provide. So the function name is just extra noise.

I'll take these patches, but removing these types of things would be good to do in future patches.

thanks,

greg k-h

#11 lore raw

PATCH v5 10/34 staging: rtl8192e: Simplify rtllib_process_probe_response()

In reply to Mateusz Kulikowski

- Extract frame_ctl once and use it as variable.
- Drop endian conversion in is_beacon() function (used in simplified function only)
- Simplify debug messages
- Invert STYPE checks in debug messages - it is valid as only BEACON and PROBE_RESP are allowed

---
 drivers/staging/rtl8192e/rtllib_rx.c | 37 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 22 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +15 -22
index 3dc0583..304404d 100644
@@ -2457,9 +2457,9 @@ static inline void update_network(struct rtllib_network *dst,
 	dst->BssCcxVerNumber = src->BssCcxVerNumber;
 }
 
-static inline int is_beacon(__le16 fc)
+static inline int is_beacon(u16 fc)
 {
-	return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == RTLLIB_STYPE_BEACON);
+	return (WLAN_FC_GET_STYPE(fc) == RTLLIB_STYPE_BEACON);
 }
 
 static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel)
@@ -2500,6 +2500,7 @@ static inline void rtllib_process_probe_response(
 	short renew;
 	struct rtllib_network *network = kzalloc(sizeof(struct rtllib_network),
 						 GFP_ATOMIC);
+	u16 frame_ctl = le16_to_cpu(beacon->header.frame_ctl);
 
 	if (!network)
 		return;
@@ -2528,12 +2529,9 @@ static inline void rtllib_process_probe_response(
 	if (rtllib_network_init(ieee, beacon, network, stats)) {
 		RTLLIB_DEBUG_SCAN("Dropped '%s' ( %pM) via %s.\n",
 				  escape_essid(info_element->data,
-				  info_element->len),
-				  beacon->header.addr3,
-				  WLAN_FC_GET_STYPE(
-					  le16_to_cpu(beacon->header.frame_ctl)) ==
-				  RTLLIB_STYPE_PROBE_RESP ?
-				  "PROBE RESPONSE" : "BEACON");
+				  info_element->len), beacon->header.addr3,
+				  is_beacon(frame_ctl) ? "BEACON" :
+							 "PROBE RESPONSE");
 		goto free_network;
 	}
 
@@ -2541,8 +2539,7 @@ static inline void rtllib_process_probe_response(
 	if (!rtllib_legal_channel(ieee, network->channel))
 		goto free_network;
 
-	if (WLAN_FC_GET_STYPE(le16_to_cpu(beacon->header.frame_ctl)) ==
-	    RTLLIB_STYPE_PROBE_RESP) {
+	if (WLAN_FC_GET_STYPE(frame_ctl) == RTLLIB_STYPE_PROBE_RESP) {
 		if (IsPassiveChannel(ieee, network->channel)) {
 			netdev_info(ieee->dev,
 				    "GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n",
@@ -2575,7 +2572,7 @@ static inline void rtllib_process_probe_response(
 			else
 				ieee->current_network.buseprotection = false;
 		}
-		if (is_beacon(beacon->header.frame_ctl)) {
+		if (is_beacon(frame_ctl)) {
 			if (ieee->state >= RTLLIB_LINKED)
 				ieee->LinkDetectInfo.NumRecvBcnInPeriod++;
 		}
@@ -2612,22 +2609,18 @@ static inline void rtllib_process_probe_response(
 		RTLLIB_DEBUG_SCAN("Adding '%s' ( %pM) via %s.\n",
 				  escape_essid(network->ssid,
 				  network->ssid_len), network->bssid,
-				  WLAN_FC_GET_STYPE(
-					  le16_to_cpu(beacon->header.frame_ctl)) ==
-				  RTLLIB_STYPE_PROBE_RESP ?
-				  "PROBE RESPONSE" : "BEACON");
+				  is_beacon(frame_ctl) ? "BEACON" :
+							 "PROBE RESPONSE");
 		memcpy(target, network, sizeof(*target));
 		list_add_tail(&target->list, &ieee->network_list);
 		if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
 			rtllib_softmac_new_net(ieee, network);
 	} else {
 		RTLLIB_DEBUG_SCAN("Updating '%s' ( %pM) via %s.\n",
-				  escape_essid(target->ssid,
-				  target->ssid_len), target->bssid,
-				  WLAN_FC_GET_STYPE(
-					  le16_to_cpu(beacon->header.frame_ctl)) ==
-				  RTLLIB_STYPE_PROBE_RESP ?
-				  "PROBE RESPONSE" : "BEACON");
+				  escape_essid(target->ssid, target->ssid_len),
+				  target->bssid,
+				  is_beacon(frame_ctl) ? "BEACON" :
+							 "PROBE RESPONSE");
 
 		/* we have an entry and we are going to update it. But this
 		 *  entry may be already expired. In this case we do the same
@@ -2648,7 +2641,7 @@ static inline void rtllib_process_probe_response(
 	}
 
 	spin_unlock_irqrestore(&ieee->lock, flags);
-	if (is_beacon(beacon->header.frame_ctl) &&
+	if (is_beacon(frame_ctl) &&
 	    is_same_network(&ieee->current_network, network,
 	    (network->ssid_len ? 1 : 0)) &&
 	    (ieee->state == RTLLIB_LINKED)) {
Signature · 1 line
1.8.4.1
#12 lore raw

PATCH v5 11/34 staging: rtl8192e: Remove RTLLIB_DEBUG_SCAN()

In reply to Mateusz Kulikowski

Use netdev_dbg() instead, remove duplicated logs.

---
 drivers/staging/rtl8192e/rtllib.h    |   1 -
 drivers/staging/rtl8192e/rtllib_rx.c | 101 ++++++++++++++++-------------------
 drivers/staging/rtl8192e/rtllib_wx.c |  12 +++--
 3 files changed, 54 insertions(+), 60 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
index 392bcd5..6481919 100644
@@ -703,7 +703,6 @@ do {								\
 #define RTLLIB_DL_ERR	   (1<<31)
 #define RTLLIB_DEBUG_INFO(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)
 
-#define RTLLIB_DEBUG_SCAN(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_SCAN, f, ## a)
 #define RTLLIB_DEBUG_STATE(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_STATE, f, ## a)
 #define RTLLIB_DEBUG_MGMT(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a)
 #define RTLLIB_DEBUG_FRAG(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_FRAG, f, ## a)
drivers/staging/rtl8192e/rtllib_rx.c +47 -54

175 lines not on this page · raw message

drivers/staging/rtl8192e/rtllib_wx.c +7 -5
index c2c5f0d..2812a77 100644
@@ -281,11 +281,13 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee,
 			ev = rtl819x_translate_scan(ieee, ev, stop, network,
 						    info);
 		else
-			RTLLIB_DEBUG_SCAN("Not showing network '%s ( %pM)' due to age (%lums).\n",
-				escape_essid(network->ssid,
-					     network->ssid_len),
-				network->bssid,
-				(jiffies - network->last_scanned) / (HZ / 100));
+			netdev_dbg(ieee->dev,
+				   "Network '%s ( %pM)' hidden due to age (%lums).\n",
+				   escape_essid(network->ssid,
+						network->ssid_len),
+				   network->bssid,
+				   (jiffies - network->last_scanned) /
+				   (HZ / 100));
 	}
 
 	spin_unlock_irqrestore(&ieee->lock, flags);
Signature · 1 line
1.8.4.1
#13 lore raw

PATCH v5 12/34 staging: rtl8192e: Remove RTLLIB_DEBUG_(FRAG|EAP|DROP|STATE|TX|RX)()

In reply to Mateusz Kulikowski

Use netdev_dbg() instead.

---
 drivers/staging/rtl8192e/rtllib.h    |  6 ----
 drivers/staging/rtl8192e/rtllib_rx.c | 58 ++++++++++++++++++++----------------
 drivers/staging/rtl8192e/rtllib_tx.c |  5 ++--
 3 files changed, 35 insertions(+), 34 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -6
index 6481919..b20090d 100644
@@ -703,13 +703,7 @@ do {								\
 #define RTLLIB_DL_ERR	   (1<<31)
 #define RTLLIB_DEBUG_INFO(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)
 
-#define RTLLIB_DEBUG_STATE(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_STATE, f, ## a)
 #define RTLLIB_DEBUG_MGMT(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a)
-#define RTLLIB_DEBUG_FRAG(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_FRAG, f, ## a)
-#define RTLLIB_DEBUG_EAP(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_EAP, f, ## a)
-#define RTLLIB_DEBUG_DROP(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_DROP, f, ## a)
-#define RTLLIB_DEBUG_TX(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_TX, f, ## a)
-#define RTLLIB_DEBUG_RX(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_RX, f, ## a)
 #define RTLLIB_DEBUG_QOS(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_QOS, f, ## a)
 
 #ifndef ETH_P_PAE
drivers/staging/rtl8192e/rtllib_rx.c +32 -26

118 lines not on this page · raw message

drivers/staging/rtl8192e/rtllib_tx.c +3 -2
index b09d5d0..8ef820d 100644
@@ -670,8 +670,9 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 			struct eapol *eap = (struct eapol *)(skb->data +
 				sizeof(struct ethhdr) - SNAP_SIZE -
 				sizeof(u16));
-			RTLLIB_DEBUG_EAP("TX: IEEE 802.11 EAPOL frame: %s\n",
-				eap_get_type(eap->type));
+			netdev_dbg(ieee->dev,
+				   "TX: IEEE 802.11 EAPOL frame: %s\n",
+				   eap_get_type(eap->type));
 		}
 
 		/* Advance the SKB to the start of the payload */
Signature · 1 line
1.8.4.1
#14 lore raw

PATCH v5 13/34 staging: rtl8192e: Remove RTLLIB_DEBUG_QOS()

In reply to Mateusz Kulikowski

- Pass extra argument (rtllib_device) to rtllib_parse_qos_info_param_IE() and update_network()
- Replace RTLLIB_DEBUG_QOS() with netdev_dbg()
- Remove RTLLIB_DEBUG_QOS()

---
 drivers/staging/rtl8192e/rtllib.h    |  1 -
 drivers/staging/rtl8192e/rtllib_rx.c | 26 ++++++++++++++------------
 2 files changed, 14 insertions(+), 13 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
index b20090d..c7afb3e 100644
@@ -704,7 +704,6 @@ do {								\
 #define RTLLIB_DEBUG_INFO(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)
 
 #define RTLLIB_DEBUG_MGMT(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a)
-#define RTLLIB_DEBUG_QOS(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_QOS, f, ## a)
 
 #ifndef ETH_P_PAE
 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
drivers/staging/rtl8192e/rtllib_rx.c +14 -12
index 8ea3e2f..5a3593b 100644
@@ -1657,9 +1657,10 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info
  * parameters element. check the information element length to decide
  * which type to read
  */
-static int rtllib_parse_qos_info_param_IE(struct rtllib_info_element
+static int rtllib_parse_qos_info_param_IE(struct rtllib_device *ieee,
+					  struct rtllib_info_element
 					     *info_element,
-					     struct rtllib_network *network)
+					  struct rtllib_network *network)
 {
 	int rc = 0;
 	struct rtllib_qos_information_element qos_info_element;
@@ -1684,7 +1685,7 @@ static int rtllib_parse_qos_info_param_IE(struct rtllib_info_element
 	}
 
 	if (rc == 0) {
-		RTLLIB_DEBUG_QOS("QoS is supported\n");
+		netdev_dbg(ieee->dev, "QoS is supported\n");
 		network->qos_data.supported = 1;
 	}
 	return rc;
@@ -1761,7 +1762,7 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee,
 	u16 ht_realtek_agg_len = 0;
 	u8  ht_realtek_agg_buf[MAX_IE_LEN];
 
-	if (!rtllib_parse_qos_info_param_IE(info_element, network))
+	if (!rtllib_parse_qos_info_param_IE(ieee, info_element, network))
 		return;
 	if (info_element->len >= 4 &&
 	    info_element->data[0] == 0x00 &&
@@ -2352,7 +2353,8 @@ static inline int is_same_network(struct rtllib_network *src,
 }
 
 
-static inline void update_network(struct rtllib_network *dst,
+static inline void update_network(struct rtllib_device *ieee,
+				  struct rtllib_network *dst,
 				  struct rtllib_network *src)
 {
 	int qos_active;
@@ -2426,12 +2428,12 @@ static inline void update_network(struct rtllib_network *dst,
 		       sizeof(struct rtllib_qos_data));
 	if (dst->qos_data.supported == 1) {
 		if (dst->ssid_len)
-			RTLLIB_DEBUG_QOS
-				("QoS the network %s is QoS supported\n",
-				dst->ssid);
+			netdev_dbg(ieee->dev,
+				   "QoS the network %s is QoS supported\n",
+				   dst->ssid);
 		else
-			RTLLIB_DEBUG_QOS
-				("QoS the network is QoS supported\n");
+			netdev_dbg(ieee->dev,
+				   "QoS the network is QoS supported\n");
 	}
 	dst->qos_data.active = qos_active;
 	dst->qos_data.old_param_count = old_param;
@@ -2567,7 +2569,7 @@ static inline void rtllib_process_probe_response(
 	spin_lock_irqsave(&ieee->lock, flags);
 	if (is_same_network(&ieee->current_network, network,
 	   (network->ssid_len ? 1 : 0))) {
-		update_network(&ieee->current_network, network);
+		update_network(ieee, &ieee->current_network, network);
 		if ((ieee->current_network.mode == IEEE_N_24G ||
 		     ieee->current_network.mode == IEEE_G)
 		     && ieee->current_network.berp_info_valid) {
@@ -2637,7 +2639,7 @@ static inline void rtllib_process_probe_response(
 		    network->ssid_len) == 0) &&
 		    (ieee->state == RTLLIB_NOLINK))))
 			renew = 1;
-		update_network(target, network);
+		update_network(ieee, target, network);
 		if (renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
 			rtllib_softmac_new_net(ieee, network);
 	}
Signature · 1 line
1.8.4.1
#15 lore raw

PATCH v5 14/34 staging: rtl8192e: Remove RTLLIB_DEBUG_MGMT()

In reply to Mateusz Kulikowski

- Use netdev_dbg() instead of RTLLIB_DEBUG_MGMT()
- Remove RTLLIB_DEBUG_MGMT()
- Pass net_device to auth_parse(), auth_rq_parse() and assoc_rq_parse()
- Remove duplicated messages

---
 drivers/staging/rtl8192e/rtllib.h         |  2 -
 drivers/staging/rtl8192e/rtllib_rx.c      | 78 +++++++++++++++----------------
 drivers/staging/rtl8192e/rtllib_softmac.c | 50 +++++++++-----------
 3 files changed, 61 insertions(+), 69 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -2
index c7afb3e..82f4fd9 100644
@@ -703,8 +703,6 @@ do {								\
 #define RTLLIB_DL_ERR	   (1<<31)
 #define RTLLIB_DEBUG_INFO(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)
 
-#define RTLLIB_DEBUG_MGMT(f, a...)  RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a)
-
 #ifndef ETH_P_PAE
 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
 #define ETH_P_IP	0x0800		/* Internet Protocol packet	*/
drivers/staging/rtl8192e/rtllib_rx.c +38 -40

161 lines not on this page · raw message

drivers/staging/rtl8192e/rtllib_softmac.c +23 -27

161 lines not on this page · raw message

Signature · 1 line
1.8.4.1
#16 lore raw

PATCH v5 15/34 staging: rtl8192e: Remove RTLLIB_DEBUG_INFO()

In reply to Mateusz Kulikowski

Use pr_debug() instead.

---
 drivers/staging/rtl8192e/rtllib.h        | 1 -
 drivers/staging/rtl8192e/rtllib_module.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
index 82f4fd9..655f5fa 100644
@@ -701,7 +701,6 @@ do {								\
 #define RTLLIB_DL_TRACE	   (1<<29)
 #define RTLLIB_DL_DATA	   (1<<30)
 #define RTLLIB_DL_ERR	   (1<<31)
-#define RTLLIB_DEBUG_INFO(f, a...)   RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)
 
 #ifndef ETH_P_PAE
 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
drivers/staging/rtl8192e/rtllib_module.c +1 -1
index b8c7df5..b61035b 100644
@@ -103,7 +103,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
 	struct net_device *dev;
 	int i, err;
 
-	RTLLIB_DEBUG_INFO("Initializing...\n");
+	pr_debug("rtllib: Initializing...\n");
 
 	dev = alloc_etherdev(sizeof(struct rtllib_device) + sizeof_priv);
 	if (!dev) {
Signature · 1 line
1.8.4.1
#17 lore raw

PATCH v5 16/34 staging: rtl8192e: Remove RTLLIB_DEBUG()

In reply to Mateusz Kulikowski

- Use netdev_dbg or netdev_vdbg instead of RTLLIB_DEBUG()
- Reformat some messages for better readability
- Remove RTLLIB_DEBUG messages that make no sense

---
 drivers/staging/rtl8192e/rtl819x_BAProc.c | 35 +++++++++------------
 drivers/staging/rtl8192e/rtl819x_HTProc.c | 21 ++++++-------
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 35 +++++++++------------
 drivers/staging/rtl8192e/rtllib.h         |  5 ---
 drivers/staging/rtl8192e/rtllib_rx.c      | 52 +++++++++++++++++--------------
 5 files changed, 67 insertions(+), 81 deletions(-)
drivers/staging/rtl8192e/rtl819x_BAProc.c +14 -21
index 7d72c19..39d28e3 100644
@@ -84,9 +84,9 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
 	u8 *tag = NULL;
 	u16 len = ieee->tx_headroom + 9;
 
-	RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA,
-		     "========>%s(), frame(%d) sentd to: %pM, ieee->dev:%p\n",
-		     __func__, type, Dst, ieee->dev);
+	netdev_dbg(ieee->dev, "%s(): frame(%d) sentd to: %pM, ieee->dev:%p\n",
+		   __func__, type, Dst, ieee->dev);
+
 	if (pBA == NULL) {
 		netdev_warn(ieee->dev, "pBA is NULL\n");
 		return NULL;
@@ -148,9 +148,8 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,
 	u16 len = 6 + ieee->tx_headroom;
 
 	if (net_ratelimit())
-		RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA,
-			     "========>%s(), ReasonCode(%d) sentd to: %pM\n",
-			     __func__, ReasonCode, dst);
+		netdev_dbg(ieee->dev, "%s(): ReasonCode(%d) sentd to: %pM\n",
+			   __func__, ReasonCode, dst);
 
 	memset(&DelbaParamSet, 0, 2);
 
@@ -186,9 +185,6 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,
 	tag += 2;
 
 	RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len);
-	if (net_ratelimit())
-		RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, "<=====%s()\n",
-			     __func__);
 	return skb;
 }
 
@@ -203,8 +199,7 @@ static void rtllib_send_ADDBAReq(struct rtllib_device *ieee, u8 *dst,
 		RT_TRACE(COMP_DBG, "====>to send ADDBAREQ!!!!!\n");
 		softmac_mgmt_xmit(skb, ieee);
 	} else {
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "alloc skb error in function %s()\n", __func__);
+		netdev_dbg(ieee->dev, "Failed to generate ADDBAReq packet.\n");
 	}
 }
 
@@ -217,8 +212,7 @@ static void rtllib_send_ADDBARsp(struct rtllib_device *ieee, u8 *dst,
 	if (skb)
 		softmac_mgmt_xmit(skb, ieee);
 	else
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "alloc skb error in function %s()\n", __func__);
+		netdev_dbg(ieee->dev, "Failed to generate ADDBARsp packet.\n");
 }
 
 static void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst,
@@ -231,8 +225,7 @@ static void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst,
 	if (skb)
 		softmac_mgmt_xmit(skb, ieee);
 	else
-		RTLLIB_DEBUG(RTLLIB_DL_ERR,
-			     "alloc skb error in function %s()\n", __func__);
+		netdev_dbg(ieee->dev, "Failed to generate DELBA packet.\n");
 }
 
 int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb)
@@ -374,20 +367,20 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)
 
 
 	if (pAdmittedBA->bValid == true) {
-		RTLLIB_DEBUG(RTLLIB_DL_BA,
-			     "OnADDBARsp(): Recv ADDBA Rsp. Drop because already admit it!\n");
+		netdev_dbg(ieee->dev, "%s(): ADDBA response already admitted\n",
+			   __func__);
 		return -1;
 	} else if ((pPendingBA->bValid == false) ||
 		   (*pDialogToken != pPendingBA->DialogToken)) {
 		netdev_warn(ieee->dev,
-			    "%s(): Recv ADDBA Rsp. BA invalid, DELBA!\n",
+			    "%s(): ADDBA Rsp. BA invalid, DELBA!\n",
 			    __func__);
 		ReasonCode = DELBA_REASON_UNKNOWN_BA;
 		goto OnADDBARsp_Reject;
 	} else {
-		RTLLIB_DEBUG(RTLLIB_DL_BA,
-			     "OnADDBARsp(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n",
-			     *pStatusCode);
+		netdev_dbg(ieee->dev,
+			   "%s(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n",
+			   __func__, *pStatusCode);
 		DeActivateBAEntry(ieee, pPendingBA);
 	}
 
drivers/staging/rtl8192e/rtl819x_HTProc.c +10 -11
index 2c365d3..584f7a9 100644
@@ -217,8 +217,7 @@ static void HTIOTPeerDetermine(struct rtllib_device *ieee)
 	else
 		pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
 
-	RTLLIB_DEBUG(RTLLIB_DL_IOT, "Joseph debug!! IOTPEER: %x\n",
-		     pHTInfo->IOTPeer);
+	netdev_dbg(ieee->dev, "IOTPEER: %x\n", pHTInfo->IOTPeer);
 }
 
 static u8 HTIOTActIsDisableMCS14(struct rtllib_device *ieee, u8 *PeerMacAddr)
@@ -328,9 +327,9 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap,
 	pCapELE->LSigTxopProtect = 0;
 
 
-	RTLLIB_DEBUG(RTLLIB_DL_HT,
-		     "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n",
-		     pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk);
+	netdev_dbg(ieee->dev,
+		   "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n",
+		   pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk);
 
 	if (IsEncrypt) {
 		pCapELE->MPDUDensity	= 7;
@@ -541,7 +540,7 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
 		netdev_warn(ieee->dev, "%s(): HT_DISABLE\n", __func__);
 		return;
 	}
-	RTLLIB_DEBUG(RTLLIB_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n");
+	netdev_dbg(ieee->dev, "%s(): HT_ENABLE\n", __func__);
 
 	if (!memcmp(pHTInfo->PeerHTCapBuf, EWC11NHTCap, sizeof(EWC11NHTCap)))
 		pPeerHTCap = (struct ht_capab_ele *)(&pHTInfo->PeerHTCapBuf[4]);
@@ -646,7 +645,7 @@ void HTInitializeHTInfo(struct rtllib_device *ieee)
 {
 	struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
 
-	RTLLIB_DEBUG(RTLLIB_DL_HT, "===========>%s()\n", __func__);
+	netdev_vdbg(ieee->dev, "%s()\n", __func__);
 	pHTInfo->bCurrentHTSupport = false;
 
 	pHTInfo->bCurBW40MHz = false;
@@ -716,7 +715,7 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,
 	struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
 	u8	bIOTAction = 0;
 
-	RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__);
+	netdev_vdbg(ieee->dev, "%s()\n", __func__);
 	/* unmark bEnableHT flag here is the same reason why unmarked in
 	 * function rtllib_softmac_new_net. WB 2008.09.10
 	 */
@@ -840,8 +839,7 @@ u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame)
 {
 	if (ieee->pHTInfo->bCurrentHTSupport) {
 		if ((IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1) {
-			RTLLIB_DEBUG(RTLLIB_DL_HT,
-				     "HT CONTROL FILED EXIST!!\n");
+			netdev_dbg(ieee->dev, "HT CONTROL FILED EXIST!!\n");
 			return true;
 		}
 	}
@@ -852,7 +850,8 @@ static void HTSetConnectBwModeCallback(struct rtllib_device *ieee)
 {
 	struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
 
-	RTLLIB_DEBUG(RTLLIB_DL_HT, "======>%s()\n", __func__);
+	netdev_vdbg(ieee->dev, "%s()\n", __func__);
+
 	if (pHTInfo->bCurBW40MHz) {
 		if (pHTInfo->CurSTAExtChnlOffset == HT_EXTCHNL_OFFSET_UPPER)
 			ieee->set_chan(ieee->dev,
drivers/staging/rtl8192e/rtl819x_TSProc.c +14 -21
index 974f03e..dea86ea 100644
@@ -58,9 +58,9 @@ static void RxPktPendingTimeout(unsigned long data)
 					pRxTs->RxIndicateSeq =
 					      (pRxTs->RxIndicateSeq + 1) % 4096;
 
-				RTLLIB_DEBUG(RTLLIB_DL_REORDER,
-					     "%s(): Indicate SeqNum: %d\n",
-					     __func__, pReorderEntry->SeqNum);
+				netdev_dbg(ieee->dev,
+					   "%s(): Indicate SeqNum: %d\n",
+					   __func__, pReorderEntry->SeqNum);
 				ieee->stats_IndicateArray[index] =
 							 pReorderEntry->prxb;
 				index++;
@@ -105,8 +105,7 @@ static void TsAddBaProcess(unsigned long data)
 				     TxTsRecord[num]);
 
 	TsInitAddBA(ieee, pTxTs, BA_POLICY_IMMEDIATE, false);
-	RTLLIB_DEBUG(RTLLIB_DL_BA,
-		     "TsAddBaProcess(): ADDBA Req is started!!\n");
+	netdev_dbg(ieee->dev, "%s(): ADDBA Req is started\n", __func__);
 }
 
 static void ResetTsCommonInfo(struct ts_common_info *pTsCommonInfo)
@@ -145,7 +144,7 @@ void TSInitialize(struct rtllib_device *ieee)
 	struct rx_reorder_entry *pRxReorderEntry = ieee->RxReorderEntry;
 	u8				count = 0;
 
-	RTLLIB_DEBUG(RTLLIB_DL_TS, "==========>%s()\n", __func__);
+	netdev_vdbg(ieee->dev, "%s()\n", __func__);
 	INIT_LIST_HEAD(&ieee->Tx_TS_Admit_List);
 	INIT_LIST_HEAD(&ieee->Tx_TS_Pending_List);
 	INIT_LIST_HEAD(&ieee->Tx_TS_Unused_List);
@@ -356,8 +355,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 		return true;
 
 	if (!bAddNewTs) {
-		RTLLIB_DEBUG(RTLLIB_DL_TS,
-			     "add new TS failed(tid:%d)\n", UP);
+		netdev_dbg(ieee->dev, "add new TS failed(tid:%d)\n", UP);
 		return false;
 	}
 
@@ -373,7 +371,6 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 				((TxRxSelect == TX_DIR) ? DIR_DOWN : DIR_UP) :
 				((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN);
 
-	RTLLIB_DEBUG(RTLLIB_DL_TS, "to add Ts\n");
 	if (!list_empty(pUnusedList)) {
 		(*ppTS) = list_entry(pUnusedList->next,
 			  struct ts_common_info, List);
@@ -392,9 +389,9 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 			ResetRxTsEntry(tmp);
 		}
 
-		RTLLIB_DEBUG(RTLLIB_DL_TS,
-			     "to init current TS, UP:%d, Dir:%d, addr: %pM ppTs=%p\n",
-			     UP, Dir, Addr, *ppTS);
+		netdev_dbg(ieee->dev,
+			   "to init current TS, UP:%d, Dir:%d, addr: %pM ppTs=%p\n",
+			   UP, Dir, Addr, *ppTS);
 		pTSInfo->field.ucTrafficType = 0;
 		pTSInfo->field.ucTSID = UP;
 		pTSInfo->field.ucDirection = Dir;
@@ -436,9 +433,8 @@ static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs
 			pRxReorderEntry = (struct rx_reorder_entry *)
 					list_entry(pRxTS->RxPendingPktList.prev,
 					struct rx_reorder_entry, List);
-			RTLLIB_DEBUG(RTLLIB_DL_REORDER,
-				     "%s(): Delete SeqNum %d!\n", __func__,
-				     pRxReorderEntry->SeqNum);
+			netdev_dbg(ieee->dev,  "%s(): Delete SeqNum %d!\n",
+				   __func__, pRxReorderEntry->SeqNum);
 			list_del_init(&pRxReorderEntry->List);
 			{
 				int i = 0;
@@ -538,16 +534,13 @@ void TsStartAddBaProcess(struct rtllib_device *ieee, struct tx_ts_record *pTxTS)
 		pTxTS->bAddBaReqInProgress = true;
 
 		if (pTxTS->bAddBaReqDelayed) {
-			RTLLIB_DEBUG(RTLLIB_DL_BA,
-				     "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n");
+			netdev_dbg(ieee->dev, "Start ADDBA after 60 sec!!\n");
 			mod_timer(&pTxTS->TsAddBaTimer, jiffies +
 				  msecs_to_jiffies(TS_ADDBA_DELAY));
 		} else {
-			RTLLIB_DEBUG(RTLLIB_DL_BA,
-				     "TsStartAddBaProcess(): Immediately Start ADDBA now!!\n");
+			netdev_dbg(ieee->dev, "Immediately Start ADDBA\n");
 			mod_timer(&pTxTS->TsAddBaTimer, jiffies+10);
 		}
 	} else
-		RTLLIB_DEBUG(RTLLIB_DL_BA, "%s()==>BA timer is already added\n",
-			     __func__);
+		netdev_dbg(ieee->dev, "BA timer is already added\n");
 }
drivers/staging/rtl8192e/rtllib.h +0 -5
index 655f5fa..da179a5 100644
@@ -643,11 +643,6 @@ enum wireless_network_type {
 
 /* debug macros */
 extern u32 rtllib_debug_level;
-#define RTLLIB_DEBUG(level, fmt, args...) \
-do {								\
-	if (rtllib_debug_level & (level))			\
-		printk(KERN_DEBUG "rtllib: " fmt, ## args);	\
-} while (0)
 
 #define RTLLIB_DEBUG_DATA(level, data, datalen)	\
 	do {							\
drivers/staging/rtl8192e/rtllib_rx.c +29 -23

118 lines not on this page · raw message

Signature · 1 line
1.8.4.1
#18 lore raw

PATCH v5 17/34 staging: rtl8192e: Remove RTLLIB_DEBUG_DATA()

In reply to Mateusz Kulikowski

Use print_hex_dump_bytes() if VERBOSE_DEBUG is enabled.

---
 drivers/staging/rtl8192e/rtl819x_BAProc.c | 20 ++++++++++++++++----
 drivers/staging/rtl8192e/rtl819x_HTProc.c |  7 +++++--
 drivers/staging/rtl8192e/rtllib.h         | 11 -----------
 drivers/staging/rtl8192e/rtllib_tx.c      |  5 ++++-
 4 files changed, 25 insertions(+), 18 deletions(-)
drivers/staging/rtl8192e/rtl819x_BAProc.c +16 -4
index 39d28e3..25765b8 100644
@@ -133,7 +133,10 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
 		tag += 2;
 	}
 
-	RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len);
+#ifdef VERBOSE_DEBUG
+	print_hex_dump_bytes("rtllib_ADDBA(): ", DUMP_PREFIX_NONE, skb->data,
+			     skb->len);
+#endif
 	return skb;
 }
 
@@ -184,7 +187,10 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,
 	put_unaligned_le16(ReasonCode, tag);
 	tag += 2;
 
-	RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len);
+#ifdef VERBOSE_DEBUG
+	print_hex_dump_bytes("rtllib_DELBA(): ", DUMP_PREFIX_NONE, skb->data,
+			     skb->len);
+#endif
 	return skb;
 }
 
@@ -246,7 +252,10 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb)
 		return -1;
 	}
 
-	RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len);
+#ifdef VERBOSE_DEBUG
+	print_hex_dump_bytes("rtllib_rx_ADDBAReq(): ", DUMP_PREFIX_NONE,
+			     skb->data, skb->len);
+#endif
 
 	req = (struct rtllib_hdr_3addr *) skb->data;
 	tag = (u8 *)req;
@@ -442,7 +451,10 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb)
 		return -1;
 	}
 
-	RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len);
+#ifdef VERBOSE_DEBUG
+	print_hex_dump_bytes("rtllib_rx_DELBA(): ", DUMP_PREFIX_NONE, skb->data,
+			     skb->len);
+#endif
 	delba = (struct rtllib_hdr_3addr *)skb->data;
 	dst = (u8 *)(&delba->addr2[0]);
 	delba += sizeof(struct rtllib_hdr_3addr);
drivers/staging/rtl8192e/rtl819x_HTProc.c +5 -2
index 584f7a9..3edd5d1 100644
@@ -553,8 +553,11 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
 	else
 		pPeerHTInfo = (struct ht_info_ele *)(pHTInfo->PeerHTInfoBuf);
 
-	RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA | RTLLIB_DL_HT, pPeerHTCap,
-			  sizeof(struct ht_capab_ele));
+
+#ifdef VERBOSE_DEBUG
+	print_hex_dump_bytes("HTOnAssocRsp(): ", DUMP_PREFIX_NONE,
+			     pPeerHTCap, sizeof(struct ht_capab_ele));
+#endif
 	HTSetConnectBwMode(ieee, (enum ht_channel_width)(pPeerHTCap->ChlWidth),
 			  (enum ht_extchnl_offset)(pPeerHTInfo->ExtChlOffset));
 	pHTInfo->bCurTxBW40MHz = ((pPeerHTInfo->RecommemdedTxWidth == 1) ?
drivers/staging/rtl8192e/rtllib.h +0 -11
index da179a5..e26a236 100644
@@ -642,17 +642,6 @@ enum wireless_network_type {
 #define OUI_SUBTYPE_QOS_CAPABI	5
 
 /* debug macros */
-extern u32 rtllib_debug_level;
-
-#define RTLLIB_DEBUG_DATA(level, data, datalen)	\
-	do {							\
-		if ((rtllib_debug_level & (level)) == (level)) {	\
-			printk(KERN_DEBUG "rtllib: %s()\n", __func__);	\
-			print_hex_dump_bytes(KERN_DEBUG, DUMP_PREFIX_NONE, \
-					     data, datalen); \
-		}					\
-	} while (0)
-
 /* To use the debug system;
  *
  * If you are defining a new debug classification, simply add it to the #define
drivers/staging/rtl8192e/rtllib_tx.c +4 -1
index 8ef820d..7047d2c 100644
@@ -260,7 +260,10 @@ static int rtllib_classify(struct sk_buff *skb, u8 bIsAmsdu)
 	if (eth->h_proto != htons(ETH_P_IP))
 		return 0;
 
-	RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA, skb->data, skb->len);
+#ifdef VERBOSE_DEBUG
+	print_hex_dump_bytes("rtllib_classify(): ", DUMP_PREFIX_NONE, skb->data,
+			     skb->len);
+#endif
 	ip = ip_hdr(skb);
 	switch (ip->tos & 0xfc) {
 	case 0x20:
Signature · 1 line
1.8.4.1
#19 lore raw

PATCH v5 18/34 staging: rtl8192e: Remove remains of RTLLIB_*_DEBUG() (including proc entry)

In reply to Mateusz Kulikowski

Remove rest of rtllib "debug" system - it is no longer used - proper netdev_* functions are used in most cases.

---
 drivers/staging/rtl8192e/rtllib.h        | 45 --------------------------
 drivers/staging/rtl8192e/rtllib_module.c | 55 --------------------------------
 2 files changed, 100 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -45
index e26a236..d5b5592 100644
@@ -641,51 +641,6 @@ enum wireless_network_type {
 #define OUI_SUBTYPE_WMM_PARAM	1
 #define OUI_SUBTYPE_QOS_CAPABI	5
 
-/* debug macros */
-/* 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:
- *
- * #define RTLLIB_DL_xxxx VALUE
- *
- * shifting value to the left one bit from the previous entry.  xxxx should be
- * the name of the classification (for example, WEP)
- *
- * You then need to either add a RTLLIB_xxxx_DEBUG() macro definition for your
- * classification, or use RTLLIB_DEBUG(RTLLIB_DL_xxxx, ...) whenever you want
- * to send output to that classification.
- *
- * To add your debug level to the list of levels seen when you perform
- *
- * % 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)
-#define RTLLIB_DL_WX	    (1<<1)
-#define RTLLIB_DL_SCAN	  (1<<2)
-#define RTLLIB_DL_STATE	 (1<<3)
-#define RTLLIB_DL_MGMT	  (1<<4)
-#define RTLLIB_DL_FRAG	  (1<<5)
-#define RTLLIB_DL_EAP	   (1<<6)
-#define RTLLIB_DL_DROP	  (1<<7)
-
-#define RTLLIB_DL_TX	    (1<<8)
-#define RTLLIB_DL_RX	    (1<<9)
-
-#define RTLLIB_DL_HT		   (1<<10)
-#define RTLLIB_DL_BA		   (1<<11)
-#define RTLLIB_DL_TS		   (1<<12)
-#define RTLLIB_DL_QOS	   (1<<13)
-#define RTLLIB_DL_REORDER	   (1<<14)
-#define RTLLIB_DL_IOT	   (1<<15)
-#define RTLLIB_DL_IPS	   (1<<16)
-#define RTLLIB_DL_TRACE	   (1<<29)
-#define RTLLIB_DL_DATA	   (1<<30)
-#define RTLLIB_DL_ERR	   (1<<31)
-
 #ifndef ETH_P_PAE
 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
 #define ETH_P_IP	0x0800		/* Internet Protocol packet	*/
drivers/staging/rtl8192e/rtllib_module.c +0 -55

68 lines not on this page · raw message

Signature · 1 line
1.8.4.1
#20 lore raw

PATCH v5 19/34 staging: rtl8192e: Remove assert() macro

In reply to Mateusz Kulikowski

Assert macro printed warning message (and was used once). Remove it, and add netdev_warn() in place where it was called.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 +++--
 drivers/staging/rtl8192e/rtllib_debug.h      | 8 --------
 2 files changed, 3 insertions(+), 10 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +3 -2
index 6f339cd..9a4f09d 100644
@@ -1885,8 +1885,9 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 		return;
 	}
 
-	assert(queue_index != TXCMD_QUEUE);
-
+	if (queue_index != TXCMD_QUEUE)
+		netdev_warn(dev, "%s(): queue index != TXCMD_QUEUE\n",
+			    __func__);
 
 	memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
 	skb_push(skb, priv->rtllib->tx_headroom);
drivers/staging/rtl8192e/rtllib_debug.h +0 -8
index 6df8df1..42e88d6 100644
@@ -76,12 +76,4 @@ do {			\
 		printk(KERN_DEBUG DRV_NAME ":" x "\n", ##args);\
 } while (0)
 
-#define assert(expr) \
-do {	\
-	if (!(expr)) {				  \
-		pr_info("Assertion failed! %s,%s,%s,line=%d\n", \
-		#expr, __FILE__, __func__, __LINE__);	  \
-	}	\
-} while (0)
-
 #endif
Signature · 1 line
1.8.4.1
#21 lore raw

PATCH v5 20/34 staging: rtl8192e: Fix PREFER_PR_LEVEL warnings

In reply to Mateusz Kulikowski

Fix most of remaining PREFER_PR_LEVEL warnings in rtllib. Replace printk() with netdev_* if possible, pr_* in other cases.

---
 drivers/staging/rtl8192e/rtllib_crypt_ccmp.c |  2 +-
 drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 67 +++++++++++++---------------
 drivers/staging/rtl8192e/rtllib_rx.c         |  5 ++-
 3 files changed, 35 insertions(+), 39 deletions(-)
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +1 -1
index 7d486e8..496de4f 100644
@@ -69,7 +69,7 @@ static void *rtllib_ccmp_init(int key_idx)
 
 	priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(priv->tfm)) {
-		pr_debug("rtllib_crypt_ccmp: could not allocate crypto API aes\n");
+		pr_debug("Could not allocate crypto API aes\n");
 		priv->tfm = NULL;
 		goto fail;
 	}
drivers/staging/rtl8192e/rtllib_crypt_tkip.c +31 -36

136 lines not on this page · raw message

drivers/staging/rtl8192e/rtllib_rx.c +3 -2
index 58c9cf2..11c6013 100644
@@ -346,8 +346,9 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb,
 	res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
 	atomic_dec(&crypt->refcnt);
 	if (res < 0) {
-		printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed (SA= %pM keyidx=%d)\n",
-		       ieee->dev->name, hdr->addr2, keyidx);
+		netdev_dbg(ieee->dev,
+			   "MSDU decryption/MIC verification failed (SA= %pM keyidx=%d)\n",
+			   hdr->addr2, keyidx);
 		return -1;
 	}
 
Signature · 1 line
1.8.4.1
#22 lore raw

PATCH v5 21/34 staging: rtl8192e: Fix LONG_LINE warnings

In reply to Mateusz Kulikowski

Fix most of simple LONG_LINE warnings. None of the changes should affect behaviour of code, so several modifications are included in this patch:
- Code is reindented where needed
- Local variable names are compacted (priv -> p)
- Unnecessary casts are removed
- Nested ifs are replaced with logical and
- a = b = c = d expressions are split
- Replace if/then series with clamp_t()
- Removed unneeded scopes

---
 drivers/staging/rtl8192e/dot11d.h                  |   4 +-
 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c     |  22 +--
 .../staging/rtl8192e/rtl8192e/r8192E_firmware.c    |  29 ++--
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c     |   4 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c       |   3 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c         | 191 +++++++++++++--------
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c         |   3 +-
 drivers/staging/rtl8192e/rtl819x_HTProc.c          |   3 +-
 drivers/staging/rtl8192e/rtl819x_TSProc.c          |  21 ++-
 drivers/staging/rtl8192e/rtllib_rx.c               | 171 +++++++++++-------
 drivers/staging/rtl8192e/rtllib_softmac.c          |  36 ++--
 drivers/staging/rtl8192e/rtllib_tx.c               |  41 ++---
 12 files changed, 314 insertions(+), 214 deletions(-)
drivers/staging/rtl8192e/dot11d.h +2 -2
index aad3394..69e0f8f 100644
@@ -74,8 +74,8 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src)
 	(GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
 
 #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa)		\
-	 ether_addr_equal_unaligned(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, \
-	__pTa)
+	 ether_addr_equal_unaligned( \
+		GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
 #define UPDATE_CIE_SRC(__pIeeeDev, __pTa)		\
 	cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
 
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +11 -11
index f9c6153..e023c70 100644
@@ -30,7 +30,8 @@
 #include "rtl_dm.h"
 #include "rtl_wx.h"
 
-static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI, EDCAPARA_VO};
+static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI,
+			     EDCAPARA_VO};
 
 void rtl8192e_start_beacon(struct net_device *dev)
 {
@@ -187,22 +188,21 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val)
 		u8		u1bAIFS;
 		u32		u4bAcParam;
 		u8 mode = priv->rtllib->mode;
-		struct rtllib_qos_parameters *qos_parameters =
+		struct rtllib_qos_parameters *qop =
 			 &priv->rtllib->current_network.qos_data.parameters;
 
-		u1bAIFS = qos_parameters->aifs[pAcParam] *
+		u1bAIFS = qop->aifs[pAcParam] *
 			  ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
 
 		dm_init_edca_turbo(dev);
 
-		u4bAcParam = (((le16_to_cpu(
-					qos_parameters->tx_op_limit[pAcParam])) <<
-			     AC_PARAM_TXOP_LIMIT_OFFSET) |
-			     ((le16_to_cpu(qos_parameters->cw_max[pAcParam])) <<
-			     AC_PARAM_ECW_MAX_OFFSET) |
-			     ((le16_to_cpu(qos_parameters->cw_min[pAcParam])) <<
-			     AC_PARAM_ECW_MIN_OFFSET) |
-			     (((u32)u1bAIFS) << AC_PARAM_AIFS_OFFSET));
+		u4bAcParam = (le16_to_cpu(qop->tx_op_limit[pAcParam]) <<
+			      AC_PARAM_TXOP_LIMIT_OFFSET) |
+				((le16_to_cpu(qop->cw_max[pAcParam])) <<
+				 AC_PARAM_ECW_MAX_OFFSET) |
+				((le16_to_cpu(qop->cw_min[pAcParam])) <<
+				 AC_PARAM_ECW_MIN_OFFSET) |
+				(((u32)u1bAIFS) << AC_PARAM_AIFS_OFFSET);
 
 		RT_TRACE(COMP_DBG, "%s():HW_VAR_AC_PARAM eACI:%x:%x\n",
 			 __func__, eACI, u4bAcParam);
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +14 -15
index c465f87..02c5b0a 100644
@@ -230,7 +230,7 @@ bool init_firmware(struct net_device *dev)
 
 	u32	file_length = 0;
 	u8	*mapped_file = NULL;
-	u8	init_step = 0;
+	u8	i = 0;
 	enum opt_rst_type rst_opt = OPT_SYSTEM_RESET;
 	enum firmware_init_step starting_state = FW_INIT_STEP0_BOOT;
 
@@ -250,10 +250,9 @@ bool init_firmware(struct net_device *dev)
 			 "PlatformInitFirmware: undefined firmware state\n");
 	}
 
-	for (init_step = starting_state; init_step <= FW_INIT_STEP2_DATA;
-	     init_step++) {
+	for (i = starting_state; i <= FW_INIT_STEP2_DATA; i++) {
 		if (rst_opt == OPT_SYSTEM_RESET) {
-			if (pfirmware->firmware_buf_size[init_step] == 0) {
+			if (pfirmware->firmware_buf_size[i] == 0) {
 				const char *fw_name[3] = {
 					RTL8192E_BOOT_IMG_FW,
 					RTL8192E_MAIN_IMG_FW,
@@ -263,7 +262,7 @@ bool init_firmware(struct net_device *dev)
 				int rc;
 
 				rc = request_firmware(&fw_entry,
-						      fw_name[init_step],
+						      fw_name[i],
 						      &priv->pdev->dev);
 				if (rc < 0) {
 					RT_TRACE(COMP_FIRMWARE,
@@ -271,24 +270,24 @@ bool init_firmware(struct net_device *dev)
 					goto download_firmware_fail;
 				}
 				if (fw_entry->size >
-				    sizeof(pfirmware->firmware_buf[init_step])) {
+				    sizeof(pfirmware->firmware_buf[i])) {
 					RT_TRACE(COMP_FIRMWARE,
 						 "img file size exceed the container struct buffer fail!\n");
 					goto download_firmware_fail;
 				}
 
-				if (init_step != FW_INIT_STEP1_MAIN) {
-					memcpy(pfirmware->firmware_buf[init_step],
+				if (i != FW_INIT_STEP1_MAIN) {
+					memcpy(pfirmware->firmware_buf[i],
 					       fw_entry->data, fw_entry->size);
-					pfirmware->firmware_buf_size[init_step] =
+					pfirmware->firmware_buf_size[i] =
 						fw_entry->size;
 
 				} else {
-					memset(pfirmware->firmware_buf[init_step],
+					memset(pfirmware->firmware_buf[i],
 					       0, 128);
-					memcpy(&pfirmware->firmware_buf[init_step][128],
+					memcpy(&pfirmware->firmware_buf[i][128],
 					       fw_entry->data, fw_entry->size);
-					pfirmware->firmware_buf_size[init_step] =
+					pfirmware->firmware_buf_size[i] =
 						fw_entry->size + 128;
 				}
 
@@ -297,14 +296,14 @@ bool init_firmware(struct net_device *dev)
 			}
 		}
 
-		mapped_file = pfirmware->firmware_buf[init_step];
-		file_length = pfirmware->firmware_buf_size[init_step];
+		mapped_file = pfirmware->firmware_buf[i];
+		file_length = pfirmware->firmware_buf_size[i];
 
 		rt_status = fw_download_code(dev, mapped_file, file_length);
 		if (!rt_status)
 			goto download_firmware_fail;
 
-		if (!firmware_check_ready(dev, init_step))
+		if (!firmware_check_ready(dev, i))
 			goto download_firmware_fail;
 	}
 
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2 -2
index eea2e39..0765c97 100644
@@ -628,8 +628,8 @@ void rtl8192_phy_getTxPower(struct net_device *dev)
 	priv->DefaultInitialGain[3] = read_nic_byte(dev, rOFDM0_XDAGCCore1);
 	RT_TRACE(COMP_INIT,
 		 "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n",
-		priv->DefaultInitialGain[0], priv->DefaultInitialGain[1],
-		priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]);
+		 priv->DefaultInitialGain[0], priv->DefaultInitialGain[1],
+		 priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]);
 
 	priv->framesync = read_nic_byte(dev, rOFDM0_RxDetector3);
 	priv->framesyncC34 = read_nic_dword(dev, rOFDM0_RxDetector2);
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -2
index 9a4f09d..d73dd57 100644
@@ -2068,8 +2068,7 @@ static short rtl8192_alloc_rx_desc_ring(struct net_device *dev)
 	int i, rx_queue_idx;
 
 	for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) {
-		priv->rx_ring[rx_queue_idx] =
-			pci_zalloc_consistent(priv->pdev,
+		priv->rx_ring[rx_queue_idx] = pci_zalloc_consistent(priv->pdev,
 					      sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
 					      &priv->rx_ring_dma[rx_queue_idx]);
 		if (!priv->rx_ring[rx_queue_idx] ||
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +116 -75

377 lines not on this page · raw message

drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +2 -1
index 43702df..2e6c4fa 100644
@@ -613,7 +613,8 @@ static int r8192_wx_set_nick(struct net_device *dev,
 	if (wrqu->data.length > IW_ESSID_MAX_SIZE)
 		return -E2BIG;
 	down(&priv->wx_sem);
-	wrqu->data.length = min_t(size_t, wrqu->data.length, sizeof(priv->nick));
+	wrqu->data.length = min_t(size_t, wrqu->data.length,
+				  sizeof(priv->nick));
 	memset(priv->nick, 0, sizeof(priv->nick));
 	memcpy(priv->nick, extra, wrqu->data.length);
 	up(&priv->wx_sem);
drivers/staging/rtl8192e/rtl819x_HTProc.c +2 -1
index 3edd5d1..dcf8db1 100644
@@ -236,7 +236,8 @@ static bool HTIOTActIsDisableMCSTwoSpatialStream(struct rtllib_device *ieee)
 	return false;
 }
 
-static u8 HTIOTActIsDisableEDCATurbo(struct rtllib_device *ieee, u8 *PeerMacAddr)
+static u8 HTIOTActIsDisableEDCATurbo(struct rtllib_device *ieee,
+				     u8 *PeerMacAddr)
 {
 	return false;
 }
drivers/staging/rtl8192e/rtl819x_TSProc.c +12 -9
index dea86ea..8a5dd6e 100644
@@ -49,8 +49,10 @@ static void RxPktPendingTimeout(unsigned long data)
 			if (index == 0)
 				pRxTs->RxIndicateSeq = pReorderEntry->SeqNum;
 
-			if (SN_LESS(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq) ||
-				SN_EQUAL(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq)) {
+			if (SN_LESS(pReorderEntry->SeqNum,
+				    pRxTs->RxIndicateSeq) ||
+			    SN_EQUAL(pReorderEntry->SeqNum,
+				     pRxTs->RxIndicateSeq)) {
 				list_del_init(&pReorderEntry->List);
 
 				if (SN_EQUAL(pReorderEntry->SeqNum,
@@ -92,7 +94,8 @@ static void RxPktPendingTimeout(unsigned long data)
 	if (bPktInBuf && (pRxTs->RxTimeoutIndicateSeq == 0xffff)) {
 		pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq;
 		mod_timer(&pRxTs->RxPktPendingTimer,  jiffies +
-			  msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime));
+			  msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)
+			  );
 	}
 	spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags);
 }
@@ -269,10 +272,10 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee,
 		if (!search_dir[dir])
 			continue;
 		list_for_each_entry(pRet, psearch_list, List) {
-			if (memcmp(pRet->Addr, Addr, 6) == 0)
-				if (pRet->TSpec.f.TSInfo.field.ucTSID == TID)
-					if (pRet->TSpec.f.TSInfo.field.ucDirection == dir)
-						break;
+			if (memcmp(pRet->Addr, Addr, 6) == 0 &&
+			    pRet->TSpec.f.TSInfo.field.ucTSID == TID &&
+			    pRet->TSpec.f.TSInfo.field.ucDirection == dir)
+				break;
 
 		}
 		if (&pRet->List  != psearch_list)
@@ -415,8 +418,8 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 	return false;
 }
 
-static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs,
-			  enum tr_select TxRxSelect)
+static void RemoveTsEntry(struct rtllib_device *ieee,
+			  struct ts_common_info *pTs, enum tr_select TxRxSelect)
 {
 	del_timer_sync(&pTs->SetupTimer);
 	del_timer_sync(&pTs->InactTimer);
drivers/staging/rtl8192e/rtllib_rx.c +109 -62

415 lines not on this page · raw message

drivers/staging/rtl8192e/rtllib_softmac.c +22 -14
index 9c83e3b..9dce121 100644
@@ -272,9 +272,10 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee)
 			ieee->seq_ctrl[0]++;
 
 		/* check whether the managed packet queued greater than 5 */
-		if (!ieee->check_nic_enough_desc(ieee->dev, tcb_desc->queue_index) ||
-		    (skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0) ||
-		    (ieee->queue_stop)) {
+		if (!ieee->check_nic_enough_desc(ieee->dev,
+						 tcb_desc->queue_index) ||
+		    skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) ||
+		    ieee->queue_stop) {
 			/* insert the skb packet to the management queue
 			 *
 			 * as for the completion function, it does not need
@@ -1483,7 +1484,8 @@ static void rtllib_associate_step1(struct rtllib_device *ieee, u8 *daddr)
 	}
 }
 
-static void rtllib_auth_challenge(struct rtllib_device *ieee, u8 *challenge, int chlen)
+static void rtllib_auth_challenge(struct rtllib_device *ieee, u8 *challenge,
+				  int chlen)
 {
 	u8 *c;
 	struct sk_buff *skb;
@@ -1740,7 +1742,7 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
 				/* Join the network for the first time */
 				ieee->AsocRetryCount = 0;
 				if ((ieee->current_network.qos_data.supported == 1) &&
-				   ieee->current_network.bssht.bdSupportHT)
+				    ieee->current_network.bssht.bdSupportHT)
 					HTResetSelfAndSavePeerSetting(ieee,
 						 &(ieee->current_network));
 				else
@@ -1755,14 +1757,19 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
 					   &ieee->associate_procedure_wq, 0);
 			} else {
 				if (rtllib_is_54g(&ieee->current_network) &&
-					(ieee->modulation & RTLLIB_OFDM_MODULATION)) {
+				    (ieee->modulation &
+				     RTLLIB_OFDM_MODULATION)) {
 					ieee->rate = 108;
-					ieee->SetWirelessMode(ieee->dev, IEEE_G);
-					netdev_info(ieee->dev, "Using G rates\n");
+					ieee->SetWirelessMode(ieee->dev,
+							      IEEE_G);
+					netdev_info(ieee->dev,
+						    "Using G rates\n");
 				} else {
 					ieee->rate = 22;
-					ieee->SetWirelessMode(ieee->dev, IEEE_B);
-					netdev_info(ieee->dev, "Using B rates\n");
+					ieee->SetWirelessMode(ieee->dev,
+							      IEEE_B);
+					netdev_info(ieee->dev,
+						    "Using B rates\n");
 				}
 				memset(ieee->dot11HTOperationalRateSet, 0, 16);
 				ieee->state = RTLLIB_LINKED;
@@ -2023,7 +2030,7 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time)
 		if (ieee->bAwakePktSent) {
 			pPSC->LPSAwakeIntvl = 1;
 		} else {
-			u8		MaxPeriod = 1;
+			u8 MaxPeriod = 1;
 
 			if (pPSC->LPSAwakeIntvl == 0)
 				pPSC->LPSAwakeIntvl = 1;
@@ -2194,7 +2201,8 @@ void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success)
 }
 EXPORT_SYMBOL(rtllib_ps_tx_ack);
 
-static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *skb)
+static void rtllib_process_action(struct rtllib_device *ieee,
+				  struct sk_buff *skb)
 {
 	struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *) skb->data;
 	u8 *act = rtllib_get_payload((struct rtllib_hdr *)header);
@@ -3674,8 +3682,8 @@ static void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib)
 
 }
 
-static void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, u8 *asSta,
-				    u8 asRsn)
+static void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib,
+					   u8 *asSta, u8 asRsn)
 {
 	u8 i;
 	u8	OpMode;
drivers/staging/rtl8192e/rtllib_tx.c +21 -20

54 lines not on this page · raw message

Signature · 1 line
1.8.4.1
#23 lore raw

PATCH v5 22/34 staging: rtl8192e: Fix LONG_LING in rtllib_parse_info_param()

In reply to Mateusz Kulikowski

Take out MIFE_TYPE_HT_CAP processing into separate function - rtllib_parse_mfie_ht_cap()

---
 drivers/staging/rtl8192e/rtllib_rx.c | 49 +++++++++++++++++++++---------------
 1 file changed, 29 insertions(+), 20 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +29 -20
index 8e3aabf..588c6d7 100644
@@ -2010,6 +2010,33 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee,
 	}
 }
 
+static void rtllib_parse_mfie_ht_cap(struct rtllib_info_element *info_element,
+				     struct rtllib_network *network,
+				     u16 *tmp_htcap_len)
+{
+	struct bss_ht *ht = &network->bssht;
+
+	*tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN);
+	if (*tmp_htcap_len != 0) {
+		ht->bdHTSpecVer = HT_SPEC_VER_EWC;
+		ht->bdHTCapLen = min_t(u16, *tmp_htcap_len,
+				       sizeof(ht->bdHTCapBuf));
+		memcpy(ht->bdHTCapBuf, info_element->data, ht->bdHTCapLen);
+
+		ht->bdSupportHT = true;
+		ht->bdHT1R = ((((struct ht_capab_ele *)
+				ht->bdHTCapBuf))->MCS[1]) == 0;
+
+		ht->bdBandWidth = (enum ht_channel_width)
+					     (((struct ht_capab_ele *)
+					     (ht->bdHTCapBuf))->ChlWidth);
+	} else {
+		ht->bdSupportHT = false;
+		ht->bdHT1R = false;
+		ht->bdBandWidth = HT_CHANNEL_WIDTH_20;
+	}
+}
+
 int rtllib_parse_info_param(struct rtllib_device *ieee,
 		struct rtllib_info_element *info_element,
 		u16 length,
@@ -2191,27 +2218,9 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 		case MFIE_TYPE_HT_CAP:
 			netdev_dbg(ieee->dev, "MFIE_TYPE_HT_CAP: %d bytes\n",
 				   info_element->len);
-			tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN);
-			if (tmp_htcap_len != 0) {
-				network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
-				network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ?
-					sizeof(network->bssht.bdHTCapBuf) : tmp_htcap_len;
-				memcpy(network->bssht.bdHTCapBuf,
-				       info_element->data,
-				       network->bssht.bdHTCapLen);
 
-				network->bssht.bdSupportHT = true;
-				network->bssht.bdHT1R = ((((struct ht_capab_ele *)
-							network->bssht.bdHTCapBuf))->MCS[1]) == 0;
-
-				network->bssht.bdBandWidth = (enum ht_channel_width)
-							     (((struct ht_capab_ele *)
-							     (network->bssht.bdHTCapBuf))->ChlWidth);
-			} else {
-				network->bssht.bdSupportHT = false;
-				network->bssht.bdHT1R = false;
-				network->bssht.bdBandWidth = HT_CHANNEL_WIDTH_20;
-			}
+			rtllib_parse_mfie_ht_cap(info_element, network,
+						 &tmp_htcap_len);
 			break;
 
 
Signature · 1 line
1.8.4.1
#24 lore raw

PATCH v5 23/34 staging: rtl8192e: Remove unimplemented iwpriv handlers

In reply to Mateusz Kulikowski

Remove the following private variables:
- force_mic_error - changes force_mic_error that is not used
- radio - changes sw_radio_on that is not used
- adhoc_peer_list - unimplemented
- firm_ver - unimplemented

---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c |  1 -
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h |  1 -
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c   | 86 ++--------------------------
 drivers/staging/rtl8192e/rtllib.h            |  1 -
 4 files changed, 4 insertions(+), 85 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
index d73dd57..abce472 100644
@@ -1118,7 +1118,6 @@ static void rtl8192_init_priv_variable(struct net_device *dev)
 	priv->bDriverIsGoingToUnload = false;
 	priv->being_init_adapter = false;
 	priv->initialized_at_probe = false;
-	priv->sw_radio_on = true;
 	priv->bdisable_nic = false;
 	priv->bfirst_init = false;
 	priv->txringcount = 64;
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
index 0640e76..6127e92 100644
@@ -626,7 +626,6 @@ struct r8192_priv {
 	u8		RegCWinMin;
 	u8		keepAliveLevel;
 
-	bool		sw_radio_on;
 	bool		bHwRadioOff;
 	bool		pwrdown;
 	bool		blinked_ingpio;
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +4 -82

125 lines not on this page · raw message

drivers/staging/rtl8192e/rtllib.h +0 -1
index d5b5592..5c3a979 100644
@@ -1904,7 +1904,6 @@ struct rtllib_device {
 
 	u8 hwsec_active;
 	bool is_silent_reset;
-	bool force_mic_error;
 	bool is_roaming;
 	bool ieee_up;
 	bool cannot_notify;
Signature · 1 line
1.8.4.1
#25 lore raw

PATCH v5 24/34 staging: rtl8192e: Fix OOM_MESSAGE warnings

In reply to Mateusz Kulikowski

Remove alloc failed messages where not needed to make checkpatch.pl happy.

---
 drivers/staging/rtl8192e/rtl819x_BAProc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/rtl8192e/rtl819x_BAProc.c +2 -6
index 25765b8..60f536c 100644
@@ -92,10 +92,8 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
 		return NULL;
 	}
 	skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr));
-	if (skb == NULL) {
-		netdev_err(ieee->dev, "Can't alloc skb for ADDBA_REQ\n");
+	if (skb == NULL)
 		return NULL;
-	}
 
 	memset(skb->data, 0, sizeof(struct rtllib_hdr_3addr));
 
@@ -160,10 +158,8 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,
 	DelbaParamSet.field.TID	= pBA->BaParamSet.field.TID;
 
 	skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr));
-	if (skb == NULL) {
-		netdev_err(ieee->dev, "Can't alloc skb for DELBA_REQ\n");
+	if (skb == NULL)
 		return NULL;
-	}
 
 	skb_reserve(skb, ieee->tx_headroom);
 
Signature · 1 line
1.8.4.1
#26 lore raw

PATCH v5 25/34 staging: rtl8192e: Remove unused rtl_crypto.h

In reply to Mateusz Kulikowski

This header is not used - remove it to make driver code smaller.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h | 382 -------------------------
 1 file changed, 382 deletions(-)
 delete mode 100644 drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h
drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h deleted +0 -382
deleted file mode 100644
index ee57c0f..0000000
@@ -1,382 +0,0 @@
-/*
- * Scatterlist Cryptographic API.
- *
- * Copyright (c) 2002 James Morris <[email protected]>
- * Copyright (c) 2002 David S. Miller ([email protected])
- *
- * Portions derived from Cryptoapi, by Alexander Kjeldaas <[email protected]>
- * and Nettle, by Niels M鰈ler.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- */
-#ifndef _LINUX_CRYPTO_H
-#define _LINUX_CRYPTO_H
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/list.h>
-#include <linux/string.h>
-#include <asm/page.h>
-#include <linux/errno.h>
-
-#define crypto_register_alg crypto_register_alg_rsl
-#define crypto_unregister_alg crypto_unregister_alg_rsl
-#define crypto_alloc_tfm crypto_alloc_tfm_rsl
-#define crypto_free_tfm crypto_free_tfm_rsl
-#define crypto_alg_available crypto_alg_available_rsl
-
-/*
- * Algorithm masks and types.
- */
-#define CRYPTO_ALG_TYPE_MASK		0x000000ff
-#define CRYPTO_ALG_TYPE_CIPHER		0x00000001
-#define CRYPTO_ALG_TYPE_DIGEST		0x00000002
-#define CRYPTO_ALG_TYPE_COMPRESS	0x00000004
-
-/*
- * Transform masks and values (for crt_flags).
- */
-#define CRYPTO_TFM_MODE_MASK		0x000000ff
-#define CRYPTO_TFM_REQ_MASK		0x000fff00
-#define CRYPTO_TFM_RES_MASK		0xfff00000
-
-#define CRYPTO_TFM_MODE_ECB		0x00000001
-#define CRYPTO_TFM_MODE_CBC		0x00000002
-#define CRYPTO_TFM_MODE_CFB		0x00000004
-#define CRYPTO_TFM_MODE_CTR		0x00000008
-
-#define CRYPTO_TFM_REQ_WEAK_KEY		0x00000100
-#define CRYPTO_TFM_RES_WEAK_KEY		0x00100000
-#define CRYPTO_TFM_RES_BAD_KEY_LEN	0x00200000
-#define CRYPTO_TFM_RES_BAD_KEY_SCHED	0x00400000
-#define CRYPTO_TFM_RES_BAD_BLOCK_LEN	0x00800000
-#define CRYPTO_TFM_RES_BAD_FLAGS	0x01000000
-
-/*
- * Miscellaneous stuff.
- */
-#define CRYPTO_UNSPEC			0
-#define CRYPTO_MAX_ALG_NAME		64
-
-struct scatterlist;
-
-/*
- * Algorithms: modular crypto algorithm implementations, managed
- * via crypto_register_alg() and crypto_unregister_alg().
- */
-struct cipher_alg {
-	unsigned int cia_min_keysize;
-	unsigned int cia_max_keysize;
-	int (*cia_setkey)(void *ctx, const u8 *key,
-			  unsigned int keylen, u32 *flags);
-	void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src);
-	void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src);
-};
-
-struct digest_alg {
-	unsigned int dia_digestsize;
-	void (*dia_init)(void *ctx);
-	void (*dia_update)(void *ctx, const u8 *data, unsigned int len);
-	void (*dia_final)(void *ctx, u8 *out);
-	int (*dia_setkey)(void *ctx, const u8 *key,
-			  unsigned int keylen, u32 *flags);
-};
-
-struct compress_alg {
-	int (*coa_init)(void *ctx);
-	void (*coa_exit)(void *ctx);
-	int (*coa_compress)(void *ctx, const u8 *src, unsigned int slen,
-			    u8 *dst, unsigned int *dlen);
-	int (*coa_decompress)(void *ctx, const u8 *src, unsigned int slen,
-			      u8 *dst, unsigned int *dlen);
-};
-
-#define cra_cipher	cra_u.cipher
-#define cra_digest	cra_u.digest
-#define cra_compress	cra_u.compress
-
-struct crypto_alg {
-	struct list_head cra_list;
-	u32 cra_flags;
-	unsigned int cra_blocksize;
-	unsigned int cra_ctxsize;
-	const char cra_name[CRYPTO_MAX_ALG_NAME];
-
-	union {
-		struct cipher_alg cipher;
-		struct digest_alg digest;
-		struct compress_alg compress;
-	} cra_u;
-
-	struct module *cra_module;
-};
-
-/*
- * Algorithm registration interface.
- */
-int crypto_register_alg(struct crypto_alg *alg);
-int crypto_unregister_alg(struct crypto_alg *alg);
-
-/*
- * Algorithm query interface.
- */
-int crypto_alg_available(const char *name, u32 flags);
-
-/*
- * Transforms: user-instantiated objects which encapsulate algorithms
- * and core processing logic.  Managed via crypto_alloc_tfm() and
- * crypto_free_tfm(), as well as the various helpers below.
- */
-struct crypto_tfm;
-
-struct cipher_tfm {
-	void *cit_iv;
-	unsigned int cit_ivsize;
-	u32 cit_mode;
-	int (*cit_setkey)(struct crypto_tfm *tfm,
-			  const u8 *key, unsigned int keylen);
-	int (*cit_encrypt)(struct crypto_tfm *tfm,
-			   struct scatterlist *dst,
-			   struct scatterlist *src,
-			   unsigned int nbytes);
-	int (*cit_encrypt_iv)(struct crypto_tfm *tfm,
-			      struct scatterlist *dst,
-			      struct scatterlist *src,
-			      unsigned int nbytes, u8 *iv);
-	int (*cit_decrypt)(struct crypto_tfm *tfm,
-			   struct scatterlist *dst,
-			   struct scatterlist *src,
-			   unsigned int nbytes);
-	int (*cit_decrypt_iv)(struct crypto_tfm *tfm,
-			   struct scatterlist *dst,
-			   struct scatterlist *src,
-			   unsigned int nbytes, u8 *iv);
-	void (*cit_xor_block)(u8 *dst, const u8 *src);
-};
-
-struct digest_tfm {
-	void (*dit_init)(struct crypto_tfm *tfm);
-	void (*dit_update)(struct crypto_tfm *tfm,
-			   struct scatterlist *sg, unsigned int nsg);
-	void (*dit_final)(struct crypto_tfm *tfm, u8 *out);
-	void (*dit_digest)(struct crypto_tfm *tfm, struct scatterlist *sg,
-			   unsigned int nsg, u8 *out);
-	int (*dit_setkey)(struct crypto_tfm *tfm,
-			  const u8 *key, unsigned int keylen);
-};
-
-struct compress_tfm {
-	int (*cot_compress)(struct crypto_tfm *tfm,
-			    const u8 *src, unsigned int slen,
-			    u8 *dst, unsigned int *dlen);
-	int (*cot_decompress)(struct crypto_tfm *tfm,
-			      const u8 *src, unsigned int slen,
-			      u8 *dst, unsigned int *dlen);
-};
-
-#define crt_cipher	crt_u.cipher
-#define crt_digest	crt_u.digest
-#define crt_compress	crt_u.compress
-
-struct crypto_tfm {
-
-	u32 crt_flags;
-
-	union {
-		struct cipher_tfm cipher;
-		struct digest_tfm digest;
-		struct compress_tfm compress;
-	} crt_u;
-
-	struct crypto_alg *__crt_alg;
-};
-
-/*
- * Transform user interface.
- */
-
-/*
- * crypto_alloc_tfm() will first attempt to locate an already loaded algorithm.
- * If that fails and the kernel supports dynamically loadable modules, it
- * will then attempt to load a module of the same name or alias.  A refcount
- * is grabbed on the algorithm which is then associated with the new transform.
- *
- * crypto_free_tfm() frees up the transform and any associated resources,
- * then drops the refcount on the associated algorithm.
- */
-struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags);
-void crypto_free_tfm(struct crypto_tfm *tfm);
-
-/*
- * Transform helpers which query the underlying algorithm.
- */
-static inline const char *crypto_tfm_alg_name(struct crypto_tfm *tfm)
-{
-	return tfm->__crt_alg->cra_name;
-}
-
-static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm)
-{
-	struct crypto_alg *alg = tfm->__crt_alg;
-
-	if (alg->cra_module)
-		return alg->cra_module->name;
-	else
-		return NULL;
-}
-
-static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm)
-{
-	return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK;
-}
-
-static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
-	return tfm->__crt_alg->cra_cipher.cia_min_keysize;
-}
-
-static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
-	return tfm->__crt_alg->cra_cipher.cia_max_keysize;
-}
-
-static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
-	return tfm->crt_cipher.cit_ivsize;
-}
-
-static inline unsigned int crypto_tfm_alg_blocksize(struct crypto_tfm *tfm)
-{
-	return tfm->__crt_alg->cra_blocksize;
-}
-
-static inline unsigned int crypto_tfm_alg_digestsize(struct crypto_tfm *tfm)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST);
-	return tfm->__crt_alg->cra_digest.dia_digestsize;
-}
-
-/*
- * API wrappers.
- */
-static inline void crypto_digest_init(struct crypto_tfm *tfm)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST);
-	tfm->crt_digest.dit_init(tfm);
-}
-
-static inline void crypto_digest_update(struct crypto_tfm *tfm,
-					struct scatterlist *sg,
-					unsigned int nsg)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST);
-	tfm->crt_digest.dit_update(tfm, sg, nsg);
-}
-
-static inline void crypto_digest_final(struct crypto_tfm *tfm, u8 *out)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST);
-	tfm->crt_digest.dit_final(tfm, out);
-}
-
-static inline void crypto_digest_digest(struct crypto_tfm *tfm,
-					struct scatterlist *sg,
-					unsigned int nsg, u8 *out)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST);
-	tfm->crt_digest.dit_digest(tfm, sg, nsg, out);
-}
-
-static inline int crypto_digest_setkey(struct crypto_tfm *tfm,
-				       const u8 *key, unsigned int keylen)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST);
-	if (tfm->crt_digest.dit_setkey == NULL)
-		return -ENOSYS;
-	return tfm->crt_digest.dit_setkey(tfm, key, keylen);
-}
-
-static inline int crypto_cipher_setkey(struct crypto_tfm *tfm,
-				       const u8 *key, unsigned int keylen)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
-	return tfm->crt_cipher.cit_setkey(tfm, key, keylen);
-}
-
-static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
-					struct scatterlist *dst,
-					struct scatterlist *src,
-					unsigned int nbytes)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
-	return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes);
-}
-
-static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
-					   struct scatterlist *dst,
-					   struct scatterlist *src,
-					   unsigned int nbytes, u8 *iv)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
-	BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
-	return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv);
-}
-
-static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
-					struct scatterlist *dst,
-					struct scatterlist *src,
-					unsigned int nbytes)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
-	return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes);
-}
-
-static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
-					   struct scatterlist *dst,
-					   struct scatterlist *src,
-					   unsigned int nbytes, u8 *iv)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
-	BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
-	return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv);
-}
-
-static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
-					const u8 *src, unsigned int len)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
-	memcpy(tfm->crt_cipher.cit_iv, src, len);
-}
-
-static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm,
-					u8 *dst, unsigned int len)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
-	memcpy(dst, tfm->crt_cipher.cit_iv, len);
-}
-
-static inline int crypto_comp_compress(struct crypto_tfm *tfm,
-				       const u8 *src, unsigned int slen,
-				       u8 *dst, unsigned int *dlen)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS);
-	return tfm->crt_compress.cot_compress(tfm, src, slen, dst, dlen);
-}
-
-static inline int crypto_comp_decompress(struct crypto_tfm *tfm,
-					 const u8 *src, unsigned int slen,
-					 u8 *dst, unsigned int *dlen)
-{
-	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS);
-	return tfm->crt_compress.cot_decompress(tfm, src, slen, dst, dlen);
-}
-
-#endif	/* _LINUX_CRYPTO_H */
Signature · 1 line
1.8.4.1
#27 lore raw

PATCH v5 26/34 staging: rtl8192e: Replace ?: with max_t

In reply to Mateusz Kulikowski

Improve readability and make checkpatch happy.

---
 drivers/staging/rtl8192e/rtllib_rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_rx.c +1 -1
index 588c6d7..2280d18 100644
@@ -1685,7 +1685,7 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info
 		qos_param->aifs[aci] = (ac_params->aci_aifsn) & 0x0f;
 
 		/* WMM spec P.11: The minimum value for AIFSN shall be 2 */
-		qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ? 2 : qos_param->aifs[aci];
+		qos_param->aifs[aci] = max_t(u8, qos_param->aifs[aci], 2);
 
 		qos_param->cw_min[aci] = cpu_to_le16(ac_params->ecw_min_max &
 						     0x0F);
Signature · 1 line
1.8.4.1
#28 lore raw

PATCH v5 27/34 staging: rtl8192e: Replace ?: with min_t

In reply to Mateusz Kulikowski

Replace :? with min_t for readability. Remove check that is always false.

---
 drivers/staging/rtl8192e/rtllib_softmac_wx.c | 8 +-------
 drivers/staging/rtl8192e/rtllib_wx.c         | 3 +--
 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1 -7
index d5e13a5..86f52ac7 100644
@@ -454,13 +454,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee,
 
 	proto_started = ieee->proto_started;
 
-	len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? wrqu->essid.length :
-	       IW_ESSID_MAX_SIZE;
-
-	if (len > IW_ESSID_MAX_SIZE) {
-		ret = -E2BIG;
-		goto out;
-	}
+	len = min_t(__u16, wrqu->essid.length, IW_ESSID_MAX_SIZE);
 
 	if (ieee->iw_mode == IW_MODE_MONITOR) {
 		ret = -1;
drivers/staging/rtl8192e/rtllib_wx.c +1 -2
index 2812a77..2ac1617 100644
@@ -851,8 +851,7 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len)
 		if ((eid == MFIE_TYPE_GENERIC) && (!memcmp(&ie[2],
 		     wps_oui, 4))) {
 
-			ieee->wps_ie_len = (len < MAX_WZC_IE_LEN) ? (len) :
-					   (MAX_WZC_IE_LEN);
+			ieee->wps_ie_len = min_t(size_t, len, MAX_WZC_IE_LEN);
 			buf = kmemdup(ie, ieee->wps_ie_len, GFP_KERNEL);
 			if (buf == NULL)
 				return -ENOMEM;
Signature · 1 line
1.8.4.1
#29 lore raw

PATCH v5 28/34 staging: rtl8192e: Replace ?: with max

In reply to Mateusz Kulikowski

All get_key implementations return either -1 or small buffers, so cast int->u16 is not a problem.

---
 drivers/staging/rtl8192e/rtllib_wx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_wx.c +2 -1
index 2ac1617..f31d864 100644
@@ -510,7 +510,8 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,
 		return 0;
 	}
 	len = crypt->ops->get_key(keybuf, SCM_KEY_LEN, NULL, crypt->priv);
-	erq->length = (len >= 0 ? len : 0);
+
+	erq->length = max(len, 0);
 
 	erq->flags |= IW_ENCODE_ENABLED;
 
Signature · 1 line
1.8.4.1
#30 lore raw

PATCH v5 29/34 staging: rtl8192e: Remove unneeded RT_TRACE(COMP_ERR,...)

In reply to Mateusz Kulikowski

This messages are not needed, as failure is reported earlier in code.

---
 drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c  | 1 -
 drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 1 -
 2 files changed, 2 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +0 -1
index 01d2201..f080a91 100644
@@ -239,7 +239,6 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev)
 	return true;
 
 phy_RF8256_Config_ParaFile_Fail:
-	RT_TRACE(COMP_ERR, "PHY Initialization failed\n");
 	return false;
 }
 
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0 -1
index 02c5b0a..54e430e 100644
@@ -171,7 +171,6 @@ static bool CPUcheck_firmware_ready(struct net_device *dev)
 	return rt_status;
 
 CPUCheckFirmwareReady_Fail:
-	RT_TRACE(COMP_ERR, "ERR in %s()\n", __func__);
 	rt_status = false;
 	return rt_status;
 
Signature · 1 line
1.8.4.1
#31 lore raw

PATCH v5 30/34 staging: rtl8192e: rtl8192_phy_checkBBAndRF(): Don't check MAC

In reply to Mateusz Kulikowski

This function never supported checking of MAC block. Instead of printing several warnings - print it once and exit.

---
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +7 -5
index 0765c97..6c4832c 100644
@@ -504,13 +504,15 @@ bool rtl8192_phy_checkBBAndRF(struct net_device *dev,
 	WriteAddr[HW90_BLOCK_RF] = 0x3;
 	RT_TRACE(COMP_PHY, "=======>%s(), CheckBlock:%d\n", __func__,
 		 CheckBlock);
+
+	if (CheckBlock == HW90_BLOCK_MAC) {
+		netdev_warn(dev, "%s(): No checks available for MAC block.\n",
+			    __func__);
+		return ret;
+	}
+
 	for (i = 0; i < CheckTimes; i++) {
 		switch (CheckBlock) {
-		case HW90_BLOCK_MAC:
-			RT_TRACE(COMP_ERR,
-				 "PHY_CheckBBRFOK(): Never Write 0x100 here!");
-			break;
-
 		case HW90_BLOCK_PHY0:
 		case HW90_BLOCK_PHY1:
 			write_nic_dword(dev, WriteAddr[CheckBlock],
Signature · 1 line
1.8.4.1
#32 lore raw

PATCH v5 31/34 staging: rtl8192e: Replace RT_TRACE(COMP_ERR, ...) with netdev_*

In reply to Mateusz Kulikowski

- Use netdev_* with log level depending on how serious error is
- Rework some messages to be more readable
- Pass net_device where needed for pretty prints

---
 drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c |  24 +++--
 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c     |  31 ++++---
 .../staging/rtl8192e/rtl8192e/r8192E_firmware.c    |  13 +--
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c     | 100 ++++++++++-----------
 drivers/staging/rtl8192e/rtl8192e/rtl_cam.c        |  18 ++--
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c       |  65 ++++++--------
 drivers/staging/rtl8192e/rtl8192e/rtl_ps.c         |   4 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c         |  14 ++-
 8 files changed, 127 insertions(+), 142 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +11 -13
index f080a91..facc6f1 100644
@@ -47,8 +47,8 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev,
 						0x0e, bMask12Bits, 0x021);
 
 			} else {
-				RT_TRACE(COMP_ERR,
-					 "PHY_SetRF8256Bandwidth(): unknown hardware version\n");
+				netdev_warn(dev, "%s(): Unknown HW version.\n",
+					    __func__);
 			}
 
 			break;
@@ -66,16 +66,15 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev,
 						 0x0e, bMask12Bits, 0x0e1);
 
 			} else {
-				RT_TRACE(COMP_ERR,
-					 "PHY_SetRF8256Bandwidth(): unknown hardware version\n");
+				netdev_warn(dev, "%s(): Unknown HW version.\n",
+					    __func__);
 			}
 
 
 			break;
 		default:
-			RT_TRACE(COMP_ERR,
-				 "PHY_SetRF8256Bandwidth(): unknown Bandwidth: %#X\n",
-				 Bandwidth);
+			netdev_err(dev, "%s(): Unknown bandwidth: %#X\n",
+				   __func__, Bandwidth);
 			break;
 
 		}
@@ -139,9 +138,8 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev)
 		rtStatus = rtl8192_phy_checkBBAndRF(dev, HW90_BLOCK_RF,
 						(enum rf90_radio_path)eRFPath);
 		if (!rtStatus) {
-			RT_TRACE(COMP_ERR,
-				 "PHY_RF8256_Config():Check Radio[%d] Fail!!\n",
-				 eRFPath);
+			netdev_err(dev, "%s(): Failed to check RF Path %d.\n",
+				   __func__, eRFPath);
 			goto phy_RF8256_Config_ParaFile_Fail;
 		}
 
@@ -227,9 +225,9 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev)
 		}
 
 		if (ret) {
-			RT_TRACE(COMP_ERR,
-				 "phy_RF8256_Config_ParaFile():Radio[%d] Fail!!",
-				 eRFPath);
+			netdev_err(dev,
+				   "%s(): Failed to initialize RF Path %d.\n",
+				   __func__, eRFPath);
 			goto phy_RF8256_Config_ParaFile_Fail;
 		}
 
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +15 -16
index e023c70..b5e4d35 100644
@@ -326,8 +326,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 
 	EEPROMId = eprom_read(dev, 0);
 	if (EEPROMId != RTL8190_EEPROM_ID) {
-		RT_TRACE(COMP_ERR, "EEPROM ID is invalid:%x, %x\n",
-			 EEPROMId, RTL8190_EEPROM_ID);
+		netdev_err(dev, "%s(): Invalid EEPROM ID: %x\n", __func__,
+			   EEPROMId);
 		priv->AutoloadFailFlag = true;
 	} else {
 		priv->AutoloadFailFlag = false;
@@ -736,9 +736,8 @@ start:
 	else if (priv->pFirmware->firmware_status == FW_STATUS_5_READY)
 		ulRegRead |= CPU_GEN_FIRMWARE_RESET;
 	else
-		RT_TRACE(COMP_ERR,
-			 "ERROR in %s(): undefined firmware state(%d)\n",
-			 __func__,   priv->pFirmware->firmware_status);
+		netdev_err(dev, "%s(): undefined firmware state: %d.\n",
+			   __func__, priv->pFirmware->firmware_status);
 
 	write_nic_dword(dev, CPU_GEN, ulRegRead);
 
@@ -754,7 +753,7 @@ start:
 	RT_TRACE(COMP_INIT, "BB Config Start!\n");
 	rtStatus = rtl8192_BBConfig(dev);
 	if (!rtStatus) {
-		RT_TRACE(COMP_ERR, "BB Config failed\n");
+		netdev_warn(dev, "%s(): Failed to configure BB\n", __func__);
 		return rtStatus;
 	}
 	RT_TRACE(COMP_INIT, "BB Config Finished!\n");
@@ -768,8 +767,8 @@ start:
 		else if (priv->LoopbackMode == RTL819X_MAC_LOOPBACK)
 			ulRegRead |= CPU_CCK_LOOPBACK;
 		else
-			RT_TRACE(COMP_ERR,
-				 "Serious error: wrong loopback mode setting\n");
+			netdev_err(dev, "%s: Invalid loopback mode setting.\n",
+				   __func__);
 
 		write_nic_dword(dev, CPU_GEN, ulRegRead);
 
@@ -867,7 +866,7 @@ start:
 		RT_TRACE(COMP_INIT, "RF Config Started!\n");
 		rtStatus = rtl8192_phy_RFConfig(dev);
 		if (!rtStatus) {
-			RT_TRACE(COMP_ERR, "RF Config failed\n");
+			netdev_info(dev, "RF Config failed\n");
 			return rtStatus;
 		}
 		RT_TRACE(COMP_INIT, "RF Config Finished!\n");
@@ -1137,7 +1136,8 @@ static u8 MRateToHwRate8190Pci(u8 rate)
 	return ret;
 }
 
-static u8 rtl8192_MapHwQueueToFirmwareQueue(u8 QueueID, u8 priority)
+static u8 rtl8192_MapHwQueueToFirmwareQueue(struct net_device *dev, u8 QueueID,
+					    u8 priority)
 {
 	u8 QueueSelect = 0x0;
 
@@ -1170,9 +1170,8 @@ static u8 rtl8192_MapHwQueueToFirmwareQueue(u8 QueueID, u8 priority)
 		QueueSelect = QSLT_HIGH;
 		break;
 	default:
-		RT_TRACE(COMP_ERR,
-			 "TransmitTCB(): Impossible Queue Selection: %d\n",
-			 QueueID);
+		netdev_warn(dev, "%s(): Impossible Queue Selection: %d\n",
+			    __func__, QueueID);
 		break;
 	}
 	return QueueSelect;
@@ -1196,7 +1195,7 @@ void  rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc,
 						cb_desc);
 
 	if (pci_dma_mapping_error(priv->pdev, mapping))
-		RT_TRACE(COMP_ERR, "DMA Mapping error\n");
+		netdev_err(dev, "%s(): DMA Mapping error\n", __func__);
 	if (cb_desc->bAMPDUEnable) {
 		pTxFwInfo->AllowAggregation = 1;
 		pTxFwInfo->RxMF = cb_desc->ampdu_factor;
@@ -1272,7 +1271,7 @@ void  rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc,
 
 	pdesc->PktId = 0x0;
 
-	pdesc->QueueSelect = rtl8192_MapHwQueueToFirmwareQueue(
+	pdesc->QueueSelect = rtl8192_MapHwQueueToFirmwareQueue(dev,
 						cb_desc->queue_index,
 						cb_desc->priority);
 	pdesc->TxFWInfoSize = sizeof(struct tx_fwinfo_8190pci);
@@ -1296,7 +1295,7 @@ void  rtl8192_tx_fill_cmd_desc(struct net_device *dev,
 			 PCI_DMA_TODEVICE);
 
 	if (pci_dma_mapping_error(priv->pdev, mapping))
-		RT_TRACE(COMP_ERR, "DMA Mapping error\n");
+		netdev_err(dev, "%s(): DMA Mapping error\n", __func__);
 	memset(entry, 0, 12);
 	entry->LINIP = cb_desc->bLastIniPkt;
 	entry->FirstSeg = 1;
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +7 -6
index 54e430e..17d2a15 100644
@@ -116,7 +116,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)
 	}
 
 	if (!(CPU_status&CPU_GEN_PUT_CODE_OK)) {
-		RT_TRACE(COMP_ERR, "Download Firmware: Put code fail!\n");
+		netdev_err(dev, "Firmware download failed.\n");
 		goto CPUCheckMainCodeOKAndTurnOnCPU_Fail;
 	} else {
 		RT_TRACE(COMP_FIRMWARE, "Download Firmware: Put code ok!\n");
@@ -135,15 +135,16 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)
 		mdelay(2);
 	}
 
-	if (!(CPU_status&CPU_GEN_BOOT_RDY))
+	if (!(CPU_status&CPU_GEN_BOOT_RDY)) {
+		netdev_err(dev, "Firmware boot failed.\n");
 		goto CPUCheckMainCodeOKAndTurnOnCPU_Fail;
-	else
-		RT_TRACE(COMP_FIRMWARE, "Download Firmware: Boot ready!\n");
+	}
+
+	RT_TRACE(COMP_FIRMWARE, "Download Firmware: Boot ready!\n");
 
 	return rt_status;
 
 CPUCheckMainCodeOKAndTurnOnCPU_Fail:
-	RT_TRACE(COMP_ERR, "ERR in %s()\n", __func__);
 	rt_status = false;
 	return rt_status;
 }
@@ -310,7 +311,7 @@ bool init_firmware(struct net_device *dev)
 	return rt_status;
 
 download_firmware_fail:
-	RT_TRACE(COMP_ERR, "ERR in %s()\n", __func__);
+	netdev_err(dev, "%s: Failed to initialize firmware.\n", __func__);
 	rt_status = false;
 	return rt_status;
 
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +48 -52

255 lines not on this page · raw message

drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +9 -9
index 0ffade4..89c3d33 100644
@@ -113,8 +113,8 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
 	if (priv->rtllib->PowerSaveControl.bInactivePs) {
 		if (rtState == eRfOff) {
 			if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) {
-				RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
-					__func__);
+				netdev_warn(dev, "%s(): RF is OFF.\n",
+					    __func__);
 				return;
 			}
 			down(&priv->rtllib->ips_sem);
@@ -124,7 +124,7 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
 	}
 	priv->rtllib->is_set_key = true;
 	if (EntryNo >= TOTAL_CAM_ENTRY)
-		RT_TRACE(COMP_ERR, "cam entry exceeds in setKey()\n");
+		netdev_info(dev, "%s(): Invalid CAM entry\n", __func__);
 
 	RT_TRACE(COMP_SEC,
 		 "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d,KeyType:%d, MacAddr %pM\n",
@@ -243,9 +243,9 @@ void CamRestoreAllEntry(struct net_device *dev)
 				       (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])
 				     );
 			} else {
-				RT_TRACE(COMP_ERR,
-					 "===>%s():ERR!! ADHOC TKIP ,but 0 entry is have no data\n",
-					 __func__);
+				netdev_warn(dev,
+					    "%s(): ADHOC TKIP: missing key entry.\n",
+					    __func__);
 				return;
 			}
 		}
@@ -267,9 +267,9 @@ void CamRestoreAllEntry(struct net_device *dev)
 					CAM_CONST_ADDR[0], 0,
 					(u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]));
 			} else {
-				RT_TRACE(COMP_ERR,
-					 "===>%s():ERR!! ADHOC CCMP ,but 0 entry is have no data\n",
-					 __func__);
+				netdev_warn(dev,
+					    "%s(): ADHOC CCMP: missing key entry.\n",
+					    __func__);
 				return;
 			}
 		}
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +29 -36

173 lines not on this page · raw message

drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +2 -2
index 386ae0c..f6eb989 100644
@@ -202,8 +202,8 @@ void rtllib_ips_leave_wq(struct net_device *dev)
 	if (priv->rtllib->PowerSaveControl.bInactivePs) {
 		if (rtState == eRfOff) {
 			if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) {
-				RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
-					 __func__);
+				netdev_warn(dev, "%s(): RF is OFF.\n",
+					    __func__);
 				return;
 			}
 			netdev_info(dev, "=========>%s(): IPSLeave\n",
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +6 -8
index 26c2ad0..f5e4961 100644
@@ -116,9 +116,8 @@ static int r8192_wx_set_power(struct net_device *dev,
 	struct r8192_priv *priv = rtllib_priv(dev);
 
 	if (priv->bHwRadioOff) {
-		RT_TRACE(COMP_ERR,
-			 "%s():Hw is Radio Off, we can't set Power,return\n",
-			 __func__);
+		netdev_warn(dev, "%s(): Can't set Power: Radio is Off.\n",
+			    __func__);
 		return 0;
 	}
 	down(&priv->wx_sem);
@@ -278,8 +277,8 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
 			if (rtState == eRfOff) {
 				if (priv->rtllib->RfOffReason >
 				    RF_CHANGE_BY_IPS) {
-					RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
-						 __func__);
+					netdev_warn(dev, "%s(): RF is OFF.\n",
+						    __func__);
 					up(&priv->wx_sem);
 					return -1;
 				}
@@ -438,9 +437,8 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
 			if (rtState == eRfOff) {
 				if (priv->rtllib->RfOffReason >
 				    RF_CHANGE_BY_IPS) {
-					RT_TRACE(COMP_ERR,
-						 "%s(): RF is OFF.\n",
-						 __func__);
+					netdev_warn(dev, "%s(): RF is OFF.\n",
+						    __func__);
 					up(&priv->wx_sem);
 					return -1;
 				}
Signature · 1 line
1.8.4.1
#33 lore raw

PATCH v5 32/34 staging: rtl8192e: Fix trivial LONG_LINE errors

In reply to Mateusz Kulikowski

Reindent lines to make checkpatch happy.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 83 +++++++++++++++++++-----------
 drivers/staging/rtl8192e/rtllib_rx.c       | 24 +++++----
 2 files changed, 67 insertions(+), 40 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +53 -30
index a921857..d480229 100644
@@ -403,16 +403,16 @@ static void dm_check_rate_adaptive(struct net_device *dev)
 				((bshort_gi_enabled) ? BIT31 : 0);
 
 		if (pra->ratr_state == DM_RATR_STA_HIGH) {
-			HighRSSIThreshForRA	= pra->high2low_rssi_thresh_for_ra;
-			LowRSSIThreshForRA	= (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) ?
+			HighRSSIThreshForRA = pra->high2low_rssi_thresh_for_ra;
+			LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) ?
 					(pra->low_rssi_thresh_for_ra40M) : (pra->low_rssi_thresh_for_ra20M);
 		} else if (pra->ratr_state == DM_RATR_STA_LOW) {
-			HighRSSIThreshForRA	= pra->high_rssi_thresh_for_ra;
-			LowRSSIThreshForRA	= (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) ?
+			HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra;
+			LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) ?
 					(pra->low2high_rssi_thresh_for_ra40M) : (pra->low2high_rssi_thresh_for_ra20M);
 		} else {
-			HighRSSIThreshForRA	= pra->high_rssi_thresh_for_ra;
-			LowRSSIThreshForRA	= (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) ?
+			HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra;
+			LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) ?
 					(pra->low_rssi_thresh_for_ra40M) : (pra->low_rssi_thresh_for_ra20M);
 		}
 
@@ -749,7 +749,8 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
 				 "Avg_TSSI_Meas_from_driver = %d\n",
 				 Avg_TSSI_Meas_from_driver);
 			TSSI_13dBm = priv->TSSI_13dBm;
-			RT_TRACE(COMP_POWER_TRACKING, "TSSI_13dBm = %d\n", TSSI_13dBm);
+			RT_TRACE(COMP_POWER_TRACKING, "TSSI_13dBm = %d\n",
+				 TSSI_13dBm);
 
 			if (Avg_TSSI_Meas_from_driver > TSSI_13dBm)
 				delta = Avg_TSSI_Meas_from_driver - TSSI_13dBm;
@@ -828,11 +829,13 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
 				 "priv->CCKPresentAttentuation = %d\n",
 				 priv->CCKPresentAttentuation);
 
-			if (priv->CCKPresentAttentuation_difference <= -12 || priv->CCKPresentAttentuation_difference >= 24) {
+			if (priv->CCKPresentAttentuation_difference <= -12 ||
+			    priv->CCKPresentAttentuation_difference >= 24) {
 				priv->rtllib->bdynamic_txpower_enable = true;
 				write_nic_byte(dev, Pw_Track_Flag, 0);
 				write_nic_byte(dev, FW_Busy_Flag, 0);
-				RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n");
+				RT_TRACE(COMP_POWER_TRACKING,
+					 "tx power track--->limited\n");
 				return;
 			}
 
@@ -1233,18 +1236,28 @@ static void dm_bb_initialgain_restore(struct net_device *dev)
 		return;
 
 	rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8);
-	rtl8192_setBBreg(dev, rOFDM0_XAAGCCore1, bit_mask, (u32)priv->initgain_backup.xaagccore1);
-	rtl8192_setBBreg(dev, rOFDM0_XBAGCCore1, bit_mask, (u32)priv->initgain_backup.xbagccore1);
-	rtl8192_setBBreg(dev, rOFDM0_XCAGCCore1, bit_mask, (u32)priv->initgain_backup.xcagccore1);
-	rtl8192_setBBreg(dev, rOFDM0_XDAGCCore1, bit_mask, (u32)priv->initgain_backup.xdagccore1);
+	rtl8192_setBBreg(dev, rOFDM0_XAAGCCore1, bit_mask,
+			 (u32)priv->initgain_backup.xaagccore1);
+	rtl8192_setBBreg(dev, rOFDM0_XBAGCCore1, bit_mask,
+			 (u32)priv->initgain_backup.xbagccore1);
+	rtl8192_setBBreg(dev, rOFDM0_XCAGCCore1, bit_mask,
+			 (u32)priv->initgain_backup.xcagccore1);
+	rtl8192_setBBreg(dev, rOFDM0_XDAGCCore1, bit_mask,
+			 (u32)priv->initgain_backup.xdagccore1);
 	bit_mask  = bMaskByte2;
-	rtl8192_setBBreg(dev, rCCK0_CCA, bit_mask, (u32)priv->initgain_backup.cca);
-
-	RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc50 is %x\n", priv->initgain_backup.xaagccore1);
-	RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc58 is %x\n", priv->initgain_backup.xbagccore1);
-	RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc60 is %x\n", priv->initgain_backup.xcagccore1);
-	RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc68 is %x\n", priv->initgain_backup.xdagccore1);
-	RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xa0a is %x\n", priv->initgain_backup.cca);
+	rtl8192_setBBreg(dev, rCCK0_CCA, bit_mask,
+			 (u32)priv->initgain_backup.cca);
+
+	RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc50 is %x\n",
+		 priv->initgain_backup.xaagccore1);
+	RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc58 is %x\n",
+		 priv->initgain_backup.xbagccore1);
+	RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc60 is %x\n",
+		 priv->initgain_backup.xcagccore1);
+	RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc68 is %x\n",
+		 priv->initgain_backup.xdagccore1);
+	RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xa0a is %x\n",
+		 priv->initgain_backup.cca);
 	rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1);
 
 }
@@ -1277,11 +1290,16 @@ static void dm_bb_initialgain_backup(struct net_device *dev)
 	bit_mask  = bMaskByte2;
 	priv->initgain_backup.cca = (u8)rtl8192_QueryBBReg(dev, rCCK0_CCA, bit_mask);
 
-	RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc50 is %x\n", priv->initgain_backup.xaagccore1);
-	RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc58 is %x\n", priv->initgain_backup.xbagccore1);
-	RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc60 is %x\n", priv->initgain_backup.xcagccore1);
-	RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc68 is %x\n", priv->initgain_backup.xdagccore1);
-	RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xa0a is %x\n", priv->initgain_backup.cca);
+	RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc50 is %x\n",
+		 priv->initgain_backup.xaagccore1);
+	RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc58 is %x\n",
+		 priv->initgain_backup.xbagccore1);
+	RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc60 is %x\n",
+		 priv->initgain_backup.xcagccore1);
+	RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc68 is %x\n",
+		 priv->initgain_backup.xdagccore1);
+	RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xa0a is %x\n",
+		 priv->initgain_backup.cca);
 
 }
 
@@ -1798,10 +1816,12 @@ static void dm_check_edca_turbo(struct net_device *dev)
 				if (!priv->bis_cur_rdlstate ||
 				    !priv->bcurrent_turbo_EDCA) {
 					if (priv->rtllib->mode == WIRELESS_MODE_G)
-						write_nic_dword(dev, EDCAPARA_BE,
+						write_nic_dword(dev,
+								EDCAPARA_BE,
 							 edca_setting_DL_GMode[pHTInfo->IOTPeer]);
 					else
-						write_nic_dword(dev, EDCAPARA_BE,
+						write_nic_dword(dev,
+								EDCAPARA_BE,
 							 edca_setting_DL[pHTInfo->IOTPeer]);
 					priv->bis_cur_rdlstate = true;
 				}
@@ -1809,12 +1829,15 @@ static void dm_check_edca_turbo(struct net_device *dev)
 			priv->bcurrent_turbo_EDCA = true;
 		} else {
 			if (curRxOkCnt > 4*curTxOkCnt) {
-				if (!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) {
+				if (!priv->bis_cur_rdlstate ||
+				    !priv->bcurrent_turbo_EDCA) {
 					if (priv->rtllib->mode == WIRELESS_MODE_G)
-						write_nic_dword(dev, EDCAPARA_BE,
+						write_nic_dword(dev,
+								EDCAPARA_BE,
 							 edca_setting_DL_GMode[pHTInfo->IOTPeer]);
 					else
-						write_nic_dword(dev, EDCAPARA_BE,
+						write_nic_dword(dev,
+								EDCAPARA_BE,
 							 edca_setting_DL[pHTInfo->IOTPeer]);
 					priv->bis_cur_rdlstate = true;
 				}
drivers/staging/rtl8192e/rtllib_rx.c +14 -10
index 2280d18..6977f04 100644
@@ -1256,14 +1256,16 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee,
 		struct sk_buff *sub_skb = rxb->subframes[i];
 
 		if (sub_skb) {
-			/* convert hdr + possible LLC headers into Ethernet header */
+			/* convert hdr + possible LLC headers
+			 * into Ethernet header
+			 */
 			ethertype = (sub_skb->data[6] << 8) | sub_skb->data[7];
 			if (sub_skb->len >= 8 &&
 				((memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) == 0 &&
 				ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
 				memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) {
-				/* remove RFC1042 or Bridge-Tunnel encapsulation and
-				 * replace EtherType
+				/* remove RFC1042 or Bridge-Tunnel encapsulation
+				 * and replace EtherType
 				 */
 				skb_pull(sub_skb, SNAP_SIZE);
 				ether_addr_copy(skb_push(sub_skb, ETH_ALEN),
@@ -1272,7 +1274,9 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee,
 						dst);
 			} else {
 				u16 len;
-				/* Leave Ethernet header part of hdr and full payload */
+				/* Leave Ethernet header part of hdr
+				 * and full payload
+				 */
 				len = sub_skb->len;
 				memcpy(skb_push(sub_skb, 2), &len, 2);
 				ether_addr_copy(skb_push(sub_skb, ETH_ALEN),
@@ -1293,7 +1297,8 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee,
 			sub_skb->dev = dev;
 			sub_skb->dev->stats.rx_packets++;
 			sub_skb->dev->stats.rx_bytes += sub_skb->len;
-			sub_skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */
+			/* 802.11 crc not sufficient */
+			sub_skb->ip_summed = CHECKSUM_NONE;
 			netif_rx(sub_skb);
 		}
 	}
@@ -1835,11 +1840,10 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee,
 
 	if (*tmp_htcap_len == 0) {
 		if (info_element->len >= 4 &&
-		   info_element->data[0] == 0x00 &&
-		   info_element->data[1] == 0x90 &&
-		   info_element->data[2] == 0x4c &&
-		   info_element->data[3] == 0x033) {
-
+		    info_element->data[0] == 0x00 &&
+		    info_element->data[1] == 0x90 &&
+		    info_element->data[2] == 0x4c &&
+		    info_element->data[3] == 0x033) {
 			*tmp_htcap_len = min_t(u8, info_element->len,
 					       MAX_IE_LEN);
 			if (*tmp_htcap_len != 0) {
Signature · 1 line
1.8.4.1
#34 lore raw

PATCH v5 33/34 staging: rtl8192e: rtl8192E_suspend(): Fix WOL reporting

In reply to Mateusz Kulikowski

WOL capability was reported in an awkward way - print it nicely.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +2 -4
index ca6ecfc..e4908672 100644
@@ -57,10 +57,8 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state)
 		write_nic_byte(dev, MacBlkCtrl, 0xa);
 	}
 out_pci_suspend:
-	netdev_info(dev, "r8192E support WOL call??????????????????????\n");
-	if (priv->rtllib->bSupportRemoteWakeUp)
-		RT_TRACE(COMP_POWER,
-			 "r8192E support WOL call!!!!!!!!!!!!!!!!!!.\n");
+	netdev_info(dev, "WOL is %s\n", priv->rtllib->bSupportRemoteWakeUp ?
+			    "Supported" : "Not supported");
 	pci_save_state(pdev);
 	pci_disable_device(pdev);
 	pci_enable_wake(pdev, pci_choose_state(pdev, state),
Signature · 1 line
1.8.4.1
#35 lore raw

PATCH v5 34/34 staging: rtl8192e: Fix SPACING error

In reply to Mateusz Kulikowski

Fix SPACING error in rtl8192_hw_to_sleep().

---
 drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +1 -1
index f6eb989..404cb83 100644
@@ -101,7 +101,7 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time)
 	time -= msecs_to_jiffies(8 + 16 + 7);
 
 	timeout = jiffies + msecs_to_jiffies(MIN_SLEEP_TIME);
-	if (time_before((unsigned long)time,timeout)) {
+	if (time_before((unsigned long)time, timeout)) {
 		spin_unlock_irqrestore(&priv->ps_lock, flags);
 		netdev_info(dev, "too short to sleep::%lld < %ld\n",
 			    time - jiffies, msecs_to_jiffies(MIN_SLEEP_TIME));
Signature · 1 line
1.8.4.1
#36 lore raw
In reply to Mateusz Kulikowski
Quoted 1 line · Mateusz Kulikowski

Updated series of patches for rtl8192.

[]

Quoted 1 line
 31 files changed, 1260 insertions(+), 2011 deletions(-)

Nice diffstat

btw:

If you have to resubmit this, please try to remove the unnecessary periods after logging statements.

Things like:

- RT_TRACE(COMP_ERR,
- "PHY_SetRF8256Bandwidth(): unknown hardware version\n");
+ netdev_warn(dev, "%s(): Unknown HW version.\n",
+ __func__);

aren't sentences and don't need punctuation.

maintainer
#37 lore raw
In reply to Mateusz Kulikowski
Quoted 5 lines · Mateusz Kulikowski

Updated series of patches for rtl8192.
Rebased to latest staging-next (9535ebc5e). Built and target tested (tests like for v3 + download of 1Mb file over http).
Side note: quality/performance of this driver is still poor - it drops a lot of packets (at least when talking to 802.11N/ 2.4G / WPA2 network).

Nice job, all now applied.

greg k-h