From nobody Tue Apr 7 11:17:21 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 45BADC433FE for ; Sat, 15 Oct 2022 15:11:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229771AbiJOPLk (ORCPT ); Sat, 15 Oct 2022 11:11:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbiJOPLg (ORCPT ); Sat, 15 Oct 2022 11:11:36 -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 5A517422E1 for ; Sat, 15 Oct 2022 08:11:35 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojip1-0006sp-Er; Sat, 15 Oct 2022 17:11:31 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser , stable@vger.kernel.org Subject: [PATCH 01/10] staging: r8188eu: fix led register settings Date: Sat, 15 Oct 2022 17:11:06 +0200 Message-Id: <20221015151115.232095-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-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" Using an InterTech DMG-02 dongle, the led remains on when the system goes into standby mode. After wakeup, it's no longer possible to control the led. It turned out that the register settings to enable or disable the led were not correct. They worked for some dongles like the Edimax V2 but not for others like the InterTech DMG-02. This patch fixes the register settings. Bit 3 in the led_cfg2 register controls the led status, bit 5 must always be set to be able to control the led, bit 6 has no influence on the led. Setting the mac_pinmux_cfg register is not necessary. These settings were tested with Edimax V2 and InterTech DMG-02. Cc: stable@vger.kernel.org Fixes: 8cd574e6af54 ("staging: r8188eu: introduce new hal dir for RTL8188eu= driver") Suggested-by: Michael Straube Signed-off-by: Martin Kaiser Tested-by: Michael Straube # InterTech DMG-02,=20 Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_led.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188= eu/core/rtw_led.c index 2527c252c3e9..5b214488571b 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -31,40 +31,19 @@ static void ResetLedStatus(struct led_priv *pLed) =20 static void SwLedOn(struct adapter *padapter, struct led_priv *pLed) { - u8 LedCfg; - int res; - if (padapter->bDriverStopped) return; =20 - res =3D rtw_read8(padapter, REG_LEDCFG2, &LedCfg); - if (res) - return; - - rtw_write8(padapter, REG_LEDCFG2, (LedCfg & 0xf0) | BIT(5) | BIT(6)); /* = SW control led0 on. */ + rtw_write8(padapter, REG_LEDCFG2, BIT(5)); /* SW control led0 on. */ pLed->bLedOn =3D true; } =20 static void SwLedOff(struct adapter *padapter, struct led_priv *pLed) { - u8 LedCfg; - int res; - if (padapter->bDriverStopped) goto exit; =20 - res =3D rtw_read8(padapter, REG_LEDCFG2, &LedCfg);/* 0x4E */ - if (res) - goto exit; - - LedCfg &=3D 0x90; /* Set to software control. */ - rtw_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3))); - res =3D rtw_read8(padapter, REG_MAC_PINMUX_CFG, &LedCfg); - if (res) - goto exit; - - LedCfg &=3D 0xFE; - rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg); + rtw_write8(padapter, REG_LEDCFG2, BIT(5) | BIT(3)); exit: pLed->bLedOn =3D false; } --=20 2.30.2 From nobody Tue Apr 7 11:17:21 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 EE4D4C4332F for ; Sat, 15 Oct 2022 15:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229794AbiJOPLp (ORCPT ); Sat, 15 Oct 2022 11:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbiJOPLi (ORCPT ); Sat, 15 Oct 2022 11:11:38 -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 B0768422DD for ; Sat, 15 Oct 2022 08:11:37 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojip2-0006sp-Fk; Sat, 15 Oct 2022 17:11:32 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 02/10] staging: r8188eu: handle rtw_write8 errors in SwLedOn Date: Sat, 15 Oct 2022 17:11:07 +0200 Message-Id: <20221015151115.232095-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-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" Check the status returned by rtw_write8. Update bLedOn only if we could update the REG_LEDCFG2 register. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_led.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188= eu/core/rtw_led.c index 5b214488571b..4f1cad890cae 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -34,7 +34,9 @@ static void SwLedOn(struct adapter *padapter, struct led_= priv *pLed) if (padapter->bDriverStopped) return; =20 - rtw_write8(padapter, REG_LEDCFG2, BIT(5)); /* SW control led0 on. */ + if (rtw_write8(padapter, REG_LEDCFG2, BIT(5)) !=3D _SUCCESS) + return; + pLed->bLedOn =3D true; } =20 --=20 2.30.2 From nobody Tue Apr 7 11:17:21 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 11E27C4332F for ; Sat, 15 Oct 2022 15:11:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbiJOPLx (ORCPT ); Sat, 15 Oct 2022 11:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbiJOPLm (ORCPT ); Sat, 15 Oct 2022 11:11:42 -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 7DA6F44CFE for ; Sat, 15 Oct 2022 08:11:38 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojip3-0006sp-Bf; Sat, 15 Oct 2022 17:11:33 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 03/10] staging: r8188eu: fix status updates in SwLedOff Date: Sat, 15 Oct 2022 17:11:08 +0200 Message-Id: <20221015151115.232095-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-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" Update bLedOn only if we could update the REG_LEDCFG2 register. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_led.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188= eu/core/rtw_led.c index 4f1cad890cae..38433296d327 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -43,10 +43,11 @@ static void SwLedOn(struct adapter *padapter, struct le= d_priv *pLed) static void SwLedOff(struct adapter *padapter, struct led_priv *pLed) { if (padapter->bDriverStopped) - goto exit; + return; + + if (rtw_write8(padapter, REG_LEDCFG2, BIT(5) | BIT(3)) !=3D _SUCCESS) + return; =20 - rtw_write8(padapter, REG_LEDCFG2, BIT(5) | BIT(3)); -exit: pLed->bLedOn =3D false; } =20 --=20 2.30.2 From nobody Tue Apr 7 11:17:21 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 449B1C4332F for ; Sat, 15 Oct 2022 15:11:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229783AbiJOPLu (ORCPT ); Sat, 15 Oct 2022 11:11:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229774AbiJOPLk (ORCPT ); Sat, 15 Oct 2022 11:11:40 -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 7DC2A45997 for ; Sat, 15 Oct 2022 08:11:38 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojip4-0006sp-CF; Sat, 15 Oct 2022 17:11:34 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 04/10] staging: r8188eu: SwLedOn needs no padapter parameter Date: Sat, 15 Oct 2022 17:11:09 +0200 Message-Id: <20221015151115.232095-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-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 padapter parameter from the SwLedOn function. padapter can be derived from the pLed parameter. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_led.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188= eu/core/rtw_led.c index 38433296d327..aa8f41edfade 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -29,8 +29,10 @@ static void ResetLedStatus(struct led_priv *pLed) pLed->bLedScanBlinkInProgress =3D false; } =20 -static void SwLedOn(struct adapter *padapter, struct led_priv *pLed) +static void SwLedOn(struct led_priv *pLed) { + struct adapter *padapter =3D container_of(pLed, struct adapter, ledpriv); + if (padapter->bDriverStopped) return; =20 @@ -67,7 +69,7 @@ static void blink_work(struct work_struct *work) if (pLed->bLedOn) SwLedOff(padapter, pLed); else - SwLedOn(padapter, pLed); + SwLedOn(pLed); =20 switch (pLed->CurrLedState) { case LED_BLINK_SLOWLY: --=20 2.30.2 From nobody Tue Apr 7 11:17:21 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 D9804C4332F for ; Sat, 15 Oct 2022 15:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbiJOPMC (ORCPT ); Sat, 15 Oct 2022 11:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbiJOPLo (ORCPT ); Sat, 15 Oct 2022 11:11:44 -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 85BB446847 for ; Sat, 15 Oct 2022 08:11:40 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojip5-0006sp-9a; Sat, 15 Oct 2022 17:11:35 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 05/10] staging: r8188eu: SwLedOff needs no padapter parameter Date: Sat, 15 Oct 2022 17:11:10 +0200 Message-Id: <20221015151115.232095-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-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 padapter parameter from the SwLedOff function. padapter can be derived from the pLed parameter. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_led.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188= eu/core/rtw_led.c index aa8f41edfade..56f043d8ff38 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -42,8 +42,10 @@ static void SwLedOn(struct led_priv *pLed) pLed->bLedOn =3D true; } =20 -static void SwLedOff(struct adapter *padapter, struct led_priv *pLed) +static void SwLedOff(struct led_priv *pLed) { + struct adapter *padapter =3D container_of(pLed, struct adapter, ledpriv); + if (padapter->bDriverStopped) return; =20 @@ -61,13 +63,13 @@ static void blink_work(struct work_struct *work) struct mlme_priv *pmlmepriv =3D &padapter->mlmepriv; =20 if (padapter->pwrctrlpriv.rf_pwrstate !=3D rf_on) { - SwLedOff(padapter, pLed); + SwLedOff(pLed); ResetLedStatus(pLed); return; } =20 if (pLed->bLedOn) - SwLedOff(padapter, pLed); + SwLedOff(pLed); else SwLedOn(pLed); =20 @@ -141,7 +143,7 @@ void rtl8188eu_DeInitSwLeds(struct adapter *padapter) =20 cancel_delayed_work_sync(&ledpriv->blink_work); ResetLedStatus(ledpriv); - SwLedOff(padapter, ledpriv); + SwLedOff(ledpriv); } =20 void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction) @@ -258,7 +260,7 @@ void rtw_led_control(struct adapter *padapter, enum LED= _CTL_MODE LedAction) pLed->bLedWPSBlinkInProgress =3D false; pLed->bLedScanBlinkInProgress =3D false; cancel_delayed_work(&pLed->blink_work); - SwLedOff(padapter, pLed); + SwLedOff(pLed); break; default: break; --=20 2.30.2 From nobody Tue Apr 7 11:17:21 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 DE10BC4332F for ; Sat, 15 Oct 2022 15:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229595AbiJOPMK (ORCPT ); Sat, 15 Oct 2022 11:12:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbiJOPLo (ORCPT ); Sat, 15 Oct 2022 11:11:44 -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 795E846DAF for ; Sat, 15 Oct 2022 08:11:41 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojip6-0006sp-4K; Sat, 15 Oct 2022 17:11:36 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 06/10] staging: r8188eu: remove two unused defines Date: Sat, 15 Oct 2022 17:11:11 +0200 Message-Id: <20221015151115.232095-7-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-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" The C2H_MEM_SZ and FREE_CMDOBJ_SZ defines are not used by the r8188eu driver. Remove them. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/include/rtw_cmd.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8= 188eu/include/rtw_cmd.h index 9a76aa85de94..20a65beed166 100644 --- a/drivers/staging/r8188eu/include/rtw_cmd.h +++ b/drivers/staging/r8188eu/include/rtw_cmd.h @@ -8,13 +8,9 @@ #include "rtw_rf.h" #include "rtw_led.h" =20 -#define C2H_MEM_SZ (16*1024) - #include "osdep_service.h" #include "ieee80211.h" /* */ =20 -#define FREE_CMDOBJ_SZ 128 - #define MAX_CMDSZ 1024 #define MAX_RSPSZ 512 #define MAX_EVTSZ 1024 --=20 2.30.2 From nobody Tue Apr 7 11:17:21 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 44560C4332F for ; Sat, 15 Oct 2022 15:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbiJOPL6 (ORCPT ); Sat, 15 Oct 2022 11:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbiJOPLo (ORCPT ); Sat, 15 Oct 2022 11:11:44 -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 A7F344684D for ; Sat, 15 Oct 2022 08:11:41 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojip7-0006sp-4g; Sat, 15 Oct 2022 17:11:37 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 07/10] staging: r8188eu: don't include rtw_led.h from rtw_cmd.h Date: Sat, 15 Oct 2022 17:11:12 +0200 Message-Id: <20221015151115.232095-8-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-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" The rtw_cmd.h does not need any definitions from the led layer, there's no reason to include rtw_led.h. When I tried to remove this component struct led_priv { struct adapter *padapter; ... I saw compiler errors because of this chain of include files: drv_types.h -> rtw_cmd.h -> rtw_led.h rtw_led.h uses struct adapter before it sees the definiton near the end of drv_types.h. (It seems that a simple struct adapter * prevents this problem.) The best option for fixing this issue is to not include rtw_led.h in rtw_cmd.h. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/include/rtw_cmd.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8= 188eu/include/rtw_cmd.h index 20a65beed166..2f4595f13e86 100644 --- a/drivers/staging/r8188eu/include/rtw_cmd.h +++ b/drivers/staging/r8188eu/include/rtw_cmd.h @@ -6,7 +6,6 @@ =20 #include "wlan_bssdef.h" #include "rtw_rf.h" -#include "rtw_led.h" =20 #include "osdep_service.h" #include "ieee80211.h" /* */ --=20 2.30.2 From nobody Tue Apr 7 11:17:21 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 879A9C4332F for ; Sat, 15 Oct 2022 15:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229832AbiJOPMS (ORCPT ); Sat, 15 Oct 2022 11:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbiJOPLo (ORCPT ); Sat, 15 Oct 2022 11:11:44 -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 796C9474E1 for ; Sat, 15 Oct 2022 08:11:42 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojip7-0006sp-So; Sat, 15 Oct 2022 17:11:37 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 08/10] staging: r8188eu: remove padapter from struct led_priv Date: Sat, 15 Oct 2022 17:11:13 +0200 Message-Id: <20221015151115.232095-9-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-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" The only struct led_priv that's used in the r8188eu driver in embedded in the driver's global struct adapter. We can use container_of to access the "outer" structure, there's no need to store a pointer to it. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_led.c | 3 +-- drivers/staging/r8188eu/include/rtw_led.h | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188= eu/core/rtw_led.c index 56f043d8ff38..2dbd7b5ffdd0 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -59,7 +59,7 @@ static void blink_work(struct work_struct *work) { struct delayed_work *dwork =3D to_delayed_work(work); struct led_priv *pLed =3D container_of(dwork, struct led_priv, blink_work= ); - struct adapter *padapter =3D pLed->padapter; + struct adapter *padapter =3D container_of(pLed, struct adapter, ledpriv); struct mlme_priv *pmlmepriv =3D &padapter->mlmepriv; =20 if (padapter->pwrctrlpriv.rf_pwrstate !=3D rf_on) { @@ -132,7 +132,6 @@ void rtl8188eu_InitSwLeds(struct adapter *padapter) { struct led_priv *pledpriv =3D &padapter->ledpriv; =20 - pledpriv->padapter =3D padapter; ResetLedStatus(pledpriv); INIT_DELAYED_WORK(&pledpriv->blink_work, blink_work); } diff --git a/drivers/staging/r8188eu/include/rtw_led.h b/drivers/staging/r8= 188eu/include/rtw_led.h index f57dcf6c8b24..ea5f5edd9013 100644 --- a/drivers/staging/r8188eu/include/rtw_led.h +++ b/drivers/staging/r8188eu/include/rtw_led.h @@ -33,8 +33,6 @@ enum LED_STATE_871x { }; =20 struct led_priv { - struct adapter *padapter; - bool bRegUseLed; =20 enum LED_STATE_871x CurrLedState; /* Current LED state. */ --=20 2.30.2 From nobody Tue Apr 7 11:17:21 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 970BAC433FE for ; Sat, 15 Oct 2022 15:12:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbiJOPMY (ORCPT ); Sat, 15 Oct 2022 11:12:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229780AbiJOPLq (ORCPT ); Sat, 15 Oct 2022 11:11:46 -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 7956443AD3 for ; Sat, 15 Oct 2022 08:11:41 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojip8-0006sp-Mt; Sat, 15 Oct 2022 17:11:38 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 09/10] staging: r8188eu: set two more state variables Date: Sat, 15 Oct 2022 17:11:14 +0200 Message-Id: <20221015151115.232095-10-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-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" Set two more state variables in the blink worker when scan blinking and tx/rx blinking are finished. bLedBlinkInProgress is true during tx/rx blinking, bLedScanBlinkInProgress is true during scan blinking. If we doing neither of the two, we may safely set both variables to false. This change makes the scan and tx/rx cases almost identical, we are now ready to summarize the two cases. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_led.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188= eu/core/rtw_led.c index 2dbd7b5ffdd0..f8bd183fba1e 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -90,6 +90,7 @@ static void blink_work(struct work_struct *work) pLed->CurrLedState =3D LED_BLINK_SLOWLY; schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL); } + pLed->bLedBlinkInProgress =3D false; pLed->bLedScanBlinkInProgress =3D false; } else { schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL); @@ -106,6 +107,7 @@ static void blink_work(struct work_struct *work) schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL); } pLed->bLedBlinkInProgress =3D false; + pLed->bLedScanBlinkInProgress =3D false; } else { schedule_delayed_work(&pLed->blink_work, LED_BLINK_FASTER_INTVL); } --=20 2.30.2 From nobody Tue Apr 7 11:17:21 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 C9D78C4332F for ; Sat, 15 Oct 2022 15:12:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229933AbiJOPMi (ORCPT ); Sat, 15 Oct 2022 11:12:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbiJOPLr (ORCPT ); Sat, 15 Oct 2022 11:11:47 -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 A625B476F2 for ; Sat, 15 Oct 2022 08:11:43 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojip9-0006sp-Iy; Sat, 15 Oct 2022 17:11:39 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 10/10] staging: r8188eu: summarize tx/rx and scan blinking Date: Sat, 15 Oct 2022 17:11:15 +0200 Message-Id: <20221015151115.232095-11-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-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 the code for tx/rx blinking and for scan blinking in blink_work. The only difference is the delay for scheduling the next worker. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_led.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188= eu/core/rtw_led.c index f8bd183fba1e..ce8de2eb7845 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -81,21 +81,6 @@ static void blink_work(struct work_struct *work) schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL); break; case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if (pLed->BlinkTimes =3D=3D 0) { - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - pLed->CurrLedState =3D LED_BLINK_NORMAL; - schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL); - } else { - pLed->CurrLedState =3D LED_BLINK_SLOWLY; - schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL); - } - pLed->bLedBlinkInProgress =3D false; - pLed->bLedScanBlinkInProgress =3D false; - } else { - schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL); - } - break; case LED_BLINK_TXRX: pLed->BlinkTimes--; if (pLed->BlinkTimes =3D=3D 0) { @@ -109,7 +94,9 @@ static void blink_work(struct work_struct *work) pLed->bLedBlinkInProgress =3D false; pLed->bLedScanBlinkInProgress =3D false; } else { - schedule_delayed_work(&pLed->blink_work, LED_BLINK_FASTER_INTVL); + schedule_delayed_work(&pLed->blink_work, + pLed->CurrLedState =3D=3D LED_BLINK_SCAN ? + LED_BLINK_SCAN_INTVL : LED_BLINK_FASTER_INTVL); } break; case LED_BLINK_WPS: --=20 2.30.2