diff mbox series

[4/4,v2] wifi: rtlwifi: simplify LED management

Message ID 20230608095051.116702-4-dmantipov@yandex.ru
State Superseded
Headers show
Series wifi: rtlwifi: remove misused flag from HAL data | expand

Commit Message

Dmitry Antipov June 8, 2023, 9:50 a.m. UTC
Introduce 'rtl_init_sw_leds()' to replace per-chip LED
initialization code (and so drop 'struct rtl_led' as no
longer used), drop 'init_sw_leds' and 'deinit_sw_leds'
fields from 'struct rtl_hal_ops', adjust related code.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
v2: adjust to match series
---
 drivers/net/wireless/realtek/rtlwifi/core.c   | 10 ++++
 drivers/net/wireless/realtek/rtlwifi/core.h   |  2 +
 drivers/net/wireless/realtek/rtlwifi/pci.c    |  2 +-
 .../wireless/realtek/rtlwifi/rtl8188ee/hw.c   |  8 +--
 .../wireless/realtek/rtlwifi/rtl8188ee/led.c  | 40 ++++---------
 .../wireless/realtek/rtlwifi/rtl8188ee/led.h  |  5 +-
 .../wireless/realtek/rtlwifi/rtl8188ee/sw.c   |  1 -
 .../wireless/realtek/rtlwifi/rtl8192ce/hw.c   |  8 +--
 .../wireless/realtek/rtlwifi/rtl8192ce/led.c  | 43 ++++---------
 .../wireless/realtek/rtlwifi/rtl8192ce/led.h  |  5 +-
 .../wireless/realtek/rtlwifi/rtl8192ce/sw.c   |  1 -
 .../wireless/realtek/rtlwifi/rtl8192cu/led.c  | 58 ++++--------------
 .../wireless/realtek/rtlwifi/rtl8192cu/led.h  |  6 +-
 .../wireless/realtek/rtlwifi/rtl8192cu/sw.c   |  2 -
 .../wireless/realtek/rtlwifi/rtl8192de/hw.c   |  8 +--
 .../wireless/realtek/rtlwifi/rtl8192de/led.c  | 44 ++++----------
 .../wireless/realtek/rtlwifi/rtl8192de/led.h  |  5 +-
 .../wireless/realtek/rtlwifi/rtl8192de/sw.c   |  1 -
 .../wireless/realtek/rtlwifi/rtl8192ee/hw.c   |  8 +--
 .../wireless/realtek/rtlwifi/rtl8192ee/led.c  | 40 ++++---------
 .../wireless/realtek/rtlwifi/rtl8192ee/led.h  |  5 +-
 .../wireless/realtek/rtlwifi/rtl8192ee/sw.c   |  1 -
 .../wireless/realtek/rtlwifi/rtl8192se/hw.c   | 10 ++--
 .../wireless/realtek/rtlwifi/rtl8192se/led.c  | 44 ++++----------
 .../wireless/realtek/rtlwifi/rtl8192se/led.h  |  5 +-
 .../wireless/realtek/rtlwifi/rtl8192se/sw.c   |  1 -
 .../wireless/realtek/rtlwifi/rtl8723ae/hw.c   |  8 +--
 .../wireless/realtek/rtlwifi/rtl8723ae/led.c  | 44 ++++----------
 .../wireless/realtek/rtlwifi/rtl8723ae/led.h  |  5 +-
 .../wireless/realtek/rtlwifi/rtl8723ae/sw.c   |  1 -
 .../wireless/realtek/rtlwifi/rtl8723be/hw.c   |  8 +--
 .../wireless/realtek/rtlwifi/rtl8723be/led.c  | 44 ++++----------
 .../wireless/realtek/rtlwifi/rtl8723be/led.h  |  5 +-
 .../wireless/realtek/rtlwifi/rtl8723be/sw.c   |  1 -
 .../wireless/realtek/rtlwifi/rtl8821ae/hw.c   | 14 ++---
 .../wireless/realtek/rtlwifi/rtl8821ae/led.c  | 60 ++++++-------------
 .../wireless/realtek/rtlwifi/rtl8821ae/led.h  |  9 ++-
 .../wireless/realtek/rtlwifi/rtl8821ae/sw.c   |  1 -
 drivers/net/wireless/realtek/rtlwifi/usb.c    |  3 +-
 drivers/net/wireless/realtek/rtlwifi/wifi.h   | 14 +----
 40 files changed, 189 insertions(+), 391 deletions(-)

Comments

Ping-Ke Shih June 13, 2023, 1:41 a.m. UTC | #1
> -----Original Message-----
> From: Dmitry Antipov <dmantipov@yandex.ru>
> Sent: Thursday, June 8, 2023 5:51 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org; Dmitry Antipov <dmantipov@yandex.ru>
> Subject: [PATCH 4/4] [v2] wifi: rtlwifi: simplify LED management
> 
> Introduce 'rtl_init_sw_leds()' to replace per-chip LED
> initialization code (and so drop 'struct rtl_led' as no
> longer used), drop 'init_sw_leds' and 'deinit_sw_leds'
> fields from 'struct rtl_hal_ops', adjust related code.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

[...]
Kalle Valo June 13, 2023, 8:31 a.m. UTC | #2
Dmitry Antipov <dmantipov@yandex.ru> wrote:

> Introduce 'rtl_init_sw_leds()' to replace per-chip LED
> initialization code (and so drop 'struct rtl_led' as no
> longer used), drop 'init_sw_leds' and 'deinit_sw_leds'
> fields from 'struct rtl_hal_ops', adjust related code.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Is there a reason why you are changing error messages to debug messages like here:

-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);

The commit log mentions nothing about that.
Dmitry Antipov June 13, 2023, 8:36 a.m. UTC | #3
On 6/13/23 11:31, Kalle Valo wrote:

> Is there a reason why you are changing error messages to debug messages like here:
> 
> -		pr_err("switch case %#x not processed\n",
> -		       pled->ledpin);
> +		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
> +			"unknown LED pin %d\n", pin);

Well, this sounds to be more problem-specific rather than
generic "something unexpected in the switch statement".

> The commit log mentions nothing about that.

It seems I have to write more detailed commit message.
Should I resend?

Dmitry
Kalle Valo June 14, 2023, 5:21 a.m. UTC | #4
Dmitry Antipov <dmantipov@yandex.ru> writes:

> On 6/13/23 11:31, Kalle Valo wrote:
>
>> Is there a reason why you are changing error messages to debug messages like here:
>>
>> -		pr_err("switch case %#x not processed\n",
>> -		       pled->ledpin);
>> +		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
>> +			"unknown LED pin %d\n", pin);
>
> Well, this sounds to be more problem-specific rather than
> generic "something unexpected in the switch statement".
>
>> The commit log mentions nothing about that.
>
> It seems I have to write more detailed commit message.
> Should I resend?

We prefer one logical change per patch, so it's better to remove all the
pr_err() conversions and resend as v3. And let's just drop the pr_err()
conversions, rtlwifi is an old driver and we want to keep changes to
that driver to the minimum. rtlw8xxxu, rtw88 and rtw89 are the active
Realtek drivers.
Ping-Ke Shih June 14, 2023, 7:11 a.m. UTC | #5
> -----Original Message-----
> From: Dmitry Antipov <dmantipov@yandex.ru>
> Sent: Wednesday, June 14, 2023 2:19 PM
> To: Kalle Valo <kvalo@kernel.org>
> Cc: Ping-Ke Shih <pkshih@realtek.com>; linux-wireless@vger.kernel.org; Dmitry Antipov
> <dmantipov@yandex.ru>
> Subject: [PATCH 1/2] [v3] wifi: rtlwifi: simplify LED management
> 
> Introduce 'rtl_init_sw_leds()' to replace per-chip LED
> initialization code (and so drop 'struct rtl_led' as no
> longer used), drop 'init_sw_leds' and 'deinit_sw_leds'
> fields from 'struct rtl_hal_ops', adjust related code.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

[...]
Dmitry Antipov June 14, 2023, 8:05 a.m. UTC | #6
On 6/14/23 10:08, Ping-Ke Shih wrote:

> I think this patch doesn't change pr_{info,err}, right ?

Yes but the previous version did, and Kalle has suggested
to avoid such a changes for rtlwifi.

Dmitry
Dmitry Antipov June 15, 2023, 8:49 a.m. UTC | #7
On 6/14/23 08:21, Kalle Valo wrote:

> rtlw8xxxu, rtw88 and rtw89 are the active Realtek drivers

What about rtl818x?

Dmitry
Kalle Valo June 16, 2023, 9:54 a.m. UTC | #8
Dmitry Antipov <dmantipov@yandex.ru> writes:

> On 6/14/23 08:21, Kalle Valo wrote:
>
>> rtlw8xxxu, rtw88 and rtw89 are the active Realtek drivers
>
> What about rtl818x?

rtl818x is not active. You can actually check that yourself:

git log drivers/net/wireless/realtek/rtl818x/

