From nobody Mon May 11 08:31:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4AE9C433EF for ; Sat, 9 Apr 2022 15:16:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242457AbiDIPSa (ORCPT ); Sat, 9 Apr 2022 11:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242431AbiDIPSR (ORCPT ); Sat, 9 Apr 2022 11:18:17 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEE721CFC8 for ; Sat, 9 Apr 2022 08:16:07 -0700 (PDT) Received: from ipservice-092-217-091-111.092.217.pools.vodafone-ip.de ([92.217.91.111] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ndCom-0005k2-H9; Sat, 09 Apr 2022 17:16:04 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 1/8] staging: r8188eu: simplify delay conditions in rtw_pwr_wakeup Date: Sat, 9 Apr 2022 17:15:50 +0200 Message-Id: <20220409151557.207980-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220409151557.207980-1-martin@kaiser.cx> References: <20220409151557.207980-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Simplify the conditions for a loop in rtw_pwr_wakeup that waits while the system is suspended. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r= 8188eu/core/rtw_pwrctrl.c index efdc7de49d49..7c1e79808087 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -378,12 +378,8 @@ int rtw_pwr_wakeup(struct adapter *padapter) } =20 /* System suspend is not allowed to wakeup */ - if (pwrpriv->bInSuspend) { - while (pwrpriv->bInSuspend && - (rtw_get_passing_time_ms(start) <=3D 3000 || - (rtw_get_passing_time_ms(start) <=3D 500))) - msleep(10); - } + while (pwrpriv->bInSuspend && rtw_get_passing_time_ms(start) <=3D 3000) + msleep(10); =20 /* I think this should be check in IPS, LPS, autosuspend functions... */ if (check_fwstate(pmlmepriv, _FW_LINKED)) { --=20 2.30.2 From nobody Mon May 11 08:31:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39A49C433F5 for ; Sat, 9 Apr 2022 15:16:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242436AbiDIPSU (ORCPT ); Sat, 9 Apr 2022 11:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242428AbiDIPSR (ORCPT ); Sat, 9 Apr 2022 11:18:17 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85D92655F for ; Sat, 9 Apr 2022 08:16:09 -0700 (PDT) Received: from ipservice-092-217-091-111.092.217.pools.vodafone-ip.de ([92.217.91.111] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ndCon-0005k2-9r; Sat, 09 Apr 2022 17:16:05 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 2/8] staging: r8188eu: don't set _SUCCESS again Date: Sat, 9 Apr 2022 17:15:51 +0200 Message-Id: <20220409151557.207980-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220409151557.207980-1-martin@kaiser.cx> References: <20220409151557.207980-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" ret is initialized to _SUCCESS, there's no need to set it again. Signed-off-by: Martin Kaiser --- 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/r= 8188eu/core/rtw_pwrctrl.c index 7c1e79808087..c43759500ef9 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -382,10 +382,9 @@ int rtw_pwr_wakeup(struct adapter *padapter) msleep(10); =20 /* I think this should be check in IPS, LPS, autosuspend functions... */ - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - ret =3D _SUCCESS; + if (check_fwstate(pmlmepriv, _FW_LINKED)) goto exit; - } + if (rf_off =3D=3D pwrpriv->rf_pwrstate) { if (_FAIL =3D=3D ips_leave(padapter)) { ret =3D _FAIL; --=20 2.30.2 From nobody Mon May 11 08:31:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1513AC433F5 for ; Sat, 9 Apr 2022 15:16:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242450AbiDIPSd (ORCPT ); Sat, 9 Apr 2022 11:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242432AbiDIPSR (ORCPT ); Sat, 9 Apr 2022 11:18:17 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 154F4186FC for ; Sat, 9 Apr 2022 08:16:09 -0700 (PDT) Received: from ipservice-092-217-091-111.092.217.pools.vodafone-ip.de ([92.217.91.111] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ndCoo-0005k2-1o; Sat, 09 Apr 2022 17:16:06 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 3/8] staging: r8188eu: make return values consistent Date: Sat, 9 Apr 2022 17:15:52 +0200 Message-Id: <20220409151557.207980-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220409151557.207980-1-martin@kaiser.cx> References: <20220409151557.207980-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" rtw_pwr_wakeup should return _SUCCESS or _FAIL. Replace false with _FAIL in one place and reformat the if-statement. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r= 8188eu/core/rtw_pwrctrl.c index c43759500ef9..a7471468e2e2 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -392,10 +392,8 @@ int rtw_pwr_wakeup(struct adapter *padapter) } } =20 - /* TODO: the following checking need to be merged... */ - if (padapter->bDriverStopped || !padapter->bup || - !padapter->hw_init_completed) { - ret =3D false; + if (padapter->bDriverStopped || !padapter->bup || !padapter->hw_init_comp= leted) { + ret =3D _FAIL; goto exit; } =20 --=20 2.30.2 From nobody Mon May 11 08:31:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED96DC433F5 for ; Sat, 9 Apr 2022 15:17:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242397AbiDIPTG (ORCPT ); Sat, 9 Apr 2022 11:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242448AbiDIPSW (ORCPT ); Sat, 9 Apr 2022 11:18:22 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A046B186FC for ; Sat, 9 Apr 2022 08:16:15 -0700 (PDT) Received: from ipservice-092-217-091-111.092.217.pools.vodafone-ip.de ([92.217.91.111] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ndCoo-0005k2-On; Sat, 09 Apr 2022 17:16:06 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 4/8] staging: r8188eu: simplify the ps_processing check Date: Sat, 9 Apr 2022 17:15:53 +0200 Message-Id: <20220409151557.207980-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220409151557.207980-1-martin@kaiser.cx> References: <20220409151557.207980-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" It's sufficient to check pwrpriv->ps_processing as part of the while-loop. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r= 8188eu/core/rtw_pwrctrl.c index a7471468e2e2..49b2b4dd9faa 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -372,10 +372,8 @@ int rtw_pwr_wakeup(struct adapter *padapter) if (pwrpriv->ips_deny_time < jiffies + rtw_ms_to_systime(ips_deffer_ms)) pwrpriv->ips_deny_time =3D jiffies + rtw_ms_to_systime(ips_deffer_ms); =20 - if (pwrpriv->ps_processing) { - while (pwrpriv->ps_processing && rtw_get_passing_time_ms(start) <=3D 300= 0) - msleep(10); - } + while (pwrpriv->ps_processing && rtw_get_passing_time_ms(start) <=3D 3000) + msleep(10); =20 /* System suspend is not allowed to wakeup */ while (pwrpriv->bInSuspend && rtw_get_passing_time_ms(start) <=3D 3000) --=20 2.30.2 From nobody Mon May 11 08:31:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEA99C433EF for ; Sat, 9 Apr 2022 15:16:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242477AbiDIPSh (ORCPT ); Sat, 9 Apr 2022 11:18:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242426AbiDIPSS (ORCPT ); Sat, 9 Apr 2022 11:18:18 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C406BFB for ; Sat, 9 Apr 2022 08:16:11 -0700 (PDT) Received: from ipservice-092-217-091-111.092.217.pools.vodafone-ip.de ([92.217.91.111] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ndCop-0005k2-FR; Sat, 09 Apr 2022 17:16:07 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 5/8] staging: r8188eu: summarize two if statements Date: Sat, 9 Apr 2022 17:15:54 +0200 Message-Id: <20220409151557.207980-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220409151557.207980-1-martin@kaiser.cx> References: <20220409151557.207980-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Summarize two if statements in rtw_pwr_wakeup and place the constants on the right side of the comparison. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r= 8188eu/core/rtw_pwrctrl.c index 49b2b4dd9faa..fa47dd24806b 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -383,11 +383,9 @@ int rtw_pwr_wakeup(struct adapter *padapter) if (check_fwstate(pmlmepriv, _FW_LINKED)) goto exit; =20 - if (rf_off =3D=3D pwrpriv->rf_pwrstate) { - if (_FAIL =3D=3D ips_leave(padapter)) { - ret =3D _FAIL; - goto exit; - } + if (pwrpriv->rf_pwrstate =3D=3D rf_off && ips_leave(padapter) =3D=3D _FAI= L) { + ret =3D _FAIL; + goto exit; } =20 if (padapter->bDriverStopped || !padapter->bup || !padapter->hw_init_comp= leted) { --=20 2.30.2 From nobody Mon May 11 08:31:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70449C433F5 for ; Sat, 9 Apr 2022 15:16:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242467AbiDIPSk (ORCPT ); Sat, 9 Apr 2022 11:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242434AbiDIPST (ORCPT ); Sat, 9 Apr 2022 11:18:19 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6329F14012 for ; Sat, 9 Apr 2022 08:16:11 -0700 (PDT) Received: from ipservice-092-217-091-111.092.217.pools.vodafone-ip.de ([92.217.91.111] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ndCoq-0005k2-5u; Sat, 09 Apr 2022 17:16:08 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 6/8] staging: r8188eu: use kernel functions for timeout handling Date: Sat, 9 Apr 2022 17:15:55 +0200 Message-Id: <20220409151557.207980-7-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220409151557.207980-1-martin@kaiser.cx> References: <20220409151557.207980-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the kernel functions to set a timeout and to check if it's expired. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r= 8188eu/core/rtw_pwrctrl.c index fa47dd24806b..1156a46b5de6 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -362,8 +362,8 @@ int rtw_pwr_wakeup(struct adapter *padapter) { struct pwrctrl_priv *pwrpriv =3D &padapter->pwrctrlpriv; struct mlme_priv *pmlmepriv =3D &padapter->mlmepriv; + unsigned long timeout =3D jiffies + msecs_to_jiffies(3000); int ret =3D _SUCCESS; - u32 start =3D jiffies; u32 ips_deffer_ms; =20 /* the ms will prevent from falling into IPS after wakeup */ @@ -372,11 +372,11 @@ int rtw_pwr_wakeup(struct adapter *padapter) if (pwrpriv->ips_deny_time < jiffies + rtw_ms_to_systime(ips_deffer_ms)) pwrpriv->ips_deny_time =3D jiffies + rtw_ms_to_systime(ips_deffer_ms); =20 - while (pwrpriv->ps_processing && rtw_get_passing_time_ms(start) <=3D 3000) + while (pwrpriv->ps_processing && time_before(jiffies, timeout)) msleep(10); =20 /* System suspend is not allowed to wakeup */ - while (pwrpriv->bInSuspend && rtw_get_passing_time_ms(start) <=3D 3000) + while (pwrpriv->bInSuspend && time_before(jiffies, timeout)) msleep(10); =20 /* I think this should be check in IPS, LPS, autosuspend functions... */ --=20 2.30.2 From nobody Mon May 11 08:31:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D57C1C433EF for ; Sat, 9 Apr 2022 15:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232427AbiDIPSt (ORCPT ); Sat, 9 Apr 2022 11:18:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242424AbiDIPSU (ORCPT ); Sat, 9 Apr 2022 11:18:20 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA9B91AF11 for ; Sat, 9 Apr 2022 08:16:12 -0700 (PDT) Received: from ipservice-092-217-091-111.092.217.pools.vodafone-ip.de ([92.217.91.111] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ndCoq-0005k2-Vy; Sat, 09 Apr 2022 17:16:09 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 7/8] staging: r8188eu: clean up the code to set ips_deny_time Date: Sat, 9 Apr 2022 17:15:56 +0200 Message-Id: <20220409151557.207980-8-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220409151557.207980-1-martin@kaiser.cx> References: <20220409151557.207980-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Clean up the code in rtw_pwr_wakeup that sets pwrpriv->ips_deny_time. Make ips_deny_time an unsigned long, this type is used by the kernel functions that process jiffies. Remove the temporary variable ips_deffer_ms and use RTW_PWR_STATE_CHK_INTERVAL directly. There's no need to set ips_deny_time twice, it's sufficient to set it at the end of rtw_pwr_wakeup. Use time_before to check if ips_deny_time should be updated. We can now remove rtw_ms_to_systime, this function is not used any more. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 13 ++++--------- drivers/staging/r8188eu/include/osdep_service.h | 1 - drivers/staging/r8188eu/include/rtw_pwrctrl.h | 2 +- drivers/staging/r8188eu/os_dep/osdep_service.c | 5 ----- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r= 8188eu/core/rtw_pwrctrl.c index 1156a46b5de6..717a9bb26c19 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -363,14 +363,8 @@ int rtw_pwr_wakeup(struct adapter *padapter) struct pwrctrl_priv *pwrpriv =3D &padapter->pwrctrlpriv; struct mlme_priv *pmlmepriv =3D &padapter->mlmepriv; unsigned long timeout =3D jiffies + msecs_to_jiffies(3000); + unsigned long deny_time; int ret =3D _SUCCESS; - u32 ips_deffer_ms; - - /* the ms will prevent from falling into IPS after wakeup */ - ips_deffer_ms =3D RTW_PWR_STATE_CHK_INTERVAL; - - if (pwrpriv->ips_deny_time < jiffies + rtw_ms_to_systime(ips_deffer_ms)) - pwrpriv->ips_deny_time =3D jiffies + rtw_ms_to_systime(ips_deffer_ms); =20 while (pwrpriv->ps_processing && time_before(jiffies, timeout)) msleep(10); @@ -394,8 +388,9 @@ int rtw_pwr_wakeup(struct adapter *padapter) } =20 exit: - if (pwrpriv->ips_deny_time < jiffies + rtw_ms_to_systime(ips_deffer_ms)) - pwrpriv->ips_deny_time =3D jiffies + rtw_ms_to_systime(ips_deffer_ms); + deny_time =3D jiffies + msecs_to_jiffies(RTW_PWR_STATE_CHK_INTERVAL); + if (time_before(pwrpriv->ips_deny_time, deny_time)) + pwrpriv->ips_deny_time =3D deny_time; return ret; } =20 diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/stag= ing/r8188eu/include/osdep_service.h index f1f3e3ba5377..1e55a8008acc 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -78,7 +78,6 @@ void *rtw_malloc2d(int h, int w, int size); } while (0) =20 u32 rtw_systime_to_ms(u32 systime); -u32 rtw_ms_to_systime(u32 ms); s32 rtw_get_passing_time_ms(u32 start); =20 void rtw_usleep_os(int us); diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/stagin= g/r8188eu/include/rtw_pwrctrl.h index 1d7dba853c40..a5bc2f276024 100644 --- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h @@ -56,7 +56,7 @@ struct pwrctrl_priv { u8 ips_mode_req; /* used to accept the mode setting request, * will update to ipsmode later */ uint bips_processing; - u32 ips_deny_time; /* will deny IPS when system time less than this */ + unsigned long ips_deny_time; /* will deny IPS when system time less than = this */ u8 ps_processing; /* temp used to mark whether in rtw_ps_processor */ =20 u8 bLeisurePs; diff --git a/drivers/staging/r8188eu/os_dep/osdep_service.c b/drivers/stagi= ng/r8188eu/os_dep/osdep_service.c index 6824a6ab2e36..7b177d50eee2 100644 --- a/drivers/staging/r8188eu/os_dep/osdep_service.c +++ b/drivers/staging/r8188eu/os_dep/osdep_service.c @@ -47,11 +47,6 @@ inline u32 rtw_systime_to_ms(u32 systime) return systime * 1000 / HZ; } =20 -inline u32 rtw_ms_to_systime(u32 ms) -{ - return ms * HZ / 1000; -} - /* the input parameter start use the same unit as jiffies */ inline s32 rtw_get_passing_time_ms(u32 start) { --=20 2.30.2 From nobody Mon May 11 08:31:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C284C433F5 for ; Sat, 9 Apr 2022 15:16:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242429AbiDIPTB (ORCPT ); Sat, 9 Apr 2022 11:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242433AbiDIPSU (ORCPT ); Sat, 9 Apr 2022 11:18:20 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89ADC167FC for ; Sat, 9 Apr 2022 08:16:13 -0700 (PDT) Received: from ipservice-092-217-091-111.092.217.pools.vodafone-ip.de ([92.217.91.111] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ndCor-0005k2-Pm; Sat, 09 Apr 2022 17:16:09 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 8/8] staging: r8188eu: remove the bInSuspend loop Date: Sat, 9 Apr 2022 17:15:57 +0200 Message-Id: <20220409151557.207980-9-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220409151557.207980-1-martin@kaiser.cx> References: <20220409151557.207980-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Remove the loop in rtw_pwr_wakeup that waits while the system is suspended. pwrpriv->bInSuspend is set in rtw_suspend and cleared in rtw_resume. These functions are the .suspend and .resume functions of the struct usb_driver for r8188eu. A usb_driver's suspend and resume functions are called when the entire system goes into suspend or runtime suspend. All of the code paths for rtw_pwr_wakeup start at ioctl handlers. We can remove the loop that checks bInSuspend. It's not possible to call an ioctl while the entire system is suspended. Signed-off-by: Martin Kaiser --- I tried to track down who calls suspend and resume of an usb_driver. My understanding is that all of these calls come from the pm layer and that the suspend and resume affects the whole system, not just the usb device. drivers/staging/r8188eu/core/rtw_pwrctrl.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r= 8188eu/core/rtw_pwrctrl.c index 717a9bb26c19..093794414d67 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -369,10 +369,6 @@ int rtw_pwr_wakeup(struct adapter *padapter) while (pwrpriv->ps_processing && time_before(jiffies, timeout)) msleep(10); =20 - /* System suspend is not allowed to wakeup */ - while (pwrpriv->bInSuspend && time_before(jiffies, timeout)) - msleep(10); - /* I think this should be check in IPS, LPS, autosuspend functions... */ if (check_fwstate(pmlmepriv, _FW_LINKED)) goto exit; --=20 2.30.2