linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] convert more DBG_88E calls and remove dead code
@ 2021-06-13 22:41 Phillip Potter
  2021-06-13 22:41 ` [PATCH 1/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c Phillip Potter
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Phillip Potter @ 2021-06-13 22:41 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, linux-staging, linux-kernel, insafonov, linux,
	straube.linux, liushixin2, gustavoars, christophe.jaillet,
	yepeilin.cs, dan.carpenter, martin, simon.fodin, romain.perier,
	apais, mh12gx2825

This series converts all DBG_88E and DBG_88E_LEVEL calls in
core/rtw_efuse.c and core/rtw_xmit.c, and also entirely removes
core/rtw_debug.c which is dead code and contains only functions not used
anywhere else. This should contribute to the continuing effort to clean
up the rtl8188eu driver, particularly with regards to its debugging.

Phillip Potter (3):
  staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c
  staging: rtl8188eu: convert DBG_88E calls in core/rtw_xmit.c
  staging: rtl8188eu: remove core/rtw_debug.c

 drivers/staging/rtl8188eu/Makefile            |   1 -
 drivers/staging/rtl8188eu/core/rtw_debug.c    | 187 ------------------
 drivers/staging/rtl8188eu/core/rtw_efuse.c    |  27 ++-
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c |   2 +-
 drivers/staging/rtl8188eu/core/rtw_xmit.c     |  60 +++---
 .../staging/rtl8188eu/hal/rtl8188eu_xmit.c    |   4 +-
 drivers/staging/rtl8188eu/include/rtw_debug.h |  25 ---
 drivers/staging/rtl8188eu/include/rtw_xmit.h  |   6 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   |   2 +-
 .../staging/rtl8188eu/os_dep/usb_ops_linux.c  |  11 +-
 10 files changed, 69 insertions(+), 256 deletions(-)
 delete mode 100644 drivers/staging/rtl8188eu/core/rtw_debug.c

-- 
2.30.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c
  2021-06-13 22:41 [PATCH 0/3] convert more DBG_88E calls and remove dead code Phillip Potter
@ 2021-06-13 22:41 ` Phillip Potter
  2021-06-14  6:50   ` Dan Carpenter
  2021-06-13 22:41 ` [PATCH 2/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_xmit.c Phillip Potter
  2021-06-13 22:41 ` [PATCH 3/3] staging: rtl8188eu: remove core/rtw_debug.c Phillip Potter
  2 siblings, 1 reply; 6+ messages in thread
From: Phillip Potter @ 2021-06-13 22:41 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, linux-staging, linux-kernel, insafonov, linux,
	straube.linux, liushixin2, gustavoars, christophe.jaillet,
	yepeilin.cs, dan.carpenter, martin, simon.fodin, romain.perier,
	apais, mh12gx2825

Convert all calls to the DBG_88E macro in core/rtw_efuse.c into
netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
debug messages can be controlled more precisely by just using debugfs.
It is important to keep these messages still, as they are displayable
via a kernel module parameter when using DBG_88E.

Also modify efuse_phymap_to_logical function signature to pass through
a struct net_device pointer, so that we can use it to call netdev_dbg
in this function too.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/rtl8188eu/core/rtw_efuse.c | 27 ++++++++++++++--------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c
index 9bb3ec0cd62f..019796c0f1af 100644
--- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
+++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
@@ -72,7 +72,7 @@ static void efuse_power_switch(struct adapter *pAdapter, u8 write, u8 pwrstate)
 }
 
 static void
-efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
+efuse_phymap_to_logical(struct net_device *dev, u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf)
 {
 	u8 *efuseTbl = NULL;
 	u8 rtemp8;
@@ -92,7 +92,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
 		      sizeof(void *) + EFUSE_MAX_WORD_UNIT * sizeof(u16),
 		      GFP_KERNEL);
 	if (!tmp) {
-		DBG_88E("%s: alloc eFuseWord fail!\n", __func__);
+		netdev_dbg(dev, "alloc eFuseWord fail!\n");
 		goto eFuseWord_failed;
 	}
 	for (i = 0; i < EFUSE_MAX_SECTION_88E; i++)
@@ -113,7 +113,9 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
 		efuse_utilized++;
 		eFuse_Addr++;
 	} else {
-		DBG_88E("EFUSE is empty efuse_Addr-%d efuse_data =%x\n", eFuse_Addr, rtemp8);
+		netdev_dbg(dev,
+			   "EFUSE is empty efuse_Addr-%d efuse_data =%x\n",
+			   eFuse_Addr, rtemp8);
 		goto exit;
 	}
 
@@ -220,7 +222,7 @@ static void efuse_read_phymap_from_txpktbuf(
 	if (bcnhead < 0) /* if not valid */
 		bcnhead = usb_read8(adapter, REG_TDECTRL + 1);
 
-	DBG_88E("%s bcnhead:%d\n", __func__, bcnhead);
+	netdev_dbg(adapter->pnetdev, "bcnhead:%d\n", bcnhead);
 
 	usb_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT);
 
@@ -232,8 +234,10 @@ static void efuse_read_phymap_from_txpktbuf(
 		usb_write8(adapter, REG_TXPKTBUF_DBG, 0);
 		start = jiffies;
 		while (!(reg_0x143 = usb_read8(adapter, REG_TXPKTBUF_DBG)) &&
-		       jiffies_to_msecs(jiffies - start) < 1000) {
-			DBG_88E("%s polling reg_0x143:0x%02x, reg_0x106:0x%02x\n", __func__, reg_0x143, usb_read8(adapter, 0x106));
+			jiffies_to_msecs(jiffies - start) < 1000) {
+			netdev_dbg(adapter->pnetdev,
+				   "polling reg_0x143:0x%02x, reg_0x106:0x%02x\n",
+				   reg_0x143, usb_read8(adapter, 0x106));
 			usleep_range(1000, 2000);
 		}
 
@@ -255,7 +259,9 @@ static void efuse_read_phymap_from_txpktbuf(
 
 			limit = min_t(u16, len - 2, limit);
 
-			DBG_88E("%s len:%u, lenbak:%u, aaa:%u, aaabak:%u\n", __func__, len, lenbak, aaa, aaabak);
+			netdev_dbg(adapter->pnetdev,
+				   "len:%u, lenbak:%u, aaa:%u, aaabak:%u\n",
+				   len, lenbak, aaa, aaabak);
 
 			memcpy(pos, ((u8 *)&lo32) + 2, (limit >= count + 2) ? 2 : limit - count);
 			count += (limit >= count + 2) ? 2 : limit - count;
@@ -278,7 +284,7 @@ static void efuse_read_phymap_from_txpktbuf(
 		i++;
 	}
 	usb_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, DISABLE_TRXPKT_BUF_ACCESS);
-	DBG_88E("%s read count:%u\n", __func__, count);
+	netdev_dbg(adapter->pnetdev, "read count:%u\n", count);
 	*size = count;
 }
 
@@ -294,7 +300,7 @@ static s32 iol_read_efuse(struct adapter *padapter, u8 txpktbuf_bndy, u16 offset
 	status = iol_execute(padapter, CMD_READ_EFUSE_MAP);
 	if (status == _SUCCESS)
 		efuse_read_phymap_from_txpktbuf(padapter, txpktbuf_bndy, physical_map, &size);
-	efuse_phymap_to_logical(physical_map, offset, size_byte, logical_map);
+	efuse_phymap_to_logical(padapter->pnetdev, physical_map, offset, size_byte, logical_map);
 	return status;
 }
 
@@ -432,7 +438,8 @@ int Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data)
 						hoffset = ((tmp_header & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1);
 						hworden = efuse_data & 0x0F;
 					} else {
-						DBG_88E("Error, All words disabled\n");
+						netdev_dbg(pAdapter->pnetdev,
+							   "Error, All words disabled\n");
 						efuse_addr++;
 						continue;
 					}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_xmit.c
  2021-06-13 22:41 [PATCH 0/3] convert more DBG_88E calls and remove dead code Phillip Potter
  2021-06-13 22:41 ` [PATCH 1/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c Phillip Potter
@ 2021-06-13 22:41 ` Phillip Potter
  2021-06-13 22:41 ` [PATCH 3/3] staging: rtl8188eu: remove core/rtw_debug.c Phillip Potter
  2 siblings, 0 replies; 6+ messages in thread
From: Phillip Potter @ 2021-06-13 22:41 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, linux-staging, linux-kernel, insafonov, linux,
	straube.linux, liushixin2, gustavoars, christophe.jaillet,
	yepeilin.cs, dan.carpenter, martin, simon.fodin, romain.perier,
	apais, mh12gx2825

Convert all calls to the DBG_88E and DBG_88E_LEVEL macros in
core/rtw_xmit.c into netdev_dbg calls. These are unnecessary,
as visibility of debug messages can be controlled more precisely
by just using debugfs. It is important to keep these messages
still, as they are displayable via a kernel module parameter when
using DBG_88E.

To do this, also modify the rtw_sctx_wait, rtw_sctx_done_err and
qos_acm functions and call sites, to pass through a struct net_device
pointer so that netdev_dbg can be used in these as well.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c |  2 +-
 drivers/staging/rtl8188eu/core/rtw_xmit.c     | 60 +++++++++++--------
 .../staging/rtl8188eu/hal/rtl8188eu_xmit.c    |  4 +-
 drivers/staging/rtl8188eu/include/rtw_xmit.h  |  6 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   |  2 +-
 .../staging/rtl8188eu/os_dep/usb_ops_linux.c  | 11 +++-
 6 files changed, 52 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 507672120cbc..e73054f6c1cb 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -240,7 +240,7 @@ static s32 dump_mgntframe_and_wait(struct adapter *padapter,
 	ret = rtw_hal_mgnt_xmit(padapter, pmgntframe);
 
 	if (ret == _SUCCESS)
-		ret = rtw_sctx_wait(&sctx);
+		ret = rtw_sctx_wait(padapter->pnetdev, &sctx);
 
 	return ret;
 }
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 718dd20ff36c..a0bc9093e68b 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -340,7 +340,7 @@ static void update_attrib_phy_info(struct pkt_attrib *pattrib, struct sta_info *
 	pattrib->retry_ctrl = false;
 }
 
-u8 qos_acm(u8 acm_mask, u8 priority)
+u8 qos_acm(struct net_device *dev, u8 acm_mask, u8 priority)
 {
 	u8 change_priority = priority;
 
@@ -364,8 +364,7 @@ u8 qos_acm(u8 acm_mask, u8 priority)
 			change_priority = 5;
 		break;
 	default:
-		DBG_88E("%s(): invalid pattrib->priority: %d!!!\n",
-			__func__, priority);
+		netdev_dbg(dev, "invalid pattrib->priority: %d!!!\n", priority);
 		break;
 	}
 
@@ -451,7 +450,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
 			}
 		}
 	} else if (pattrib->ether_type == ETH_P_PAE) {
-		DBG_88E_LEVEL(_drv_info_, "send eapol packet\n");
+		netdev_dbg(padapter->pnetdev, "send eapol packet\n");
 	}
 
 	if ((pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1))
