staging: r8188eu: make power sequences static
PATCH 1/1 staging: r8188eu: make power sequences static
Simplify the handling of "power sequences". At the moment, this is rather complicated:
The hal layer calls HalPwrSeqCmdParsing. This function takes a pointer to a power sequence. The sequences themselves are defined as global variables in a separate file. There's an alias for each sequence, the callers of HalPwrSeqCmdParsing use these aliases instead of the sequences themselves.
There's no point in passing the sequences around. We can move the sequences into the same file as the HalPwrSeqCmdParsing function where they are used. Callers of HalPwrSeqCmdParsing can refer to a sequence by using a numeric define rather than a pointer to the sequence.
--- drivers/staging/r8188eu/Makefile | 1 - drivers/staging/r8188eu/hal/Hal8188EPwrSeq.c | 45 --------------- drivers/staging/r8188eu/hal/HalPwrSeqCmd.c | 57 ++++++++++++++++++- drivers/staging/r8188eu/hal/usb_halinit.c | 8 +-- .../staging/r8188eu/include/Hal8188EPwrSeq.h | 13 ----- .../staging/r8188eu/include/HalPwrSeqCmd.h | 8 ++- .../staging/r8188eu/include/rtl8188e_hal.h | 5 -- 7 files changed, 67 insertions(+), 70 deletions(-) delete mode 100644 drivers/staging/r8188eu/hal/Hal8188EPwrSeq.c delete mode 100644 drivers/staging/r8188eu/include/Hal8188EPwrSeq.h
drivers/staging/r8188eu/Makefile +0 -1
@@ -5,7 +5,6 @@ r8188eu-y = \ hal/HalHWImg8188E_RF.o \ hal/HalPhyRf_8188e.o \ hal/HalPwrSeqCmd.o \ - hal/Hal8188EPwrSeq.o \ hal/Hal8188ERateAdaptive.o \ hal/hal_intf.o \ hal/hal_com.o \
drivers/staging/r8188eu/hal/Hal8188EPwrSeq.c deleted +0 -45
45 lines not on this page · raw message
drivers/staging/r8188eu/hal/HalPwrSeqCmd.c +56 -1
71 lines not on this page · raw message
drivers/staging/r8188eu/hal/usb_halinit.c +4 -4
@@ -11,7 +11,7 @@#include "../include/rtw_iol.h" #include "../include/usb_ops.h" #include "../include/usb_osintf.h" -#include "../include/Hal8188EPwrSeq.h" +#include "../include/HalPwrSeqCmd.h" static void _ConfigNormalChipOutEP_8188E (struct adapter *adapt,u8 NumOutPipe) {
@@ -59,7 +59,7 @@ u32 rtl8188eu_InitPowerOn(struct adapter *adapt)if (haldata->bMacPwrCtrlOn)return _SUCCESS; -if (!HalPwrSeqCmdParsing (adapt, Rtl8188E_NIC_PWR_ON_FLOW)) +if (!HalPwrSeqCmdParsing (adapt,PWR_ON_FLOW ))return _FAIL;/* Enable MAC DMA/WMAC/SCHEDULE/SEC block */
@@ -798,7 +798,7 @@ static void CardDisableRTL8188EU(struct adapter *Adapter)rtw_write8 (Adapter,REG_CR ,0x0 );/* Run LPS WL RFOFF flow */ -HalPwrSeqCmdParsing (Adapter, Rtl8188E_NIC_LPS_ENTER_FLOW); +HalPwrSeqCmdParsing (Adapter,LPS_ENTER_FLOW );/* 2. 0x1F[7:0] = 0 turn off RF */
@@ -828,7 +828,7 @@ static void CardDisableRTL8188EU(struct adapter *Adapter)rtw_write8 (Adapter,REG_32K_CTRL , val8 & (~BIT (0 )));/* Card disable power action flow */ -HalPwrSeqCmdParsing (Adapter, Rtl8188E_NIC_DISABLE_FLOW); +HalPwrSeqCmdParsing (Adapter,DISABLE_FLOW );/* Reset MCU IO Wrapper */ res =rtw_read8 (Adapter,REG_RSV_CTRL +1 , &val8);
drivers/staging/r8188eu/include/Hal8188EPwrSeq.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright(c) 2007 - 2011 Realtek Corporation. */ - -#ifndef __HAL8188EPWRSEQ_H__ -#define __HAL8188EPWRSEQ_H__ - -#include "HalPwrSeqCmd.h" - -extern struct wl_pwr_cfg rtl8188E_power_on_flow[]; -extern struct wl_pwr_cfg rtl8188E_card_disable_flow[]; -extern struct wl_pwr_cfg rtl8188E_enter_lps_flow[]; - -#endif /* __HAL8188EPWRSEQ_H__ */
drivers/staging/r8188eu/include/HalPwrSeqCmd.h +7 -1
@@ -53,7 +53,13 @@ struct wl_pwr_cfg {#define GET_PWR_CFG_MASK (__PWR_CMD) __PWR_CMD.msk#define GET_PWR_CFG_VALUE (__PWR_CMD) __PWR_CMD.value +enum r8188eu_pwr_seq { +PWR_ON_FLOW , +DISABLE_FLOW , +LPS_ENTER_FLOW , +}; +/* Prototype of protected function. */ -u8 HalPwrSeqCmdParsing (struct adapter *padapter,struct wl_pwr_cfg PwrCfgCmd[]); +u8 HalPwrSeqCmdParsing (struct adapter *padapter,enum r8188eu_pwr_seq seq);#endif
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -5
@@ -26,11 +26,6 @@#include "odm_RegConfig8188E.h" #include "odm_RTL8188E.h" -/* RTL8188E Power Configuration CMDs for USB/SDIO interfaces */ -#define Rtl8188E_NIC_PWR_ON_FLOW rtl8188E_power_on_flow -#define Rtl8188E_NIC_DISABLE_FLOW rtl8188E_card_disable_flow -#define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188E_enter_lps_flow -#define DRVINFO_SZ 4/* unit is 8bytes */ #define PageNum_128 (_Len) (u32)(((_Len)>>7) + ((_Len) & 0x7F ? 1 : 0))
Signature · 1 line
2.30.2