From nobody Sun Apr 19 21:57:34 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 73FA9C433EF for ; Sun, 26 Jun 2022 18:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231576AbiFZSKP (ORCPT ); Sun, 26 Jun 2022 14:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiFZSKN (ORCPT ); Sun, 26 Jun 2022 14:10:13 -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 A4D90A47F for ; Sun, 26 Jun 2022 11:10:12 -0700 (PDT) Received: from dslb-188-104-057-109.188.104.pools.vodafone-ip.de ([188.104.57.109] 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 1o5Whw-00075l-6b; Sun, 26 Jun 2022 20:10:04 +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] staging: r8188eu: merge two led structs Date: Sun, 26 Jun 2022 20:09:59 +0200 Message-Id: <20220626181000.287225-1-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 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 led layer uses struct led_priv and struct LED_871x to store state info. Merge the two structs. Move LED_871x's components into led_priv. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_led.c | 27 ++++++++++------------- drivers/staging/r8188eu/include/rtw_led.h | 9 +++----- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188= eu/core/rtw_led.c index 25989acf5259..d5c6c5e29621 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -16,7 +16,7 @@ (l)->CurrLedState =3D=3D LED_BLINK_WPS_STOP || \ (l)->bLedWPSBlinkInProgress) =20 -static void ResetLedStatus(struct LED_871x *pLed) +static void ResetLedStatus(struct led_priv *pLed) { pLed->CurrLedState =3D RTW_LED_OFF; /* Current LED state. */ pLed->bLedOn =3D false; /* true if LED is ON, false if LED is OFF. */ @@ -32,7 +32,7 @@ static void ResetLedStatus(struct LED_871x *pLed) pLed->bLedScanBlinkInProgress =3D false; } =20 -static void SwLedOn(struct adapter *padapter, struct LED_871x *pLed) +static void SwLedOn(struct adapter *padapter, struct led_priv *pLed) { u8 LedCfg; int res; @@ -48,7 +48,7 @@ static void SwLedOn(struct adapter *padapter, struct LED_= 871x *pLed) pLed->bLedOn =3D true; } =20 -static void SwLedOff(struct adapter *padapter, struct LED_871x *pLed) +static void SwLedOff(struct adapter *padapter, struct led_priv *pLed) { u8 LedCfg; int res; @@ -75,7 +75,7 @@ static void SwLedOff(struct adapter *padapter, struct LED= _871x *pLed) static void blink_work(struct work_struct *work) { struct delayed_work *dwork =3D to_delayed_work(work); - struct LED_871x *pLed =3D container_of(dwork, struct LED_871x, blink_work= ); + struct led_priv *pLed =3D container_of(dwork, struct led_priv, blink_work= ); struct adapter *padapter =3D pLed->padapter; struct mlme_priv *pmlmepriv =3D &padapter->mlmepriv; =20 @@ -182,35 +182,32 @@ static void blink_work(struct work_struct *work) void rtl8188eu_InitSwLeds(struct adapter *padapter) { struct led_priv *pledpriv =3D &padapter->ledpriv; - struct LED_871x *pLed =3D &pledpriv->SwLed0; =20 - pLed->padapter =3D padapter; - ResetLedStatus(pLed); - INIT_DELAYED_WORK(&pLed->blink_work, blink_work); + pledpriv->padapter =3D padapter; + ResetLedStatus(pledpriv); + INIT_DELAYED_WORK(&pledpriv->blink_work, blink_work); } =20 void rtl8188eu_DeInitSwLeds(struct adapter *padapter) { struct led_priv *ledpriv =3D &padapter->ledpriv; - struct LED_871x *pLed =3D &ledpriv->SwLed0; =20 - cancel_delayed_work_sync(&pLed->blink_work); - ResetLedStatus(pLed); - SwLedOff(padapter, pLed); + cancel_delayed_work_sync(&ledpriv->blink_work); + ResetLedStatus(ledpriv); + SwLedOff(padapter, ledpriv); } =20 void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction) { - struct led_priv *ledpriv =3D &padapter->ledpriv; + struct led_priv *pLed =3D &padapter->ledpriv; struct registry_priv *registry_par; - struct LED_871x *pLed =3D &ledpriv->SwLed0; struct mlme_priv *pmlmepriv =3D &padapter->mlmepriv; =20 if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped) || (!padapter->hw_init_completed)) return; =20 - if (!ledpriv->bRegUseLed) + if (!pLed->bRegUseLed) return; =20 registry_par =3D &padapter->registrypriv; diff --git a/drivers/staging/r8188eu/include/rtw_led.h b/drivers/staging/r8= 188eu/include/rtw_led.h index 2c14cb23d9ad..d6b0c1c2f9a2 100644 --- a/drivers/staging/r8188eu/include/rtw_led.h +++ b/drivers/staging/r8188eu/include/rtw_led.h @@ -37,9 +37,11 @@ enum LED_STATE_871x { LED_BLINK_RUNTOP =3D 13, /* Customized for RunTop */ }; =20 -struct LED_871x { +struct led_priv { struct adapter *padapter; =20 + bool bRegUseLed; + enum LED_STATE_871x CurrLedState; /* Current LED state. */ enum LED_STATE_871x BlinkingLedState; /* Next state for blinking, * either RTW_LED_ON or RTW_LED_OFF are. */ @@ -58,11 +60,6 @@ struct LED_871x { struct delayed_work blink_work; }; =20 -struct led_priv{ - struct LED_871x SwLed0; - bool bRegUseLed; -}; - void rtl8188eu_InitSwLeds(struct adapter *padapter); void rtl8188eu_DeInitSwLeds(struct adapter *padapter); =20 --=20 2.30.2