@@ -481,7 +480,6 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
 
 	if (psta) {
 		pattrib->mac_id = psta->mac_id;
-		/* DBG_88E("%s ==> mac_id(%d)\n", __func__, pattrib->mac_id); */
 		pattrib->psta = psta;
 	} else {
 		/*  if we cannot get psta => drop the pkt */
@@ -505,7 +503,9 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
 			set_qos(pkt, pattrib);
 
 			if (pmlmepriv->acm_mask != 0)
-				pattrib->priority = qos_acm(pmlmepriv->acm_mask, pattrib->priority);
+				pattrib->priority = qos_acm(padapter->pnetdev,
+							    pmlmepriv->acm_mask,
+							    pattrib->priority);
 		}
 	}
 
@@ -927,7 +927,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
 		return _FAIL;
 
 	if (!pxmitframe->buf_addr) {
-		DBG_88E("==> %s buf_addr == NULL\n", __func__);
+		netdev_dbg(padapter->pnetdev, "buf_addr == NULL\n");
 		return _FAIL;
 	}
 
@@ -939,7 +939,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
 
 	if (rtw_make_wlanhdr(padapter, mem_start, pattrib) == _FAIL) {
 		RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("%s: rtw_make_wlanhdr fail; drop pkt\n", __func__));
-		DBG_88E("%s: rtw_make_wlanhdr fail; drop pkt\n", __func__);
+		netdev_dbg(padapter->pnetdev, "rtw_make_wlanhdr fail; drop pkt\n");
 		res = _FAIL;
 		goto exit;
 	}