If you see from the past few years only kernel wide API changes or
similar it's a clear sign that the driver is not in active development
anymore. 

I want to also mention that the maintainers are not really enthusiastic
about random cleanups to random drivers from new contributors, they
increase our workload and there's always a risk of regressions. I try to
be nice and take few cleanups now and then, but if there's too much such
patches I'll start to back off.

Instead random cleanups I would be very happy to see these issues fixed
in wireless drivers:

o removal of strlcpy()

o fixing sparse warnings (my goal is to have wireless drivers sparse
  warning free)

o removal of BUG_ON() (no wireless driver should use BUG_ON() which
  crashes the whole system)

Here's a list of sparse warnings:

drivers/net/wireless/legacy/wl3501_cs.c: note: in included file:
drivers/net/wireless/legacy/wl3501.h:608:48: warning: array of flexible structures
drivers/net/wireless/atmel/atmel.c:3645:30: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3646:31: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3647:30: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3648:32: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3649:30: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3650:31: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3651:30: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3652:32: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3653:32: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3654:30: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3655:32: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3656:32: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3657:28: warning: cast to restricted __le16
drivers/net/wireless/atmel/atmel.c:3658:29: warning: cast to restricted __le16
drivers/net/wireless/cisco/airo.c:2055:24: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:2055:24:    expected restricted __le16 [usertype] status
drivers/net/wireless/cisco/airo.c:2055:24:    got unsigned short [usertype] status
drivers/net/wireless/cisco/airo.c:3262:18: warning: cast to restricted __le16
drivers/net/wireless/cisco/airo.c:3854:27: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:3854:27:    expected int auth_type
drivers/net/wireless/cisco/airo.c:3854:27:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:4927:51: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:4927:51:    expected int auth_type
drivers/net/wireless/cisco/airo.c:4927:51:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:4930:51: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:4930:51:    expected int auth_type
drivers/net/wireless/cisco/airo.c:4930:51:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:4933:51: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:4933:51:    expected int auth_type
drivers/net/wireless/cisco/airo.c:4933:51:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:6429:46: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:6429:46:    expected int auth_type
drivers/net/wireless/cisco/airo.c:6429:46:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:6449:38: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:6449:38:    expected int auth_type
drivers/net/wireless/cisco/airo.c:6449:38:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:6451:38: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:6451:38:    expected int auth_type
drivers/net/wireless/cisco/airo.c:6451:38:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:6453:38: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:6453:38:    expected int auth_type
drivers/net/wireless/cisco/airo.c:6453:38:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:6610:38: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:6610:38:    expected int auth_type
drivers/net/wireless/cisco/airo.c:6610:38:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:6612:38: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:6612:38:    expected int auth_type
drivers/net/wireless/cisco/airo.c:6612:38:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:6614:38: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:6614:38:    expected int auth_type
drivers/net/wireless/cisco/airo.c:6614:38:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:6719:54: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:6719:54:    expected int auth_type
drivers/net/wireless/cisco/airo.c:6719:54:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:6721:46: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:6721:46:    expected int auth_type
drivers/net/wireless/cisco/airo.c:6721:46:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:6731:54: warning: incorrect type in argument 2 (different base types)
drivers/net/wireless/cisco/airo.c:6731:54:    expected int auth_type
drivers/net/wireless/cisco/airo.c:6731:54:    got restricted __le16 [usertype]
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3812:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/cisco/airo.c:3812:32:    expected restricted __le16 [usertype] authType
drivers/net/wireless/cisco/airo.c:3812:32:    got int auth_type
drivers/net/wireless/cisco/airo.c:3816:26: warning: restricted __le16 degrades to integer
drivers/net/wireless/cisco/airo.c:3816:52: warning: restricted __le16 degrades to integer
drivers/net/wireless/microchip/wilc1000/cfg80211.c:362:42: warning: incorrect type in assignment (different base types)
drivers/net/wireless/microchip/wilc1000/cfg80211.c:362:42:    expected unsigned int key_mgmt_suite
drivers/net/wireless/microchip/wilc1000/cfg80211.c:362:42:    got restricted __be32 [usertype]
drivers/net/wireless/intersil/hostap/hostap_ap.c:353:13: warning: context imbalance in 'ap_control_proc_start' - wrong count at exit
drivers/net/wireless/intersil/hostap/hostap_ap.c:366:13: warning: context imbalance in 'ap_control_proc_stop' - unexpected unlock
drivers/net/wireless/intersil/hostap/hostap_ap.c:555:13: warning: context imbalance in 'prism2_ap_proc_start' - wrong count at exit
drivers/net/wireless/intersil/hostap/hostap_ap.c:568:13: warning: context imbalance in 'prism2_ap_proc_stop' - unexpected unlock
drivers/net/wireless/zydas/zd1211rw/zd_usb.c:383:24: warning: implicit cast from nocast type
drivers/net/wireless/zydas/zd1211rw/zd_usb.c:419:24: warning: implicit cast from nocast type
drivers/net/wireless/mediatek/mt7601u/mac.c:361:16: warning: dubious: x & !y
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c:3302:46: warning: cast truncates bits from constant value (ffff7fff becomes 7fff)
drivers/net/wireless/broadcom/b43/phy_n.c:6249:35: warning: cast truncates bits from constant value (ffff3fff becomes 3fff)
drivers/net/wireless/broadcom/b43/phy_n.c:6380:55: warning: cast truncates bits from constant value (ffff7fff becomes 7fff)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:17590:47: warning: cast truncates bits from constant value (ffff7fff becomes 7fff)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:18089:53: warning: cast truncates bits from constant value (ffff3fff becomes 3fff)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:21056:36: warning: cast truncates bits from constant value (ffff3fff becomes 3fff)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:21290:68: warning: cast truncates bits from constant value (ffff03ff becomes 3ff)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:23200:35: warning: cast truncates bits from constant value (ffff7fff becomes 7fff)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:28205:44: warning: cast truncates bits from constant value (ffff1fff becomes 1fff)
drivers/net/wireless/intersil/hostap/hostap_proc.c:98:13: warning: context imbalance in 'prism2_wds_proc_start' - wrong count at exit
drivers/net/wireless/intersil/hostap/hostap_proc.c:111:13: warning: context imbalance in 'prism2_wds_proc_stop' - unexpected unlock
drivers/net/wireless/intersil/hostap/hostap_proc.c:323:13: warning: context imbalance in 'prism2_scan_results_proc_start' - wrong count at exit
drivers/net/wireless/intersil/hostap/hostap_proc.c:344:13: warning: context imbalance in 'prism2_scan_results_proc_stop' - unexpected unlock
drivers/net/wireless/broadcom/b43/phy_ht.c:325:35: warning: cast truncates bits from constant value (ffff3fff becomes 3fff)
drivers/net/wireless/broadcom/b43/phy_ht.c:554:61: warning: cast truncates bits from constant value (ffff1fff becomes 1fff)
drivers/net/wireless/st/cw1200/cw1200_spi.c:83:17: warning: incorrect type in assignment (different base types)
drivers/net/wireless/st/cw1200/cw1200_spi.c:83:17:    expected unsigned short [addressable] [assigned] [usertype] regaddr
drivers/net/wireless/st/cw1200/cw1200_spi.c:83:17:    got restricted __le16 [usertype]
drivers/net/wireless/st/cw1200/cw1200_spi.c:148:17: warning: incorrect type in assignment (different base types)
drivers/net/wireless/st/cw1200/cw1200_spi.c:148:17:    expected unsigned short [addressable] [assigned] [usertype] regaddr
drivers/net/wireless/st/cw1200/cw1200_spi.c:148:17:    got restricted __le16 [usertype]
drivers/net/wireless/rsi/rsi_91x_usb.c:235:27: warning: restricted __le32 degrades to integer
drivers/net/wireless/rsi/rsi_91x_usb.c:236:27: warning: restricted __le32 degrades to integer
drivers/net/wireless/rsi/rsi_91x_usb.c:237:27: warning: restricted __le32 degrades to integer
drivers/net/wireless/rsi/rsi_91x_usb.c:238:27: warning: restricted __le32 degrades to integer
drivers/net/wireless/rsi/rsi_91x_usb.c:244:36: warning: restricted __le32 degrades to integer
drivers/net/wireless/rsi/rsi_91x_usb.c:245:35: warning: restricted __le32 degrades to integer
drivers/net/wireless/ath/wil6210/cfg80211.c: note: in included file (through drivers/net/wireless/ath/wil6210/wil6210.h):
drivers/net/wireless/ath/wil6210/fw.h:96:47: warning: array of flexible structures
drivers/net/wireless/ath/ath9k/init.c:79:5: warning: symbol 'ath9k_use_msi' was not declared. Should it be static?
drivers/net/wireless/ath/wcn36xx/main.c:759:58: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/wcn36xx/main.c:759:58:    expected unsigned short [usertype] vht_rx_mcs_map
drivers/net/wireless/ath/wcn36xx/main.c:759:58:    got restricted __le16 [usertype] rx_mcs_map
drivers/net/wireless/ath/wcn36xx/main.c:761:58: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/wcn36xx/main.c:761:58:    expected unsigned short [usertype] vht_tx_mcs_map
drivers/net/wireless/ath/wcn36xx/main.c:761:58:    got restricted __le16 [usertype] tx_mcs_map
drivers/net/wireless/ath/ath9k/xmit.c:1676:20: warning: incorrect type in initializer (different base types)
drivers/net/wireless/ath/ath9k/xmit.c:1676:20:    expected unsigned short [usertype] mask
drivers/net/wireless/ath/ath9k/xmit.c:1676:20:    got restricted __le16 [usertype]
drivers/net/wireless/ath/ath9k/xmit.c:1680:17: warning: restricted __le16 degrades to integer
drivers/net/wireless/ath/ath9k/xmit.c:1681:42: warning: restricted __le16 degrades to integer
drivers/net/wireless/ath/ath9k/xmit.c:1681:36: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath9k/xmit.c:1681:36:    expected restricted __le16 [usertype] frame_control
drivers/net/wireless/ath/ath9k/xmit.c:1681:36:    got int
drivers/net/wireless/ath/wcn36xx/txrx.c: note: in included file (through drivers/net/wireless/ath/wcn36xx/txrx.h):
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24:    expected unsigned int [usertype]
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24:    got restricted __be32 [usertype]
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24:    expected unsigned int [usertype]
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24:    got restricted __be32 [usertype]
drivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9:    expected restricted __le16 x
drivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9:    got unsigned short [usertype]
drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17:    expected restricted __le16 x
drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17:    got unsigned short [usertype]
drivers/net/wireless/ath/wil6210/fw.c: note: in included file (through drivers/net/wireless/ath/wil6210/wil6210.h):
drivers/net/wireless/ath/wil6210/fw.h:96:47: warning: array of flexible structures
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10796:39: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10796:39:    expected unsigned int [usertype]
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10796:39:    got restricted __le32 [usertype]
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10798:43: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10798:43:    expected unsigned int [usertype]
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10798:43:    got restricted __le32 [usertype]
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10800:43: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10800:43:    expected unsigned int [usertype]
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10800:43:    got restricted __le32 [usertype]
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10802:43: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10802:43:    expected unsigned int [usertype]
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10802:43:    got restricted __le32 [usertype]
drivers/net/wireless/ath/ath11k/hal_rx.c:112:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:114:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:116:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:118:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:120:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:122:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:124:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:126:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:128:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:130:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:132:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:134:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:136:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:138:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:140:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:142:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:144:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:146:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:148:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:150:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:152:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:154:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:160:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:164:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:166:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:170:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:172:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:174:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:176:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:178:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:180:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:182:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:184:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:186:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:206:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:210:17: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/hal_rx.c:212:17: warning: dubious: x & !y
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:123:17: warning: dubious: x & !y
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:155:16: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/dp_tx.c:930:23: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/dp_tx.c:932:23: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/dp_tx.c:935:23: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/dp_tx.c:1108:23: warning: dubious: x & !y
drivers/net/wireless/ath/ath11k/dp_tx.c:1110:23: warning: dubious: x & !y
drivers/net/wireless/ath/ath9k/eeprom_def.c:138:9: warning: cast to restricted __le16
drivers/net/wireless/ath/ath9k/eeprom_def.c:138:9: warning: cast from restricted __le32
drivers/net/wireless/ath/ath9k/eeprom_def.c:139:9: warning: cast to restricted __le16
drivers/net/wireless/ath/ath9k/eeprom_def.c:139:9: warning: cast from restricted __le32
drivers/net/wireless/ath/ath9k/eeprom_def.c:140:9: warning: cast to restricted __le16
drivers/net/wireless/ath/ath9k/eeprom_def.c:140:9: warning: cast from restricted __le32
drivers/net/wireless/ath/ath9k/eeprom_4k.c:79:9: warning: cast to restricted __le16
drivers/net/wireless/ath/ath9k/eeprom_4k.c:79:9: warning: cast from restricted __le32
drivers/net/wireless/ath/ath9k/eeprom_9287.c:82:9: warning: cast to restricted __le16
drivers/net/wireless/ath/ath9k/eeprom_9287.c:82:9: warning: cast from restricted __le32
drivers/net/wireless/ath/ath9k/eeprom_9287.c:83:9: warning: cast to restricted __le16
drivers/net/wireless/ath/ath9k/eeprom_9287.c:83:9: warning: cast from restricted __le32
drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c:521:9: warning: dubious: x & !y
drivers/net/wireless/mediatek/mt76/mt7603/mac.c:901:9: warning: dubious: x & !y
drivers/net/wireless/mediatek/mt76/mt7603/mac.c:961:15: warning: dubious: x & !y
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:534:9: warning: dubious: x | !y
Dmitry Antipov June 16, 2023, 10:20 a.m. UTC | #9
On 6/16/23 12:54, Kalle Valo wrote:

