linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: r8188eu: remove unused led1
@ 2021-12-07 21:05 Martin Kaiser
  2021-12-07 21:05 ` [PATCH 1/3] staging: r8188eu: remove SwLed1 Martin Kaiser
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Martin Kaiser @ 2021-12-07 21:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The r8188eu driver uses only led0. Remove code for led1.

Martin Kaiser (3):
  staging: r8188eu: remove SwLed1
  staging: r8188eu: remove code to set led1 registers
  staging: r8188eu: remove LedPin from struct struct LED_871x

 drivers/staging/r8188eu/core/rtw_led.c      |  3 +-
 drivers/staging/r8188eu/hal/rtl8188eu_led.c | 42 ++++-----------------
 drivers/staging/r8188eu/include/rtw_led.h   | 12 +-----
 3 files changed, 10 insertions(+), 47 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] staging: r8188eu: remove SwLed1
  2021-12-07 21:05 [PATCH 0/3] staging: r8188eu: remove unused led1 Martin Kaiser
@ 2021-12-07 21:05 ` Martin Kaiser
  2021-12-07 21:05 ` [PATCH 2/3] staging: r8188eu: remove code to set led1 registers Martin Kaiser
  2021-12-07 21:05 ` [PATCH 3/3] staging: r8188eu: remove LedPin from struct struct LED_871x Martin Kaiser
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Kaiser @ 2021-12-07 21:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The r8188eu driver does not use SwLed1. Calls from other layers to modify
the led state end up in SwLedControlMode1, where SwLed0 is hard-coded.

This patch removes the code to initialise and deinitialise SwLed1 and
the SwLed1 struct itself.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/rtl8188eu_led.c | 3 ---
 drivers/staging/r8188eu/include/rtw_led.h   | 1 -
 2 files changed, 4 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_led.c b/drivers/staging/r8188eu/hal/rtl8188eu_led.c
index 2dd9b4518f13..0d2d658af5bb 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_led.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_led.c
@@ -73,8 +73,6 @@ void rtl8188eu_InitSwLeds(struct adapter *padapter)
 	pledpriv->LedControlHandler = LedControl8188eu;
 
 	InitLed871x(padapter, &pledpriv->SwLed0, LED_PIN_LED0);
-
-	InitLed871x(padapter, &pledpriv->SwLed1, LED_PIN_LED1);
 }
 
 /*	Description: */
@@ -84,5 +82,4 @@ void rtl8188eu_DeInitSwLeds(struct adapter *padapter)
 	struct led_priv	*ledpriv = &padapter->ledpriv;
 
 	DeInitLed871x(&ledpriv->SwLed0);
-	DeInitLed871x(&ledpriv->SwLed1);
 }
diff --git a/drivers/staging/r8188eu/include/rtw_led.h b/drivers/staging/r8188eu/include/rtw_led.h
index f0272a7e8aa7..87c41ac6f701 100644
--- a/drivers/staging/r8188eu/include/rtw_led.h
+++ b/drivers/staging/r8188eu/include/rtw_led.h
@@ -95,7 +95,6 @@ void LedControl8188eu(struct adapter *padapter, enum LED_CTL_MODE	LedAction);
 struct led_priv{
 	/* add for led control */
 	struct LED_871x			SwLed0;
-	struct LED_871x			SwLed1;
 	u8	bRegUseLed;
 	void (*LedControlHandler)(struct adapter *padapter,
 				  enum LED_CTL_MODE LedAction);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] staging: r8188eu: remove code to set led1 registers
  2021-12-07 21:05 [PATCH 0/3] staging: r8188eu: remove unused led1 Martin Kaiser
  2021-12-07 21:05 ` [PATCH 1/3] staging: r8188eu: remove SwLed1 Martin Kaiser
@ 2021-12-07 21:05 ` Martin Kaiser
  2021-12-07 21:05 ` [PATCH 3/3] staging: r8188eu: remove LedPin from struct struct LED_871x Martin Kaiser
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Kaiser @ 2021-12-07 21:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

This driver uses only led0. Remove the register settings to switch led1
on and off.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/rtl8188eu_led.c | 32 +++++----------------
 drivers/staging/r8188eu/include/rtw_led.h   |  1 -
 2 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_led.c b/drivers/staging/r8188eu/hal/rtl8188eu_led.c
index 0d2d658af5bb..dd692d6a3ab7 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_led.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_led.c
@@ -17,17 +17,9 @@ void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
 
 	if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
 		return;
+
 	LedCfg = rtw_read8(padapter, REG_LEDCFG2);
-	switch (pLed->LedPin) {
-	case LED_PIN_LED0:
-		rtw_write8(padapter, REG_LEDCFG2, (LedCfg & 0xf0) | BIT(5) | BIT(6)); /*  SW control led0 on. */
-		break;
-	case LED_PIN_LED1:
-		rtw_write8(padapter, REG_LEDCFG2, (LedCfg & 0x0f) | BIT(5)); /*  SW control led1 on. */
-		break;
-	default:
-		break;
-	}
+	rtw_write8(padapter, REG_LEDCFG2, (LedCfg & 0xf0) | BIT(5) | BIT(6)); /*  SW control led0 on. */
 	pLed->bLedOn = true;
 }
 
@@ -42,21 +34,11 @@ void SwLedOff(struct adapter *padapter, struct LED_871x *pLed)
 
 	LedCfg = rtw_read8(padapter, REG_LEDCFG2);/* 0x4E */
 
-	switch (pLed->LedPin) {
-	case LED_PIN_LED0:
-		LedCfg &= 0x90; /*  Set to software control. */
-		rtw_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3)));
-		LedCfg = rtw_read8(padapter, REG_MAC_PINMUX_CFG);
-		LedCfg &= 0xFE;
-		rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
-		break;
-	case LED_PIN_LED1:
-		LedCfg &= 0x0f; /*  Set to software control. */
-		rtw_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3)));
-		break;
-	default:
-		break;
-	}
+	LedCfg &= 0x90; /*  Set to software control. */
+	rtw_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3)));
+	LedCfg = rtw_read8(padapter, REG_MAC_PINMUX_CFG);
+	LedCfg &= 0xFE;
+	rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
 exit:
 	pLed->bLedOn = false;
 }
diff --git a/drivers/staging/r8188eu/include/rtw_led.h b/drivers/staging/r8188eu/include/rtw_led.h
index 87c41ac6f701..ff182878e371 100644
--- a/drivers/staging/r8188eu/include/rtw_led.h
+++ b/drivers/staging/r8188eu/include/rtw_led.h
@@ -53,7 +53,6 @@ enum LED_STATE_871x {
 
 enum LED_PIN_871x {
 	LED_PIN_LED0 = 1,
-	LED_PIN_LED1 = 2,
 };
 
 struct LED_871x {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] staging: r8188eu: remove LedPin from struct struct LED_871x
  2021-12-07 21:05 [PATCH 0/3] staging: r8188eu: remove unused led1 Martin Kaiser
  2021-12-07 21:05 ` [PATCH 1/3] staging: r8188eu: remove SwLed1 Martin Kaiser
  2021-12-07 21:05 ` [PATCH 2/3] staging: r8188eu: remove code to set led1 registers Martin Kaiser
@ 2021-12-07 21:05 ` Martin Kaiser
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Kaiser @ 2021-12-07 21:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