@@ -1040,7 +1040,8 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
 
 	if (xmitframe_addmic(padapter, pxmitframe) == _FAIL) {
 		RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n"));
-		DBG_88E("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n");
+		netdev_dbg(padapter->pnetdev,
+			   "xmitframe_addmic(padapter, pxmitframe) == _FAIL\n");
 		res = _FAIL;
 		goto exit;
 	}
@@ -1154,8 +1155,11 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv)
 		pxmitpriv->free_xmit_extbuf_cnt--;
 		pxmitbuf->priv_data = NULL;
 		if (pxmitbuf->sctx) {
-			DBG_88E("%s pxmitbuf->sctx is not NULL\n", __func__);
-			rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC);
+			netdev_dbg(pxmitpriv->adapter->pnetdev,
+				   "pxmitbuf->sctx is not NULL\n");
+			rtw_sctx_done_err(pxmitpriv->adapter->pnetdev,
+					  &pxmitbuf->sctx,
+					  RTW_SCTX_DONE_BUF_ALLOC);
 		}
 	}
 	spin_unlock_irqrestore(&pfree_queue->lock, irql);
@@ -1197,8 +1201,11 @@ struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv)
 		pxmitpriv->free_xmitbuf_cnt--;
 		pxmitbuf->priv_data = NULL;
 		if (pxmitbuf->sctx) {
-			DBG_88E("%s pxmitbuf->sctx is not NULL\n", __func__);
-			rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC);
+			netdev_dbg(pxmitpriv->adapter->pnetdev,
+				   "pxmitbuf->sctx is not NULL\n");
+			rtw_sctx_done_err(pxmitpriv->adapter->pnetdev,
+					  &pxmitbuf->sctx,
+					  RTW_SCTX_DONE_BUF_ALLOC);
 		}
 	}
 	spin_unlock_irqrestore(&pfree_xmitbuf_queue->lock, irql);
@@ -1215,8 +1222,11 @@ s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
 		return _FAIL;
 
 	if (pxmitbuf->sctx) {
-		DBG_88E("%s pxmitbuf->sctx is not NULL\n", __func__);
-		rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_FREE);
+		netdev_dbg(pxmitpriv->adapter->pnetdev,
+			   "pxmitbuf->sctx is not NULL\n");
+		rtw_sctx_done_err(pxmitpriv->adapter->pnetdev,
+				  &pxmitbuf->sctx,
+				  RTW_SCTX_DONE_BUF_FREE);
 	}
 
 	if (pxmitbuf->ext_tag) {
@@ -1482,7 +1492,7 @@ s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe)
 
 	if (!psta) {
 		res = _FAIL;
-		DBG_88E("%s: psta == NULL\n", __func__);
+		netdev_dbg(padapter->pnetdev, "psta == NULL\n");
 		RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("%s: psta == NULL\n", __func__));
 		goto exit;
 	}
@@ -1591,7 +1601,7 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt)
 	pxmitframe = rtw_alloc_xmitframe(pxmitpriv);
 	if (!pxmitframe) {
 		RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("%s: no more pxmitframe\n", __func__));
-		DBG_88E("DBG_TX_DROP_FRAME %s no more pxmitframe\n", __func__);
+		netdev_dbg(padapter->pnetdev, "DBG_TX_DROP_FRAME no more pxmitframe\n");
 		return -1;
 	}
 
@@ -1982,7 +1992,7 @@ void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms)
 	sctx->status = RTW_SCTX_SUBMITTED;
 }
 
-int rtw_sctx_wait(struct submit_ctx *sctx)
+int rtw_sctx_wait(struct net_device *dev, struct submit_ctx *sctx)
 {
 	int ret = _FAIL;
 	unsigned long expire;
@@ -1992,7 +2002,7 @@ int rtw_sctx_wait(struct submit_ctx *sctx)
 	if (!wait_for_completion_timeout(&sctx->done, expire)) {
 		/* timeout, do something?? */
 		status = RTW_SCTX_DONE_TIMEOUT;
-		DBG_88E("%s timeout\n", __func__);
+		netdev_dbg(dev, "timeout\n");
 	} else {
 		status = sctx->status;
 	}
@@ -2018,11 +2028,11 @@ static bool rtw_sctx_chk_warning_status(int status)
 	}
 }
 
-void rtw_sctx_done_err(struct submit_ctx **sctx, int status)
+void rtw_sctx_done_err(struct net_device *dev, struct submit_ctx **sctx, int status)
 {
 	if (*sctx) {
 		if (rtw_sctx_chk_warning_status(status))
-			DBG_88E("%s status:%d\n", __func__, status);
+			netdev_dbg(dev, "status:%d\n", status);
 		(*sctx)->status = status;
 		complete(&((*sctx)->done));
 		*sctx = NULL;
@@ -2037,7 +2047,7 @@ int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms)
 	pack_tx_ops->timeout_ms = timeout_ms;
 	pack_tx_ops->status = RTW_SCTX_SUBMITTED;
 
-	return rtw_sctx_wait(pack_tx_ops);
+	return rtw_sctx_wait(pxmitpriv->adapter->pnetdev, pack_tx_ops);
 }
 
 void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status)
@@ -2045,7 +2055,9 @@ void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status)
 	struct submit_ctx *pack_tx_ops = &pxmitpriv->ack_tx_ops;
 
 	if (pxmitpriv->ack_tx)
-		rtw_sctx_done_err(&pack_tx_ops, status);
+		rtw_sctx_done_err(pxmitpriv->adapter->pnetdev,
+				  &pack_tx_ops,
+				  status);
 	else
-		DBG_88E("%s ack_tx not set\n", __func__);
+		netdev_dbg(pxmitpriv->adapter->pnetdev, "ack_tx not set\n");
 }
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
index d82dd22f2903..ba6c726e8724 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
@@ -387,7 +387,9 @@ static s32 rtw_dump_xframe(struct adapter *adapt, struct xmit_frame *pxmitframe)
 	rtw_free_xmitframe(pxmitpriv, pxmitframe);
 
 	if  (ret != _SUCCESS)
-		rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_UNKNOWN);
+		rtw_sctx_done_err(adapt->pnetdev,
+				  &pxmitbuf->sctx,
+				  RTW_SCTX_DONE_UNKNOWN);
 
 	return ret;
 }
diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h b/drivers/staging/rtl8188eu/include/rtw_xmit.h
index 456fd52717f3..bc5dc656d054 100644
--- a/drivers/staging/rtl8188eu/include/rtw_xmit.h
+++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h
@@ -182,8 +182,8 @@ enum {
 };
 
 void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms);
-int rtw_sctx_wait(struct submit_ctx *sctx);
-void rtw_sctx_done_err(struct submit_ctx **sctx, int status);
+int rtw_sctx_wait(struct net_device *dev, struct submit_ctx *sctx);
+void rtw_sctx_done_err(struct net_device *dev, struct submit_ctx **sctx, int status);
 
 struct xmit_buf {
 	struct list_head list;
@@ -341,7 +341,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta);
 void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *psta);
 #endif
 
-u8	qos_acm(u8 acm_mask, u8 priority);
+u8	qos_acm(struct net_device *dev, u8 acm_mask, u8 priority);
 u32	rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe);
 int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms);
 void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status);
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index 870148020e61..663286d5a7d4 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -254,7 +254,7 @@ static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
 	skb->priority = rtw_classify8021d(skb);
 
 	if (pmlmepriv->acm_mask != 0)
-		skb->priority = qos_acm(pmlmepriv->acm_mask, skb->priority);
+		skb->priority = qos_acm(dev, pmlmepriv->acm_mask, skb->priority);
 
 	return rtw_1d_to_queue[skb->priority];
 }
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index ec07b2017fb7..70dc0a074cbe 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -500,7 +500,8 @@ static void usb_write_port_complete(struct urb *purb)
 	}
 
 check_completion:
