linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] staging: r8188eu: use standard timer functions
@ 2022-04-09 16:32 Martin Kaiser
  2022-04-09 16:32 ` [PATCH 01/10] staging: r8188eu: no need for an else after return Martin Kaiser
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Make the driver-specific rtw_get_passing_time_ms function obsolete. Use
the stardard kernel functions for timeout handling.

Martin Kaiser (10):
  staging: r8188eu: no need for an else after return
  staging: r8188eu: remove unnecessary rtw_get_passing_time_ms call
  staging: r8188eu: summarize two if statements
  staging: r8188eu: improve timeout handling in
    rtl8188e_firmware_download
  staging: r8188eu: improve timeout handling in rtw_check_join_candidate
  staging: r8188eu: make LPS_RF_ON_check static
  staging: r8188eu: improve timeout handling in LPS_RF_ON_check
  staging: r8188eu: improve timeout handling in iol_execute
  staging: r8188eu: improve timeout handling in
    efuse_read_phymap_from_txpktbuf
  staging: r8188eu: remove unused timer functions

 drivers/staging/r8188eu/core/rtw_fw.c           |  6 +++---
 drivers/staging/r8188eu/core/rtw_mlme.c         |  4 +++-
 drivers/staging/r8188eu/core/rtw_mlme_ext.c     | 11 ++---------
 drivers/staging/r8188eu/core/rtw_pwrctrl.c      |  7 +++----
 drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 14 ++++++--------
 drivers/staging/r8188eu/include/osdep_service.h |  3 ---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h   |  1 -
 drivers/staging/r8188eu/os_dep/osdep_service.c  | 11 -----------
 8 files changed, 17 insertions(+), 40 deletions(-)

-- 
2.30.2


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

* [PATCH 01/10] staging: r8188eu: no need for an else after return
  2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
@ 2022-04-09 16:32 ` Martin Kaiser
  2022-04-09 16:32 ` [PATCH 02/10] staging: r8188eu: remove unnecessary rtw_get_passing_time_ms call Martin Kaiser
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The else branch at the end of send_beacon is not necessary. We return in
the if branch.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_mlme_ext.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index 474391bf7cb5..babadfc279bc 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -5767,13 +5767,11 @@ unsigned int send_beacon(struct adapter *padapter)
 
 	if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
 		return _FAIL;
-	if (!bxmitok) {
+	if (!bxmitok)
 		return _FAIL;
-	} else {
-		rtw_get_passing_time_ms(start);
 
-		return _SUCCESS;
-	}
+	rtw_get_passing_time_ms(start);
+	return _SUCCESS;
 }
 
 bool get_beacon_valid_bit(struct adapter *adapter)
-- 
2.30.2


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

* [PATCH 02/10] staging: r8188eu: remove unnecessary rtw_get_passing_time_ms call
  2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
  2022-04-09 16:32 ` [PATCH 01/10] staging: r8188eu: no need for an else after return Martin Kaiser
@ 2022-04-09 16:32 ` Martin Kaiser
  2022-04-09 16:32 ` [PATCH 03/10] staging: r8188eu: summarize two if statements Martin Kaiser
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove the rtw_get_passing_time_ms call in send_beacon.

Calling rtw_get_passing_time_ms makes no sense if we discard the result.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index babadfc279bc..d85f2182b816 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -5751,8 +5751,6 @@ unsigned int send_beacon(struct adapter *padapter)
 	int	issue = 0;
 	int poll = 0;
 
-	u32 start = jiffies;
-
 	clear_beacon_valid_bit(padapter);
 
 	do {
@@ -5770,7 +5768,6 @@ unsigned int send_beacon(struct adapter *padapter)
 	if (!bxmitok)
 		return _FAIL;
 
-	rtw_get_passing_time_ms(start);
 	return _SUCCESS;
 }
 
-- 
2.30.2


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

* [PATCH 03/10] staging: r8188eu: summarize two if statements
  2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
  2022-04-09 16:32 ` [PATCH 01/10] staging: r8188eu: no need for an else after return Martin Kaiser
  2022-04-09 16:32 ` [PATCH 02/10] staging: r8188eu: remove unnecessary rtw_get_passing_time_ms call Martin Kaiser
@ 2022-04-09 16:32 ` Martin Kaiser
  2022-04-09 16:32 ` [PATCH 04/10] staging: r8188eu: improve timeout handling in rtl8188e_firmware_download Martin Kaiser
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Summarize the two if statements at the end of send_beacon.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_mlme_ext.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index d85f2182b816..2deb92e5a00a 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -5763,9 +5763,7 @@ unsigned int send_beacon(struct adapter *padapter)
 		} while ((poll % 10) != 0 && !bxmitok && !padapter->bSurpriseRemoved && !padapter->bDriverStopped);
 	} while (!bxmitok && issue < 100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped);
 
-	if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
-		return _FAIL;
-	if (!bxmitok)
+	if (padapter->bSurpriseRemoved || padapter->bDriverStopped || !bxmitok)
 		return _FAIL;
 
 	return _SUCCESS;
-- 
2.30.2


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

* [PATCH 04/10] staging: r8188eu: improve timeout handling in rtl8188e_firmware_download
  2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
                   ` (2 preceding siblings ...)
  2022-04-09 16:32 ` [PATCH 03/10] staging: r8188eu: summarize two if statements Martin Kaiser
@ 2022-04-09 16:32 ` Martin Kaiser
  2022-04-09 16:32 ` [PATCH 05/10] staging: r8188eu: improve timeout handling in rtw_check_join_candidate Martin Kaiser
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Use the standard kernel functions to define and check the timeout in
rtl8188e_firmware_download.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_fw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188eu/core/rtw_fw.c
index 625d186c3647..7a0997b9bac5 100644
--- a/drivers/staging/r8188eu/core/rtw_fw.c
+++ b/drivers/staging/r8188eu/core/rtw_fw.c
@@ -247,7 +247,7 @@ int rtl8188e_firmware_download(struct adapter *padapter)
 {
 	int ret = _SUCCESS;
 	u8 write_fw_retry = 0;
-	u32 fwdl_start_time;
+	unsigned long fwdl_timeout;
 	struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
 	struct device *device = dvobj_to_dev(dvobj);
 	struct rt_firmware_hdr *fwhdr = NULL;
@@ -290,7 +290,7 @@ int rtl8188e_firmware_download(struct adapter *padapter)
 	}
 
 	fw_download_enable(padapter, true);
-	fwdl_start_time = jiffies;
+	fwdl_timeout = jiffies + msecs_to_jiffies(500);
 	while (1) {
 		/* reset the FWDL chksum */
 		rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWDL_CHKSUM_RPT);
@@ -298,7 +298,7 @@ int rtl8188e_firmware_download(struct adapter *padapter)
 		ret = write_fw(padapter, fw_data, fw_size);
 
 		if (ret == _SUCCESS ||
-		    (rtw_get_passing_time_ms(fwdl_start_time) > 500 && write_fw_retry++ >= 3))
+		    (time_after(jiffies, fwdl_timeout) && write_fw_retry++ >= 3))
 			break;
 	}
 	fw_download_enable(padapter, false);
-- 
2.30.2


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

* [PATCH 05/10] staging: r8188eu: improve timeout handling in rtw_check_join_candidate
  2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
                   ` (3 preceding siblings ...)
  2022-04-09 16:32 ` [PATCH 04/10] staging: r8188eu: improve timeout handling in rtl8188e_firmware_download Martin Kaiser
