[PATCH 5/6] staging: r8188eu: remove duplicate bSurpriseRemoved check

Martin Kaiser posted 6 patches 3 years, 6 months ago
[PATCH 5/6] staging: r8188eu: remove duplicate bSurpriseRemoved check
Posted by Martin Kaiser 3 years, 6 months ago
We don't have to check bSurpriseRemoved in the SwLedOn function.

SwLedOn calls rtw_read8 which in turn calls usb_read. This function checks
bSurpriseRemoved for us.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_led.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 744247af5956..989808a2b171 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -35,7 +35,7 @@ static void SwLedOn(struct adapter *padapter, struct led_priv *pLed)
 	u8	LedCfg;
 	int res;
 
-	if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
+	if (padapter->bDriverStopped)
 		return;
 
 	res = rtw_read8(padapter, REG_LEDCFG2, &LedCfg);
-- 
2.30.2
Re: [PATCH 5/6] staging: r8188eu: remove duplicate bSurpriseRemoved check
Posted by Michael Straube 3 years, 6 months ago
On 9/18/22 19:56, Martin Kaiser wrote:
> We don't have to check bSurpriseRemoved in the SwLedOn function.
> 
> SwLedOn calls rtw_read8 which in turn calls usb_read. This function checks
> bSurpriseRemoved for us.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>   drivers/staging/r8188eu/core/rtw_led.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
> index 744247af5956..989808a2b171 100644
> --- a/drivers/staging/r8188eu/core/rtw_led.c
> +++ b/drivers/staging/r8188eu/core/rtw_led.c
> @@ -35,7 +35,7 @@ static void SwLedOn(struct adapter *padapter, struct led_priv *pLed)
>   	u8	LedCfg;
>   	int res;
>   
> -	if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
> +	if (padapter->bDriverStopped)
>   		return;
>   
>   	res = rtw_read8(padapter, REG_LEDCFG2, &LedCfg);

Hi Martin,

same could be done in SwLedOff.

regards,
Michael
Re: [PATCH 5/6] staging: r8188eu: remove duplicate bSurpriseRemoved check
Posted by Martin Kaiser 3 years, 6 months ago
Hi Michael,

Thus wrote Michael Straube (straube.linux@gmail.com):

> On 9/18/22 19:56, Martin Kaiser wrote:
> > We don't have to check bSurpriseRemoved in the SwLedOn function.

> > SwLedOn calls rtw_read8 which in turn calls usb_read. This function checks
> > bSurpriseRemoved for us.

> > Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> > ---
> >   drivers/staging/r8188eu/core/rtw_led.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)

> > diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
> > index 744247af5956..989808a2b171 100644
> > --- a/drivers/staging/r8188eu/core/rtw_led.c
> > +++ b/drivers/staging/r8188eu/core/rtw_led.c
> > @@ -35,7 +35,7 @@ static void SwLedOn(struct adapter *padapter, struct led_priv *pLed)
> >   	u8	LedCfg;
> >   	int res;
> > -	if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
> > +	if (padapter->bDriverStopped)
> >   		return;
> >   	res = rtw_read8(padapter, REG_LEDCFG2, &LedCfg);

> Hi Martin,

> same could be done in SwLedOff.

you're right. I wanted to kick off the bSurpriseRemoved cleanup with a
simple patch and wait for people's comments. I'll do SwLedOff when this
one's accepted.

Thanks,
Martin