From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: Martin Kaiser <martin@kaiser.cx>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
Phillip Potter <phil@philpotter.co.uk>,
Michael Straube <straube.linux@gmail.com>,
Pavel Skripkin <paskripkin@gmail.com>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: r8188eu: merge two led structs
Date: Sun, 26 Jun 2022 22:45:36 +0200 [thread overview]
Message-ID: <e048a607-6679-8a0d-f68c-91b4c4b42afd@gmail.com> (raw)
In-Reply-To: <20220626181000.287225-1-martin@kaiser.cx>
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@kaiser.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@gmail.com> # Edimax N150
prev parent reply other threads:[~2022-06-26 20:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-26 18:09 Martin Kaiser
2022-06-26 20:45 ` Philipp Hortmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e048a607-6679-8a0d-f68c-91b4c4b42afd@gmail.com \
--to=philipp.g.hortmann@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=martin@kaiser.cx \
--cc=paskripkin@gmail.com \
--cc=phil@philpotter.co.uk \
--cc=straube.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®