> rtl818x is not active. You can actually check that yourself:
> 
> git log drivers/net/wireless/realtek/rtl818x/

Note MAINTAINERS marks drivers/net/wireless/realtek/rtl818x/rtl8180 as
orphaned but drivers/net/wireless/realtek/rtl818x/rtl8187 as maintained.

> I want to also mention that the maintainers are not really enthusiastic
> about random cleanups to random drivers from new contributors, they
> increase our workload and there's always a risk of regressions. I try to
> be nice and take few cleanups now and then, but if there's too much such
> patches I'll start to back off.
> 
> Instead random cleanups I would be very happy to see these issues fixed
> in wireless drivers:
> 
> o removal of strlcpy()
> 
> o fixing sparse warnings (my goal is to have wireless drivers sparse
>    warning free)
> 
> o removal of BUG_ON() (no wireless driver should use BUG_ON() which
>    crashes the whole system)

Got your point, thanks.

Dmitry
Larry Finger June 16, 2023, 4:06 p.m. UTC | #10
On 6/16/23 05:20, Dmitry Antipov wrote:
> Note MAINTAINERS marks drivers/net/wireless/realtek/rtl818x/rtl8180 as
> orphaned but drivers/net/wireless/realtek/rtl818x/rtl8187 as maintained.

Driver rtl8187 is certainly maintained, not that it gets many bug reports. 
Devices that support 802.11g are not used very often, but at least once a year I 
use my device to get online to retrieve the drivers for a fancier wifi card that 
does not have a driver in Linux or Windows. Drivers for the USB-based 8187A and 
8187B have been in Linux since version 2.6.38 (December 2010), and also in 
Windows 7, if not in older versions.

The driver for rtl8180 is not very important, and could be removed as the card 
uses PCI, not PCIe, slots. I do not have such a device, nor do I have any 
hardware old enough to support it, even though I do have some stuff that tends 
to match my age. :)

Larry
Kalle Valo Aug. 1, 2023, 9:31 a.m. UTC | #11
+ Herton, Hin-Tak

Larry Finger <Larry.Finger@lwfinger.net> writes:

> On 6/16/23 05:20, Dmitry Antipov wrote:
>> Note MAINTAINERS marks drivers/net/wireless/realtek/rtl818x/rtl8180 as
>> orphaned but drivers/net/wireless/realtek/rtl818x/rtl8187 as maintained.
>
> Driver rtl8187 is certainly maintained, not that it gets many bug
> reports. Devices that support 802.11g are not used very often, but at
> least once a year I use my device to get online to retrieve the
> drivers for a fancier wifi card that does not have a driver in Linux
> or Windows. Drivers for the USB-based 8187A and 8187B have been in
> Linux since version 2.6.38 (December 2010), and also in Windows 7, if
> not in older versions.

So this is what we have in MAINTAINERS right now:

RTL8187 WIRELESS DRIVER
M:	Herton Ronaldo Krzesinski <herton@canonical.com>
M:	Hin-Tak Leung <htl10@users.sourceforge.net>
M:	Larry Finger <Larry.Finger@lwfinger.net>
L:	linux-wireless@vger.kernel.org
S:	Maintained
W:	https://wireless.wiki.kernel.org/
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
F:	drivers/net/wireless/realtek/rtl818x/rtl8187/

In the git history the last activity from Herton is from 2010 so I think
we should remove him.

Is Hin-Tak still active? The last activity is from 2020.