-	rtw_sctx_done_err(&pxmitbuf->sctx,
+	rtw_sctx_done_err(padapter->pnetdev,
+			  &pxmitbuf->sctx,
 			  purb->status ? RTW_SCTX_DONE_WRITE_PORT_ERR :
 			  RTW_SCTX_DONE_SUCCESS);
 
@@ -523,7 +524,9 @@ u32 usb_write_port(struct adapter *padapter, u32 addr, u32 cnt, struct xmit_buf
 
 	if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||
 	    (padapter->pwrctrlpriv.pnp_bstop_trx)) {
-		rtw_sctx_done_err(&xmitbuf->sctx, RTW_SCTX_DONE_TX_DENY);
+		rtw_sctx_done_err(padapter->pnetdev,
+				  &xmitbuf->sctx,
+				  RTW_SCTX_DONE_TX_DENY);
 		goto exit;
 	}
 
@@ -569,7 +572,9 @@ u32 usb_write_port(struct adapter *padapter, u32 addr, u32 cnt, struct xmit_buf
 
 	status = usb_submit_urb(purb, GFP_ATOMIC);
 	if (status) {
-		rtw_sctx_done_err(&xmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR);
+		rtw_sctx_done_err(padapter->pnetdev,
+				  &xmitbuf->sctx,
+				  RTW_SCTX_DONE_WRITE_PORT_ERR);
 		if (status == -ENODEV)
 			padapter->bDriverStopped = true;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] staging: rtl8188eu: remove core/rtw_debug.c
  2021-06-13 22:41 [PATCH 0/3] convert more DBG_88E calls and remove dead code Phillip Potter
  2021-06-13 22:41 ` [PATCH 1/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c Phillip Potter
  2021-06-13 22:41 ` [PATCH 2/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_xmit.c Phillip Potter
@ 2021-06-13 22:41 ` Phillip Potter
  2 siblings, 0 replies; 6+ messages in thread
From: Phillip Potter @ 2021-06-13 22:41 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, linux-staging, linux-kernel, insafonov, linux,
	straube.linux, liushixin2, gustavoars, christophe.jaillet,
	yepeilin.cs, dan.carpenter, martin, simon.fodin, romain.perier,
	apais, mh12gx2825

Remove core/rtw_debug.c and its associated definitions in
include/rtw_debug.h, as well as modifying the makefile. This file's
functions may have been intended to be hooked up in procfs, but as
they are unused, they are dead code and better to remove.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/rtl8188eu/Makefile            |   1 -
 drivers/staging/rtl8188eu/core/rtw_debug.c    | 187 ------------------
 drivers/staging/rtl8188eu/include/rtw_debug.h |  25 ---
 3 files changed, 213 deletions(-)
 delete mode 100644 drivers/staging/rtl8188eu/core/rtw_debug.c

diff --git a/drivers/staging/rtl8188eu/Makefile b/drivers/staging/rtl8188eu/Makefile
index 7da911c2ab89..28b936e8be0a 100644
--- a/drivers/staging/rtl8188eu/Makefile
+++ b/drivers/staging/rtl8188eu/Makefile
@@ -2,7 +2,6 @@
 r8188eu-y :=				\
 		core/rtw_ap.o		\
 		core/rtw_cmd.o		\
-		core/rtw_debug.o	\
 		core/rtw_efuse.o	\
 		core/rtw_ieee80211.o	\
 		core/rtw_ioctl_set.o	\
diff --git a/drivers/staging/rtl8188eu/core/rtw_debug.c b/drivers/staging/rtl8188eu/core/rtw_debug.c
deleted file mode 100644
index 1060837fe463..000000000000
--- a/drivers/staging/rtl8188eu/core/rtw_debug.c
+++ /dev/null
@@ -1,187 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- ******************************************************************************/
-#define _RTW_DEBUG_C_
-
-#include <rtw_debug.h>
-#include <usb_ops_linux.h>
-
-int proc_get_drv_version(char *page, char **start,
-			 off_t offset, int count,
-			 int *eof, void *data)
-{
-	int len = 0;
-
-	len += scnprintf(page + len, count - len, "%s\n", DRIVERVERSION);
-
-	*eof = 1;
-	return len;
-}
-
-int proc_get_write_reg(char *page, char **start,
-		       off_t offset, int count,
-		       int *eof, void *data)
-{
-	*eof = 1;
-	return 0;
-}
-
-int proc_set_write_reg(struct file *file, const char __user *buffer,
-		       unsigned long count, void *data)
-{
-	struct net_device *dev = data;
-	struct adapter *padapter = netdev_priv(dev);
-	char tmp[32];
-	u32 addr, val, len;
-
-	if (count < 3) {
-		DBG_88E("argument size is less than 3\n");
-		return -EFAULT;
-	}
-
-	if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
-		int num = sscanf(tmp, "%x %x %x", &addr, &val, &len);
-
-		if (num !=  3) {
-			DBG_88E("invalid write_reg parameter!\n");
-			return count;
-		}
-		switch (len) {
-		case 1:
-			usb_write8(padapter, addr, (u8)val);
-			break;
-		case 2:
-			usb_write16(padapter, addr, (u16)val);
-			break;
-		case 4:
-			usb_write32(padapter, addr, val);
-			break;
-		default:
-			DBG_88E("error write length =%d", len);
-			break;
-		}
-	}
-	return count;
-}
-
-static u32 proc_get_read_addr = 0xeeeeeeee;
-static u32 proc_get_read_len = 0x4;
-
-int proc_get_read_reg(char *page, char **start,
-		      off_t offset, int count,
-		      int *eof, void *data)
-{
-	struct net_device *dev = data;
-	struct adapter *padapter = netdev_priv(dev);
-
-	int len = 0;
-
-	if (proc_get_read_addr == 0xeeeeeeee) {
-		*eof = 1;
-		return len;
-	}
-
-	switch (proc_get_read_len) {
-	case 1:
-		len += scnprintf(page + len, count - len, "usb_read8(0x%x)=0x%x\n",
-				 proc_get_read_addr, usb_read8(padapter, proc_get_read_addr));
-		break;
-	case 2:
-		len += scnprintf(page + len, count - len, "usb_read16(0x%x)=0x%x\n",
-				 proc_get_read_addr, usb_read16(padapter, proc_get_read_addr));
-		break;
-	case 4:
-		len += scnprintf(page + len, count - len, "usb_read32(0x%x)=0x%x\n",
-				 proc_get_read_addr, usb_read32(padapter, proc_get_read_addr));
-		break;
-	default:
-		len += scnprintf(page + len, count - len, "error read length=%d\n",
-				 proc_get_read_len);
-		break;
-	}
-
-	*eof = 1;
-	return len;
-}
-
-int proc_set_read_reg(struct file *file, const char __user *buffer,
-		      unsigned long count, void *data)
-{
-	char tmp[16];
-	u32 addr, len;
-
-	if (count < 2) {
-		DBG_88E("argument size is less than 2\n");
-		return -EFAULT;
-	}
-
-	if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
-		int num = sscanf(tmp, "%x %x", &addr, &len);
-
-		if (num !=  2) {
-			DBG_88E("invalid read_reg parameter!\n");
-			return count;
-		}
-
-		proc_get_read_addr = addr;
-
-		proc_get_read_len = len;
-	}
-
-	return count;
-}
-
-int proc_get_adapter_state(char *page, char **start,
-			   off_t offset, int count,
-			   int *eof, void *data)
-{
-	struct net_device *dev = data;
-	struct adapter *padapter = netdev_priv(dev);
-	int len = 0;
-
-	len += scnprintf(page + len, count - len, "bSurpriseRemoved=%d, bDriverStopped=%d\n",
-			 padapter->bSurpriseRemoved,
-			 padapter->bDriverStopped);
-
-	*eof = 1;
-	return len;
-}
-
-int proc_get_best_channel(char *page, char **start,
-			  off_t offset, int count,
-			  int *eof, void *data)
-{
-	struct net_device *dev = data;
-	struct adapter *padapter = netdev_priv(dev);
-	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-	int len = 0;
-	u32 i, best_channel_24G = 1, index_24G = 0;
-
-	for (i = 0; pmlmeext->channel_set[i].ChannelNum != 0; i++) {
-		if (pmlmeext->channel_set[i].ChannelNum == 1)
-			index_24G = i;
-	}
-
-	for (i = 0; pmlmeext->channel_set[i].ChannelNum != 0; i++) {
-		/*  2.4G */
-		if (pmlmeext->channel_set[i].ChannelNum == 6) {
-			if (pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_24G].rx_count) {
-				index_24G = i;
-				best_channel_24G = pmlmeext->channel_set[i].ChannelNum;
-			}
-		}
-
-		/*  debug */
-		len += scnprintf(page + len, count - len, "The rx cnt of channel %3d = %d\n",
-				 pmlmeext->channel_set[i].ChannelNum,
-				 pmlmeext->channel_set[i].rx_count);
-	}
-
-	len += scnprintf(page + len, count - len, "best_channel_24G = %d\n", best_channel_24G);
-
-	*eof = 1;
-	return len;
-}
diff --git a/drivers/staging/rtl8188eu/include/rtw_debug.h b/drivers/staging/rtl8188eu/include/rtw_debug.h
index 7e2be1ba80fb..2fd6151bf698 100644
--- a/drivers/staging/rtl8188eu/include/rtw_debug.h
+++ b/drivers/staging/rtl8188eu/include/rtw_debug.h
@@ -85,29 +85,4 @@ extern u32 GlobalDebugLevel;
 		}							\
 	} while (0)
 
-int proc_get_drv_version(char *page, char **start,
-			 off_t offset, int count,
-			 int *eof, void *data);
-
-int proc_get_write_reg(char *page, char **start,
-		       off_t offset, int count,
-		       int *eof, void *data);
-
-int proc_set_write_reg(struct file *file, const char __user *buffer,
-		       unsigned long count, void *data);
-int proc_get_read_reg(char *page, char **start,
-		      off_t offset, int count,
-		      int *eof, void *data);
-
-int proc_set_read_reg(struct file *file, const char __user *buffer,
-		      unsigned long count, void *data);
-
-int proc_get_adapter_state(char *page, char **start,
-			   off_t offset, int count,
-			   int *eof, void *data);
-
-int proc_get_best_channel(char *page, char **start,
-			  off_t offset, int count,
-			  int *eof, void *data);
-
 #endif	/* __RTW_DEBUG_H__ */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c
  2021-06-13 22:41 ` [PATCH 1/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c Phillip Potter
@ 2021-06-14  6:50   ` Dan Carpenter
  2021-06-14 21:29     ` Phillip Potter
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2021-06-14  6:50 UTC (permalink / raw)
  To: Phillip Potter
  Cc: gregkh, Larry.Finger, linux-staging, linux-kernel, insafonov,
	linux, straube.linux, liushixin2, gustavoars, christophe.jaillet,
	yepeilin.cs, martin, simon.fodin, romain.perier, apais,
	mh12gx2825

On Sun, Jun 13, 2021 at 11:41:45PM +0100, Phillip Potter wrote:
> Convert all calls to the DBG_88E macro in core/rtw_efuse.c into
> netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
> debug messages can be controlled more precisely by just using debugfs.
> It is important to keep these messages still, as they are displayable
> via a kernel module parameter when using DBG_88E.
> 

These are not 100% dead code like the previous debug macros but I think
we are better off doing another mass delete.

> Also modify efuse_phymap_to_logical function signature to pass through
> a struct net_device pointer, so that we can use it to call netdev_dbg
> in this function too.
> 
> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> ---
>  drivers/staging/rtl8188eu/core/rtw_efuse.c | 27 ++++++++++++++--------
>  1 file changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c
> index 9bb3ec0cd62f..019796c0f1af 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
> @@ -72,7 +72,7 @@ static void efuse_power_switch(struct adapter *pAdapter, u8 write, u8 pwrstate)
>  }
>  
>  static void
> -efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
> +efuse_phymap_to_logical(struct net_device *dev, u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf)
>  {
>  	u8 *efuseTbl = NULL;
>  	u8 rtemp8;
> @@ -92,7 +92,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
>  		      sizeof(void *) + EFUSE_MAX_WORD_UNIT * sizeof(u16),
>  		      GFP_KERNEL);
>  	if (!tmp) {
> -		DBG_88E("%s: alloc eFuseWord fail!\n", __func__);
> +		netdev_dbg(dev, "alloc eFuseWord fail!\n");

This print is pointless and wrong.  It shouldn't be a debug printk it
should be an error message.  But kcalloc() already has an error message
built in and adding an additional warning here will lead to a checkpatch
complaint.

>  		goto eFuseWord_failed;
>  	}
>  	for (i = 0; i < EFUSE_MAX_SECTION_88E; i++)
> @@ -113,7 +113,9 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
>  		efuse_utilized++;
>  		eFuse_Addr++;
>  	} else {
> -		DBG_88E("EFUSE is empty efuse_Addr-%d efuse_data =%x\n", eFuse_Addr, rtemp8);
> +		netdev_dbg(dev,
> +			   "EFUSE is empty efuse_Addr-%d efuse_data =%x\n",
> +			   eFuse_Addr, rtemp8);

I don't know enough to say if this is useful or not, but I'm really
skeptical.

>  		goto exit;
>  	}
>  
> @@ -220,7 +222,7 @@ static void efuse_read_phymap_from_txpktbuf(
>  	if (bcnhead < 0) /* if not valid */
>  		bcnhead = usb_read8(adapter, REG_TDECTRL + 1);
>  
> -	DBG_88E("%s bcnhead:%d\n", __func__, bcnhead);
> +	netdev_dbg(adapter->pnetdev, "bcnhead:%d\n", bcnhead);

The only caller is efuse_ReadEFuse() and bcnhead is always zero.  All
these checks and debug code can be deleted.

>  
>  	usb_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT);
>  
> @@ -232,8 +234,10 @@ static void efuse_read_phymap_from_txpktbuf(
>  		usb_write8(adapter, REG_TXPKTBUF_DBG, 0);
>  		start = jiffies;
>  		while (!(reg_0x143 = usb_read8(adapter, REG_TXPKTBUF_DBG)) &&
> -		       jiffies_to_msecs(jiffies - start) < 1000) {
> -			DBG_88E("%s polling reg_0x143:0x%02x, reg_0x106:0x%02x\n", __func__, reg_0x143, usb_read8(adapter, 0x106));
> +			jiffies_to_msecs(jiffies - start) < 1000) {
> +			netdev_dbg(adapter->pnetdev,
> +				   "polling reg_0x143:0x%02x, reg_0x106:0x%02x\n",
> +				   reg_0x143, usb_read8(adapter, 0x106));

This is the wrong place to put debug code.  If the loop timesout it will
print a thousand messages.  See?  So far whenever we can understand the
code enough to say, then it's totally rubbish.

Just do a mass delete.  You won't ever regret it.

>  			usleep_range(1000, 2000);
>  		}
>  

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c
  2021-06-14  6:50   ` Dan Carpenter
@ 2021-06-14 21:29     ` Phillip Potter
  0 siblings, 0 replies; 6+ messages in thread
From: Phillip Potter @ 2021-06-14 21:29 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: gregkh, Larry.Finger, linux-staging, linux-kernel, insafonov,
	linux, straube.linux, liushixin2, gustavoars, christophe.jaillet,
	yepeilin.cs, martin, simon.fodin, romain.perier, apais,
	mh12gx2825

On Mon, Jun 14, 2021 at 09:50:19AM +0300, Dan Carpenter wrote:
> On Sun, Jun 13, 2021 at 11:41:45PM +0100, Phillip Potter wrote:
> > Convert all calls to the DBG_88E macro in core/rtw_efuse.c into
> > netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
> > debug messages can be controlled more precisely by just using debugfs.
> > It is important to keep these messages still, as they are displayable
> > via a kernel module parameter when using DBG_88E.
> > 
> 
> These are not 100% dead code like the previous debug macros but I think
> we are better off doing another mass delete.
> 
> > Also modify efuse_phymap_to_logical function signature to pass through
> > a struct net_device pointer, so that we can use it to call netdev_dbg
> > in this function too.
> > 
> > Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> > ---
> >  drivers/staging/rtl8188eu/core/rtw_efuse.c | 27 ++++++++++++++--------
> >  1 file changed, 17 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c
> > index 9bb3ec0cd62f..019796c0f1af 100644
> > --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
> > +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
> > @@ -72,7 +72,7 @@ static void efuse_power_switch(struct adapter *pAdapter, u8 write, u8 pwrstate)
> >  }
> >  
> >  static void
> > -efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
> > +efuse_phymap_to_logical(struct net_device *dev, u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf)
> >  {
> >  	u8 *efuseTbl = NULL;
> >  	u8 rtemp8;
> > @@ -92,7 +92,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
> >  		      sizeof(void *) + EFUSE_MAX_WORD_UNIT * sizeof(u16),
> >  		      GFP_KERNEL);
> >  	if (!tmp) {
> > -		DBG_88E("%s: alloc eFuseWord fail!\n", __func__);
> > +		netdev_dbg(dev, "alloc eFuseWord fail!\n");
> 
> This print is pointless and wrong.  It shouldn't be a debug printk it
> should be an error message.  But kcalloc() already has an error message
> built in and adding an additional warning here will lead to a checkpatch
> complaint.
> 
> >  		goto eFuseWord_failed;
> >  	}
> >  	for (i = 0; i < EFUSE_MAX_SECTION_88E; i++)
> > @@ -113,7 +113,9 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
> >  		efuse_utilized++;
> >  		eFuse_Addr++;
> >  	} else {
> > -		DBG_88E("EFUSE is empty efuse_Addr-%d efuse_data =%x\n", eFuse_Addr, rtemp8);
> > +		netdev_dbg(dev,
> > +			   "EFUSE is empty efuse_Addr-%d efuse_data =%x\n",
> > +			   eFuse_Addr, rtemp8);
> 
> I don't know enough to say if this is useful or not, but I'm really
> skeptical.
> 
> >  		goto exit;
> >  	}
> >  
> > @@ -220,7 +222,7 @@ static void efuse_read_phymap_from_txpktbuf(
> >  	if (bcnhead < 0) /* if not valid */
> >  		bcnhead = usb_read8(adapter, REG_TDECTRL + 1);
> >  
> > -	DBG_88E("%s bcnhead:%d\n", __func__, bcnhead);
> > +	netdev_dbg(adapter->pnetdev, "bcnhead:%d\n", bcnhead);
> 
> The only caller is efuse_ReadEFuse() and bcnhead is always zero.  All
> these checks and debug code can be deleted.
> 
> >  
> >  	usb_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT);
> >  
> > @@ -232,8 +234,10 @@ static void efuse_read_phymap_from_txpktbuf(
> >  		usb_write8(adapter, REG_TXPKTBUF_DBG, 0);
> >  		start = jiffies;
> >  		while (!(reg_0x143 = usb_read8(adapter, REG_TXPKTBUF_DBG)) &&
> > -		       jiffies_to_msecs(jiffies - start) < 1000) {
> > -			DBG_88E("%s polling reg_0x143:0x%02x, reg_0x106:0x%02x\n", __func__, reg_0x143, usb_read8(adapter, 0x106));
> > +			jiffies_to_msecs(jiffies - start) < 1000) {
> > +			netdev_dbg(adapter->pnetdev,
> > +				   "polling reg_0x143:0x%02x, reg_0x106:0x%02x\n",
> > +				   reg_0x143, usb_read8(adapter, 0x106));
> 
> This is the wrong place to put debug code.  If the loop timesout it will
> print a thousand messages.  See?  So far whenever we can understand the
> code enough to say, then it's totally rubbish.
> 
> Just do a mass delete.  You won't ever regret it.
> 
> >  			usleep_range(1000, 2000);
> >  		}
> >  
> 
> regards,
> dan carpenter
> 

Dear Dan,

Thank you for this, and your other feedback. Mass delete works for me, I
shall get started :-)

Regards,
Phil

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-14 21:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-13 22:41 [PATCH 0/3] convert more DBG_88E calls and remove dead code Phillip Potter
2021-06-13 22:41 ` [PATCH 1/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c Phillip Potter
2021-06-14  6:50   ` Dan Carpenter
2021-06-14 21:29     ` Phillip Potter
2021-06-13 22:41 ` [PATCH 2/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_xmit.c Phillip Potter
2021-06-13 22:41 ` [PATCH 3/3] staging: rtl8188eu: remove core/rtw_debug.c Phillip Potter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).