@ 2022-04-09 16:32 ` Martin Kaiser
  2022-04-09 16:32 ` [PATCH 06/10] staging: r8188eu: make LPS_RF_ON_check static Martin Kaiser
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Use the standard kernel functions to define and check the timeout in
rtw_check_join_candidate.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_mlme.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index c90f36dee1ea..aa39f07847c2 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -1419,6 +1419,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
 {
 	int updated = false;
 	struct adapter *adapter = container_of(pmlmepriv, struct adapter, mlmepriv);
+	unsigned long scan_res_expire;
 
 	/* check bssid, if needed */
 	if (pmlmepriv->assoc_by_bssid) {
@@ -1436,8 +1437,9 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
 	if (!rtw_is_desired_network(adapter, competitor))
 		goto exit;
 
+	scan_res_expire = competitor->last_scanned + msecs_to_jiffies(RTW_SCAN_RESULT_EXPIRE);
 	if (rtw_to_roaming(adapter) > 0) {
-		if (rtw_get_passing_time_ms((u32)competitor->last_scanned) >= RTW_SCAN_RESULT_EXPIRE ||
+		if (time_after(jiffies, scan_res_expire) ||
 		    !is_same_ess(&competitor->network, &pmlmepriv->cur_network.network))
 			goto exit;
 	}
-- 
2.30.2


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

* [PATCH 06/10] staging: r8188eu: make LPS_RF_ON_check static
  2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
                   ` (4 preceding siblings ...)
  2022-04-09 16:32 ` [PATCH 05/10] staging: r8188eu: improve timeout handling in rtw_check_join_candidate Martin Kaiser
@ 2022-04-09 16:32 ` Martin Kaiser
  2022-04-09 16:32 ` [PATCH 07/10] staging: r8188eu: improve timeout handling in LPS_RF_ON_check Martin Kaiser
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

LPS_RF_ON_check is used only in rtw_pwrctrl.c. Make it a static function.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 2 +-
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 093794414d67..ffafeb7f9c47 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -237,7 +237,7 @@ static bool lps_rf_on(struct adapter *adapter)
  *	-1:	Timeout
  *	-2:	Other error
  */
-s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
+static s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
 {
 	u32 start_time;
 	s32 err = 0;
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index a5bc2f276024..4324e41780e9 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -103,7 +103,6 @@ int ips_leave(struct adapter *padapter);
 
 void rtw_ps_processor(struct adapter *padapter);
 
-s32 LPS_RF_ON_check(struct adapter *adapter, u32 delay_ms);
 void LPS_Enter(struct adapter *adapter);
 void LPS_Leave(struct adapter *adapter);
 
-- 
2.30.2


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

* [PATCH 07/10] staging: r8188eu: improve timeout handling in LPS_RF_ON_check
  2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
                   ` (5 preceding siblings ...)
  2022-04-09 16:32 ` [PATCH 06/10] staging: r8188eu: make LPS_RF_ON_check static Martin Kaiser
@ 2022-04-09 16:32 ` Martin Kaiser
  2022-04-09 16:32 ` [PATCH 08/10] staging: r8188eu: improve timeout handling in iol_execute Martin Kaiser
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Use the standard kernel functions to define and check the timeout in
LPS_RF_ON_check.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index ffafeb7f9c47..1aebf9400f12 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -239,10 +239,9 @@ static bool lps_rf_on(struct adapter *adapter)
  */
 static s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
 {
-	u32 start_time;
+	unsigned long timeout = jiffies + msecs_to_jiffies(delay_ms);
 	s32 err = 0;
 
-	start_time = jiffies;
 	while (1) {
 		if (lps_rf_on(padapter))
 			break;
@@ -252,7 +251,7 @@ static s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
 			break;
 		}
 
-		if (rtw_get_passing_time_ms(start_time) > delay_ms) {
+		if (time_after(jiffies, timeout)) {
 			err = -1;
 			break;
 		}
-- 
2.30.2


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

* [PATCH 08/10] staging: r8188eu: improve timeout handling in iol_execute
  2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
                   ` (6 preceding siblings ...)
  2022-04-09 16:32 ` [PATCH 07/10] staging: r8188eu: improve timeout handling in LPS_RF_ON_check Martin Kaiser
@ 2022-04-09 16:32 ` Martin Kaiser
  2022-04-09 16:32 ` [PATCH 09/10] staging: r8188eu: improve timeout handling in efuse_read_phymap_from_txpktbuf Martin Kaiser
  2022-04-09 16:32 ` [PATCH 10/10] staging: r8188eu: remove unused timer functions Martin Kaiser
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Use the standard kernel functions to define and check the timeout in
iol_execute.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
index 609138887b25..efdadfb61905 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
@@ -33,17 +33,16 @@ static s32 iol_execute(struct adapter *padapter, u8 control)
 {
 	s32 status = _FAIL;
 	u8 reg_0x88 = 0;
-	u32 start = 0, passing_time = 0;
+	unsigned long timeout;
 
 	control = control & 0x0f;
 	reg_0x88 = rtw_read8(padapter, REG_HMEBOX_E0);
 	rtw_write8(padapter, REG_HMEBOX_E0,  reg_0x88 | control);
 
-	start = jiffies;
+	timeout = jiffies + msecs_to_jiffies(1000);
 	while ((reg_0x88 = rtw_read8(padapter, REG_HMEBOX_E0)) & control &&
-	       (passing_time = rtw_get_passing_time_ms(start)) < 1000) {
+		time_before(jiffies, timeout))
 		;
-	}
 
 	reg_0x88 = rtw_read8(padapter, REG_HMEBOX_E0);
 	status = (reg_0x88 & control) ? _FAIL : _SUCCESS;
-- 
2.30.2


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

* [PATCH 09/10] staging: r8188eu: improve timeout handling in efuse_read_phymap_from_txpktbuf
  2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
                   ` (7 preceding siblings ...)
  2022-04-09 16:32 ` [PATCH 08/10] staging: r8188eu: improve timeout handling in iol_execute Martin Kaiser
@ 2022-04-09 16:32 ` Martin Kaiser
  2022-04-09 16:32 ` [PATCH 10/10] staging: r8188eu: remove unused timer functions Martin Kaiser
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Use the standard kernel functions to define and check the timeout in
efuse_read_phymap_from_txpktbuf.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
index efdadfb61905..e17375a74f17 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
@@ -186,8 +186,8 @@ static void efuse_read_phymap_from_txpktbuf(
 	u16 *size	/* for efuse content: the max byte to read. will update to byte read */
 	)
 {
+	unsigned long timeout;
 	u16 dbg_addr = 0;
-	u32 start  = 0, passing_time = 0;
 	__le32 lo32 = 0, hi32 = 0;
 	u16 len = 0, count = 0;
 	int i = 0;
@@ -206,9 +206,8 @@ static void efuse_read_phymap_from_txpktbuf(
 		rtw_write16(adapter, REG_PKTBUF_DBG_ADDR, dbg_addr + i);
 
 		rtw_write8(adapter, REG_TXPKTBUF_DBG, 0);
-		start = jiffies;
-		while (!rtw_read8(adapter, REG_TXPKTBUF_DBG) &&
-		       (passing_time = rtw_get_passing_time_ms(start)) < 1000)
+		timeout = jiffies + msecs_to_jiffies(1000);
+		while (!rtw_read8(adapter, REG_TXPKTBUF_DBG) && time_before(jiffies, timeout))
 			rtw_usleep_os(100);
 
 		/* data from EEPROM needs to be in LE */
-- 
2.30.2


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

* [PATCH 10/10] staging: r8188eu: remove unused timer functions
  2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
                   ` (8 preceding siblings ...)
  2022-04-09 16:32 ` [PATCH 09/10] staging: r8188eu: improve timeout handling in efuse_read_phymap_from_txpktbuf Martin Kaiser
@ 2022-04-09 16:32 ` Martin Kaiser
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-04-09 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

rtw_get_passing_time_ms and rtw_systime_to_ms are not used any more.
Remove them.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/include/osdep_service.h |  3 ---
 drivers/staging/r8188eu/os_dep/osdep_service.c  | 11 -----------
 2 files changed, 14 deletions(-)

diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h
index 1e55a8008acc..f1a703643e74 100644
--- a/drivers/staging/r8188eu/include/osdep_service.h
+++ b/drivers/staging/r8188eu/include/osdep_service.h
@@ -77,9 +77,6 @@ void *rtw_malloc2d(int h, int w, int size);
 		spin_lock_init(&((q)->lock));			\
 	} while (0)
 
-u32  rtw_systime_to_ms(u32 systime);
-s32  rtw_get_passing_time_ms(u32 start);
-
 void rtw_usleep_os(int us);
 
 static inline unsigned char _cancel_timer_ex(struct timer_list *ptimer)
diff --git a/drivers/staging/r8188eu/os_dep/osdep_service.c b/drivers/staging/r8188eu/os_dep/osdep_service.c
index 7b177d50eee2..812acd59be79 100644
--- a/drivers/staging/r8188eu/os_dep/osdep_service.c
+++ b/drivers/staging/r8188eu/os_dep/osdep_service.c
@@ -42,17 +42,6 @@ Otherwise, there will be racing condition.
 Caller must check if the list is empty before calling rtw_list_delete
 */
 
-inline u32 rtw_systime_to_ms(u32 systime)
-{
-	return systime * 1000 / HZ;
-}
-
-/*  the input parameter start use the same unit as jiffies */
-inline s32 rtw_get_passing_time_ms(u32 start)
-{
-	return rtw_systime_to_ms(jiffies - start);
-}
-
 void rtw_usleep_os(int us)
 {
 	if (1 < (us / 1000))
-- 
2.30.2


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

end of thread, other threads:[~2022-04-09 16:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-09 16:32 [PATCH 00/10] staging: r8188eu: use standard timer functions Martin Kaiser
2022-04-09 16:32 ` [PATCH 01/10] staging: r8188eu: no need for an else after return Martin Kaiser
2022-04-09 16:32 ` [PATCH 02/10] staging: r8188eu: remove unnecessary rtw_get_passing_time_ms call Martin Kaiser
2022-04-09 16:32 ` [PATCH 03/10] staging: r8188eu: summarize two if statements Martin Kaiser
2022-04-09 16:32 ` [PATCH 04/10] staging: r8188eu: improve timeout handling in rtl8188e_firmware_download Martin Kaiser
2022-04-09 16:32 ` [PATCH 05/10] staging: r8188eu: improve timeout handling in rtw_check_join_candidate Martin Kaiser
2022-04-09 16:32 ` [PATCH 06/10] staging: r8188eu: make LPS_RF_ON_check static Martin Kaiser
2022-04-09 16:32 ` [PATCH 07/10] staging: r8188eu: improve timeout handling in LPS_RF_ON_check Martin Kaiser
2022-04-09 16:32 ` [PATCH 08/10] staging: r8188eu: improve timeout handling in iol_execute Martin Kaiser
2022-04-09 16:32 ` [PATCH 09/10] staging: r8188eu: improve timeout handling in efuse_read_phymap_from_txpktbuf Martin Kaiser
2022-04-09 16:32 ` [PATCH 10/10] staging: r8188eu: remove unused timer functions Martin Kaiser

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).