Also the git tree is outdated so that should be removed.
Larry Finger Aug. 1, 2023, 5:04 p.m. UTC | #12
On 8/1/23 04:31, Kalle Valo wrote:
> + Herton, Hin-Tak
> 
> Larry Finger <Larry.Finger@lwfinger.net> writes:
> 
>> On 6/16/23 05:20, Dmitry Antipov wrote:
>>> Note MAINTAINERS marks drivers/net/wireless/realtek/rtl818x/rtl8180 as
>>> orphaned but drivers/net/wireless/realtek/rtl818x/rtl8187 as maintained.
>>
>> Driver rtl8187 is certainly maintained, not that it gets many bug
>> reports. Devices that support 802.11g are not used very often, but at
>> least once a year I use my device to get online to retrieve the
>> drivers for a fancier wifi card that does not have a driver in Linux
>> or Windows. Drivers for the USB-based 8187A and 8187B have been in
>> Linux since version 2.6.38 (December 2010), and also in Windows 7, if
>> not in older versions.
> 
> So this is what we have in MAINTAINERS right now:
> 
> RTL8187 WIRELESS DRIVER
> M:	Herton Ronaldo Krzesinski <herton@canonical.com>
> M:	Hin-Tak Leung <htl10@users.sourceforge.net>
> M:	Larry Finger <Larry.Finger@lwfinger.net>
> L:	linux-wireless@vger.kernel.org
> S:	Maintained
> W:	https://wireless.wiki.kernel.org/
> T:	git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
> F:	drivers/net/wireless/realtek/rtl818x/rtl8187/
> 
> In the git history the last activity from Herton is from 2010 so I think
> we should remove him.
> 
> Is Hin-Tak still active? The last activity is from 2020.
> 
> Also the git tree is outdated so that should be removed.

Kalle,

I removed Herton and Hin-Tak as Maintainers for rtl8187 and updated the tree 
entries for rtl8187 and rtl8180. Patches are submitted.

Larry
Kalle Valo Aug. 1, 2023, 5:19 p.m. UTC | #13
Larry Finger <Larry.Finger@lwfinger.net> writes:

> On 8/1/23 04:31, Kalle Valo wrote:
>
>> + Herton, Hin-Tak
>> Larry Finger <Larry.Finger@lwfinger.net> writes:
>> 
>>> On 6/16/23 05:20, Dmitry Antipov wrote:
>>>> Note MAINTAINERS marks drivers/net/wireless/realtek/rtl818x/rtl8180 as
>>>> orphaned but drivers/net/wireless/realtek/rtl818x/rtl8187 as maintained.
>>>
>>> Driver rtl8187 is certainly maintained, not that it gets many bug
>>> reports. Devices that support 802.11g are not used very often, but at
>>> least once a year I use my device to get online to retrieve the
>>> drivers for a fancier wifi card that does not have a driver in Linux
>>> or Windows. Drivers for the USB-based 8187A and 8187B have been in
>>> Linux since version 2.6.38 (December 2010), and also in Windows 7, if
>>> not in older versions.
>> So this is what we have in MAINTAINERS right now:
>> RTL8187 WIRELESS DRIVER
>> M:	Herton Ronaldo Krzesinski <herton@canonical.com>
>> M:	Hin-Tak Leung <htl10@users.sourceforge.net>
>> M:	Larry Finger <Larry.Finger@lwfinger.net>
>> L:	linux-wireless@vger.kernel.org
>> S:	Maintained
>> W:	https://wireless.wiki.kernel.org/
>> T: git
>> git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
>> F:	drivers/net/wireless/realtek/rtl818x/rtl8187/
>> In the git history the last activity from Herton is from 2010 so I
>> think
>> we should remove him.
>> Is Hin-Tak still active? The last activity is from 2020.
>> Also the git tree is outdated so that should be removed.
>
> Kalle,
>
> I removed Herton and Hin-Tak as Maintainers for rtl8187 and updated
> the tree entries for rtl8187 and rtl8180. Patches are submitted.

Thanks!
Kalle Valo Aug. 2, 2023, 2:38 p.m. UTC | #14
Hin-Tak Leung <htl10@users.sourceforge.net> writes:

> On Tuesday, 1 August 2023 at 18:05:08 BST, Larry Finger <larry.finger@lwfinger.net> wrote: 
>
> <snipped>
>
>> > In the git history the last activity from Herton is from 2010 so I think
>> > we should remove him.
>>.> 
>> > Is Hin-Tak still active? The last activity is from 2020.
>> > 
>> > Also the git tree is outdated so that should be removed.
>
>> Kalle,
>
>> I removed Herton and Hin-Tak as Maintainers for rtl8187 > and updated the tree 
>> entries for rtl8187 and rtl8180. Patches are submitted.
>
> I think I tried to Ack some recent changes a few months ago, but it
> didn't go through - my email server insists on sending html-enabled
> messages, which gets dropped by the kernel mailing lists. I did have
> to jump through some hoops to use git-send-email instead for important
> things.

Yeah, your reply was in HTML so our lists dropped it. I'm sorry to say
but if you are not able to send mails as text/plain you cannot continue
as a maintainer, we require that the mails are visible in the list.
Hin-Tak Leung Aug. 2, 2023, 10:48 p.m. UTC | #15
On Wed, 2 Aug 2023 at 16:10, Kalle Valo <kvalo@kernel.org> wrote:
>
> Hin-Tak Leung <htl10@users.sourceforge.net> writes:
>
> > On Tuesday, 1 August 2023 at 18:05:08 BST, Larry Finger <larry.finger@lwfinger.net> wrote:
> >
> > <snipped>
> >
> >> > In the git history the last activity from Herton is from 2010 so I think
> >> > we should remove him.
> >>.>
> >> > Is Hin-Tak still active? The last activity is from 2020.
> >> >
> >> > Also the git tree is outdated so that should be removed.
> >
> >> Kalle,
> >
> >> I removed Herton and Hin-Tak as Maintainers for rtl8187 > and updated the tree
> >> entries for rtl8187 and rtl8180. Patches are submitted.
> >
> > I think I tried to Ack some recent changes a few months ago, but it
> > didn't go through - my email server insists on sending html-enabled
> > messages, which gets dropped by the kernel mailing lists. I did have
> > to jump through some hoops to use git-send-email instead for important
> > things.
>
> Yeah, your reply was in HTML so our lists dropped it. I'm sorry to say
> but if you are not able to send mails as text/plain you cannot continue
> as a maintainer, we require that the mails are visible in the list.
>

I should have done this ages ago - can I switch e-mail address, and
possibly keep the old one? I also have a g-mail address which I use
less often. So I would like to keep getting e-mails on the sourceforge
one, but only respond from the gmail one when needed. Is that more
acceptable?

Hin-Tak
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
index 6f10727cdb94..4fb16f5f6f83 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -1908,6 +1908,16 @@  bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
 	return true;
 }
 EXPORT_SYMBOL(rtl_cmd_send_packet);
+
+void rtl_init_sw_leds(struct ieee80211_hw *hw)
+{
+	struct rtl_priv *rtlpriv = rtl_priv(hw);
+
+	rtlpriv->ledctl.sw_led0 = LED_PIN_LED0;
+	rtlpriv->ledctl.sw_led1 = LED_PIN_LED1;
+}
+EXPORT_SYMBOL(rtl_init_sw_leds);
+
 const struct ieee80211_ops rtl_ops = {
 	.start = rtl_op_start,
 	.stop = rtl_op_stop,
diff --git a/drivers/net/wireless/realtek/rtlwifi/core.h b/drivers/net/wireless/realtek/rtlwifi/core.h
index 345161b47442..42c2d9e13bb8 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.h
+++ b/drivers/net/wireless/realtek/rtlwifi/core.h
@@ -51,6 +51,8 @@  enum dm_dig_connect_e {
 };
 
 extern const struct ieee80211_ops rtl_ops;
+
+void rtl_init_sw_leds(struct ieee80211_hw *hw);
 void rtl_fw_cb(const struct firmware *firmware, void *context);
 void rtl_wowlan_fw_cb(const struct firmware *firmware, void *context);
 void rtl_addr_delay(u32 addr);
diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
index 028a7c97bacf..9886e719739b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
@@ -2260,7 +2260,7 @@  int rtl_pci_probe(struct pci_dev *pdev,
 		err = -ENODEV;
 		goto fail3;
 	}
-	rtlpriv->cfg->ops->init_sw_leds(hw);
+	rtl_init_sw_leds(hw);
 
 	/*aspm */
 	rtl_pci_init_aspm(hw);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
index de61c9c0ddec..58b1a46066b5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
@@ -803,17 +803,17 @@  static void _rtl88ee_gen_refresh_led_state(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	if (rtlpriv->rtlhal.up_first_time)
 		return;
 
 	if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS)
-		rtl88ee_sw_led_on(hw, pled0);
+		rtl88ee_sw_led_on(hw, pin0);
 	else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT)
-		rtl88ee_sw_led_on(hw, pled0);
+		rtl88ee_sw_led_on(hw, pin0);
 	else
-		rtl88ee_sw_led_off(hw, pled0);
+		rtl88ee_sw_led_off(hw, pin0);
 }
 
 static bool _rtl88ee_init_mac(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.c
index 006b979da1c6..61f1709b30aa 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.c
@@ -6,23 +6,15 @@ 
 #include "reg.h"
 #include "led.h"
 
-static void _rtl88ee_init_led(struct ieee80211_hw *hw,
-			      struct rtl_led *pled, enum rtl_led_pin ledpin)
-{
-	pled->hw = hw;
-	pled->ledpin = ledpin;
-	pled->ledon = false;
-}
-
-void rtl88ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl88ee_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u8 ledcfg;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
-		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin);
+		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pin);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -36,21 +28,20 @@  void rtl88ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
 		break;
 	default:
 		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
