Commit d5efe153 authored by Larry Finger's avatar Larry Finger Committed by Kalle Valo

rtlwifi: Move items out of rtl_pci_priv and rtl_usb_priv

In commit 6773386f ("rtlwifi: rtl8192c-common: Fix "BUG: KASAN:"),
a BUG detected when CONFIG_KASAN=y was fixed by reordering the layouts
of struct rtl_pci_priv, and struct rtl_usb_priv so that the variables
used by both PCI and USB drivers have the same offsets in both structs.
The better fix of relocating the critical variables into struct rtl_priv
was deferred as these changes do not have to be applied to stable
kernels.

This change also removes CamelCase variables with pLed0 => pled0.
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent d0630555
...@@ -817,19 +817,18 @@ static bool _rtl88ee_llt_table_init(struct ieee80211_hw *hw) ...@@ -817,19 +817,18 @@ static bool _rtl88ee_llt_table_init(struct ieee80211_hw *hw)
static void _rtl88ee_gen_refresh_led_state(struct ieee80211_hw *hw) static void _rtl88ee_gen_refresh_led_state(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
if (rtlpriv->rtlhal.up_first_time) if (rtlpriv->rtlhal.up_first_time)
return; return;
if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS)
rtl88ee_sw_led_on(hw, pLed0); rtl88ee_sw_led_on(hw, pled0);
else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT) else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT)
rtl88ee_sw_led_on(hw, pLed0); rtl88ee_sw_led_on(hw, pled0);
else else
rtl88ee_sw_led_off(hw, pLed0); rtl88ee_sw_led_off(hw, pled0);
} }
static bool _rtl88ee_init_mac(struct ieee80211_hw *hw) static bool _rtl88ee_init_mac(struct ieee80211_hw *hw)
...@@ -1931,14 +1930,13 @@ static void _rtl88ee_read_adapter_info(struct ieee80211_hw *hw) ...@@ -1931,14 +1930,13 @@ static void _rtl88ee_read_adapter_info(struct ieee80211_hw *hw)
static void _rtl88ee_hal_customized_behavior(struct ieee80211_hw *hw) static void _rtl88ee_hal_customized_behavior(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
pcipriv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
switch (rtlhal->oem_id) { switch (rtlhal->oem_id) {
case RT_CID_819X_HP: case RT_CID_819X_HP:
pcipriv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
break; break;
case RT_CID_819X_LENOVO: case RT_CID_819X_LENOVO:
case RT_CID_DEFAULT: case RT_CID_DEFAULT:
......
...@@ -67,7 +67,6 @@ void rtl88ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -67,7 +67,6 @@ 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_off(struct ieee80211_hw *hw, struct rtl_led *pled)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
u8 ledcfg; u8 ledcfg;
RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD,
...@@ -79,7 +78,7 @@ void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -79,7 +78,7 @@ void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
case LED_PIN_LED0: case LED_PIN_LED0:
ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
ledcfg &= 0xf0; ledcfg &= 0xf0;
if (pcipriv->ledctl.led_opendrain) { if (rtlpriv->ledctl.led_opendrain) {
rtl_write_byte(rtlpriv, REG_LEDCFG2, rtl_write_byte(rtlpriv, REG_LEDCFG2,
(ledcfg | BIT(3) | BIT(5) | BIT(6))); (ledcfg | BIT(3) | BIT(5) | BIT(6)));
ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG); ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG);
...@@ -104,24 +103,26 @@ void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -104,24 +103,26 @@ void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
void rtl88ee_init_sw_leds(struct ieee80211_hw *hw) void rtl88ee_init_sw_leds(struct ieee80211_hw *hw)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
_rtl88ee_init_led(hw, &pcipriv->ledctl.sw_led0, LED_PIN_LED0);
_rtl88ee_init_led(hw, &pcipriv->ledctl.sw_led1, LED_PIN_LED1); _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, static void _rtl88ee_sw_led_control(struct ieee80211_hw *hw,
enum led_ctl_mode ledaction) enum led_ctl_mode ledaction)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
switch (ledaction) { switch (ledaction) {
case LED_CTL_POWER_ON: case LED_CTL_POWER_ON:
case LED_CTL_LINK: case LED_CTL_LINK:
case LED_CTL_NO_LINK: case LED_CTL_NO_LINK:
rtl88ee_sw_led_on(hw, pLed0); rtl88ee_sw_led_on(hw, pled0);
break; break;
case LED_CTL_POWER_OFF: case LED_CTL_POWER_OFF:
rtl88ee_sw_led_off(hw, pLed0); rtl88ee_sw_led_off(hw, pled0);
break; break;
default: default:
break; break;
......
...@@ -67,7 +67,6 @@ void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -67,7 +67,6 @@ 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_off(struct ieee80211_hw *hw, struct rtl_led *pled)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
u8 ledcfg; u8 ledcfg;
RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
...@@ -80,7 +79,7 @@ void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -80,7 +79,7 @@ void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
break; break;
case LED_PIN_LED0: case LED_PIN_LED0:
ledcfg &= 0xf0; ledcfg &= 0xf0;
if (pcipriv->ledctl.led_opendrain) if (rtlpriv->ledctl.led_opendrain)
rtl_write_byte(rtlpriv, REG_LEDCFG2, rtl_write_byte(rtlpriv, REG_LEDCFG2,
(ledcfg | BIT(1) | BIT(5) | BIT(6))); (ledcfg | BIT(1) | BIT(5) | BIT(6)));
else else
...@@ -100,24 +99,26 @@ void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -100,24 +99,26 @@ void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
void rtl92ce_init_sw_leds(struct ieee80211_hw *hw) void rtl92ce_init_sw_leds(struct ieee80211_hw *hw)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
_rtl92ce_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0);
_rtl92ce_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1); _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, static void _rtl92ce_sw_led_control(struct ieee80211_hw *hw,
enum led_ctl_mode ledaction) enum led_ctl_mode ledaction)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
switch (ledaction) { switch (ledaction) {
case LED_CTL_POWER_ON: case LED_CTL_POWER_ON:
case LED_CTL_LINK: case LED_CTL_LINK:
case LED_CTL_NO_LINK: case LED_CTL_NO_LINK:
rtl92ce_sw_led_on(hw, pLed0); rtl92ce_sw_led_on(hw, pled0);
break; break;
case LED_CTL_POWER_OFF: case LED_CTL_POWER_OFF:
rtl92ce_sw_led_off(hw, pLed0); rtl92ce_sw_led_off(hw, pled0);
break; break;
default: default:
break; break;
......
...@@ -393,12 +393,11 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw) ...@@ -393,12 +393,11 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw)
static void _rtl92cu_hal_customized_behavior(struct ieee80211_hw *hw) static void _rtl92cu_hal_customized_behavior(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
switch (rtlhal->oem_id) { switch (rtlhal->oem_id) {
case RT_CID_819X_HP: case RT_CID_819X_HP:
usb_priv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
break; break;
case RT_CID_819X_LENOVO: case RT_CID_819X_LENOVO:
case RT_CID_DEFAULT: case RT_CID_DEFAULT:
......
...@@ -67,7 +67,6 @@ void rtl92cu_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -67,7 +67,6 @@ 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_off(struct ieee80211_hw *hw, struct rtl_led *pled)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw);
u8 ledcfg; u8 ledcfg;
RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
...@@ -78,7 +77,7 @@ void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -78,7 +77,7 @@ void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
break; break;
case LED_PIN_LED0: case LED_PIN_LED0:
ledcfg &= 0xf0; ledcfg &= 0xf0;
if (usbpriv->ledctl.led_opendrain) if (rtlpriv->ledctl.led_opendrain)
rtl_write_byte(rtlpriv, REG_LEDCFG2, rtl_write_byte(rtlpriv, REG_LEDCFG2,
(ledcfg | BIT(1) | BIT(5) | BIT(6))); (ledcfg | BIT(1) | BIT(5) | BIT(6)));
else else
...@@ -99,16 +98,18 @@ void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -99,16 +98,18 @@ void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
void rtl92cu_init_sw_leds(struct ieee80211_hw *hw) void rtl92cu_init_sw_leds(struct ieee80211_hw *hw)
{ {
struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
_rtl92cu_init_led(hw, &(usbpriv->ledctl.sw_led0), LED_PIN_LED0);
_rtl92cu_init_led(hw, &(usbpriv->ledctl.sw_led1), LED_PIN_LED1); _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) void rtl92cu_deinit_sw_leds(struct ieee80211_hw *hw)
{ {
struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
_rtl92cu_deInit_led(&(usbpriv->ledctl.sw_led0));
_rtl92cu_deInit_led(&(usbpriv->ledctl.sw_led1)); _rtl92cu_deInit_led(&rtlpriv->ledctl.sw_led0);
_rtl92cu_deInit_led(&rtlpriv->ledctl.sw_led1);
} }
static void _rtl92cu_sw_led_control(struct ieee80211_hw *hw, static void _rtl92cu_sw_led_control(struct ieee80211_hw *hw,
......
...@@ -614,19 +614,19 @@ static bool _rtl92de_llt_table_init(struct ieee80211_hw *hw) ...@@ -614,19 +614,19 @@ static bool _rtl92de_llt_table_init(struct ieee80211_hw *hw)
static void _rtl92de_gen_refresh_led_state(struct ieee80211_hw *hw) static void _rtl92de_gen_refresh_led_state(struct ieee80211_hw *hw)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
if (rtlpci->up_first_time) if (rtlpci->up_first_time)
return; return;
if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS)
rtl92de_sw_led_on(hw, pLed0); rtl92de_sw_led_on(hw, pled0);
else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT) else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT)
rtl92de_sw_led_on(hw, pLed0); rtl92de_sw_led_on(hw, pled0);
else else
rtl92de_sw_led_off(hw, pLed0); rtl92de_sw_led_off(hw, pled0);
} }
static bool _rtl92de_init_mac(struct ieee80211_hw *hw) static bool _rtl92de_init_mac(struct ieee80211_hw *hw)
......
...@@ -76,7 +76,6 @@ void rtl92de_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -76,7 +76,6 @@ 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_off(struct ieee80211_hw *hw, struct rtl_led *pled)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
u8 ledcfg; u8 ledcfg;
RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
...@@ -89,7 +88,7 @@ void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -89,7 +88,7 @@ void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
break; break;
case LED_PIN_LED0: case LED_PIN_LED0:
ledcfg &= 0xf0; ledcfg &= 0xf0;
if (pcipriv->ledctl.led_opendrain) if (rtlpriv->ledctl.led_opendrain)
rtl_write_byte(rtlpriv, REG_LEDCFG2, rtl_write_byte(rtlpriv, REG_LEDCFG2,
(ledcfg | BIT(1) | BIT(5) | BIT(6))); (ledcfg | BIT(1) | BIT(5) | BIT(6)));
else else
...@@ -110,24 +109,26 @@ void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -110,24 +109,26 @@ void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
void rtl92de_init_sw_leds(struct ieee80211_hw *hw) void rtl92de_init_sw_leds(struct ieee80211_hw *hw)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
_rtl92ce_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0);
_rtl92ce_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1); _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, static void _rtl92ce_sw_led_control(struct ieee80211_hw *hw,
enum led_ctl_mode ledaction) enum led_ctl_mode ledaction)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
switch (ledaction) { switch (ledaction) {
case LED_CTL_POWER_ON: case LED_CTL_POWER_ON:
case LED_CTL_LINK: case LED_CTL_LINK:
case LED_CTL_NO_LINK: case LED_CTL_NO_LINK:
rtl92de_sw_led_on(hw, pLed0); rtl92de_sw_led_on(hw, pled0);
break; break;
case LED_CTL_POWER_OFF: case LED_CTL_POWER_OFF:
rtl92de_sw_led_off(hw, pLed0); rtl92de_sw_led_off(hw, pled0);
break; break;
default: default:
break; break;
......
...@@ -735,9 +735,8 @@ static bool _rtl92ee_llt_table_init(struct ieee80211_hw *hw) ...@@ -735,9 +735,8 @@ static bool _rtl92ee_llt_table_init(struct ieee80211_hw *hw)
static void _rtl92ee_gen_refresh_led_state(struct ieee80211_hw *hw) static void _rtl92ee_gen_refresh_led_state(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
struct rtl_led *pled0 = &pcipriv->ledctl.sw_led0; struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
if (rtlpriv->rtlhal.up_first_time) if (rtlpriv->rtlhal.up_first_time)
return; return;
...@@ -2166,10 +2165,9 @@ static void _rtl92ee_read_adapter_info(struct ieee80211_hw *hw) ...@@ -2166,10 +2165,9 @@ static void _rtl92ee_read_adapter_info(struct ieee80211_hw *hw)
static void _rtl92ee_hal_customized_behavior(struct ieee80211_hw *hw) static void _rtl92ee_hal_customized_behavior(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
pcipriv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
"RT Customized ID: 0x%02X\n", rtlhal->oem_id); "RT Customized ID: 0x%02X\n", rtlhal->oem_id);
......
...@@ -99,26 +99,26 @@ void rtl92ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -99,26 +99,26 @@ void rtl92ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
void rtl92ee_init_sw_leds(struct ieee80211_hw *hw) void rtl92ee_init_sw_leds(struct ieee80211_hw *hw)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
_rtl92ee_init_led(hw, &pcipriv->ledctl.sw_led0, LED_PIN_LED0); _rtl92ee_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
_rtl92ee_init_led(hw, &pcipriv->ledctl.sw_led1, LED_PIN_LED1); _rtl92ee_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
} }
static void _rtl92ee_sw_led_control(struct ieee80211_hw *hw, static void _rtl92ee_sw_led_control(struct ieee80211_hw *hw,
enum led_ctl_mode ledaction) enum led_ctl_mode ledaction)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_led *pLed0 = &pcipriv->ledctl.sw_led0; struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
switch (ledaction) { switch (ledaction) {
case LED_CTL_POWER_ON: case LED_CTL_POWER_ON:
case LED_CTL_LINK: case LED_CTL_LINK:
case LED_CTL_NO_LINK: case LED_CTL_NO_LINK:
rtl92ee_sw_led_on(hw, pLed0); rtl92ee_sw_led_on(hw, pled0);
break; break;
case LED_CTL_POWER_OFF: case LED_CTL_POWER_OFF:
rtl92ee_sw_led_off(hw, pLed0); rtl92ee_sw_led_off(hw, pled0);
break; break;
default: default:
break; break;
......
...@@ -753,13 +753,12 @@ static void _rtl92se_macconfig_before_fwdownload(struct ieee80211_hw *hw) ...@@ -753,13 +753,12 @@ static void _rtl92se_macconfig_before_fwdownload(struct ieee80211_hw *hw)
/* After MACIO reset,we must refresh LED state. */ /* After MACIO reset,we must refresh LED state. */
if ((ppsc->rfoff_reason == RF_CHANGE_BY_IPS) || if ((ppsc->rfoff_reason == RF_CHANGE_BY_IPS) ||
(ppsc->rfoff_reason == 0)) { (ppsc->rfoff_reason == 0)) {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0);
enum rf_pwrstate rfpwr_state_toset; enum rf_pwrstate rfpwr_state_toset;
rfpwr_state_toset = _rtl92se_rf_onoff_detect(hw); rfpwr_state_toset = _rtl92se_rf_onoff_detect(hw);
if (rfpwr_state_toset == ERFON) if (rfpwr_state_toset == ERFON)
rtl92se_sw_led_on(hw, pLed0); rtl92se_sw_led_on(hw, pled0);
} }
} }
...@@ -1395,16 +1394,15 @@ static void _rtl92se_gen_refreshledstate(struct ieee80211_hw *hw) ...@@ -1395,16 +1394,15 @@ static void _rtl92se_gen_refreshledstate(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0);
if (rtlpci->up_first_time == 1) if (rtlpci->up_first_time == 1)
return; return;
if (rtlpriv->psc.rfoff_reason == RF_CHANGE_BY_IPS) if (rtlpriv->psc.rfoff_reason == RF_CHANGE_BY_IPS)
rtl92se_sw_led_on(hw, pLed0); rtl92se_sw_led_on(hw, pled0);
else else
rtl92se_sw_led_off(hw, pLed0); rtl92se_sw_led_off(hw, pled0);
} }
......
...@@ -38,9 +38,10 @@ static void _rtl92se_init_led(struct ieee80211_hw *hw, ...@@ -38,9 +38,10 @@ static void _rtl92se_init_led(struct ieee80211_hw *hw,
void rtl92se_init_sw_leds(struct ieee80211_hw *hw) void rtl92se_init_sw_leds(struct ieee80211_hw *hw)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
_rtl92se_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0);
_rtl92se_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1); _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, struct rtl_led *pled)
...@@ -73,7 +74,6 @@ void rtl92se_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -73,7 +74,6 @@ 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_off(struct ieee80211_hw *hw, struct rtl_led *pled)
{ {
struct rtl_priv *rtlpriv; struct rtl_priv *rtlpriv;
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
u8 ledcfg; u8 ledcfg;
rtlpriv = rtl_priv(hw); rtlpriv = rtl_priv(hw);
...@@ -89,7 +89,7 @@ void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -89,7 +89,7 @@ void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
break; break;
case LED_PIN_LED0: case LED_PIN_LED0:
ledcfg &= 0xf0; ledcfg &= 0xf0;
if (pcipriv->ledctl.led_opendrain) if (rtlpriv->ledctl.led_opendrain)
rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(1))); rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(1)));
else else
rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(3))); rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(3)));
...@@ -109,16 +109,17 @@ void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -109,16 +109,17 @@ void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
static void _rtl92se_sw_led_control(struct ieee80211_hw *hw, static void _rtl92se_sw_led_control(struct ieee80211_hw *hw,
enum led_ctl_mode ledaction) enum led_ctl_mode ledaction)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
switch (ledaction) { switch (ledaction) {
case LED_CTL_POWER_ON: case LED_CTL_POWER_ON:
case LED_CTL_LINK: case LED_CTL_LINK:
case LED_CTL_NO_LINK: case LED_CTL_NO_LINK:
rtl92se_sw_led_on(hw, pLed0); rtl92se_sw_led_on(hw, pled0);
break; break;
case LED_CTL_POWER_OFF: case LED_CTL_POWER_OFF:
rtl92se_sw_led_off(hw, pLed0); rtl92se_sw_led_off(hw, pled0);
break; break;
default: default:
break; break;
......
...@@ -664,9 +664,8 @@ static bool _rtl8723e_llt_table_init(struct ieee80211_hw *hw) ...@@ -664,9 +664,8 @@ static bool _rtl8723e_llt_table_init(struct ieee80211_hw *hw)
static void _rtl8723e_gen_refresh_led_state(struct ieee80211_hw *hw) static void _rtl8723e_gen_refresh_led_state(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
struct rtl_led *pled0 = &pcipriv->ledctl.sw_led0; struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
if (rtlpriv->rtlhal.up_first_time) if (rtlpriv->rtlhal.up_first_time)
return; return;
...@@ -1790,13 +1789,12 @@ static void _rtl8723e_read_adapter_info(struct ieee80211_hw *hw, ...@@ -1790,13 +1789,12 @@ static void _rtl8723e_read_adapter_info(struct ieee80211_hw *hw,
static void _rtl8723e_hal_customized_behavior(struct ieee80211_hw *hw) static void _rtl8723e_hal_customized_behavior(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
pcipriv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
switch (rtlhal->oem_id) { switch (rtlhal->oem_id) {
case RT_CID_819X_HP: case RT_CID_819X_HP:
pcipriv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
break; break;
case RT_CID_819X_LENOVO: case RT_CID_819X_LENOVO:
case RT_CID_DEFAULT: case RT_CID_DEFAULT:
......
...@@ -68,7 +68,6 @@ void rtl8723e_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -68,7 +68,6 @@ 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_off(struct ieee80211_hw *hw, struct rtl_led *pled)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
u8 ledcfg; u8 ledcfg;
RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD,
...@@ -81,7 +80,7 @@ void rtl8723e_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -81,7 +80,7 @@ void rtl8723e_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
break; break;
case LED_PIN_LED0: case LED_PIN_LED0:
ledcfg &= 0xf0; ledcfg &= 0xf0;
if (pcipriv->ledctl.led_opendrain) { if (rtlpriv->ledctl.led_opendrain) {
ledcfg &= 0x90; /* Set to software control. */ ledcfg &= 0x90; /* Set to software control. */
rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg|BIT(3))); rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg|BIT(3)));
ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG); ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG);
...@@ -109,24 +108,26 @@ void rtl8723e_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -109,24 +108,26 @@ void rtl8723e_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
void rtl8723e_init_sw_leds(struct ieee80211_hw *hw) void rtl8723e_init_sw_leds(struct ieee80211_hw *hw)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
_rtl8723e_init_led(hw, &pcipriv->ledctl.sw_led0, LED_PIN_LED0);
_rtl8723e_init_led(hw, &pcipriv->ledctl.sw_led1, LED_PIN_LED1); _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, static void _rtl8723e_sw_led_control(struct ieee80211_hw *hw,
enum led_ctl_mode ledaction) enum led_ctl_mode ledaction)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
switch (ledaction) { switch (ledaction) {
case LED_CTL_POWER_ON: case LED_CTL_POWER_ON:
case LED_CTL_LINK: case LED_CTL_LINK:
case LED_CTL_NO_LINK: case LED_CTL_NO_LINK:
rtl8723e_sw_led_on(hw, pLed0); rtl8723e_sw_led_on(hw, pled0);
break; break;
case LED_CTL_POWER_OFF: case LED_CTL_POWER_OFF:
rtl8723e_sw_led_off(hw, pLed0); rtl8723e_sw_led_off(hw, pled0);
break; break;
default: default:
break; break;
......
...@@ -809,9 +809,8 @@ static bool _rtl8723be_llt_table_init(struct ieee80211_hw *hw) ...@@ -809,9 +809,8 @@ static bool _rtl8723be_llt_table_init(struct ieee80211_hw *hw)
static void _rtl8723be_gen_refresh_led_state(struct ieee80211_hw *hw) static void _rtl8723be_gen_refresh_led_state(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
struct rtl_led *pled0 = &(pcipriv->ledctl.sw_led0); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
if (rtlpriv->rtlhal.up_first_time) if (rtlpriv->rtlhal.up_first_time)
return; return;
...@@ -2228,13 +2227,12 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, ...@@ -2228,13 +2227,12 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw,
static void _rtl8723be_hal_customized_behavior(struct ieee80211_hw *hw) static void _rtl8723be_hal_customized_behavior(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
pcipriv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
switch (rtlhal->oem_id) { switch (rtlhal->oem_id) {
case RT_CID_819X_HP: case RT_CID_819X_HP:
pcipriv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
break; break;
case RT_CID_819X_LENOVO: case RT_CID_819X_LENOVO:
case RT_CID_DEFAULT: case RT_CID_DEFAULT:
......
...@@ -67,7 +67,6 @@ void rtl8723be_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -67,7 +67,6 @@ 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_off(struct ieee80211_hw *hw, struct rtl_led *pled)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
u8 ledcfg; u8 ledcfg;
RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD,
...@@ -80,7 +79,7 @@ void rtl8723be_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -80,7 +79,7 @@ void rtl8723be_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
break; break;
case LED_PIN_LED0: case LED_PIN_LED0:
ledcfg &= 0xf0; ledcfg &= 0xf0;
if (pcipriv->ledctl.led_opendrain) { if (rtlpriv->ledctl.led_opendrain) {
ledcfg &= 0x90; /* Set to software control. */ ledcfg &= 0x90; /* Set to software control. */
rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg|BIT(3))); rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg|BIT(3)));
ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG); ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG);
...@@ -108,16 +107,18 @@ void rtl8723be_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -108,16 +107,18 @@ void rtl8723be_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
void rtl8723be_init_sw_leds(struct ieee80211_hw *hw) void rtl8723be_init_sw_leds(struct ieee80211_hw *hw)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
_rtl8723be_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0);
_rtl8723be_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1); _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, static void _rtl8723be_sw_led_control(struct ieee80211_hw *hw,
enum led_ctl_mode ledaction) enum led_ctl_mode ledaction)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_led *pled0 = &(pcipriv->ledctl.sw_led0); struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
switch (ledaction) { switch (ledaction) {
case LED_CTL_POWER_ON: case LED_CTL_POWER_ON:
case LED_CTL_LINK: case LED_CTL_LINK:
......
...@@ -890,9 +890,8 @@ static bool _rtl8821ae_llt_table_init(struct ieee80211_hw *hw) ...@@ -890,9 +890,8 @@ static bool _rtl8821ae_llt_table_init(struct ieee80211_hw *hw)
static void _rtl8821ae_gen_refresh_led_state(struct ieee80211_hw *hw) static void _rtl8821ae_gen_refresh_led_state(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
struct rtl_led *pled0 = &pcipriv->ledctl.sw_led0; struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
if (rtlpriv->rtlhal.up_first_time) if (rtlpriv->rtlhal.up_first_time)
...@@ -3098,7 +3097,6 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_ ...@@ -3098,7 +3097,6 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
int params[] = {RTL_EEPROM_ID, EEPROM_VID, EEPROM_DID, int params[] = {RTL_EEPROM_ID, EEPROM_VID, EEPROM_DID,
EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR,
EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
...@@ -3193,7 +3191,7 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_ ...@@ -3193,7 +3191,7 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_
"SWAS: bHwAntDiv = %x, TRxAntDivType = %x\n", "SWAS: bHwAntDiv = %x, TRxAntDivType = %x\n",
rtlefuse->antenna_div_cfg, rtlefuse->antenna_div_type); rtlefuse->antenna_div_cfg, rtlefuse->antenna_div_type);
pcipriv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
if (rtlhal->oem_id == RT_CID_DEFAULT) { if (rtlhal->oem_id == RT_CID_DEFAULT) {
switch (rtlefuse->eeprom_oemid) { switch (rtlefuse->eeprom_oemid) {
...@@ -3224,10 +3222,10 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_ ...@@ -3224,10 +3222,10 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
pcipriv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
switch (rtlhal->oem_id) { switch (rtlhal->oem_id) {
case RT_CID_819X_HP: case RT_CID_819X_HP:
pcipriv->ledctl.led_opendrain = true; rtlpriv->ledctl.led_opendrain = true;
break; break;
case RT_CID_819X_LENOVO: case RT_CID_819X_LENOVO:
case RT_CID_DEFAULT: case RT_CID_DEFAULT:
......
...@@ -101,7 +101,6 @@ void rtl8812ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -101,7 +101,6 @@ 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 rtl8821ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
u8 ledcfg; u8 ledcfg;
RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD,
...@@ -114,7 +113,7 @@ void rtl8821ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -114,7 +113,7 @@ void rtl8821ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
break; break;
case LED_PIN_LED0: case LED_PIN_LED0:
ledcfg &= 0xf0; ledcfg &= 0xf0;
if (pcipriv->ledctl.led_opendrain) { if (rtlpriv->ledctl.led_opendrain) {
ledcfg &= 0x90; /* Set to software control. */ ledcfg &= 0x90; /* Set to software control. */
rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg|BIT(3))); rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg|BIT(3)));
ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG); ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG);
...@@ -143,7 +142,6 @@ void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -143,7 +142,6 @@ void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
{ {
u16 ledreg = REG_LEDCFG1; u16 ledreg = REG_LEDCFG1;
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
switch (pled->ledpin) { switch (pled->ledpin) {
case LED_PIN_LED0: case LED_PIN_LED0:
...@@ -163,7 +161,7 @@ void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -163,7 +161,7 @@ void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
"In SwLedOff,LedAddr:%X LEDPIN=%d\n", "In SwLedOff,LedAddr:%X LEDPIN=%d\n",
ledreg, pled->ledpin); ledreg, pled->ledpin);
/*Open-drain arrangement for controlling the LED*/ /*Open-drain arrangement for controlling the LED*/
if (pcipriv->ledctl.led_opendrain) { if (rtlpriv->ledctl.led_opendrain) {
u8 ledcfg = rtl_read_byte(rtlpriv, ledreg); u8 ledcfg = rtl_read_byte(rtlpriv, ledreg);
ledreg &= 0xd0; /* Set to software control.*/ ledreg &= 0xd0; /* Set to software control.*/
...@@ -182,17 +180,17 @@ void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) ...@@ -182,17 +180,17 @@ void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
void rtl8821ae_init_sw_leds(struct ieee80211_hw *hw) void rtl8821ae_init_sw_leds(struct ieee80211_hw *hw)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
_rtl8821ae_init_led(hw, &pcipriv->ledctl.sw_led0, LED_PIN_LED0); _rtl8821ae_init_led(hw, &rtlpriv->ledctl.sw_led0, LED_PIN_LED0);
_rtl8821ae_init_led(hw, &pcipriv->ledctl.sw_led1, LED_PIN_LED1); _rtl8821ae_init_led(hw, &rtlpriv->ledctl.sw_led1, LED_PIN_LED1);
} }
static void _rtl8821ae_sw_led_control(struct ieee80211_hw *hw, static void _rtl8821ae_sw_led_control(struct ieee80211_hw *hw,
enum led_ctl_mode ledaction) enum led_ctl_mode ledaction)
{ {
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_led *pLed0 = &pcipriv->ledctl.sw_led0; struct rtl_led *pled0 = &rtlpriv->ledctl.sw_led0;
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
switch (ledaction) { switch (ledaction) {
...@@ -200,15 +198,15 @@ static void _rtl8821ae_sw_led_control(struct ieee80211_hw *hw, ...@@ -200,15 +198,15 @@ static void _rtl8821ae_sw_led_control(struct ieee80211_hw *hw,
case LED_CTL_LINK: case LED_CTL_LINK:
case LED_CTL_NO_LINK: case LED_CTL_NO_LINK:
if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE)
rtl8812ae_sw_led_on(hw, pLed0); rtl8812ae_sw_led_on(hw, pled0);
else else
rtl8821ae_sw_led_on(hw, pLed0); rtl8821ae_sw_led_on(hw, pled0);
break; break;
case LED_CTL_POWER_OFF: case LED_CTL_POWER_OFF:
if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE)
rtl8812ae_sw_led_off(hw, pLed0); rtl8812ae_sw_led_off(hw, pled0);
else else
rtl8821ae_sw_led_off(hw, pLed0); rtl8821ae_sw_led_off(hw, pled0);
break; break;
default: default:
break; break;
......
...@@ -147,7 +147,6 @@ struct rtl_usb { ...@@ -147,7 +147,6 @@ struct rtl_usb {
struct rtl_usb_priv { struct rtl_usb_priv {
struct bt_coexist_info bt_coexist; struct bt_coexist_info bt_coexist;
struct rtl_led_ctl ledctl;
struct rtl_usb dev; struct rtl_usb dev;
}; };
......
...@@ -2583,6 +2583,7 @@ struct rtl_priv { ...@@ -2583,6 +2583,7 @@ struct rtl_priv {
struct rtl_dm dm; struct rtl_dm dm;
struct rtl_security sec; struct rtl_security sec;
struct rtl_efuse efuse; struct rtl_efuse efuse;
struct rtl_led_ctl ledctl;
struct rtl_ps_ctl psc; struct rtl_ps_ctl psc;
struct rate_adaptive ra; struct rate_adaptive ra;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment