lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e048a607-6679-8a0d-f68c-91b4c4b42afd@gmail.com>
Date:   Sun, 26 Jun 2022 22:45:36 +0200
From:   Philipp Hortmann <philipp.g.hortmann@...il.com>
To:     Martin Kaiser <martin@...ser.cx>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Larry Finger <Larry.Finger@...inger.net>,
        Phillip Potter <phil@...lpotter.co.uk>,
        Michael Straube <straube.linux@...il.com>,
        Pavel Skripkin <paskripkin@...il.com>,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: r8188eu: merge two led structs

On 6/26/22 20:09, Martin Kaiser wrote:
> 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 <martin@...ser.cx>
> ---
>   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/r8188eu/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 == LED_BLINK_WPS_STOP || \
>   	(l)->bLedWPSBlinkInProgress)
>   
> -static void ResetLedStatus(struct LED_871x *pLed)
> +static void ResetLedStatus(struct led_priv *pLed)
>   {
>   	pLed->CurrLedState = RTW_LED_OFF; /*  Current LED state. */
>   	pLed->bLedOn = false; /*  true if LED is ON, false if LED is OFF. */
> @@ -32,7 +32,7 @@ static void ResetLedStatus(struct LED_871x *pLed)
>   	pLed->bLedScanBlinkInProgress = false;
>   }
>   
> -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 = true;
>   }
>   
> -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 = to_delayed_work(work);
> -	struct LED_871x *pLed = container_of(dwork, struct LED_871x, blink_work);
> +	struct led_priv *pLed = container_of(dwork, struct led_priv, blink_work);
>   	struct adapter *padapter = pLed->padapter;
>   	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>   
> @@ -182,35 +182,32 @@ static void blink_work(struct work_struct *work)
>   void rtl8188eu_InitSwLeds(struct adapter *padapter)
>   {
>   	struct led_priv *pledpriv = &padapter->ledpriv;
> -	struct LED_871x *pLed = &pledpriv->SwLed0;
>   
> -	pLed->padapter = padapter;
> -	ResetLedStatus(pLed);
> -	INIT_DELAYED_WORK(&pLed->blink_work, blink_work);
> +	pledpriv->padapter = padapter;
> +	ResetLedStatus(pledpriv);
> +	INIT_DELAYED_WORK(&pledpriv->blink_work, blink_work);
>   }
>   
>   void rtl8188eu_DeInitSwLeds(struct adapter *padapter)
>   {
>   	struct led_priv	*ledpriv = &padapter->ledpriv;
> -	struct LED_871x *pLed = &ledpriv->SwLed0;
>   
> -	cancel_delayed_work_sync(&pLed->blink_work);
> -	ResetLedStatus(pLed);
> -	SwLedOff(padapter, pLed);
> +	cancel_delayed_work_sync(&ledpriv->blink_work);
> +	ResetLedStatus(ledpriv);
> +	SwLedOff(padapter, ledpriv);
>   }
>   
>   void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
>   {
> -	struct led_priv *ledpriv = &padapter->ledpriv;
> +	struct led_priv *pLed = &padapter->ledpriv;
>   	struct registry_priv *registry_par;
> -	struct LED_871x *pLed = &ledpriv->SwLed0;
>   	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>   
>   	if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped) ||
>   	    (!padapter->hw_init_completed))
>   		return;
>   
> -	if (!ledpriv->bRegUseLed)
> +	if (!pLed->bRegUseLed)
>   		return;
>   
>   	registry_par = &padapter->registrypriv;
> diff --git a/drivers/staging/r8188eu/include/rtw_led.h b/drivers/staging/r8188eu/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 = 13, /*  Customized for RunTop */
>   };
>   
> -struct LED_871x {
> +struct led_priv {
>   	struct adapter *padapter;
>   
> +	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;
>   };
>   
> -struct led_priv{
> -	struct LED_871x			SwLed0;
> -	bool	bRegUseLed;
> -};
> -
>   void rtl8188eu_InitSwLeds(struct adapter *padapter);
>   void rtl8188eu_DeInitSwLeds(struct adapter *padapter);
>   

Tested-by: Philipp Hortmann <philipp.g.hortmann@...il.com> # Edimax N150

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