-			"switch case %#x not processed\n", pled->ledpin);
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = true;
 }
 
-void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl88ee_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	u8 ledcfg;
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
-		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin);
+		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pin);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -73,34 +64,25 @@  void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 		break;
 	default:
 		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
-			"switch case %#x not processed\n", pled->ledpin);
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = false;
-}
-
-void rtl88ee_init_sw_leds(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-
-	_rtl88ee_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
-	_rtl88ee_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
 }
 
 static void _rtl88ee_sw_led_control(struct ieee80211_hw *hw,
 				    enum led_ctl_mode ledaction)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	switch (ledaction) {
 	case LED_CTL_POWER_ON:
 	case LED_CTL_LINK:
 	case LED_CTL_NO_LINK:
-		rtl88ee_sw_led_on(hw, pled0);
+		rtl88ee_sw_led_on(hw, pin0);
 		break;
 	case LED_CTL_POWER_OFF:
-		rtl88ee_sw_led_off(hw, pled0);
+		rtl88ee_sw_led_off(hw, pin0);
 		break;
 	default:
 		break;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.h
index 67d3dc389ba0..e5cc35d4c298 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.h
@@ -4,9 +4,8 @@ 
 #ifndef __RTL92CE_LED_H__
 #define __RTL92CE_LED_H__
 
-void rtl88ee_init_sw_leds(struct ieee80211_hw *hw);
-void rtl88ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
-void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl88ee_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl88ee_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin);
 void rtl88ee_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction);
 
 #endif
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
index 02b77521b5cd..b77937fe2448 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
@@ -230,7 +230,6 @@  static struct rtl_hal_ops rtl8188ee_hal_ops = {
 	.tx_polling = rtl88ee_tx_polling,
 	.enable_hw_sec = rtl88ee_enable_hw_security_config,
 	.set_key = rtl88ee_set_key,
-	.init_sw_leds = rtl88ee_init_sw_leds,
 	.get_bbreg = rtl88e_phy_query_bb_reg,
 	.set_bbreg = rtl88e_phy_set_bb_reg,
 	.get_rfreg = rtl88e_phy_query_rf_reg,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
index dc480323c9cb..049c4fe9eeed 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
@@ -639,17 +639,17 @@  static void _rtl92ce_gen_refresh_led_state(struct ieee80211_hw *hw)
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	if (rtlpci->up_first_time)
 		return;
 
 	if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS)
-		rtl92ce_sw_led_on(hw, pled0);
+		rtl92ce_sw_led_on(hw, pin0);
 	else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT)
-		rtl92ce_sw_led_on(hw, pled0);
+		rtl92ce_sw_led_on(hw, pin0);
 	else
-		rtl92ce_sw_led_off(hw, pled0);
+		rtl92ce_sw_led_off(hw, pin0);
 }
 
 static bool _rtl92ce_init_mac(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.c
index 57132278eb5c..e9c1abd662f7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.c
@@ -6,25 +6,17 @@ 
 #include "reg.h"
 #include "led.h"
 
-static void _rtl92ce_init_led(struct ieee80211_hw *hw,
-			      struct rtl_led *pled, enum rtl_led_pin ledpin)
-{
-	pled->hw = hw;
-	pled->ledpin = ledpin;
-	pled->ledon = false;
-}
-
-void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl92ce_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u8 ledcfg;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
-		REG_LEDCFG2, pled->ledpin);
+		REG_LEDCFG2, pin);
 
 	ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -35,24 +27,23 @@  void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
 		rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0x0f) | BIT(5));
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = true;
 }
 
-void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl92ce_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	u8 ledcfg;
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
-		REG_LEDCFG2, pled->ledpin);
+		REG_LEDCFG2, pin);
 
 	ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -69,34 +60,26 @@  void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 		rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg | BIT(3)));
 		break;
 	default:
-		pr_info("switch case %#x not processed\n", pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = false;
-}
-
-void rtl92ce_init_sw_leds(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-
-	_rtl92ce_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
-	_rtl92ce_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
 }
 
 static void _rtl92ce_sw_led_control(struct ieee80211_hw *hw,
 				    enum led_ctl_mode ledaction)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	switch (ledaction) {
 	case LED_CTL_POWER_ON:
 	case LED_CTL_LINK:
 	case LED_CTL_NO_LINK:
-		rtl92ce_sw_led_on(hw, pled0);
+		rtl92ce_sw_led_on(hw, pin0);
 		break;
 	case LED_CTL_POWER_OFF:
-		rtl92ce_sw_led_off(hw, pled0);
+		rtl92ce_sw_led_off(hw, pin0);
 		break;
 	default:
 		break;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.h
index 97ab1e00af5f..66dc28d62003 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.h
@@ -4,9 +4,8 @@ 
 #ifndef __RTL92CE_LED_H__
 #define __RTL92CE_LED_H__
 
-void rtl92ce_init_sw_leds(struct ieee80211_hw *hw);
-void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
-void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl92ce_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl92ce_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin);
 void rtl92ce_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction);
 
 #endif
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
index ed68c850f9a2..e452275d8789 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
@@ -207,7 +207,6 @@  static struct rtl_hal_ops rtl8192ce_hal_ops = {
 	.tx_polling = rtl92ce_tx_polling,
 	.enable_hw_sec = rtl92ce_enable_hw_security_config,
 	.set_key = rtl92ce_set_key,
-	.init_sw_leds = rtl92ce_init_sw_leds,
 	.get_bbreg = rtl92c_phy_query_bb_reg,
 	.set_bbreg = rtl92c_phy_set_bb_reg,
 	.set_rfreg = rtl92ce_phy_set_rf_reg,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.c
index 1488f52a2d2f..b429b2ef78c5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.c
@@ -6,27 +6,15 @@ 
 #include "reg.h"
 #include "led.h"
 
-static void _rtl92cu_init_led(struct ieee80211_hw *hw,
-			      struct rtl_led *pled, enum rtl_led_pin ledpin)
-{
-	pled->hw = hw;
-	pled->ledpin = ledpin;
-	pled->ledon = false;
-}
-
-static void rtl92cu_deinit_led(struct rtl_led *pled)
-{
-}
-
-void rtl92cu_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl92cu_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u8 ledcfg;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
-		REG_LEDCFG2, pled->ledpin);
+		REG_LEDCFG2, pin);
 	ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -37,22 +25,21 @@  void rtl92cu_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
 		rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0x0f) | BIT(5));
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = true;
 }
 
-void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl92cu_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	u8 ledcfg;
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
-		REG_LEDCFG2, pled->ledpin);
+		REG_LEDCFG2, pin);
 	ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -69,36 +56,14 @@  void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 		rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg | BIT(3)));
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = false;
-}
-
-void rtl92cu_init_sw_leds(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-
-	_rtl92cu_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
-	_rtl92cu_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
-}
-
-void rtl92cu_deinit_sw_leds(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-
-	rtl92cu_deinit_led(&rtlpriv->ledctl.sw_led0);
-	rtl92cu_deinit_led(&rtlpriv->ledctl.sw_led1);
-}
-
-static void _rtl92cu_sw_led_control(struct ieee80211_hw *hw,
-				    enum led_ctl_mode ledaction)
-{
 }
 
 void rtl92cu_led_control(struct ieee80211_hw *hw,
-			enum led_ctl_mode ledaction)
+			 enum led_ctl_mode ledaction)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
@@ -114,5 +79,4 @@  void rtl92cu_led_control(struct ieee80211_hw *hw,
 		return;
 	}
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d\n", ledaction);
-	_rtl92cu_sw_led_control(hw, ledaction);
 }
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.h
index 3fc1e7c8f78b..8175f8bddd6d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.h
@@ -4,10 +4,8 @@ 
 #ifndef __RTL92CU_LED_H__
 #define __RTL92CU_LED_H__
 
-void rtl92cu_init_sw_leds(struct ieee80211_hw *hw);
-void rtl92cu_deinit_sw_leds(struct ieee80211_hw *hw);
-void rtl92cu_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
-void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl92cu_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl92cu_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin);
 void rtl92cu_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction);
 
 #endif
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c
index 876c14d46c2f..e6403d4c937c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c
@@ -115,8 +115,6 @@  static struct rtl_hal_ops rtl8192cu_hal_ops = {
 	.led_control = rtl92cu_led_control,
 	.enable_hw_sec = rtl92cu_enable_hw_security_config,
 	.set_key = rtl92c_set_key,
-	.init_sw_leds = rtl92cu_init_sw_leds,
-	.deinit_sw_leds = rtl92cu_deinit_sw_leds,
 	.get_bbreg = rtl92c_phy_query_bb_reg,
 	.set_bbreg = rtl92c_phy_set_bb_reg,
 	.get_rfreg = rtl92cu_phy_query_rf_reg,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
index df1e36fbc348..31a18bbface9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
@@ -595,16 +595,16 @@  static void _rtl92de_gen_refresh_led_state(struct ieee80211_hw *hw)
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	if (rtlpci->up_first_time)
 		return;
 	if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS)
-		rtl92de_sw_led_on(hw, pled0);
+		rtl92de_sw_led_on(hw, pin0);
 	else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT)
-		rtl92de_sw_led_on(hw, pled0);
+		rtl92de_sw_led_on(hw, pin0);
 	else
-		rtl92de_sw_led_off(hw, pled0);
+		rtl92de_sw_led_off(hw, pin0);
 }
 
 static bool _rtl92de_init_mac(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.c
index 93d1c6a610c3..1b57f51ce0dd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.c
@@ -6,23 +6,15 @@ 
 #include "reg.h"
 #include "led.h"
 
-static void _rtl92ce_init_led(struct ieee80211_hw *hw,
-			      struct rtl_led *pled, enum rtl_led_pin ledpin)
-{
-	pled->hw = hw;
-	pled->ledpin = ledpin;
-	pled->ledon = false;
-}
-
-void rtl92de_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl92de_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u8 ledcfg;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
-		REG_LEDCFG2, pled->ledpin);
+		REG_LEDCFG2, pin);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -44,24 +36,23 @@  void rtl92de_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
 		rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0x0f) | BIT(5));
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = true;
 }
 
-void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl92de_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	u8 ledcfg;
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
-		REG_LEDCFG2, pled->ledpin);
+		REG_LEDCFG2, pin);
 
 	ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -78,35 +69,26 @@  void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 		rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg | BIT(3)));
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = false;
-}
-
-void rtl92de_init_sw_leds(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-
-	_rtl92ce_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
-	_rtl92ce_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
 }
 
 static void _rtl92ce_sw_led_control(struct ieee80211_hw *hw,
 				    enum led_ctl_mode ledaction)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	switch (ledaction) {
 	case LED_CTL_POWER_ON:
 	case LED_CTL_LINK:
 	case LED_CTL_NO_LINK:
-		rtl92de_sw_led_on(hw, pled0);
+		rtl92de_sw_led_on(hw, pin0);
 		break;
 	case LED_CTL_POWER_OFF:
-		rtl92de_sw_led_off(hw, pled0);
+		rtl92de_sw_led_off(hw, pin0);
 		break;
 	default:
 		break;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.h
index 7599c7e5ecc3..33e544ad6f99 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.h
@@ -4,9 +4,8 @@ 
 #ifndef __RTL92CE_LED_H__
 #define __RTL92CE_LED_H__
 
-void rtl92de_init_sw_leds(struct ieee80211_hw *hw);
-void rtl92de_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
-void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl92de_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl92de_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin);
 void rtl92de_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction);
 
 #endif
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
index a74724c971b9..11f319c97124 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
@@ -220,7 +220,6 @@  static struct rtl_hal_ops rtl8192de_hal_ops = {
 	.tx_polling = rtl92de_tx_polling,
 	.enable_hw_sec = rtl92de_enable_hw_security_config,
 	.set_key = rtl92de_set_key,
-	.init_sw_leds = rtl92de_init_sw_leds,
 	.get_bbreg = rtl92d_phy_query_bb_reg,
 	.set_bbreg = rtl92d_phy_set_bb_reg,
 	.get_rfreg = rtl92d_phy_query_rf_reg,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
index 47d8999e31c0..ebb7abd0c9ad 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
@@ -714,17 +714,17 @@  static void _rtl92ee_gen_refresh_led_state(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	if (rtlpriv->rtlhal.up_first_time)
 		return;
 
 	if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS)
-		rtl92ee_sw_led_on(hw, pled0);
+		rtl92ee_sw_led_on(hw, pin0);
 	else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT)
-		rtl92ee_sw_led_on(hw, pled0);
+		rtl92ee_sw_led_on(hw, pin0);
 	else
-		rtl92ee_sw_led_off(hw, pled0);
+		rtl92ee_sw_led_off(hw, pin0);
 }
 
 static bool _rtl92ee_init_mac(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.c
index fb4ea3a8481f..e8800f62dc1b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.c
@@ -6,23 +6,15 @@ 
 #include "reg.h"
 #include "led.h"
 
-static void _rtl92ee_init_led(struct ieee80211_hw *hw,
-			      struct rtl_led *pled, enum rtl_led_pin ledpin)
-{
-	pled->hw = hw;
-	pled->ledpin = ledpin;
-	pled->ledon = false;
-}
-
-void rtl92ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl92ee_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u32 ledcfg;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
-		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin);
+		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pin);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -39,21 +31,20 @@  void rtl92ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
 		break;
 	default:
 		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
-			"switch case %#x not processed\n", pled->ledpin);
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = true;
 }
 
-void rtl92ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl92ee_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	u32 ledcfg;
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
-		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin);
+		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pin);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -69,34 +60,25 @@  void rtl92ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 		break;
 	default:
 		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
-			"switch case %#x not processed\n", pled->ledpin);
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = false;
-}
-
-void rtl92ee_init_sw_leds(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-
-	_rtl92ee_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
-	_rtl92ee_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
 }
 
 static void _rtl92ee_sw_led_control(struct ieee80211_hw *hw,
 				    enum led_ctl_mode ledaction)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	switch (ledaction) {
 	case LED_CTL_POWER_ON:
 	case LED_CTL_LINK:
 	case LED_CTL_NO_LINK:
-		rtl92ee_sw_led_on(hw, pled0);
+		rtl92ee_sw_led_on(hw, pin0);
 		break;
 	case LED_CTL_POWER_OFF:
-		rtl92ee_sw_led_off(hw, pled0);
+		rtl92ee_sw_led_off(hw, pin0);
 		break;
 	default:
 		break;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.h
index 6d775e14846f..08b8ff328b63 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.h
@@ -4,9 +4,8 @@ 
 #ifndef __RTL92E_LED_H__
 #define __RTL92E_LED_H__
 
-void rtl92ee_init_sw_leds(struct ieee80211_hw *hw);
-void rtl92ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
-void rtl92ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl92ee_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl92ee_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin);
 void rtl92ee_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction);
 
 #endif
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c
index 7a16563b3a5d..616a47d8d97a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c
@@ -220,7 +220,6 @@  static struct rtl_hal_ops rtl8192ee_hal_ops = {
 	.tx_polling = rtl92ee_tx_polling,
 	.enable_hw_sec = rtl92ee_enable_hw_security_config,
 	.set_key = rtl92ee_set_key,
-	.init_sw_leds = rtl92ee_init_sw_leds,
 	.get_bbreg = rtl92ee_phy_query_bb_reg,
 	.set_bbreg = rtl92ee_phy_set_bb_reg,
 	.get_rfreg = rtl92ee_phy_query_rf_reg,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c
index 4ae8f69c64f9..e5775b94f04e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c
@@ -731,12 +731,12 @@  static void _rtl92se_macconfig_before_fwdownload(struct ieee80211_hw *hw)
 	/* After MACIO reset,we must refresh LED state. */
 	if ((ppsc->rfoff_reason == RF_CHANGE_BY_IPS) ||
 	   (ppsc->rfoff_reason == 0)) {
-		struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+		enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 		enum rf_pwrstate rfpwr_state_toset;
 		rfpwr_state_toset = _rtl92se_rf_onoff_detect(hw);
 
 		if (rfpwr_state_toset == ERFON)
-			rtl92se_sw_led_on(hw, pled0);
+			rtl92se_sw_led_on(hw, pin0);
 	}
 }
 
@@ -1371,15 +1371,15 @@  static void _rtl92se_gen_refreshledstate(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	if (rtlpci->up_first_time)
 		return;
 
 	if (rtlpriv->psc.rfoff_reason == RF_CHANGE_BY_IPS)
-		rtl92se_sw_led_on(hw, pled0);
+		rtl92se_sw_led_on(hw, pin0);
 	else
-		rtl92se_sw_led_off(hw, pled0);
+		rtl92se_sw_led_off(hw, pin0);
 }
 
 
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.c
index ecbf425f679f..7378d7493586 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.c
@@ -6,33 +6,17 @@ 
 #include "reg.h"
 #include "led.h"
 
-static void _rtl92se_init_led(struct ieee80211_hw *hw,
-			      struct rtl_led *pled, enum rtl_led_pin ledpin)
-{
-	pled->hw = hw;
-	pled->ledpin = ledpin;
-	pled->ledon = false;
-}
-
-void rtl92se_init_sw_leds(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-
-	_rtl92se_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
-	_rtl92se_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
-}
-
-void rtl92se_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl92se_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u8 ledcfg;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
-		LEDCFG, pled->ledpin);
+		LEDCFG, pin);
 
 	ledcfg = rtl_read_byte(rtlpriv, LEDCFG);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -42,14 +26,13 @@  void rtl92se_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
 		rtl_write_byte(rtlpriv, LEDCFG, ledcfg & 0x0f);
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = true;
 }
 
-void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl92se_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	struct rtl_priv *rtlpriv;
 	u8 ledcfg;