We only support a single LED. LedPin in struct struct LED_871x is
always LED_PIN_LED0. There's no need to store this info or to pass it
to functions as a parameter.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_led.c      |  3 +--
 drivers/staging/r8188eu/hal/rtl8188eu_led.c |  7 +------
 drivers/staging/r8188eu/include/rtw_led.h   | 10 +---------
 3 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 1eda366c61aa..e1be1ba189cb 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -28,10 +28,9 @@ void ResetLedStatus(struct LED_871x *pLed)
 	pLed->bLedScanBlinkInProgress = false;
 }
 
-void InitLed871x(struct adapter *padapter, struct LED_871x *pLed, enum LED_PIN_871x LedPin)
+void InitLed871x(struct adapter *padapter, struct LED_871x *pLed)
 {
 	pLed->padapter = padapter;
-	pLed->LedPin = LedPin;
 
 	ResetLedStatus(pLed);
 
diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_led.c b/drivers/staging/r8188eu/hal/rtl8188eu_led.c
index dd692d6a3ab7..6fd1d1d476c7 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_led.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_led.c
@@ -8,9 +8,6 @@
 
 /*  LED object. */
 
-/*  LED_819xUsb routines. */
-/*	Description: */
-/*		Turn on LED according to LedPin specified. */
 void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
 {
 	u8	LedCfg;
@@ -23,8 +20,6 @@ void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
 	pLed->bLedOn = true;
 }
 
-/*	Description: */
-/*		Turn off LED according to LedPin specified. */
 void SwLedOff(struct adapter *padapter, struct LED_871x *pLed)
 {
 	u8	LedCfg;
@@ -54,7 +49,7 @@ void rtl8188eu_InitSwLeds(struct adapter *padapter)
 
 	pledpriv->LedControlHandler = LedControl8188eu;
 
-	InitLed871x(padapter, &pledpriv->SwLed0, LED_PIN_LED0);
+	InitLed871x(padapter, &pledpriv->SwLed0);
 }
 
 /*	Description: */
diff --git a/drivers/staging/r8188eu/include/rtw_led.h b/drivers/staging/r8188eu/include/rtw_led.h
index ff182878e371..e9b6d7768c2d 100644
--- a/drivers/staging/r8188eu/include/rtw_led.h
+++ b/drivers/staging/r8188eu/include/rtw_led.h
@@ -51,15 +51,9 @@ enum LED_STATE_871x {
 	LED_BLINK_ALWAYS_ON = 16,
 };
 
-enum LED_PIN_871x {
-	LED_PIN_LED0 = 1,
-};
-
 struct LED_871x {
 	struct adapter *padapter;
 
-	enum LED_PIN_871x	LedPin;	/* Identify how to implement this
-					 * SW led. */
 	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. */
@@ -110,9 +104,7 @@ void BlinkWorkItemCallback(struct work_struct *work);
 
 void ResetLedStatus(struct LED_871x * pLed);
 
-void InitLed871x(struct adapter *padapter, struct LED_871x *pLed,
-		 enum LED_PIN_871x LedPin);
-
+void InitLed871x(struct adapter *padapter, struct LED_871x *pLed);
 void DeInitLed871x(struct LED_871x *pLed);
 
 /* hal... */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-07 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 21:05 [PATCH 0/3] staging: r8188eu: remove unused led1 Martin Kaiser
2021-12-07 21:05 ` [PATCH 1/3] staging: r8188eu: remove SwLed1 Martin Kaiser
2021-12-07 21:05 ` [PATCH 2/3] staging: r8188eu: remove code to set led1 registers Martin Kaiser
2021-12-07 21:05 ` [PATCH 3/3] staging: r8188eu: remove LedPin from struct struct LED_871x Martin Kaiser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).