@@ -58,11 +41,11 @@  void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 	if (!rtlpriv || rtlpriv->max_fw_size)
 		return;
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
-		LEDCFG, pled->ledpin);
+		LEDCFG, pin);
 
 	ledcfg = rtl_read_byte(rtlpriv, LEDCFG);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -77,27 +60,26 @@  void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 		rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(3)));
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = false;
 }
 
 static void _rtl92se_sw_led_control(struct ieee80211_hw *hw,
 				    enum led_ctl_mode ledaction)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	switch (ledaction) {
 	case LED_CTL_POWER_ON:
 	case LED_CTL_LINK:
 	case LED_CTL_NO_LINK:
-		rtl92se_sw_led_on(hw, pled0);
+		rtl92se_sw_led_on(hw, pin0);
 		break;
 	case LED_CTL_POWER_OFF:
-		rtl92se_sw_led_off(hw, pled0);
+		rtl92se_sw_led_off(hw, pin0);
 		break;
 	default:
 		break;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.h
index c9e481a8d943..43fcc3c77bc1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.h
@@ -4,9 +4,8 @@ 
 #ifndef __REALTEK_PCI92SE_LED_H__
 #define __REALTEK_PCI92SE_LED_H__
 
-void rtl92se_init_sw_leds(struct ieee80211_hw *hw);
-void rtl92se_sw_led_on(struct ieee80211_hw *hw,	struct rtl_led *pled);
-void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl92se_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl92se_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin);
 void rtl92se_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction);
 
 #endif
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c
index 6d352a3161b8..30bce381c3bb 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c
@@ -260,7 +260,6 @@  static struct rtl_hal_ops rtl8192se_hal_ops = {
 	.tx_polling = rtl92se_tx_polling,
 	.enable_hw_sec = rtl92se_enable_hw_security_config,
 	.set_key = rtl92se_set_key,
-	.init_sw_leds = rtl92se_init_sw_leds,
 	.get_bbreg = rtl92s_phy_query_bb_reg,
 	.set_bbreg = rtl92s_phy_set_bb_reg,
 	.get_rfreg = rtl92s_phy_query_rf_reg,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
index 965d98b9b09f..d26d4c4314a3 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
@@ -643,17 +643,17 @@  static void _rtl8723e_gen_refresh_led_state(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	if (rtlpriv->rtlhal.up_first_time)
 		return;
 
 	if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS)
-		rtl8723e_sw_led_on(hw, pled0);
+		rtl8723e_sw_led_on(hw, pin0);
 	else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT)
-		rtl8723e_sw_led_on(hw, pled0);
+		rtl8723e_sw_led_on(hw, pin0);
 	else
-		rtl8723e_sw_led_off(hw, pled0);
+		rtl8723e_sw_led_off(hw, pin0);
 }
 
 static bool _rtl8712e_init_mac(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.c
index 7fab02e01a8c..b084f894ab93 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.c
@@ -6,23 +6,15 @@ 
 #include "reg.h"
 #include "led.h"
 
-static void _rtl8723e_init_led(struct ieee80211_hw *hw,
-			       struct rtl_led *pled, enum rtl_led_pin ledpin)
-{
-	pled->hw = hw;
-	pled->ledpin = ledpin;
-	pled->ledon = false;
-}
-
-void rtl8723e_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl8723e_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u8 ledcfg;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
-		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin);
+		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pin);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -36,24 +28,23 @@  void rtl8723e_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
 		rtl_write_byte(rtlpriv, REG_LEDCFG1, ledcfg & 0x10);
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = true;
 }
 
-void rtl8723e_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl8723e_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	u8 ledcfg;
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
-		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin);
+		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pin);
 
 	ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -77,35 +68,26 @@  void rtl8723e_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = false;
-}
-
-void rtl8723e_init_sw_leds(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-
-	_rtl8723e_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
-	_rtl8723e_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
 }
 
 static void _rtl8723e_sw_led_control(struct ieee80211_hw *hw,
 				     enum led_ctl_mode ledaction)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	switch (ledaction) {
 	case LED_CTL_POWER_ON:
 	case LED_CTL_LINK:
 	case LED_CTL_NO_LINK:
-		rtl8723e_sw_led_on(hw, pled0);
+		rtl8723e_sw_led_on(hw, pin0);
 		break;
 	case LED_CTL_POWER_OFF:
-		rtl8723e_sw_led_off(hw, pled0);
+		rtl8723e_sw_led_off(hw, pin0);
 		break;
 	default:
 		break;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.h
index 9f85845d23cd..6db5290da806 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.h
@@ -4,9 +4,8 @@ 
 #ifndef __RTL92CE_LED_H__
 #define __RTL92CE_LED_H__
 
-void rtl8723e_init_sw_leds(struct ieee80211_hw *hw);
-void rtl8723e_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
-void rtl8723e_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl8723e_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl8723e_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin);
 void rtl8723e_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction);
 
 #endif
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c
index 7828acb1de3f..c821436a1991 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c
@@ -223,7 +223,6 @@  static struct rtl_hal_ops rtl8723e_hal_ops = {
 	.tx_polling = rtl8723e_tx_polling,
 	.enable_hw_sec = rtl8723e_enable_hw_security_config,
 	.set_key = rtl8723e_set_key,
-	.init_sw_leds = rtl8723e_init_sw_leds,
 	.get_bbreg = rtl8723_phy_query_bb_reg,
 	.set_bbreg = rtl8723_phy_set_bb_reg,
 	.get_rfreg = rtl8723e_phy_query_rf_reg,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
index 0ba3bbed6ed3..15575644551f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
@@ -793,17 +793,17 @@  static void _rtl8723be_gen_refresh_led_state(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	if (rtlpriv->rtlhal.up_first_time)
 		return;
 
 	if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS)
-		rtl8723be_sw_led_on(hw, pled0);
+		rtl8723be_sw_led_on(hw, pin0);
 	else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT)
-		rtl8723be_sw_led_on(hw, pled0);
+		rtl8723be_sw_led_on(hw, pin0);
 	else
-		rtl8723be_sw_led_off(hw, pled0);
+		rtl8723be_sw_led_off(hw, pin0);
 }
 
 static bool _rtl8723be_init_mac(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.c
index 3954624ab314..ba20cb7509a9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.c
@@ -6,23 +6,15 @@ 
 #include "reg.h"
 #include "led.h"
 
-static void _rtl8723be_init_led(struct ieee80211_hw *hw,  struct rtl_led *pled,
-				enum rtl_led_pin ledpin)
-{
-	pled->hw = hw;
-	pled->ledpin = ledpin;
-	pled->ledon = false;
-}
-
-void rtl8723be_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl8723be_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u8 ledcfg;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
-		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin);
+		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pin);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -35,24 +27,23 @@  void rtl8723be_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
 		rtl_write_byte(rtlpriv, REG_LEDCFG1, ledcfg & 0x10);
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = true;
 }
 
-void rtl8723be_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl8723be_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	u8 ledcfg;
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
-		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin);
+		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pin);
 
 	ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -76,35 +67,26 @@  void rtl8723be_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 
 		break;
 	default:
-		pr_err("switch case %#x not processed\n",
-		       pled->ledpin);
+		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = false;
-}
-
-void rtl8723be_init_sw_leds(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-
-	_rtl8723be_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
-	_rtl8723be_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
 }
 
 static void _rtl8723be_sw_led_control(struct ieee80211_hw *hw,
 				      enum led_ctl_mode ledaction)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 
 	switch (ledaction) {
 	case LED_CTL_POWER_ON:
 	case LED_CTL_LINK:
 	case LED_CTL_NO_LINK:
-		rtl8723be_sw_led_on(hw, pled0);
+		rtl8723be_sw_led_on(hw, pin0);
 		break;
 	case LED_CTL_POWER_OFF:
-		rtl8723be_sw_led_off(hw, pled0);
+		rtl8723be_sw_led_off(hw, pin0);
 		break;
 	default:
 		break;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.h
index 8ac59374b632..3ca9277152f7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.h
@@ -4,9 +4,8 @@ 
 #ifndef __RTL8723BE_LED_H__
 #define __RTL8723BE_LED_H__
 
-void rtl8723be_init_sw_leds(struct ieee80211_hw *hw);
-void rtl8723be_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
-void rtl8723be_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl8723be_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl8723be_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin);
 void rtl8723be_led_control(struct ieee80211_hw *hw,
 			   enum led_ctl_mode ledaction);
 
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
index d220e8955e37..43b611d5288d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
@@ -227,7 +227,6 @@  static struct rtl_hal_ops rtl8723be_hal_ops = {
 	.tx_polling = rtl8723be_tx_polling,
 	.enable_hw_sec = rtl8723be_enable_hw_security_config,
 	.set_key = rtl8723be_set_key,
-	.init_sw_leds = rtl8723be_init_sw_leds,
 	.get_bbreg = rtl8723_phy_query_bb_reg,
 	.set_bbreg = rtl8723_phy_set_bb_reg,
 	.get_rfreg = rtl8723be_phy_query_rf_reg,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index a7e3250957dc..3f8f6da33b12 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -869,7 +869,7 @@  static void _rtl8821ae_gen_refresh_led_state(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
 
 	if (rtlpriv->rtlhal.up_first_time)
@@ -877,19 +877,19 @@  static void _rtl8821ae_gen_refresh_led_state(struct ieee80211_hw *hw)
 
 	if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS)
 		if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE)
-			rtl8812ae_sw_led_on(hw, pled0);
+			rtl8812ae_sw_led_on(hw, pin0);
 		else
-			rtl8821ae_sw_led_on(hw, pled0);
+			rtl8821ae_sw_led_on(hw, pin0);
 	else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT)
 		if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE)
-			rtl8812ae_sw_led_on(hw, pled0);
+			rtl8812ae_sw_led_on(hw, pin0);
 		else
-			rtl8821ae_sw_led_on(hw, pled0);
+			rtl8821ae_sw_led_on(hw, pin0);
 	else
 		if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE)
-			rtl8812ae_sw_led_off(hw, pled0);
+			rtl8812ae_sw_led_off(hw, pin0);
 		else
-			rtl8821ae_sw_led_off(hw, pled0);
+			rtl8821ae_sw_led_off(hw, pin0);
 }
 
 static bool _rtl8821ae_init_mac(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.c
index 7d6fb134c10f..8bd58db3b3c9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.c
@@ -6,24 +6,15 @@ 
 #include "reg.h"
 #include "led.h"
 
-static void _rtl8821ae_init_led(struct ieee80211_hw *hw,
-				struct rtl_led *pled,
-				enum rtl_led_pin ledpin)
-{
-	pled->hw = hw;
-	pled->ledpin = ledpin;
-	pled->ledon = false;
-}
-
-void rtl8821ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl8821ae_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u8 ledcfg;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
-		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin);
+		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pin);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -38,19 +29,18 @@  void rtl8821ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
 		break;
 	default:
 		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
-			"switch case %#x not processed\n", pled->ledpin);
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = true;
 }
 
-void rtl8812ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl8812ae_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u16	ledreg = REG_LEDCFG1;
 	u8	ledcfg = 0;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_LED0:
 		ledreg = REG_LEDCFG1;
 		break;
@@ -66,27 +56,26 @@  void rtl8812ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
 		"In SwLedOn, LedAddr:%X LEDPIN=%d\n",
-		ledreg, pled->ledpin);
+		ledreg, pin);
 
 	ledcfg =  rtl_read_byte(rtlpriv, ledreg);
 	ledcfg |= BIT(5); /*Set 0x4c[21]*/
 	ledcfg &= ~(BIT(7) | BIT(6) | BIT(3) | BIT(2) | BIT(1) | BIT(0));
 		/*Clear 0x4c[23:22] and 0x4c[19:16]*/
 	rtl_write_byte(rtlpriv, ledreg, ledcfg); /*SW control led0 on.*/
-	pled->ledon = true;
 }
 
-void rtl8821ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl8821ae_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	u8 ledcfg;
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
-		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin);
+		"LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pin);
 
 	ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_GPIO0:
 		break;
 	case LED_PIN_LED0:
@@ -110,18 +99,17 @@  void rtl8821ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 		break;
 	default:
 		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
-			"switch case %#x not processed\n", pled->ledpin);
+			"unknown LED pin %d\n", pin);
 		break;
 	}
-	pled->ledon = false;
 }
 
-void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin)
 {
 	u16 ledreg = REG_LEDCFG1;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
-	switch (pled->ledpin) {
+	switch (pin) {
 	case LED_PIN_LED0:
 		ledreg = REG_LEDCFG1;
 		break;
@@ -137,7 +125,7 @@  void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 
 	rtl_dbg(rtlpriv, COMP_LED, DBG_LOUD,
 		"In SwLedOff,LedAddr:%X LEDPIN=%d\n",
-		ledreg, pled->ledpin);
+		ledreg, pin);
 	/*Open-drain arrangement for controlling the LED*/
 	if (rtlpriv->ledctl.led_opendrain) {
 		u8 ledcfg = rtl_read_byte(rtlpriv, ledreg);
@@ -152,23 +140,13 @@  void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
 	} else {
 		rtl_write_byte(rtlpriv, ledreg, 0x28);
 	}
-
-	pled->ledon = false;
-}
-
-void rtl8821ae_init_sw_leds(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-
-	_rtl8821ae_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
-	_rtl8821ae_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
 }
 
 static void _rtl8821ae_sw_led_control(struct ieee80211_hw *hw,
 				      enum led_ctl_mode ledaction)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
+	enum rtl_led_pin pin0 = rtlpriv->ledctl.sw_led0;
 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
 
 	switch (ledaction) {
@@ -176,15 +154,15 @@  static void _rtl8821ae_sw_led_control(struct ieee80211_hw *hw,
 	case LED_CTL_LINK:
 	case LED_CTL_NO_LINK:
 		if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE)
-			rtl8812ae_sw_led_on(hw, pled0);
+			rtl8812ae_sw_led_on(hw, pin0);
 		else
-			rtl8821ae_sw_led_on(hw, pled0);
+			rtl8821ae_sw_led_on(hw, pin0);
 		break;
 	case LED_CTL_POWER_OFF:
 		if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE)
-			rtl8812ae_sw_led_off(hw, pled0);
+			rtl8812ae_sw_led_off(hw, pin0);
 		else
-			rtl8821ae_sw_led_off(hw, pled0);
+			rtl8821ae_sw_led_off(hw, pin0);
 		break;
 	default:
 		break;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.h
index 249a37a8d9db..76d5c0b0e39e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.h
@@ -4,11 +4,10 @@ 
 #ifndef __RTL8821AE_LED_H__
 #define __RTL8821AE_LED_H__
 
-void rtl8821ae_init_sw_leds(struct ieee80211_hw *hw);
-void rtl8821ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
-void rtl8812ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
-void rtl8821ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
-void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl8821ae_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl8812ae_sw_led_on(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl8821ae_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin);
+void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, enum rtl_led_pin pin);
 void rtl8821ae_led_control(struct ieee80211_hw *hw,
 			   enum led_ctl_mode ledaction);
 
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
index 950542a24e31..0bca542e103f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
@@ -269,7 +269,6 @@  static struct rtl_hal_ops rtl8821ae_hal_ops = {
 	.tx_polling = rtl8821ae_tx_polling,
 	.enable_hw_sec = rtl8821ae_enable_hw_security_config,
 	.set_key = rtl8821ae_set_key,
-	.init_sw_leds = rtl8821ae_init_sw_leds,
 	.get_bbreg = rtl8821ae_phy_query_bb_reg,
 	.set_bbreg = rtl8821ae_phy_set_bb_reg,
 	.get_rfreg = rtl8821ae_phy_query_rf_reg,
diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
index a8eebafb9a7e..969fb31d7985 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
@@ -1068,7 +1068,7 @@  int rtl_usb_probe(struct usb_interface *intf,
 		pr_err("Can't init_sw_vars\n");
 		goto error_out;
 	}
-	rtlpriv->cfg->ops->init_sw_leds(hw);
+	rtl_init_sw_leds(hw);
 
 	err = ieee80211_register_hw(hw);
 	if (err) {
@@ -1117,7 +1117,6 @@  void rtl_usb_disconnect(struct usb_interface *intf)
 	rtl_usb_deinit(hw);
 	rtl_deinit_core(hw);
 	kfree(rtlpriv->usb_data);
-	rtlpriv->cfg->ops->deinit_sw_leds(hw);
 	rtlpriv->cfg->ops->deinit_sw_vars(hw);
 	_rtl_usb_io_handler_release(hw);
 	usb_put_dev(rtlusb->udev);
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index a16b779080cb..5b4979771dbf 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -1070,18 +1070,10 @@  struct rtl_probe_rsp {
 	struct rtl_info_element info_element[];
 } __packed;
 
-/*LED related.*/
-/*ledpin Identify how to implement this SW led.*/
-struct rtl_led {
-	void *hw;
-	enum rtl_led_pin ledpin;
-	bool ledon;
-};
-
 struct rtl_led_ctl {
 	bool led_opendrain;
-	struct rtl_led sw_led0;
-	struct rtl_led sw_led1;
+	enum rtl_led_pin sw_led0;
+	enum rtl_led_pin sw_led1;
 };
 
 struct rtl_qos_parameters {
@@ -2287,8 +2279,6 @@  struct rtl_hal_ops {
 	void (*set_key)(struct ieee80211_hw *hw, u32 key_index,
 			u8 *macaddr, bool is_group, u8 enc_algo,
 			bool is_wepkey, bool clear_all);
-	void (*init_sw_leds)(struct ieee80211_hw *hw);
-	void (*deinit_sw_leds)(struct ieee80211_hw *hw);
 	u32 (*get_bbreg)(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask);
 	void (*set_bbreg)(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
 			  u32 data);