From 915d5c3248723905610acbc1709038805cfc379c Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:02 +0100 Subject: staging: r8188eu: remove Firmware* from struct hal_data_8188e The fields FirmwareVersion, FirmwareSubVersion and FirmwareSignature of struct hal_data_8188e are only used in the function rtl8188e_FirmwareDownload(). Use local variables in that function and remove the fields from struct hal_data_8188e. FirmwareVersionRev is not used at all, remove it as well. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 11 +++++------ drivers/staging/r8188eu/include/rtl8188e_hal.h | 4 ---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index b818872e0d19..20e4a12801cf 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -550,10 +550,10 @@ s32 rtl8188e_FirmwareDownload(struct adapter *padapter) s32 rtStatus = _SUCCESS; u8 writeFW_retry = 0; u32 fwdl_start_time; - struct hal_data_8188e *pHalData = &padapter->haldata; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct device *device = dvobj_to_dev(dvobj); struct rt_firmware_hdr *pFwHdr = NULL; + u16 fw_version, fw_subversion, fw_signature; u8 *pFirmwareBuf; u32 FirmwareLen; static int log_version; @@ -570,14 +570,13 @@ s32 rtl8188e_FirmwareDownload(struct adapter *padapter) /* To Check Fw header. Added by tynli. 2009.12.04. */ pFwHdr = (struct rt_firmware_hdr *)dvobj->firmware.szFwBuffer; - pHalData->FirmwareVersion = le16_to_cpu(pFwHdr->Version); - pHalData->FirmwareSubVersion = pFwHdr->Subversion; - pHalData->FirmwareSignature = le16_to_cpu(pFwHdr->Signature); + fw_version = le16_to_cpu(pFwHdr->Version); + fw_subversion = pFwHdr->Subversion; + fw_signature = le16_to_cpu(pFwHdr->Signature); if (!log_version++) pr_info("%sFirmware Version %d, SubVersion %d, Signature 0x%x\n", - DRIVER_PREFIX, pHalData->FirmwareVersion, - pHalData->FirmwareSubVersion, pHalData->FirmwareSignature); + DRIVER_PREFIX, fw_version, fw_subversion, fw_signature); if (IS_FW_HEADER_EXIST(pFwHdr)) { /* Shift 32 bytes for FW header */ diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 8134a173ea07..9133f3b0acc1 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -162,10 +162,6 @@ struct txpowerinfo24g { struct hal_data_8188e { struct HAL_VERSION VersionID; - u16 FirmwareVersion; - u16 FirmwareVersionRev; - u16 FirmwareSubVersion; - u16 FirmwareSignature; u8 PGMaxGroup; /* current WIFI_PHY values */ u32 ReceiveConfig; -- cgit From 6da97125036fe9b50182f1825a84b5ac057d02cf Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:03 +0100 Subject: staging: r8188eu: remove rtl8188e_InitializeFirmwareVars() Merge rtl8188e_InitializeFirmwareVars() into rtl8188eu_hal_init() and remove rtl8188e_InitializeFirmwareVars(). Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 11 ----------- drivers/staging/r8188eu/hal/usb_halinit.c | 4 +++- drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 - 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index 20e4a12801cf..dc41682fd8d6 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -623,17 +623,6 @@ Exit: return rtStatus; } -void rtl8188e_InitializeFirmwareVars(struct adapter *padapter) -{ - struct hal_data_8188e *pHalData = &padapter->haldata; - - /* Init Fw LPS related. */ - padapter->pwrctrlpriv.bFwCurrentInPSMode = false; - - /* Init H2C counter. by tynli. 2009.12.09. */ - pHalData->LastHMEBoxNum = 0; -} - /* */ /* Efuse related code */ /* */ diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 96db9a8e7667..696beb29536f 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -636,7 +636,9 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) Adapter->bFWReady = true; haldata->fw_ractrl = false; } - rtl8188e_InitializeFirmwareVars(Adapter); + /* Initialize firmware vars */ + Adapter->pwrctrlpriv.bFwCurrentInPSMode = false; + haldata->LastHMEBoxNum = 0; #if (HAL_MAC_ENABLE == 1) status = PHY_MACConfig8188E(Adapter); diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 9133f3b0acc1..3da04751f25d 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -253,7 +253,6 @@ struct hal_data_8188e { /* rtl8188e_hal_init.c */ s32 rtl8188e_FirmwareDownload(struct adapter *padapter); void _8051Reset88E(struct adapter *padapter); -void rtl8188e_InitializeFirmwareVars(struct adapter *padapter); s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy); -- cgit From 39850edf2befe27bcb3d6c37b6ee76d2ee4df903 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:04 +0100 Subject: staging: r8188eu: release_firmware is not called if allocation fails In function load_firmware() release_firmware() is not called if the allocation of pFirmware->szFwBuffer fails or if fw->size is greater than FW_8188E_SIZE. Move the call to release_firmware() to the exit label at the end of the function to fix this. Fixes: 8cd574e6af54 ("staging: r8188eu: introduce new hal dir for RTL8188eu driver") Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index dc41682fd8d6..cfafbb6c42f7 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -538,10 +538,10 @@ static int load_firmware(struct rt_firmware *pFirmware, struct device *device) } memcpy(pFirmware->szFwBuffer, fw->data, fw->size); pFirmware->ulFwLength = fw->size; - release_firmware(fw); dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", pFirmware->ulFwLength); Exit: + release_firmware(fw); return rtStatus; } -- cgit From 1541c8210a8cde97887ed108602cfac35372d8b4 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:05 +0100 Subject: staging: r8188eu: rename Exit label in load_firmware() Rename Exit label in load_firmware() to avoid camel case. Exit -> exit Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index cfafbb6c42f7..b4f29c48d58d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -518,29 +518,29 @@ static int load_firmware(struct rt_firmware *pFirmware, struct device *device) if (err) { pr_err("Request firmware failed with error 0x%x\n", err); rtStatus = _FAIL; - goto Exit; + goto exit; } if (!fw) { pr_err("Firmware %s not available\n", fw_name); rtStatus = _FAIL; - goto Exit; + goto exit; } if (fw->size > FW_8188E_SIZE) { rtStatus = _FAIL; - goto Exit; + goto exit; } pFirmware->szFwBuffer = kzalloc(FW_8188E_SIZE, GFP_KERNEL); if (!pFirmware->szFwBuffer) { pr_err("Failed to allocate pFirmware->szFwBuffer\n"); rtStatus = _FAIL; - goto Exit; + goto exit; } memcpy(pFirmware->szFwBuffer, fw->data, fw->size); pFirmware->ulFwLength = fw->size; dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", pFirmware->ulFwLength); -Exit: +exit: release_firmware(fw); return rtStatus; } -- cgit From 996d0af0f48610bacac8490a5228037d9a209f92 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:06 +0100 Subject: staging: r8188eu: rename rtStatus in load_firmware() Rename the local variable rtStatus in load_firmware() to avoid camel case. rtStatus -> ret Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-6-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index b4f29c48d58d..edb56a9ae283 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -510,30 +510,30 @@ static s32 _FWFreeToGo(struct adapter *padapter) static int load_firmware(struct rt_firmware *pFirmware, struct device *device) { - s32 rtStatus = _SUCCESS; + s32 ret = _SUCCESS; const struct firmware *fw; const char *fw_name = "rtlwifi/rtl8188eufw.bin"; int err = request_firmware(&fw, fw_name, device); if (err) { pr_err("Request firmware failed with error 0x%x\n", err); - rtStatus = _FAIL; + ret = _FAIL; goto exit; } if (!fw) { pr_err("Firmware %s not available\n", fw_name); - rtStatus = _FAIL; + ret = _FAIL; goto exit; } if (fw->size > FW_8188E_SIZE) { - rtStatus = _FAIL; + ret = _FAIL; goto exit; } pFirmware->szFwBuffer = kzalloc(FW_8188E_SIZE, GFP_KERNEL); if (!pFirmware->szFwBuffer) { pr_err("Failed to allocate pFirmware->szFwBuffer\n"); - rtStatus = _FAIL; + ret = _FAIL; goto exit; } memcpy(pFirmware->szFwBuffer, fw->data, fw->size); @@ -542,7 +542,7 @@ static int load_firmware(struct rt_firmware *pFirmware, struct device *device) exit: release_firmware(fw); - return rtStatus; + return ret; } s32 rtl8188e_FirmwareDownload(struct adapter *padapter) -- cgit From 43394501457ddc90b28dc721cd3cfbf483484f2a Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:07 +0100 Subject: staging: r8188eu: convert type of return variable in load_firmware() The return type of load_firmware() is int. Change the type of the return variable from s32 to int to match the function return type. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-7-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index edb56a9ae283..bd7f3dc5878b 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -510,7 +510,7 @@ static s32 _FWFreeToGo(struct adapter *padapter) static int load_firmware(struct rt_firmware *pFirmware, struct device *device) { - s32 ret = _SUCCESS; + int ret = _SUCCESS; const struct firmware *fw; const char *fw_name = "rtlwifi/rtl8188eufw.bin"; int err = request_firmware(&fw, fw_name, device); -- cgit From ca1cb3c278cb8c33c033bcf0781888bbf1c14839 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:08 +0100 Subject: staging: r8188eu: rename parameter pFirmware of load_firmware() Rename the parameter pFirmware of load_firmware() to avoid camel case. pFirmware -> rtfw Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-8-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index bd7f3dc5878b..5c1da9dd179b 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -508,7 +508,7 @@ static s32 _FWFreeToGo(struct adapter *padapter) return _FAIL; } -static int load_firmware(struct rt_firmware *pFirmware, struct device *device) +static int load_firmware(struct rt_firmware *rtfw, struct device *device) { int ret = _SUCCESS; const struct firmware *fw; @@ -530,15 +530,15 @@ static int load_firmware(struct rt_firmware *pFirmware, struct device *device) goto exit; } - pFirmware->szFwBuffer = kzalloc(FW_8188E_SIZE, GFP_KERNEL); - if (!pFirmware->szFwBuffer) { - pr_err("Failed to allocate pFirmware->szFwBuffer\n"); + rtfw->szFwBuffer = kzalloc(FW_8188E_SIZE, GFP_KERNEL); + if (!rtfw->szFwBuffer) { + pr_err("Failed to allocate rtfw->szFwBuffer\n"); ret = _FAIL; goto exit; } - memcpy(pFirmware->szFwBuffer, fw->data, fw->size); - pFirmware->ulFwLength = fw->size; - dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", pFirmware->ulFwLength); + memcpy(rtfw->szFwBuffer, fw->data, fw->size); + rtfw->ulFwLength = fw->size; + dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", rtfw->ulFwLength); exit: release_firmware(fw); -- cgit From 2f8e84b2d1f841dd9b82d231463b7733112735b6 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:09 +0100 Subject: staging: r8188eu: rename fields of struct rt_firmware Rename fields of struct rt_firmware to avoid camel case. szFwBuffer -> data ulFwLength -> size Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-9-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 22 +++++++++++----------- drivers/staging/r8188eu/include/drv_types.h | 4 ++-- drivers/staging/r8188eu/os_dep/os_intfs.c | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index 5c1da9dd179b..ee684b37ff91 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -530,15 +530,15 @@ static int load_firmware(struct rt_firmware *rtfw, struct device *device) goto exit; } - rtfw->szFwBuffer = kzalloc(FW_8188E_SIZE, GFP_KERNEL); - if (!rtfw->szFwBuffer) { - pr_err("Failed to allocate rtfw->szFwBuffer\n"); + rtfw->data = kzalloc(FW_8188E_SIZE, GFP_KERNEL); + if (!rtfw->data) { + pr_err("Failed to allocate rtfw->data\n"); ret = _FAIL; goto exit; } - memcpy(rtfw->szFwBuffer, fw->data, fw->size); - rtfw->ulFwLength = fw->size; - dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", rtfw->ulFwLength); + memcpy(rtfw->data, fw->data, fw->size); + rtfw->size = fw->size; + dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", rtfw->size); exit: release_firmware(fw); @@ -558,17 +558,17 @@ s32 rtl8188e_FirmwareDownload(struct adapter *padapter) u32 FirmwareLen; static int log_version; - if (!dvobj->firmware.szFwBuffer) + if (!dvobj->firmware.data) rtStatus = load_firmware(&dvobj->firmware, device); if (rtStatus == _FAIL) { - dvobj->firmware.szFwBuffer = NULL; + dvobj->firmware.data = NULL; goto Exit; } - pFirmwareBuf = dvobj->firmware.szFwBuffer; - FirmwareLen = dvobj->firmware.ulFwLength; + pFirmwareBuf = dvobj->firmware.data; + FirmwareLen = dvobj->firmware.size; /* To Check Fw header. Added by tynli. 2009.12.04. */ - pFwHdr = (struct rt_firmware_hdr *)dvobj->firmware.szFwBuffer; + pFwHdr = (struct rt_firmware_hdr *)dvobj->firmware.data; fw_version = le16_to_cpu(pFwHdr->Version); fw_subversion = pFwHdr->Subversion; diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 2dd5ebaaa921..388822dd325d 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -117,8 +117,8 @@ struct registry_priv { #define MAX_CONTINUAL_URB_ERR 4 struct rt_firmware { - u8 *szFwBuffer; - u32 ulFwLength; + u8 *data; + u32 size; }; struct dvobj_priv { diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c index b65e44f97826..08d719822062 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -789,8 +789,8 @@ int netdev_close(struct net_device *pnetdev) rtw_p2p_enable(padapter, P2P_ROLE_DISABLE); - kfree(dvobj->firmware.szFwBuffer); - dvobj->firmware.szFwBuffer = NULL; + kfree(dvobj->firmware.data); + dvobj->firmware.data = NULL; DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup); return 0; -- cgit From 2441fa93a82b2a799de2e07f74acca07a7d7d49d Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:10 +0100 Subject: staging: r8188eu: use kmemdup instead of kzalloc and memcpy Use kmemdup instead of kzalloc and memcpy in load_firmware(). Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-10-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 7 +------ drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index ee684b37ff91..f7ae2fc0d2b9 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -525,18 +525,13 @@ static int load_firmware(struct rt_firmware *rtfw, struct device *device) ret = _FAIL; goto exit; } - if (fw->size > FW_8188E_SIZE) { - ret = _FAIL; - goto exit; - } - rtfw->data = kzalloc(FW_8188E_SIZE, GFP_KERNEL); + rtfw->data = kmemdup(fw->data, fw->size, GFP_KERNEL); if (!rtfw->data) { pr_err("Failed to allocate rtfw->data\n"); ret = _FAIL; goto exit; } - memcpy(rtfw->data, fw->data, fw->size); rtfw->size = fw->size; dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", rtfw->size); diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 3da04751f25d..051f3b9fe726 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -35,7 +35,6 @@ #define PageNum_128(_Len) (u32)(((_Len)>>7) + ((_Len) & 0x7F ? 1 : 0)) /* download firmware related data structure */ -#define FW_8188E_SIZE 0x4000 /* 16384,16k */ #define FW_8188E_START_ADDRESS 0x1000 #define MAX_PAGE_SIZE 4096 /* @ page : 4k bytes */ -- cgit From f1c140b62f13b40ca1459d18973045a10badd1cb Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:11 +0100 Subject: staging: r8188eu: rename fw related functions to avoid camel case Rename firmware related functions to avoid camel case. rtl8188e_FirmwareDownload -> rtl8188e_firmware_download _FWDownloadEnable -> fw_download_enable _8051Reset88E -> rtw_reset_8051 _FWFreeToGo -> fw_free_to_go _BlockWrite -> block_write _PageWrite -> page_write _WriteFW -> write_fw Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-11-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 34 ++++++++++++------------- drivers/staging/r8188eu/hal/usb_halinit.c | 2 +- drivers/staging/r8188eu/include/rtl8188e_hal.h | 4 +-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index f7ae2fc0d2b9..b1f2d349c33a 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -21,7 +21,7 @@ static void iol_mode_enable(struct adapter *padapter, u8 enable) if (!padapter->bFWReady) { DBG_88E("bFWReady == false call reset 8051...\n"); - _8051Reset88E(padapter); + rtw_reset_8051(padapter); } } else { @@ -336,7 +336,7 @@ exit: return ret; } -static void _FWDownloadEnable(struct adapter *padapter, bool enable) +static void fw_download_enable(struct adapter *padapter, bool enable) { u8 tmp; @@ -360,7 +360,7 @@ static void _FWDownloadEnable(struct adapter *padapter, bool enable) #define MAX_REG_BOLCK_SIZE 196 -static int _BlockWrite(struct adapter *padapter, void *buffer, u32 buffSize) +static int block_write(struct adapter *padapter, void *buffer, u32 buffSize) { int ret = _SUCCESS; u32 blockSize_p1 = 4; /* (Default) Phase #1 : PCI muse use 4-byte write to download FW */ @@ -416,7 +416,7 @@ exit: return ret; } -static int _PageWrite(struct adapter *padapter, u32 page, void *buffer, u32 size) +static int page_write(struct adapter *padapter, u32 page, void *buffer, u32 size) { u8 value8; u8 u8Page = (u8)(page & 0x07); @@ -424,10 +424,10 @@ static int _PageWrite(struct adapter *padapter, u32 page, void *buffer, u32 size value8 = (rtw_read8(padapter, REG_MCUFWDL + 2) & 0xF8) | u8Page; rtw_write8(padapter, REG_MCUFWDL + 2, value8); - return _BlockWrite(padapter, buffer, size); + return block_write(padapter, buffer, size); } -static int _WriteFW(struct adapter *padapter, void *buffer, u32 size) +static int write_fw(struct adapter *padapter, void *buffer, u32 size) { /* Since we need dynamic decide method of dwonload fw, so we call this function to get chip version. */ /* We can remove _ReadChipVersion from ReadpadapterInfo8192C later. */ @@ -441,7 +441,7 @@ static int _WriteFW(struct adapter *padapter, void *buffer, u32 size) for (page = 0; page < pageNums; page++) { offset = page * MAX_PAGE_SIZE; - ret = _PageWrite(padapter, page, bufferPtr + offset, MAX_PAGE_SIZE); + ret = page_write(padapter, page, bufferPtr + offset, MAX_PAGE_SIZE); if (ret == _FAIL) goto exit; @@ -449,7 +449,7 @@ static int _WriteFW(struct adapter *padapter, void *buffer, u32 size) if (remainSize) { offset = pageNums * MAX_PAGE_SIZE; page = pageNums; - ret = _PageWrite(padapter, page, bufferPtr + offset, remainSize); + ret = page_write(padapter, page, bufferPtr + offset, remainSize); if (ret == _FAIL) goto exit; @@ -458,7 +458,7 @@ exit: return ret; } -void _8051Reset88E(struct adapter *padapter) +void rtw_reset_8051(struct adapter *padapter) { u8 u1bTmp; @@ -468,7 +468,7 @@ void _8051Reset88E(struct adapter *padapter) DBG_88E("=====> _8051Reset88E(): 8051 reset success .\n"); } -static s32 _FWFreeToGo(struct adapter *padapter) +static s32 fw_free_to_go(struct adapter *padapter) { u32 counter = 0; u32 value32; @@ -491,7 +491,7 @@ static s32 _FWFreeToGo(struct adapter *padapter) value32 &= ~WINTINI_RDY; rtw_write32(padapter, REG_MCUFWDL, value32); - _8051Reset88E(padapter); + rtw_reset_8051(padapter); /* polling for FW ready */ counter = 0; @@ -540,7 +540,7 @@ exit: return ret; } -s32 rtl8188e_FirmwareDownload(struct adapter *padapter) +s32 rtl8188e_firmware_download(struct adapter *padapter) { s32 rtStatus = _SUCCESS; u8 writeFW_retry = 0; @@ -583,16 +583,16 @@ s32 rtl8188e_FirmwareDownload(struct adapter *padapter) /* or it will cause download Fw fail. 2010.02.01. by tynli. */ if (rtw_read8(padapter, REG_MCUFWDL) & RAM_DL_SEL) { /* 8051 RAM code */ rtw_write8(padapter, REG_MCUFWDL, 0x00); - _8051Reset88E(padapter); + rtw_reset_8051(padapter); } - _FWDownloadEnable(padapter, true); + fw_download_enable(padapter, true); fwdl_start_time = jiffies; while (1) { /* reset the FWDL chksum */ rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWDL_ChkSum_rpt); - rtStatus = _WriteFW(padapter, pFirmwareBuf, FirmwareLen); + rtStatus = write_fw(padapter, pFirmwareBuf, FirmwareLen); if (rtStatus == _SUCCESS || (rtw_get_passing_time_ms(fwdl_start_time) > 500 && writeFW_retry++ >= 3)) @@ -602,13 +602,13 @@ s32 rtl8188e_FirmwareDownload(struct adapter *padapter) __func__, writeFW_retry, rtw_get_passing_time_ms(fwdl_start_time) ); } - _FWDownloadEnable(padapter, false); + fw_download_enable(padapter, false); if (_SUCCESS != rtStatus) { DBG_88E("DL Firmware failed!\n"); goto Exit; } - rtStatus = _FWFreeToGo(padapter); + rtStatus = fw_free_to_go(padapter); if (_SUCCESS != rtStatus) { DBG_88E("DL Firmware failed!\n"); goto Exit; diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 696beb29536f..3dc1c432e8cf 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -625,7 +625,7 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) _InitTxBufferBoundary(Adapter, 0); - status = rtl8188e_FirmwareDownload(Adapter); + status = rtl8188e_firmware_download(Adapter); if (status != _SUCCESS) { DBG_88E("%s: Download Firmware failed!!\n", __func__); diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 051f3b9fe726..11d79606e120 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -250,8 +250,8 @@ struct hal_data_8188e { }; /* rtl8188e_hal_init.c */ -s32 rtl8188e_FirmwareDownload(struct adapter *padapter); -void _8051Reset88E(struct adapter *padapter); +s32 rtl8188e_firmware_download(struct adapter *padapter); +void rtw_reset_8051(struct adapter *padapter); s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy); -- cgit From 843e06987045ca58e9a5676f72c415461950c22d Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:12 +0100 Subject: staging: r8188eu: clean up rtw_reset_8051() Rename the local variable u1bTmp in rtw_reset_8051() to avoid camel case and remove a call to DBG_88E that contains no important information. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-12-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index b1f2d349c33a..d219882fc4a2 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -460,12 +460,11 @@ exit: void rtw_reset_8051(struct adapter *padapter) { - u8 u1bTmp; + u8 val8; - u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, u1bTmp & (~BIT(2))); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, u1bTmp | (BIT(2))); - DBG_88E("=====> _8051Reset88E(): 8051 reset success .\n"); + val8 = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); + rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 & (~BIT(2))); + rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 | (BIT(2))); } static s32 fw_free_to_go(struct adapter *padapter) -- cgit From 08c6f78e9272694259fe1430011ba911c675d5cf Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:13 +0100 Subject: staging: r8188eu: convert two functions from s32 to int Convert the return type of fw_free_to_go() and rtl8188e_firmware_download() from s32 to the more common int. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-13-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 6 +++--- drivers/staging/r8188eu/include/rtl8188e_hal.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index d219882fc4a2..f86b5cb2b6f9 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -467,7 +467,7 @@ void rtw_reset_8051(struct adapter *padapter) rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 | (BIT(2))); } -static s32 fw_free_to_go(struct adapter *padapter) +static int fw_free_to_go(struct adapter *padapter) { u32 counter = 0; u32 value32; @@ -539,9 +539,9 @@ exit: return ret; } -s32 rtl8188e_firmware_download(struct adapter *padapter) +int rtl8188e_firmware_download(struct adapter *padapter) { - s32 rtStatus = _SUCCESS; + int rtStatus = _SUCCESS; u8 writeFW_retry = 0; u32 fwdl_start_time; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 11d79606e120..4b67e11024a1 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -250,7 +250,7 @@ struct hal_data_8188e { }; /* rtl8188e_hal_init.c */ -s32 rtl8188e_firmware_download(struct adapter *padapter); +int rtl8188e_firmware_download(struct adapter *padapter); void rtw_reset_8051(struct adapter *padapter); s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy); -- cgit From 7a0c9c46c4e0b3526491e0080c594b603dd6ba45 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:14 +0100 Subject: staging: r8188eu: rename Exit label in rtl8188e_firmware_download() Rename the Exit label in rtl8188e_firmware_download() to avoid camel case. Exit -> exit Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-14-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index f86b5cb2b6f9..f158bbf44094 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -556,7 +556,7 @@ int rtl8188e_firmware_download(struct adapter *padapter) rtStatus = load_firmware(&dvobj->firmware, device); if (rtStatus == _FAIL) { dvobj->firmware.data = NULL; - goto Exit; + goto exit; } pFirmwareBuf = dvobj->firmware.data; FirmwareLen = dvobj->firmware.size; @@ -604,16 +604,16 @@ int rtl8188e_firmware_download(struct adapter *padapter) fw_download_enable(padapter, false); if (_SUCCESS != rtStatus) { DBG_88E("DL Firmware failed!\n"); - goto Exit; + goto exit; } rtStatus = fw_free_to_go(padapter); if (_SUCCESS != rtStatus) { DBG_88E("DL Firmware failed!\n"); - goto Exit; + goto exit; } -Exit: +exit: return rtStatus; } -- cgit From fc6730404a9ae82aa03b56dfa7eed43449ecc0b7 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:15 +0100 Subject: staging: r8188eu: rename rtSatus in rtl8188e_firmware_download() Rename the variable rtStatus in rtl8188e_firmware_download() to avoid camel case. rtStatus -> ret Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-15-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index f158bbf44094..1685386a7015 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -541,7 +541,7 @@ exit: int rtl8188e_firmware_download(struct adapter *padapter) { - int rtStatus = _SUCCESS; + int ret = _SUCCESS; u8 writeFW_retry = 0; u32 fwdl_start_time; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); @@ -553,8 +553,8 @@ int rtl8188e_firmware_download(struct adapter *padapter) static int log_version; if (!dvobj->firmware.data) - rtStatus = load_firmware(&dvobj->firmware, device); - if (rtStatus == _FAIL) { + ret = load_firmware(&dvobj->firmware, device); + if (ret == _FAIL) { dvobj->firmware.data = NULL; goto exit; } @@ -591,9 +591,9 @@ int rtl8188e_firmware_download(struct adapter *padapter) /* reset the FWDL chksum */ rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWDL_ChkSum_rpt); - rtStatus = write_fw(padapter, pFirmwareBuf, FirmwareLen); + ret = write_fw(padapter, pFirmwareBuf, FirmwareLen); - if (rtStatus == _SUCCESS || + if (ret == _SUCCESS || (rtw_get_passing_time_ms(fwdl_start_time) > 500 && writeFW_retry++ >= 3)) break; @@ -602,19 +602,19 @@ int rtl8188e_firmware_download(struct adapter *padapter) ); } fw_download_enable(padapter, false); - if (_SUCCESS != rtStatus) { + if (ret != _SUCCESS) { DBG_88E("DL Firmware failed!\n"); goto exit; } - rtStatus = fw_free_to_go(padapter); - if (_SUCCESS != rtStatus) { + ret = fw_free_to_go(padapter); + if (ret != _SUCCESS) { DBG_88E("DL Firmware failed!\n"); goto exit; } exit: - return rtStatus; + return ret; } /* */ -- cgit From 8a9ee2b4d02fdb3bd29342332216ebc58ec1325a Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:16 +0100 Subject: staging: r8188eu: rename FWDL_ChkSum_rpt Rename FWDL_ChkSum_rpt to avoid camel case. FWDL_ChkSum_rpt -> FWDL_CHKSUM_RPT Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-16-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 4 ++-- drivers/staging/r8188eu/include/rtl8188e_spec.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index 1685386a7015..6c23966ec785 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -475,7 +475,7 @@ static int fw_free_to_go(struct adapter *padapter) /* polling CheckSum report */ do { value32 = rtw_read32(padapter, REG_MCUFWDL); - if (value32 & FWDL_ChkSum_rpt) + if (value32 & FWDL_CHKSUM_RPT) break; } while (counter++ < POLLING_READY_TIMEOUT_COUNT); @@ -589,7 +589,7 @@ int rtl8188e_firmware_download(struct adapter *padapter) fwdl_start_time = jiffies; while (1) { /* reset the FWDL chksum */ - rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWDL_ChkSum_rpt); + rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWDL_CHKSUM_RPT); ret = write_fw(padapter, pFirmwareBuf, FirmwareLen); diff --git a/drivers/staging/r8188eu/include/rtl8188e_spec.h b/drivers/staging/r8188eu/include/rtl8188e_spec.h index 009222b4a95d..edae053e350e 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_spec.h +++ b/drivers/staging/r8188eu/include/rtl8188e_spec.h @@ -794,7 +794,7 @@ Current IOREG MAP /* 2 MCUFWDL */ #define MCUFWDL_EN BIT(0) #define MCUFWDL_RDY BIT(1) -#define FWDL_ChkSum_rpt BIT(2) +#define FWDL_CHKSUM_RPT BIT(2) #define MACINI_RDY BIT(3) #define BBINI_RDY BIT(4) #define RFINI_RDY BIT(5) -- cgit From 9c010d7a72b55bc6ba5e7022f563245af3d52431 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:17 +0100 Subject: staging: r8188eu: rename writeFW_retry Rename the variable writeFW_retry in rtl8188e_firmware_download() to avoid camel case. writeFW_retry -> write_fw_retry Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-17-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index 6c23966ec785..15e8dc0b9a37 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -542,7 +542,7 @@ exit: int rtl8188e_firmware_download(struct adapter *padapter) { int ret = _SUCCESS; - u8 writeFW_retry = 0; + u8 write_fw_retry = 0; u32 fwdl_start_time; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct device *device = dvobj_to_dev(dvobj); @@ -594,11 +594,11 @@ int rtl8188e_firmware_download(struct adapter *padapter) ret = write_fw(padapter, pFirmwareBuf, FirmwareLen); if (ret == _SUCCESS || - (rtw_get_passing_time_ms(fwdl_start_time) > 500 && writeFW_retry++ >= 3)) + (rtw_get_passing_time_ms(fwdl_start_time) > 500 && write_fw_retry++ >= 3)) break; - DBG_88E("%s writeFW_retry:%u, time after fwdl_start_time:%ums\n", - __func__, writeFW_retry, rtw_get_passing_time_ms(fwdl_start_time) + DBG_88E("%s write_fw_retry:%u, time after fwdl_start_time:%ums\n", + __func__, write_fw_retry, rtw_get_passing_time_ms(fwdl_start_time) ); } fw_download_enable(padapter, false); -- cgit From b44dcfb787f5b4801e324fd8c5139a9e48fac58e Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:18 +0100 Subject: staging: r8188eu: rename pFwHdr in rtl8188e_firmware_download() Rename the variable pFwHdr in rtl8188e_firmware_download() to avoid camel case. pFwHdr -> fwhdr Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-18-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index 15e8dc0b9a37..c2112df0ac82 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -546,7 +546,7 @@ int rtl8188e_firmware_download(struct adapter *padapter) u32 fwdl_start_time; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct device *device = dvobj_to_dev(dvobj); - struct rt_firmware_hdr *pFwHdr = NULL; + struct rt_firmware_hdr *fwhdr = NULL; u16 fw_version, fw_subversion, fw_signature; u8 *pFirmwareBuf; u32 FirmwareLen; @@ -562,17 +562,17 @@ int rtl8188e_firmware_download(struct adapter *padapter) FirmwareLen = dvobj->firmware.size; /* To Check Fw header. Added by tynli. 2009.12.04. */ - pFwHdr = (struct rt_firmware_hdr *)dvobj->firmware.data; + fwhdr = (struct rt_firmware_hdr *)dvobj->firmware.data; - fw_version = le16_to_cpu(pFwHdr->Version); - fw_subversion = pFwHdr->Subversion; - fw_signature = le16_to_cpu(pFwHdr->Signature); + fw_version = le16_to_cpu(fwhdr->Version); + fw_subversion = fwhdr->Subversion; + fw_signature = le16_to_cpu(fwhdr->Signature); if (!log_version++) pr_info("%sFirmware Version %d, SubVersion %d, Signature 0x%x\n", DRIVER_PREFIX, fw_version, fw_subversion, fw_signature); - if (IS_FW_HEADER_EXIST(pFwHdr)) { + if (IS_FW_HEADER_EXIST(fwhdr)) { /* Shift 32 bytes for FW header */ pFirmwareBuf = pFirmwareBuf + 32; FirmwareLen = FirmwareLen - 32; -- cgit From dbf1c5e37ef6c1f54f6d33750bf61c4b7642006a Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:19 +0100 Subject: staging: r8188eu: rename pFirmwareBuf and FirmwareLen Rename the variables pFirmwareBuf and FirmwareLen in rtl8188e_firmware_download() to avoid camel case. pFirmwareBuf -> fw_data FirmwareLen -> fw_size Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-19-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index c2112df0ac82..3c9ddbe16754 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -548,8 +548,8 @@ int rtl8188e_firmware_download(struct adapter *padapter) struct device *device = dvobj_to_dev(dvobj); struct rt_firmware_hdr *fwhdr = NULL; u16 fw_version, fw_subversion, fw_signature; - u8 *pFirmwareBuf; - u32 FirmwareLen; + u8 *fw_data; + u32 fw_size; static int log_version; if (!dvobj->firmware.data) @@ -558,8 +558,8 @@ int rtl8188e_firmware_download(struct adapter *padapter) dvobj->firmware.data = NULL; goto exit; } - pFirmwareBuf = dvobj->firmware.data; - FirmwareLen = dvobj->firmware.size; + fw_data = dvobj->firmware.data; + fw_size = dvobj->firmware.size; /* To Check Fw header. Added by tynli. 2009.12.04. */ fwhdr = (struct rt_firmware_hdr *)dvobj->firmware.data; @@ -574,8 +574,8 @@ int rtl8188e_firmware_download(struct adapter *padapter) if (IS_FW_HEADER_EXIST(fwhdr)) { /* Shift 32 bytes for FW header */ - pFirmwareBuf = pFirmwareBuf + 32; - FirmwareLen = FirmwareLen - 32; + fw_data = fw_data + 32; + fw_size = fw_size - 32; } /* Suggested by Filen. If 8051 is running in RAM code, driver should inform Fw to reset by itself, */ @@ -591,7 +591,7 @@ int rtl8188e_firmware_download(struct adapter *padapter) /* reset the FWDL chksum */ rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWDL_CHKSUM_RPT); - ret = write_fw(padapter, pFirmwareBuf, FirmwareLen); + ret = write_fw(padapter, fw_data, fw_size); if (ret == _SUCCESS || (rtw_get_passing_time_ms(fwdl_start_time) > 500 && write_fw_retry++ >= 3)) -- cgit From 7235d165d3cd15bc32c0a466d4b2c21094edcd25 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 11:36:20 +0100 Subject: staging: r8188eu: move firmware loading code out of the hal layer Move the firmware loading functions from rtl8188e_hal_init.c into the new file core/rtw_fw.c. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-20-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/Makefile | 1 + drivers/staging/r8188eu/core/rtw_fw.c | 284 ++++++++++++++++++++++++ drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 283 +---------------------- drivers/staging/r8188eu/hal/usb_halinit.c | 2 +- drivers/staging/r8188eu/include/rtl8188e_hal.h | 4 - drivers/staging/r8188eu/include/rtw_fw.h | 14 ++ 6 files changed, 301 insertions(+), 287 deletions(-) create mode 100644 drivers/staging/r8188eu/core/rtw_fw.c create mode 100644 drivers/staging/r8188eu/include/rtw_fw.h diff --git a/drivers/staging/r8188eu/Makefile b/drivers/staging/r8188eu/Makefile index a7a486cc16dd..84627fc89ec9 100644 --- a/drivers/staging/r8188eu/Makefile +++ b/drivers/staging/r8188eu/Makefile @@ -37,6 +37,7 @@ r8188eu-y = \ core/rtw_br_ext.o \ core/rtw_cmd.o \ core/rtw_efuse.o \ + core/rtw_fw.o \ core/rtw_ieee80211.o \ core/rtw_ioctl_set.o \ core/rtw_iol.o \ diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188eu/core/rtw_fw.c new file mode 100644 index 000000000000..fa29d47bf165 --- /dev/null +++ b/drivers/staging/r8188eu/core/rtw_fw.c @@ -0,0 +1,284 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright(c) 2007 - 2011 Realtek Corporation. */ + +#include +#include "../include/rtw_fw.h" + +static void fw_download_enable(struct adapter *padapter, bool enable) +{ + u8 tmp; + + if (enable) { + /* MCU firmware download enable. */ + tmp = rtw_read8(padapter, REG_MCUFWDL); + rtw_write8(padapter, REG_MCUFWDL, tmp | 0x01); + + /* 8051 reset */ + tmp = rtw_read8(padapter, REG_MCUFWDL + 2); + rtw_write8(padapter, REG_MCUFWDL + 2, tmp & 0xf7); + } else { + /* MCU firmware download disable. */ + tmp = rtw_read8(padapter, REG_MCUFWDL); + rtw_write8(padapter, REG_MCUFWDL, tmp & 0xfe); + + /* Reserved for fw extension. */ + rtw_write8(padapter, REG_MCUFWDL + 1, 0x00); + } +} + +static int block_write(struct adapter *padapter, void *buffer, u32 buffSize) +{ + int ret = _SUCCESS; + u32 blockSize_p1 = 4; /* (Default) Phase #1 : PCI muse use 4-byte write to download FW */ + u32 blockSize_p2 = 8; /* Phase #2 : Use 8-byte, if Phase#1 use big size to write FW. */ + u32 blockSize_p3 = 1; /* Phase #3 : Use 1-byte, the remnant of FW image. */ + u32 blockCount_p1 = 0, blockCount_p2 = 0, blockCount_p3 = 0; + u32 remainSize_p1 = 0, remainSize_p2 = 0; + u8 *bufferPtr = (u8 *)buffer; + u32 i = 0, offset = 0; + + blockSize_p1 = MAX_REG_BOLCK_SIZE; + + /* 3 Phase #1 */ + blockCount_p1 = buffSize / blockSize_p1; + remainSize_p1 = buffSize % blockSize_p1; + + for (i = 0; i < blockCount_p1; i++) { + ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + i * blockSize_p1), blockSize_p1, (bufferPtr + i * blockSize_p1)); + if (ret == _FAIL) + goto exit; + } + + /* 3 Phase #2 */ + if (remainSize_p1) { + offset = blockCount_p1 * blockSize_p1; + + blockCount_p2 = remainSize_p1 / blockSize_p2; + remainSize_p2 = remainSize_p1 % blockSize_p2; + + for (i = 0; i < blockCount_p2; i++) { + ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + offset + i * blockSize_p2), blockSize_p2, (bufferPtr + offset + i * blockSize_p2)); + + if (ret == _FAIL) + goto exit; + } + } + + /* 3 Phase #3 */ + if (remainSize_p2) { + offset = (blockCount_p1 * blockSize_p1) + (blockCount_p2 * blockSize_p2); + + blockCount_p3 = remainSize_p2 / blockSize_p3; + + for (i = 0; i < blockCount_p3; i++) { + ret = rtw_write8(padapter, (FW_8188E_START_ADDRESS + offset + i), *(bufferPtr + offset + i)); + + if (ret == _FAIL) + goto exit; + } + } + +exit: + return ret; +} + +static int page_write(struct adapter *padapter, u32 page, void *buffer, u32 size) +{ + u8 value8; + u8 u8Page = (u8)(page & 0x07); + + value8 = (rtw_read8(padapter, REG_MCUFWDL + 2) & 0xF8) | u8Page; + rtw_write8(padapter, REG_MCUFWDL + 2, value8); + + return block_write(padapter, buffer, size); +} + +static int write_fw(struct adapter *padapter, void *buffer, u32 size) +{ + /* Since we need dynamic decide method of dwonload fw, so we call this function to get chip version. */ + /* We can remove _ReadChipVersion from ReadpadapterInfo8192C later. */ + int ret = _SUCCESS; + u32 pageNums, remainSize; + u32 page, offset; + u8 *bufferPtr = (u8 *)buffer; + + pageNums = size / MAX_PAGE_SIZE; + remainSize = size % MAX_PAGE_SIZE; + + for (page = 0; page < pageNums; page++) { + offset = page * MAX_PAGE_SIZE; + ret = page_write(padapter, page, bufferPtr + offset, MAX_PAGE_SIZE); + + if (ret == _FAIL) + goto exit; + } + if (remainSize) { + offset = pageNums * MAX_PAGE_SIZE; + page = pageNums; + ret = page_write(padapter, page, bufferPtr + offset, remainSize); + + if (ret == _FAIL) + goto exit; + } +exit: + return ret; +} + +void rtw_reset_8051(struct adapter *padapter) +{ + u8 val8; + + val8 = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); + rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 & (~BIT(2))); + rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 | (BIT(2))); +} + +static int fw_free_to_go(struct adapter *padapter) +{ + u32 counter = 0; + u32 value32; + + /* polling CheckSum report */ + do { + value32 = rtw_read32(padapter, REG_MCUFWDL); + if (value32 & FWDL_CHKSUM_RPT) + break; + } while (counter++ < POLLING_READY_TIMEOUT_COUNT); + + if (counter >= POLLING_READY_TIMEOUT_COUNT) { + DBG_88E("%s: chksum report fail! REG_MCUFWDL:0x%08x\n", __func__, value32); + return _FAIL; + } + DBG_88E("%s: Checksum report OK! REG_MCUFWDL:0x%08x\n", __func__, value32); + + value32 = rtw_read32(padapter, REG_MCUFWDL); + value32 |= MCUFWDL_RDY; + value32 &= ~WINTINI_RDY; + rtw_write32(padapter, REG_MCUFWDL, value32); + + rtw_reset_8051(padapter); + + /* polling for FW ready */ + counter = 0; + do { + value32 = rtw_read32(padapter, REG_MCUFWDL); + if (value32 & WINTINI_RDY) { + DBG_88E("%s: Polling FW ready success!! REG_MCUFWDL:0x%08x\n", __func__, value32); + return _SUCCESS; + } + udelay(5); + } while (counter++ < POLLING_READY_TIMEOUT_COUNT); + + DBG_88E("%s: Polling FW ready fail!! REG_MCUFWDL:0x%08x\n", __func__, value32); + return _FAIL; +} + +static int load_firmware(struct rt_firmware *rtfw, struct device *device) +{ + int ret = _SUCCESS; + const struct firmware *fw; + const char *fw_name = "rtlwifi/rtl8188eufw.bin"; + int err = request_firmware(&fw, fw_name, device); + + if (err) { + pr_err("Request firmware failed with error 0x%x\n", err); + ret = _FAIL; + goto exit; + } + if (!fw) { + pr_err("Firmware %s not available\n", fw_name); + ret = _FAIL; + goto exit; + } + + rtfw->data = kmemdup(fw->data, fw->size, GFP_KERNEL); + if (!rtfw->data) { + pr_err("Failed to allocate rtfw->data\n"); + ret = _FAIL; + goto exit; + } + rtfw->size = fw->size; + dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", rtfw->size); + +exit: + release_firmware(fw); + return ret; +} + +int rtl8188e_firmware_download(struct adapter *padapter) +{ + int ret = _SUCCESS; + u8 write_fw_retry = 0; + u32 fwdl_start_time; + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + struct device *device = dvobj_to_dev(dvobj); + struct rt_firmware_hdr *fwhdr = NULL; + u16 fw_version, fw_subversion, fw_signature; + u8 *fw_data; + u32 fw_size; + static int log_version; + + if (!dvobj->firmware.data) + ret = load_firmware(&dvobj->firmware, device); + if (ret == _FAIL) { + dvobj->firmware.data = NULL; + goto exit; + } + fw_data = dvobj->firmware.data; + fw_size = dvobj->firmware.size; + + /* To Check Fw header. Added by tynli. 2009.12.04. */ + fwhdr = (struct rt_firmware_hdr *)dvobj->firmware.data; + + fw_version = le16_to_cpu(fwhdr->Version); + fw_subversion = fwhdr->Subversion; + fw_signature = le16_to_cpu(fwhdr->Signature); + + if (!log_version++) + pr_info("%sFirmware Version %d, SubVersion %d, Signature 0x%x\n", + DRIVER_PREFIX, fw_version, fw_subversion, fw_signature); + + if (IS_FW_HEADER_EXIST(fwhdr)) { + /* Shift 32 bytes for FW header */ + fw_data = fw_data + 32; + fw_size = fw_size - 32; + } + + /* Suggested by Filen. If 8051 is running in RAM code, driver should inform Fw to reset by itself, */ + /* or it will cause download Fw fail. 2010.02.01. by tynli. */ + if (rtw_read8(padapter, REG_MCUFWDL) & RAM_DL_SEL) { /* 8051 RAM code */ + rtw_write8(padapter, REG_MCUFWDL, 0x00); + rtw_reset_8051(padapter); + } + + fw_download_enable(padapter, true); + fwdl_start_time = jiffies; + while (1) { + /* reset the FWDL chksum */ + rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWDL_CHKSUM_RPT); + + ret = write_fw(padapter, fw_data, fw_size); + + if (ret == _SUCCESS || + (rtw_get_passing_time_ms(fwdl_start_time) > 500 && write_fw_retry++ >= 3)) + break; + + DBG_88E("%s write_fw_retry:%u, time after fwdl_start_time:%ums\n", + __func__, write_fw_retry, rtw_get_passing_time_ms(fwdl_start_time) + ); + } + fw_download_enable(padapter, false); + if (ret != _SUCCESS) { + DBG_88E("DL Firmware failed!\n"); + goto exit; + } + + ret = fw_free_to_go(padapter); + if (ret != _SUCCESS) { + DBG_88E("DL Firmware failed!\n"); + goto exit; + } + +exit: + return ret; +} diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index 3c9ddbe16754..dd89973928cf 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -3,12 +3,12 @@ #define _HAL_INIT_C_ -#include "../include/linux/firmware.h" #include "../include/drv_types.h" #include "../include/rtw_efuse.h" #include "../include/rtl8188e_hal.h" #include "../include/rtw_iol.h" #include "../include/usb_ops.h" +#include "../include/rtw_fw.h" static void iol_mode_enable(struct adapter *padapter, u8 enable) { @@ -336,287 +336,6 @@ exit: return ret; } -static void fw_download_enable(struct adapter *padapter, bool enable) -{ - u8 tmp; - - if (enable) { - /* MCU firmware download enable. */ - tmp = rtw_read8(padapter, REG_MCUFWDL); - rtw_write8(padapter, REG_MCUFWDL, tmp | 0x01); - - /* 8051 reset */ - tmp = rtw_read8(padapter, REG_MCUFWDL + 2); - rtw_write8(padapter, REG_MCUFWDL + 2, tmp & 0xf7); - } else { - /* MCU firmware download disable. */ - tmp = rtw_read8(padapter, REG_MCUFWDL); - rtw_write8(padapter, REG_MCUFWDL, tmp & 0xfe); - - /* Reserved for fw extension. */ - rtw_write8(padapter, REG_MCUFWDL + 1, 0x00); - } -} - -#define MAX_REG_BOLCK_SIZE 196 - -static int block_write(struct adapter *padapter, void *buffer, u32 buffSize) -{ - int ret = _SUCCESS; - u32 blockSize_p1 = 4; /* (Default) Phase #1 : PCI muse use 4-byte write to download FW */ - u32 blockSize_p2 = 8; /* Phase #2 : Use 8-byte, if Phase#1 use big size to write FW. */ - u32 blockSize_p3 = 1; /* Phase #3 : Use 1-byte, the remnant of FW image. */ - u32 blockCount_p1 = 0, blockCount_p2 = 0, blockCount_p3 = 0; - u32 remainSize_p1 = 0, remainSize_p2 = 0; - u8 *bufferPtr = (u8 *)buffer; - u32 i = 0, offset = 0; - - blockSize_p1 = MAX_REG_BOLCK_SIZE; - - /* 3 Phase #1 */ - blockCount_p1 = buffSize / blockSize_p1; - remainSize_p1 = buffSize % blockSize_p1; - - for (i = 0; i < blockCount_p1; i++) { - ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + i * blockSize_p1), blockSize_p1, (bufferPtr + i * blockSize_p1)); - if (ret == _FAIL) - goto exit; - } - - /* 3 Phase #2 */ - if (remainSize_p1) { - offset = blockCount_p1 * blockSize_p1; - - blockCount_p2 = remainSize_p1 / blockSize_p2; - remainSize_p2 = remainSize_p1 % blockSize_p2; - - for (i = 0; i < blockCount_p2; i++) { - ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + offset + i * blockSize_p2), blockSize_p2, (bufferPtr + offset + i * blockSize_p2)); - - if (ret == _FAIL) - goto exit; - } - } - - /* 3 Phase #3 */ - if (remainSize_p2) { - offset = (blockCount_p1 * blockSize_p1) + (blockCount_p2 * blockSize_p2); - - blockCount_p3 = remainSize_p2 / blockSize_p3; - - for (i = 0; i < blockCount_p3; i++) { - ret = rtw_write8(padapter, (FW_8188E_START_ADDRESS + offset + i), *(bufferPtr + offset + i)); - - if (ret == _FAIL) - goto exit; - } - } - -exit: - return ret; -} - -static int page_write(struct adapter *padapter, u32 page, void *buffer, u32 size) -{ - u8 value8; - u8 u8Page = (u8)(page & 0x07); - - value8 = (rtw_read8(padapter, REG_MCUFWDL + 2) & 0xF8) | u8Page; - rtw_write8(padapter, REG_MCUFWDL + 2, value8); - - return block_write(padapter, buffer, size); -} - -static int write_fw(struct adapter *padapter, void *buffer, u32 size) -{ - /* Since we need dynamic decide method of dwonload fw, so we call this function to get chip version. */ - /* We can remove _ReadChipVersion from ReadpadapterInfo8192C later. */ - int ret = _SUCCESS; - u32 pageNums, remainSize; - u32 page, offset; - u8 *bufferPtr = (u8 *)buffer; - - pageNums = size / MAX_PAGE_SIZE; - remainSize = size % MAX_PAGE_SIZE; - - for (page = 0; page < pageNums; page++) { - offset = page * MAX_PAGE_SIZE; - ret = page_write(padapter, page, bufferPtr + offset, MAX_PAGE_SIZE); - - if (ret == _FAIL) - goto exit; - } - if (remainSize) { - offset = pageNums * MAX_PAGE_SIZE; - page = pageNums; - ret = page_write(padapter, page, bufferPtr + offset, remainSize); - - if (ret == _FAIL) - goto exit; - } -exit: - return ret; -} - -void rtw_reset_8051(struct adapter *padapter) -{ - u8 val8; - - val8 = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 & (~BIT(2))); - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 | (BIT(2))); -} - -static int fw_free_to_go(struct adapter *padapter) -{ - u32 counter = 0; - u32 value32; - - /* polling CheckSum report */ - do { - value32 = rtw_read32(padapter, REG_MCUFWDL); - if (value32 & FWDL_CHKSUM_RPT) - break; - } while (counter++ < POLLING_READY_TIMEOUT_COUNT); - - if (counter >= POLLING_READY_TIMEOUT_COUNT) { - DBG_88E("%s: chksum report fail! REG_MCUFWDL:0x%08x\n", __func__, value32); - return _FAIL; - } - DBG_88E("%s: Checksum report OK! REG_MCUFWDL:0x%08x\n", __func__, value32); - - value32 = rtw_read32(padapter, REG_MCUFWDL); - value32 |= MCUFWDL_RDY; - value32 &= ~WINTINI_RDY; - rtw_write32(padapter, REG_MCUFWDL, value32); - - rtw_reset_8051(padapter); - - /* polling for FW ready */ - counter = 0; - do { - value32 = rtw_read32(padapter, REG_MCUFWDL); - if (value32 & WINTINI_RDY) { - DBG_88E("%s: Polling FW ready success!! REG_MCUFWDL:0x%08x\n", __func__, value32); - return _SUCCESS; - } - udelay(5); - } while (counter++ < POLLING_READY_TIMEOUT_COUNT); - - DBG_88E("%s: Polling FW ready fail!! REG_MCUFWDL:0x%08x\n", __func__, value32); - return _FAIL; -} - -static int load_firmware(struct rt_firmware *rtfw, struct device *device) -{ - int ret = _SUCCESS; - const struct firmware *fw; - const char *fw_name = "rtlwifi/rtl8188eufw.bin"; - int err = request_firmware(&fw, fw_name, device); - - if (err) { - pr_err("Request firmware failed with error 0x%x\n", err); - ret = _FAIL; - goto exit; - } - if (!fw) { - pr_err("Firmware %s not available\n", fw_name); - ret = _FAIL; - goto exit; - } - - rtfw->data = kmemdup(fw->data, fw->size, GFP_KERNEL); - if (!rtfw->data) { - pr_err("Failed to allocate rtfw->data\n"); - ret = _FAIL; - goto exit; - } - rtfw->size = fw->size; - dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", rtfw->size); - -exit: - release_firmware(fw); - return ret; -} - -int rtl8188e_firmware_download(struct adapter *padapter) -{ - int ret = _SUCCESS; - u8 write_fw_retry = 0; - u32 fwdl_start_time; - struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); - struct device *device = dvobj_to_dev(dvobj); - struct rt_firmware_hdr *fwhdr = NULL; - u16 fw_version, fw_subversion, fw_signature; - u8 *fw_data; - u32 fw_size; - static int log_version; - - if (!dvobj->firmware.data) - ret = load_firmware(&dvobj->firmware, device); - if (ret == _FAIL) { - dvobj->firmware.data = NULL; - goto exit; - } - fw_data = dvobj->firmware.data; - fw_size = dvobj->firmware.size; - - /* To Check Fw header. Added by tynli. 2009.12.04. */ - fwhdr = (struct rt_firmware_hdr *)dvobj->firmware.data; - - fw_version = le16_to_cpu(fwhdr->Version); - fw_subversion = fwhdr->Subversion; - fw_signature = le16_to_cpu(fwhdr->Signature); - - if (!log_version++) - pr_info("%sFirmware Version %d, SubVersion %d, Signature 0x%x\n", - DRIVER_PREFIX, fw_version, fw_subversion, fw_signature); - - if (IS_FW_HEADER_EXIST(fwhdr)) { - /* Shift 32 bytes for FW header */ - fw_data = fw_data + 32; - fw_size = fw_size - 32; - } - - /* Suggested by Filen. If 8051 is running in RAM code, driver should inform Fw to reset by itself, */ - /* or it will cause download Fw fail. 2010.02.01. by tynli. */ - if (rtw_read8(padapter, REG_MCUFWDL) & RAM_DL_SEL) { /* 8051 RAM code */ - rtw_write8(padapter, REG_MCUFWDL, 0x00); - rtw_reset_8051(padapter); - } - - fw_download_enable(padapter, true); - fwdl_start_time = jiffies; - while (1) { - /* reset the FWDL chksum */ - rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWDL_CHKSUM_RPT); - - ret = write_fw(padapter, fw_data, fw_size); - - if (ret == _SUCCESS || - (rtw_get_passing_time_ms(fwdl_start_time) > 500 && write_fw_retry++ >= 3)) - break; - - DBG_88E("%s write_fw_retry:%u, time after fwdl_start_time:%ums\n", - __func__, write_fw_retry, rtw_get_passing_time_ms(fwdl_start_time) - ); - } - fw_download_enable(padapter, false); - if (ret != _SUCCESS) { - DBG_88E("DL Firmware failed!\n"); - goto exit; - } - - ret = fw_free_to_go(padapter); - if (ret != _SUCCESS) { - DBG_88E("DL Firmware failed!\n"); - goto exit; - } - -exit: - return ret; -} - /* */ /* Efuse related code */ /* */ diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 3dc1c432e8cf..fc62019143ba 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -6,7 +6,7 @@ #include "../include/osdep_service.h" #include "../include/drv_types.h" #include "../include/rtw_efuse.h" - +#include "../include/rtw_fw.h" #include "../include/rtl8188e_hal.h" #include "../include/rtw_iol.h" #include "../include/usb_ops.h" diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 4b67e11024a1..c614faf188bb 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -249,10 +249,6 @@ struct hal_data_8188e { u8 UsbRxAggPageTimeout; }; -/* rtl8188e_hal_init.c */ -int rtl8188e_firmware_download(struct adapter *padapter); -void rtw_reset_8051(struct adapter *padapter); - s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy); /* EFuse */ diff --git a/drivers/staging/r8188eu/include/rtw_fw.h b/drivers/staging/r8188eu/include/rtw_fw.h new file mode 100644 index 000000000000..749157704251 --- /dev/null +++ b/drivers/staging/r8188eu/include/rtw_fw.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ +/* Copyright(c) 2007 - 2011 Realtek Corporation. */ + +#ifndef __RTW_FW_H__ +#define __RTW_FW_H__ + +#include "drv_types.h" + +#define MAX_REG_BOLCK_SIZE 196 + +int rtl8188e_firmware_download(struct adapter *padapter); +void rtw_reset_8051(struct adapter *padapter); + +#endif -- cgit From 106ee4d8c357b8d564360895659479a799853a45 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 15:36:15 +0100 Subject: staging: r8188eu: rename _pFwHdr in IS_FW_HEADER_EXIST Rename _pFwHdr in the macro IS_FW_HEADER_EXIST to avoid camel case. _pFwHdr -> _fwhdr Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107143617.2214-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtl8188e_hal.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index c614faf188bb..d8892acad224 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -39,11 +39,11 @@ #define MAX_PAGE_SIZE 4096 /* @ page : 4k bytes */ -#define IS_FW_HEADER_EXIST(_pFwHdr) \ - ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x92C0 || \ - (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88C0 || \ - (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x2300 || \ - (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88E0) +#define IS_FW_HEADER_EXIST(_fwhdr) \ + ((le16_to_cpu(_fwhdr->Signature)&0xFFF0) == 0x92C0 || \ + (le16_to_cpu(_fwhdr->Signature)&0xFFF0) == 0x88C0 || \ + (le16_to_cpu(_fwhdr->Signature)&0xFFF0) == 0x2300 || \ + (le16_to_cpu(_fwhdr->Signature)&0xFFF0) == 0x88E0) /* This structure must be careful with byte-ordering */ -- cgit From 9df7cc3a829a208da79a265cc4d39ae587ffbcca Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 15:36:16 +0100 Subject: staging: r8188eu: add spaces around & operator in IS_FW_HEADER_EXIST Add spaces around & operator in the macro IS_FW_HEADER_EXIST to improve readability and follow kernel coding style. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107143617.2214-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtl8188e_hal.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index d8892acad224..dad2aa473a1c 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -40,10 +40,10 @@ #define MAX_PAGE_SIZE 4096 /* @ page : 4k bytes */ #define IS_FW_HEADER_EXIST(_fwhdr) \ - ((le16_to_cpu(_fwhdr->Signature)&0xFFF0) == 0x92C0 || \ - (le16_to_cpu(_fwhdr->Signature)&0xFFF0) == 0x88C0 || \ - (le16_to_cpu(_fwhdr->Signature)&0xFFF0) == 0x2300 || \ - (le16_to_cpu(_fwhdr->Signature)&0xFFF0) == 0x88E0) + ((le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x92C0 || \ + (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88C0 || \ + (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x2300 || \ + (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88E0) /* This structure must be careful with byte-ordering */ -- cgit From f19fe1537c38d8a4a0ac15dc07fb058df67cd486 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 15:36:17 +0100 Subject: staging: r8188eu: move firmware related macros to rtw_fw.h Move firmware related macros from rtl8188e_hal.h to rtw_fw.h. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107143617.2214-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtl8188e_hal.h | 11 ----------- drivers/staging/r8188eu/include/rtw_fw.h | 10 +++++++++- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index dad2aa473a1c..d9e944a83940 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -34,17 +34,6 @@ #define DRVINFO_SZ 4 /* unit is 8bytes */ #define PageNum_128(_Len) (u32)(((_Len)>>7) + ((_Len) & 0x7F ? 1 : 0)) -/* download firmware related data structure */ -#define FW_8188E_START_ADDRESS 0x1000 - -#define MAX_PAGE_SIZE 4096 /* @ page : 4k bytes */ - -#define IS_FW_HEADER_EXIST(_fwhdr) \ - ((le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x92C0 || \ - (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88C0 || \ - (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x2300 || \ - (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88E0) - /* This structure must be careful with byte-ordering */ struct rt_firmware_hdr { diff --git a/drivers/staging/r8188eu/include/rtw_fw.h b/drivers/staging/r8188eu/include/rtw_fw.h index 749157704251..9b7492ef0199 100644 --- a/drivers/staging/r8188eu/include/rtw_fw.h +++ b/drivers/staging/r8188eu/include/rtw_fw.h @@ -6,7 +6,15 @@ #include "drv_types.h" -#define MAX_REG_BOLCK_SIZE 196 +#define MAX_REG_BOLCK_SIZE 196 +#define FW_8188E_START_ADDRESS 0x1000 +#define MAX_PAGE_SIZE 4096 + +#define IS_FW_HEADER_EXIST(_fwhdr) \ + ((le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x92C0 || \ + (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88C0 || \ + (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x2300 || \ + (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88E0) int rtl8188e_firmware_download(struct adapter *padapter); void rtw_reset_8051(struct adapter *padapter); -- cgit From dba29039b6d0a7aebb72525ebf028a5f2cf1aa89 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 22:50:28 +0100 Subject: staging: r8188eu: remove HW_VAR_BASIC_RATE from GetHwReg8188EU() GetHwReg8188EU() is never called with HW_VAR_BASIC_RATE. Remove that case from the function. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107215033.12257-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index fc62019143ba..306f3b4ecc27 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1594,9 +1594,6 @@ void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) struct odm_dm_struct *podmpriv = &haldata->odmpriv; switch (variable) { - case HW_VAR_BASIC_RATE: - *((u16 *)(val)) = haldata->BasicRateSet; - fallthrough; case HW_VAR_TXPAUSE: val[0] = rtw_read8(Adapter, REG_TXPAUSE); break; -- cgit From 08dc8feb14fd427ae8bb7df15f0987181809e3d0 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 22:50:29 +0100 Subject: staging: r8188eu: remove HW_VAR_TXPAUSE SetHwReg8188EU() and GetHwReg8188EU() are never called with HW_VAR_TXPAUSE. Remove that case from both functions. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107215033.12257-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 6 ------ drivers/staging/r8188eu/include/hal_intf.h | 1 - 2 files changed, 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 306f3b4ecc27..1900b34c0b6f 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1140,9 +1140,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) rtw_write8(Adapter, REG_INIRTS_RATE_SEL, RateIndex); } break; - case HW_VAR_TXPAUSE: - rtw_write8(Adapter, REG_TXPAUSE, *((u8 *)val)); - break; case HW_VAR_BCN_FUNC: hw_var_set_bcn_func(Adapter, variable, val); break; @@ -1594,9 +1591,6 @@ void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) struct odm_dm_struct *podmpriv = &haldata->odmpriv; switch (variable) { - case HW_VAR_TXPAUSE: - val[0] = rtw_read8(Adapter, REG_TXPAUSE); - break; case HW_VAR_BCN_VALID: /* BCN_VALID, BIT(16) of REG_TDECTRL = BIT(0) of REG_TDECTRL+2 */ val[0] = (BIT(0) & rtw_read8(Adapter, REG_TDECTRL + 2)) ? true : false; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index b4a7e0ce3116..77149eda7edf 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -16,7 +16,6 @@ enum hw_variables { HW_VAR_BSSID, HW_VAR_INIT_RTS_RATE, HW_VAR_BASIC_RATE, - HW_VAR_TXPAUSE, HW_VAR_BCN_FUNC, HW_VAR_CORRECT_TSF, HW_VAR_CHECK_BSSID, -- cgit From f3806385a46936957dd328c404772c783b095eea Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 22:50:30 +0100 Subject: staging: r8188eu: remove HW_VAR_CURRENT_ANTENNA from GetHwReg8188EU() GetHwReg8188EU() is never called with HW_VAR_CURRENT_ANTENNA. Remove that case from the function. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107215033.12257-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - 2 files changed, 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 1900b34c0b6f..12d4f92749e6 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1616,9 +1616,6 @@ void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } } break; - case HW_VAR_CURRENT_ANTENNA: - val[0] = haldata->CurAntenna; - break; case HW_VAR_EFUSE_BYTES: /* To get EFUE total used bytes, added by Roger, 2008.12.22. */ *((u16 *)(val)) = haldata->EfuseUsedBytes; break; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 77149eda7edf..37c2d2b82ea8 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -55,7 +55,6 @@ enum hw_variables { HW_VAR_INITIAL_GAIN, HW_VAR_BT_SET_COEXIST, HW_VAR_BT_ISSUE_DELBA, - HW_VAR_CURRENT_ANTENNA, HW_VAR_ANTENNA_DIVERSITY_LINK, HW_VAR_ANTENNA_DIVERSITY_SELECT, HW_VAR_SWITCH_EPHY_WoWLAN, -- cgit From 762e47b34b87635f48864ecfe46dc6a1f2351256 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 22:50:31 +0100 Subject: staging: r8188eu: remove HW_VAR_EFUSE_BYTES from GetHwReg8188EU() GetHwReg8188EU() is never called with HW_VAR_EFUSE_BYTES. Remove that case from the function. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107215033.12257-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 12d4f92749e6..179d2a4dce1d 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1616,9 +1616,6 @@ void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } } break; - case HW_VAR_EFUSE_BYTES: /* To get EFUE total used bytes, added by Roger, 2008.12.22. */ - *((u16 *)(val)) = haldata->EfuseUsedBytes; - break; case HW_VAR_APFM_ON_MAC: *val = haldata->bMacPwrCtrlOn; break; -- cgit From dce7cbb4e1e512522df3da4b83fb46b9c72b4841 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 22:50:32 +0100 Subject: staging: r8188eu: EfuseUsedBytes is set but never used The field EfuseUsedBytes of struct hal_data_8188e is set but never used. Remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107215033.12257-6-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 3 --- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - drivers/staging/r8188eu/include/rtl8188e_hal.h | 2 -- 4 files changed, 9 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index dd89973928cf..b3ae358d1143 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -498,9 +498,6 @@ static void Hal_EfuseReadEFuse88E(struct adapter *Adapter, for (i = 0; i < _size_byte; i++) pbuf[i] = efuseTbl[_offset + i]; - /* 5. Calculate Efuse utilization. */ - SetHwReg8188EU(Adapter, HW_VAR_EFUSE_BYTES, (u8 *)&eFuse_Addr); - exit: kfree(efuseTbl); kfree(eFuseWord); diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 179d2a4dce1d..f1a90d66ff67 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1530,9 +1530,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } } break; - case HW_VAR_EFUSE_BYTES: /* To set EFUE total used bytes, added by Roger, 2008.12.22. */ - haldata->EfuseUsedBytes = *((u16 *)val); - break; case HW_VAR_FIFO_CLEARN_UP: { struct pwrctrl_priv *pwrpriv = &Adapter->pwrctrlpriv; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 37c2d2b82ea8..a86cb376a125 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -59,7 +59,6 @@ enum hw_variables { HW_VAR_ANTENNA_DIVERSITY_SELECT, HW_VAR_SWITCH_EPHY_WoWLAN, HW_VAR_EFUSE_USAGE, - HW_VAR_EFUSE_BYTES, HW_VAR_EFUSE_BT_USAGE, HW_VAR_EFUSE_BT_BYTES, HW_VAR_FIFO_CLEARN_UP, diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index d9e944a83940..66eadd170c9b 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -216,8 +216,6 @@ struct hal_data_8188e { u8 OutEpQueueSel; u8 OutEpNumber; - u16 EfuseUsedBytes; - struct P2P_PS_Offload_t p2p_ps_offload; /* Auto FSM to Turn On, include clock, isolation, power control -- cgit From 53493c253510d129aa159c0302a490a11dcdbb59 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 7 Jan 2022 22:50:33 +0100 Subject: staging: r8188eu: remove HW_VAR_APFM_ON_MAC SetHwReg8188EU() and GetHwReg8188EU() are never called with HW_VAR_APFM_ON_MAC. Remove that case from both functions. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107215033.12257-7-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 7 ------- drivers/staging/r8188eu/include/hal_intf.h | 2 -- 2 files changed, 9 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index f1a90d66ff67..38b88e6b7bdb 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1558,10 +1558,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } } break; - case HW_VAR_APFM_ON_MAC: - haldata->bMacPwrCtrlOn = *val; - DBG_88E("%s: bMacPwrCtrlOn=%d\n", __func__, haldata->bMacPwrCtrlOn); - break; case HW_VAR_TX_RPT_MAX_MACID: { u8 maxMacid = *val; @@ -1613,9 +1609,6 @@ void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } } break; - case HW_VAR_APFM_ON_MAC: - *val = haldata->bMacPwrCtrlOn; - break; case HW_VAR_CHK_HI_QUEUE_EMPTY: *val = ((rtw_read32(Adapter, REG_HGQ_INFORMATION) & 0x0000ff00) == 0) ? true : false; break; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index a86cb376a125..120b32994e1f 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -62,8 +62,6 @@ enum hw_variables { HW_VAR_EFUSE_BT_USAGE, HW_VAR_EFUSE_BT_BYTES, HW_VAR_FIFO_CLEARN_UP, - HW_VAR_APFM_ON_MAC, /* Auto FSM to Turn On, include clock, isolation, - * power control for MAC only */ /* The valid upper nav range for the HW updating, if the true value is * larger than the upper range, the HW won't update it. */ /* Unit in microsecond. 0 means disable this function. */ -- cgit From ea9ac80e2eceac6388eea2164e68a53c54d70ca0 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Sat, 8 Jan 2022 00:55:46 +0000 Subject: staging: r8188eu: convert/remove DBG_88E calls in core/rtw_ap.c Convert DBG_88E macro calls in core/rtw_ap.c to use netdev_dbg when they may display useful information, and remove erroneous DBG_88E calls entirely. This leaves six empty static functions which only had DBG_88E calls, so just remove them: update_bcn_fixed_ie update_bcn_htcap_ie update_bcn_htinfo_ie update_bcn_rsn_ie update_bcn_wpa_ie update_bcn_wmm_ie also modifying the if blocks/switch cases that invoke them to no longer do so. This goes further towards the goal of removing this non-standard debugging code. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220108005550.26264-2-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_ap.c | 145 +++++++++++++--------------------- 1 file changed, 56 insertions(+), 89 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c index 1675e2e8439c..1486ec613458 100644 --- a/drivers/staging/r8188eu/core/rtw_ap.c +++ b/drivers/staging/r8188eu/core/rtw_ap.c @@ -179,8 +179,9 @@ void expire_timeout_chk(struct adapter *padapter) list_del_init(&psta->auth_list); pstapriv->auth_list_cnt--; - DBG_88E("auth expire %6ph\n", - psta->hwaddr); + netdev_dbg(padapter->pnetdev, + "auth expire %6ph\n", + psta->hwaddr); spin_unlock_bh(&pstapriv->auth_list_lock); @@ -249,16 +250,19 @@ void expire_timeout_chk(struct adapter *padapter) list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; - DBG_88E("asoc expire %pM, state = 0x%x\n", (psta->hwaddr), psta->state); + netdev_dbg(padapter->pnetdev, + "asoc expire %pM, state = 0x%x\n", + (psta->hwaddr), psta->state); updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING); } else { /* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */ if (psta->sleepq_len > (NR_XMITFRAME / pstapriv->asoc_list_cnt) && padapter->xmitpriv.free_xmitframe_cnt < (NR_XMITFRAME / pstapriv->asoc_list_cnt / 2)) { - DBG_88E("%s sta:%pM, sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", __func__, - (psta->hwaddr), psta->sleepq_len, - padapter->xmitpriv.free_xmitframe_cnt, - pstapriv->asoc_list_cnt); + netdev_dbg(padapter->pnetdev, + "sta:%pM, sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", + (psta->hwaddr), psta->sleepq_len, + padapter->xmitpriv.free_xmitframe_cnt, + pstapriv->asoc_list_cnt); wakeup_sta_to_xmit(padapter, psta); } } @@ -288,19 +292,25 @@ void expire_timeout_chk(struct adapter *padapter) psta->keep_alive_trycnt++; if (ret == _SUCCESS) { - DBG_88E("asoc check, sta(%pM) is alive\n", (psta->hwaddr)); + netdev_dbg(padapter->pnetdev, + "asoc check, sta(%pM) is alive\n", + (psta->hwaddr)); psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; continue; } else if (psta->keep_alive_trycnt <= 3) { - DBG_88E("ack check for asoc expire, keep_alive_trycnt =%d\n", psta->keep_alive_trycnt); + netdev_dbg(padapter->pnetdev, + "ack check for asoc expire, keep_alive_trycnt =%d\n", + psta->keep_alive_trycnt); psta->expire_to = 1; continue; } psta->keep_alive_trycnt = 0; - DBG_88E("asoc expire %pM, state = 0x%x\n", (psta->hwaddr), psta->state); + netdev_dbg(padapter->pnetdev, + "asoc expire %pM, state = 0x%x\n", + (psta->hwaddr), psta->state); spin_lock_bh(&pstapriv->asoc_list_lock); list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; @@ -380,8 +390,9 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) tx_ra_bitmap |= ((raid << 28) & 0xf0000000); - DBG_88E("%s => mac_id:%d , raid:%d , bitmap = 0x%x, arg = 0x%x\n", - __func__, psta->mac_id, raid, tx_ra_bitmap, arg); + netdev_dbg(padapter->pnetdev, + "mac_id:%d, raid:%d, bitmap = 0x%x, arg = 0x%x\n", + psta->mac_id, raid, tx_ra_bitmap, arg); /* bitmap[0:27] = tx_rate_bitmap */ /* bitmap[28:31]= Rate Adaptive id */ @@ -397,7 +408,9 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) psta->init_rate = init_rate; } else { - DBG_88E("station aid %d exceed the max number\n", psta->aid); + netdev_dbg(padapter->pnetdev, + "station aid %d exceed the max number\n", + psta->aid); } } @@ -455,7 +468,9 @@ void update_bmc_sta(struct adapter *padapter) arg = psta->mac_id & 0x1f; arg |= BIT(7); tx_ra_bitmap |= ((raid << 28) & 0xf0000000); - DBG_88E("update_bmc_sta, mask = 0x%x, arg = 0x%x\n", tx_ra_bitmap, arg); + netdev_dbg(padapter->pnetdev, + "mask = 0x%x, arg = 0x%x\n", + tx_ra_bitmap, arg); /* bitmap[0:27] = tx_rate_bitmap */ /* bitmap[28:31]= Rate Adaptive id */ @@ -474,7 +489,7 @@ void update_bmc_sta(struct adapter *padapter) spin_unlock_bh(&psta->lock); } else { - DBG_88E("add_RATid_bmc_sta error!\n"); + netdev_dbg(padapter->pnetdev, "add_RATid_bmc_sta error!\n"); } } @@ -496,7 +511,6 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) u16 ap_cap_info; psta->mac_id = psta->aid + 1; - DBG_88E("%s\n", __func__); /* ap mode */ rtl8188e_SetHalODMVar(padapter, psta, true); @@ -552,11 +566,6 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) spin_unlock_bh(&psta->lock); } -static void update_bcn_fixed_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - static void update_bcn_erpinfo_ie(struct adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -566,7 +575,7 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter) unsigned char *p, *ie = pnetwork->IEs; u32 len = 0; - DBG_88E("%s, ERP_enable =%d\n", __func__, pmlmeinfo->ERP_enable); + netdev_dbg(padapter->pnetdev, "ERP_enable = %d\n", pmlmeinfo->ERP_enable); if (!pmlmeinfo->ERP_enable) return; @@ -591,31 +600,6 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter) } } -static void update_bcn_htcap_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - -static void update_bcn_htinfo_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - -static void update_bcn_rsn_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - -static void update_bcn_wpa_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - -static void update_bcn_wmm_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - static void update_bcn_wps_ie(struct adapter *padapter) { u8 *pwps_ie = NULL, *pwps_ie_src; @@ -628,8 +612,6 @@ static void update_bcn_wps_ie(struct adapter *padapter) unsigned char *ie = pnetwork->IEs; u32 ielen = pnetwork->IELength; - DBG_88E("%s\n", __func__); - pwps_ie = rtw_get_wps_ie(ie + _FIXED_IE_LENGTH_, ielen - _FIXED_IE_LENGTH_, NULL, &wps_ielen); if (!pwps_ie || wps_ielen == 0) @@ -673,18 +655,12 @@ static void update_bcn_p2p_ie(struct adapter *padapter) static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui) { - DBG_88E("%s\n", __func__); - - if (!memcmp(RTW_WPA_OUI, oui, 4)) - update_bcn_wpa_ie(padapter); - else if (!memcmp(WMM_OUI, oui, 4)) - update_bcn_wmm_ie(padapter); - else if (!memcmp(WPS_OUI, oui, 4)) + if (!memcmp(WPS_OUI, oui, 4)) update_bcn_wps_ie(padapter); else if (!memcmp(P2P_OUI, oui, 4)) update_bcn_p2p_ie(padapter); else - DBG_88E("unknown OUI type!\n"); + netdev_dbg(padapter->pnetdev, "unknown/unused OUI type!\n"); } void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) @@ -704,24 +680,12 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) spin_lock_bh(&pmlmepriv->bcn_update_lock); switch (ie_id) { - case 0xFF: - update_bcn_fixed_ie(padapter);/* 8: TimeStamp, 2: Beacon Interval 2:Capability */ - break; case _TIM_IE_: update_BCNTIM(padapter); break; case _ERPINFO_IE_: update_bcn_erpinfo_ie(padapter); break; - case _HT_CAPABILITY_IE_: - update_bcn_htcap_ie(padapter); - break; - case _RSN_IE_2_: - update_bcn_rsn_ie(padapter); - break; - case _HT_ADD_INFO_IE_: - update_bcn_htinfo_ie(padapter); - break; case _VENDOR_SPECIFIC_IE_: update_bcn_vendor_spec_ie(padapter, oui); break; @@ -759,8 +723,9 @@ static int rtw_ht_operation_update(struct adapter *padapter) if (pmlmepriv->htpriv.ht_option) return 0; - DBG_88E("%s current operation mode = 0x%X\n", - __func__, pmlmepriv->ht_op_mode); + netdev_dbg(padapter->pnetdev, + "current operation mode = 0x%X\n", + pmlmepriv->ht_op_mode); if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) && pmlmepriv->num_sta_ht_no_gf) { @@ -811,8 +776,9 @@ static int rtw_ht_operation_update(struct adapter *padapter) op_mode_changes++; } - DBG_88E("%s new operation mode = 0x%X changes =%d\n", - __func__, pmlmepriv->ht_op_mode, op_mode_changes); + netdev_dbg(padapter->pnetdev, + "new operation mode = 0x%X changes = %d\n", + pmlmepriv->ht_op_mode, op_mode_changes); return op_mode_changes; } @@ -928,8 +894,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) if (psta->flags & WLAN_STA_HT) { u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info); - DBG_88E("HT: STA %pM HT Capabilities Info: 0x%04x\n", - (psta->hwaddr), ht_capab); + netdev_dbg(padapter->pnetdev, + "HT: STA %pM HT Capabilities Info: 0x%04x\n", + (psta->hwaddr), ht_capab); if (psta->no_ht_set) { psta->no_ht_set = 0; @@ -941,9 +908,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) psta->no_ht_gf_set = 1; pmlmepriv->num_sta_ht_no_gf++; } - DBG_88E("%s STA %pM - no greenfield, num of non-gf stations %d\n", - __func__, (psta->hwaddr), - pmlmepriv->num_sta_ht_no_gf); + netdev_dbg(padapter->pnetdev, + "STA %pM - no greenfield, num of non-gf stations %d\n", + (psta->hwaddr), pmlmepriv->num_sta_ht_no_gf); } if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH_20_40) == 0) { @@ -951,9 +918,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) psta->ht_20mhz_set = 1; pmlmepriv->num_sta_ht_20mhz++; } - DBG_88E("%s STA %pM - 20 MHz HT, num of 20MHz HT STAs %d\n", - __func__, (psta->hwaddr), - pmlmepriv->num_sta_ht_20mhz); + netdev_dbg(padapter->pnetdev, + "STA %pM - 20 MHz HT, num of 20MHz HT STAs %d\n", + (psta->hwaddr), pmlmepriv->num_sta_ht_20mhz); } } else { if (!psta->no_ht_set) { @@ -961,9 +928,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) pmlmepriv->num_sta_no_ht++; } if (pmlmepriv->htpriv.ht_option) { - DBG_88E("%s STA %pM - no HT, num of non-HT stations %d\n", - __func__, (psta->hwaddr), - pmlmepriv->num_sta_no_ht); + netdev_dbg(padapter->pnetdev, + "STA %pM - no HT, num of non-HT stations %d\n", + (psta->hwaddr), pmlmepriv->num_sta_no_ht); } } @@ -975,7 +942,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) /* update associcated stations cap. */ associated_clients_update(padapter, beacon_updated); - DBG_88E("%s, updated =%d\n", __func__, beacon_updated); + netdev_dbg(padapter->pnetdev, "updated = %d\n", beacon_updated); } u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta) @@ -1038,7 +1005,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta) /* update associcated stations cap. */ - DBG_88E("%s, updated =%d\n", __func__, beacon_updated); + netdev_dbg(padapter->pnetdev, "updated = %d\n", beacon_updated); return beacon_updated; } @@ -1093,8 +1060,6 @@ int rtw_sta_flush(struct adapter *padapter) struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - DBG_88E(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev)); - if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE) return ret; @@ -1236,7 +1201,9 @@ void stop_ap_mode(struct adapter *padapter) } spin_unlock_bh(&pacl_node_q->lock); - DBG_88E("%s, free acl_node_queue, num =%d\n", __func__, pacl_list->num); + netdev_dbg(padapter->pnetdev, + "free acl_node_queue, num = %d\n", + pacl_list->num); rtw_sta_flush(padapter); -- cgit From 0bfcc8b5c1ed9999a8717a3482faea2ebae17a3a Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Sat, 8 Jan 2022 00:55:47 +0000 Subject: staging: r8188eu: convert DBG_88E calls in os_dep/xmit_linux.c Convert three DBG_88E macro calls in core/rtw_ap.c to use netdev_dbg as their information may be useful to observers, and this gets the driver closer to the point of being able to remove DBG_88E itself. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220108005550.26264-3-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/xmit_linux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c index 088c294f2586..7287897b3f65 100644 --- a/drivers/staging/r8188eu/os_dep/xmit_linux.c +++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c @@ -79,7 +79,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb for (i = 0; i < 8; i++) { pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); if (!pxmitbuf->pxmit_urb[i]) { - DBG_88E("pxmitbuf->pxmit_urb[i]==NULL"); + netdev_dbg(padapter->pnetdev, "pxmitbuf->pxmit_urb[i]==NULL"); return _FAIL; } } @@ -188,14 +188,14 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) memcpy(newskb->data, psta->hwaddr, 6); res = rtw_xmit(padapter, &newskb); if (res < 0) { - DBG_88E("%s()-%d: rtw_xmit() return error!\n", __func__, __LINE__); + netdev_dbg(padapter->pnetdev, "rtw_xmit() return error!\n"); pxmitpriv->tx_drop++; dev_kfree_skb_any(newskb); } else { pxmitpriv->tx_pkts++; } } else { - DBG_88E("%s-%d: skb_copy() failed!\n", __func__, __LINE__); + netdev_dbg(padapter->pnetdev, "skb_copy() failed!\n"); pxmitpriv->tx_drop++; spin_unlock_bh(&pstapriv->asoc_list_lock); -- cgit From 6397fb278bd92cc60a19f9779061dc3f677dfdc2 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Sat, 8 Jan 2022 00:55:48 +0000 Subject: staging: r8188eu: remove DBG_88E call from os_dep/osdep_service.c Remove the single DBG_88E macro call from os_dep/osdep_service.c, as it is unreachable anyway. This gets the driver closer to the eventual removal of DBG_88E itself. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220108005550.26264-4-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/osdep_service.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/osdep_service.c b/drivers/staging/r8188eu/os_dep/osdep_service.c index 59bdd0abea7e..7a6fcc96081a 100644 --- a/drivers/staging/r8188eu/os_dep/osdep_service.c +++ b/drivers/staging/r8188eu/os_dep/osdep_service.c @@ -236,8 +236,6 @@ void *rtw_cbuf_pop(struct rtw_cbuf *cbuf) if (rtw_cbuf_empty(cbuf)) return NULL; - if (0) - DBG_88E("%s on %u\n", __func__, cbuf->read); buf = cbuf->bufs[cbuf->read]; cbuf->read = (cbuf->read + 1) % cbuf->size; -- cgit From 198fae4213e219797d5e2c7832593b8b8cfb0049 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Sat, 8 Jan 2022 00:55:49 +0000 Subject: staging: r8188eu: convert DBG_88E call in core/rtw_cmd.c Convert the DBG_88E macro call in core/rtw_cmd.c to use netdev_dbg as its information may be useful to observers, and this gets the driver closer to the point of being able to remove DBG_88E itself. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220108005550.26264-5-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_cmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index 8bfb01c2ebb5..712fd6e536c4 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -952,7 +952,9 @@ static void rtl8188e_sreset_xmit_status_check(struct adapter *padapter) txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS); if (txdma_status != 0x00) { - DBG_88E("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status); + netdev_dbg(padapter->pnetdev, + "REG_TXDMA_STATUS: 0x%08x\n", + txdma_status); rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status); } /* total xmit irp = 4 */ -- cgit From d601ad5686de0fd1c2cae3a72063aa008bf50b3a Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Sat, 8 Jan 2022 00:55:50 +0000 Subject: staging: r8188eu: convert/remove DBG_88E calls in os_dep/usb_ops_linux.c Convert DBG_88E macro calls in os_dep/usb_ops_linux.c to use netdev_dbg when they may display useful information, and remove erroneous DBG_88E calls entirely. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220108005550.26264-6-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/usb_ops_linux.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c index d1cb33d3e6a7..3977a717d30a 100644 --- a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c +++ b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c @@ -32,8 +32,6 @@ void rtw_read_port_cancel(struct adapter *padapter) int i; struct recv_buf *precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf; - DBG_88E("%s\n", __func__); - padapter->bReadPortCancel = true; for (i = 0; i < NR_RECVBUFF; i++) { @@ -72,30 +70,32 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) if (padapter->bSurpriseRemoved || padapter->bDriverStopped || padapter->bWritePortCancel) { - DBG_88E("%s(): TX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bWritePortCancel(%d) pxmitbuf->ext_tag(%x)\n", - __func__, padapter->bDriverStopped, - padapter->bSurpriseRemoved, padapter->bReadPortCancel, - pxmitbuf->ext_tag); + netdev_dbg(padapter->pnetdev, + "TX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", + padapter->bDriverStopped, padapter->bSurpriseRemoved); + netdev_dbg(padapter->pnetdev, + "TX Warning! bWritePortCancel(%d) pxmitbuf->ext_tag(%x)\n", + padapter->bReadPortCancel, pxmitbuf->ext_tag); goto check_completion; } if (purb->status) { - DBG_88E("###=> urb_write_port_complete status(%d)\n", purb->status); + netdev_dbg(padapter->pnetdev, "status(%d)\n", purb->status); if (purb->status == -EINPROGRESS) { goto check_completion; } else if (purb->status == -ENOENT) { - DBG_88E("%s: -ENOENT\n", __func__); + netdev_dbg(padapter->pnetdev, "-ENOENT\n"); goto check_completion; } else if (purb->status == -ECONNRESET) { - DBG_88E("%s: -ECONNRESET\n", __func__); + netdev_dbg(padapter->pnetdev, "-ECONNRESET\n"); goto check_completion; } else if (purb->status == -ESHUTDOWN) { padapter->bDriverStopped = true; goto check_completion; } else if ((purb->status != -EPIPE) && (purb->status != -EPROTO)) { padapter->bSurpriseRemoved = true; - DBG_88E("bSurpriseRemoved = true\n"); + netdev_dbg(padapter->pnetdev, "bSurpriseRemoved = true\n"); goto check_completion; } @@ -174,7 +174,7 @@ u32 rtw_write_port(struct adapter *padapter, u32 addr, u32 cnt, u8 *wmem) status = usb_submit_urb(purb, GFP_ATOMIC); if (status) { rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR); - DBG_88E("usb_write_port, status =%d\n", status); + netdev_dbg(padapter->pnetdev, "usb_write_port, status = %d\n", status); switch (status) { case -ENODEV: @@ -202,8 +202,6 @@ void rtw_write_port_cancel(struct adapter *padapter) int i, j; struct xmit_buf *pxmitbuf = (struct xmit_buf *)padapter->xmitpriv.pxmitbuf; - DBG_88E("%s\n", __func__); - padapter->bWritePortCancel = true; for (i = 0; i < NR_XMITBUFF; i++) { -- cgit From a5ea39eaa7fd353af6ba16a8b036073d5483d5f3 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 8 Jan 2022 09:27:32 +0100 Subject: staging: r8188eu: rtw_hostapd_mlme_rx() is empty The function rtw_hostapd_mlme_rx() is empty. Remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220108082736.16788-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 -- drivers/staging/r8188eu/include/recv_osdep.h | 1 - drivers/staging/r8188eu/os_dep/recv_linux.c | 5 ----- 3 files changed, 8 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index a9141ab1690e..cdd928c37a3e 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -459,8 +459,6 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) break; default: _mgt_dispatcher(padapter, ptable, precv_frame); - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) - rtw_hostapd_mlme_rx(padapter, precv_frame); break; } } diff --git a/drivers/staging/r8188eu/include/recv_osdep.h b/drivers/staging/r8188eu/include/recv_osdep.h index e87467022b39..4b5e3dde4590 100644 --- a/drivers/staging/r8188eu/include/recv_osdep.h +++ b/drivers/staging/r8188eu/include/recv_osdep.h @@ -14,7 +14,6 @@ s32 rtw_recv_entry(struct recv_frame *precv_frame); int rtw_recv_indicatepkt(struct adapter *adapter, struct recv_frame *recv_frame); void rtw_recv_returnpacket(struct net_device *cnxt, struct sk_buff *retpkt); -void rtw_hostapd_mlme_rx(struct adapter *padapter, struct recv_frame *recv_fr); void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup); int rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter); diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index 5a7fb94e21c1..41c4e35d967f 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -100,11 +100,6 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup) &wrqu, (char *)&ev); } -void rtw_hostapd_mlme_rx(struct adapter *padapter, - struct recv_frame *precv_frame) -{ -} - int rtw_recv_indicatepkt(struct adapter *padapter, struct recv_frame *precv_frame) { -- cgit From 3a0f2edf54475ddc4f7cdf3e6b6517841a93e09a Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 8 Jan 2022 09:27:33 +0100 Subject: staging: r8188eu: convert switch to if statement in mgt_dispatcher() The 'switch (GetFrameSubType(pframe))' in mgt_dispatcher() has only one case that does something different than the default case. Convert the switch to an if statement to improve readability. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220108082736.16788-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index cdd928c37a3e..a169a7a39ebc 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -443,24 +443,13 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) psta->RxMgmtFrameSeqNum = precv_frame->attrib.seq_num; } - switch (GetFrameSubType(pframe)) { - case WIFI_AUTH: + if (GetFrameSubType(pframe) == WIFI_AUTH) { if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) ptable->func = &OnAuth; else ptable->func = &OnAuthClient; - fallthrough; - case WIFI_ASSOCREQ: - case WIFI_REASSOCREQ: - case WIFI_PROBEREQ: - case WIFI_BEACON: - case WIFI_ACTION: - _mgt_dispatcher(padapter, ptable, precv_frame); - break; - default: - _mgt_dispatcher(padapter, ptable, precv_frame); - break; } + _mgt_dispatcher(padapter, ptable, precv_frame); } static u32 p2p_listen_state_process(struct adapter *padapter, unsigned char *da) -- cgit From da1c0756a2e7879177daf2c5f34fde871c652c7f Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 8 Jan 2022 09:27:34 +0100 Subject: staging: r8188eu: rtw_os_recv_resource_free() is empty The function rtw_os_recv_resource_free() is empty. Remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220108082736.16788-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 2 -- drivers/staging/r8188eu/include/recv_osdep.h | 1 - drivers/staging/r8188eu/os_dep/recv_linux.c | 5 ----- 3 files changed, 8 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 51a13262a226..72007952ee74 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -100,8 +100,6 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv) rtw_free_uc_swdec_pending_queue(padapter); - rtw_os_recv_resource_free(precvpriv); - vfree(precvpriv->pallocated_frame_buf); rtl8188eu_free_recv_priv(padapter); diff --git a/drivers/staging/r8188eu/include/recv_osdep.h b/drivers/staging/r8188eu/include/recv_osdep.h index 4b5e3dde4590..4c6cf5b1ac76 100644 --- a/drivers/staging/r8188eu/include/recv_osdep.h +++ b/drivers/staging/r8188eu/include/recv_osdep.h @@ -21,7 +21,6 @@ void rtw_free_recv_priv(struct recv_priv *precvpriv); int rtw_os_recv_resource_init(struct recv_priv *recvpr, struct adapter *adapt); int rtw_os_recv_resource_alloc(struct adapter *adapt, struct recv_frame *recvfr); -void rtw_os_recv_resource_free(struct recv_priv *precvpriv); int rtw_os_recvbuf_resource_alloc(struct adapter *adapt, struct recv_buf *buf); int rtw_os_recvbuf_resource_free(struct adapter *adapt, struct recv_buf *buf); diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index 41c4e35d967f..0d3110a4c3d2 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -28,11 +28,6 @@ int rtw_os_recv_resource_alloc(struct adapter *padapter, return _SUCCESS; } -/* free os related resource in struct recv_frame */ -void rtw_os_recv_resource_free(struct recv_priv *precvpriv) -{ -} - /* alloc os related resource in struct recv_buf */ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, struct recv_buf *precvbuf) -- cgit From ca6246b095dfbd8ce33c65c58611a63defd78580 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 8 Jan 2022 09:27:35 +0100 Subject: staging: r8188eu: rtw_os_recv_resource_init() does nothing The function rtw_os_recv_resource_init() just returns _SUCCESS and the return value is not checked by the caller. Remove the function. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220108082736.16788-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 2 -- drivers/staging/r8188eu/include/recv_osdep.h | 1 - drivers/staging/r8188eu/os_dep/recv_linux.c | 7 ------- 3 files changed, 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 72007952ee74..26893f36d1ff 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -54,8 +54,6 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) precvpriv->free_recvframe_cnt = NR_RECVFRAME; - rtw_os_recv_resource_init(precvpriv, padapter); - precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ); if (!precvpriv->pallocated_frame_buf) { diff --git a/drivers/staging/r8188eu/include/recv_osdep.h b/drivers/staging/r8188eu/include/recv_osdep.h index 4c6cf5b1ac76..71fe581fbc85 100644 --- a/drivers/staging/r8188eu/include/recv_osdep.h +++ b/drivers/staging/r8188eu/include/recv_osdep.h @@ -19,7 +19,6 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup); int rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter); void rtw_free_recv_priv(struct recv_priv *precvpriv); -int rtw_os_recv_resource_init(struct recv_priv *recvpr, struct adapter *adapt); int rtw_os_recv_resource_alloc(struct adapter *adapt, struct recv_frame *recvfr); int rtw_os_recvbuf_resource_alloc(struct adapter *adapt, struct recv_buf *buf); diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index 0d3110a4c3d2..da21490fe168 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -12,13 +12,6 @@ #include "../include/osdep_intf.h" #include "../include/usb_ops.h" -/* init os related resource in struct recv_priv */ -int rtw_os_recv_resource_init(struct recv_priv *precvpriv, - struct adapter *padapter) -{ - return _SUCCESS; -} - /* alloc os related resource in struct recv_frame */ int rtw_os_recv_resource_alloc(struct adapter *padapter, struct recv_frame *precvframe) -- cgit From 8c2cffdec78ea7a35b1b98738938b2161ed1190c Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 8 Jan 2022 09:27:36 +0100 Subject: staging: r8188eu: remove rtw_os_recv_resource_alloc() Merge rtw_os_recv_resource_alloc() into _rtw_init_recv_priv() and remove rtw_os_recv_resource_alloc(). Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220108082736.16788-6-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 3 ++- drivers/staging/r8188eu/include/recv_osdep.h | 2 -- drivers/staging/r8188eu/os_dep/recv_linux.c | 9 --------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 26893f36d1ff..5438a73ba06b 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -70,7 +70,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) list_add_tail(&precvframe->list, &precvpriv->free_recv_queue.queue); - res = rtw_os_recv_resource_alloc(padapter, precvframe); + precvframe->pkt_newalloc = NULL; + precvframe->pkt = NULL; precvframe->len = 0; diff --git a/drivers/staging/r8188eu/include/recv_osdep.h b/drivers/staging/r8188eu/include/recv_osdep.h index 71fe581fbc85..ca8a613508fd 100644 --- a/drivers/staging/r8188eu/include/recv_osdep.h +++ b/drivers/staging/r8188eu/include/recv_osdep.h @@ -19,8 +19,6 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup); int rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter); void rtw_free_recv_priv(struct recv_priv *precvpriv); -int rtw_os_recv_resource_alloc(struct adapter *adapt, struct recv_frame *recvfr); - int rtw_os_recvbuf_resource_alloc(struct adapter *adapt, struct recv_buf *buf); int rtw_os_recvbuf_resource_free(struct adapter *adapt, struct recv_buf *buf); diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index da21490fe168..b205c50e9d75 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -12,15 +12,6 @@ #include "../include/osdep_intf.h" #include "../include/usb_ops.h" -/* alloc os related resource in struct recv_frame */ -int rtw_os_recv_resource_alloc(struct adapter *padapter, - struct recv_frame *precvframe) -{ - precvframe->pkt_newalloc = NULL; - precvframe->pkt = NULL; - return _SUCCESS; -} - /* alloc os related resource in struct recv_buf */ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, struct recv_buf *precvbuf) -- cgit From 8765a5bc443a36df8abe1a51658c8eed90caa26e Mon Sep 17 00:00:00 2001 From: Minghao Chi Date: Mon, 10 Jan 2022 01:32:40 +0000 Subject: staging: rtl8723bs: remove redundant result variable Return value from ips_netdrv_open() directly instead of taking this in another redundant variable. Reported-by: Zeal Robot Signed-off-by: Minghao Chi Signed-off-by: CGEL ZTE Link: https://lore.kernel.org/r/20220110013240.644190-1-chi.minghao@zte.com.cn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 05482341eefe..757efeb49d08 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -922,11 +922,7 @@ netdev_open_error: int rtw_ips_pwr_up(struct adapter *padapter) { - int result; - - result = ips_netdrv_open(padapter); - - return result; + return ips_netdrv_open(padapter); } void rtw_ips_pwr_down(struct adapter *padapter) -- cgit From d04213433ef49c40126dd5ce6f08b1ee5d5bf12b Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:48 +0100 Subject: staging: r8188eu: ODM_MAC_EDCA_TURBO is always set The ODM_MAC_EDCA_TURBO flag is always set for chips that are supported by this driver. Remove the flag and the one place where it's checked. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm.c | 3 --- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 1 - drivers/staging/r8188eu/include/odm.h | 3 --- 3 files changed, 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index d8fa587ff286..77ece1950b63 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -563,9 +563,6 @@ static void odm_EdcaTurboCheck(struct odm_dm_struct *pDM_Odm) struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - if (!(pDM_Odm->SupportAbility & ODM_MAC_EDCA_TURBO)) - return; - if (pregpriv->wifi_spec == 1) goto dm_CheckEdcaTurbo_EXIT; diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c index bd6eb3878060..5118d0e3045b 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -56,7 +56,6 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) pdmpriv->InitODMFlag = ODM_BB_FA_CNT | ODM_BB_RSSI_MONITOR | ODM_BB_CCK_PD | - ODM_MAC_EDCA_TURBO | ODM_RF_CALIBRATION | ODM_RF_TX_PWR_TRACK; if (hal_data->AntDivCfg) diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 23a151c558dc..616a862180b2 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -154,9 +154,6 @@ enum odm_ability_def { ODM_BB_ANT_DIV = BIT(6), ODM_BB_PWR_TRA = BIT(8), - /* MAC DM section BIT 16-23 */ - ODM_MAC_EDCA_TURBO = BIT(16), - /* RF ODM section BIT 24-31 */ ODM_RF_TX_PWR_TRACK = BIT(24), ODM_RF_CALIBRATION = BIT(26), -- cgit From dbc04d2730f719a8c10bd2684ed53a9f6d8e794c Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:49 +0100 Subject: staging: r8188eu: ODM_BB_FA_CNT is always set The ODM_BB_FA_CNT flag is always set. Remove the flag and the code to check if ODM_BB_FA_CNT is not set. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm.c | 8 +------- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 3 +-- drivers/staging/r8188eu/include/odm.h | 1 - 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index 77ece1950b63..7cc9ab4b1a59 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -169,9 +169,6 @@ static void odm_DIG(struct odm_dm_struct *pDM_Odm) u8 dm_dig_max, dm_dig_min; u8 CurrentIGI = pDM_DigTable->CurIGValue; - if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) - return; - if (*pDM_Odm->pbScanInProcess) return; @@ -367,9 +364,6 @@ static void odm_FalseAlarmCounterStatistics(struct odm_dm_struct *pDM_Odm) struct false_alarm_stats *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; struct adapter *adapter = pDM_Odm->Adapter; - if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) - return; - /* hold ofdm counter */ rtl8188e_PHY_SetBBReg(adapter, ODM_REG_OFDM_FA_HOLDC_11N, BIT(31), 1); /* hold page C counter */ rtl8188e_PHY_SetBBReg(adapter, ODM_REG_OFDM_FA_RSTD_11N, BIT(31), 1); /* hold page D counter */ @@ -422,7 +416,7 @@ static void odm_CCKPacketDetectionThresh(struct odm_dm_struct *pDM_Odm) u8 CurCCK_CCAThres; struct false_alarm_stats *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; - if (!(pDM_Odm->SupportAbility & (ODM_BB_CCK_PD | ODM_BB_FA_CNT))) + if (!(pDM_Odm->SupportAbility & ODM_BB_CCK_PD)) return; if (pDM_Odm->bLinked) { if (pDM_Odm->RSSI_Min > 25) { diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c index 5118d0e3045b..2ff9c7d84dbf 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -53,8 +53,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) struct dm_priv *pdmpriv = &hal_data->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_BB_FA_CNT | - ODM_BB_RSSI_MONITOR | + pdmpriv->InitODMFlag = ODM_BB_RSSI_MONITOR | ODM_BB_CCK_PD | ODM_RF_CALIBRATION | ODM_RF_TX_PWR_TRACK; diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 616a862180b2..664e75c3a7c2 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -148,7 +148,6 @@ enum odm_common_info_def { enum odm_ability_def { /* BB ODM section BIT 0-15 */ - ODM_BB_FA_CNT = BIT(3), ODM_BB_RSSI_MONITOR = BIT(4), ODM_BB_CCK_PD = BIT(5), ODM_BB_ANT_DIV = BIT(6), -- cgit From 828f2e9d278c698d8676b73dcf412276b24dc216 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:50 +0100 Subject: staging: r8188eu: ODM_BB_CCK_PD is always set The ODM_BB_CCK_PD flag is always set. Remove the flag and the check if ODM_BB_CCK_PD is not set. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm.c | 2 -- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 1 - drivers/staging/r8188eu/include/odm.h | 1 - 3 files changed, 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index 7cc9ab4b1a59..8156e4acaa09 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -416,8 +416,6 @@ static void odm_CCKPacketDetectionThresh(struct odm_dm_struct *pDM_Odm) u8 CurCCK_CCAThres; struct false_alarm_stats *FalseAlmCnt = &pDM_Odm->FalseAlmCnt; - if (!(pDM_Odm->SupportAbility & ODM_BB_CCK_PD)) - return; if (pDM_Odm->bLinked) { if (pDM_Odm->RSSI_Min > 25) { CurCCK_CCAThres = 0xcd; diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c index 2ff9c7d84dbf..adf87c1721ee 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -54,7 +54,6 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) int i; pdmpriv->InitODMFlag = ODM_BB_RSSI_MONITOR | - ODM_BB_CCK_PD | ODM_RF_CALIBRATION | ODM_RF_TX_PWR_TRACK; if (hal_data->AntDivCfg) diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 664e75c3a7c2..50960e7daf1d 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -149,7 +149,6 @@ enum odm_common_info_def { enum odm_ability_def { /* BB ODM section BIT 0-15 */ ODM_BB_RSSI_MONITOR = BIT(4), - ODM_BB_CCK_PD = BIT(5), ODM_BB_ANT_DIV = BIT(6), ODM_BB_PWR_TRA = BIT(8), -- cgit From 055305b2237348bfdbf4ac03985bf172f6f84f49 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:51 +0100 Subject: staging: r8188eu: remove unused chip type settings Remove some unused defines and macros related to chip type. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/HalVerDef.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/include/HalVerDef.h b/drivers/staging/r8188eu/include/HalVerDef.h index 62b94c993f0d..f4816ac765e5 100644 --- a/drivers/staging/r8188eu/include/HalVerDef.h +++ b/drivers/staging/r8188eu/include/HalVerDef.h @@ -6,7 +6,6 @@ enum HAL_CHIP_TYPE { TEST_CHIP = 0, NORMAL_CHIP = 1, - FPGA = 2, }; enum HAL_CUT_VERSION { @@ -40,8 +39,6 @@ struct HAL_VERSION { /* HAL_VERSION VersionID */ /* HAL_CHIP_TYPE_E */ -#define IS_TEST_CHIP(version) \ - ((GET_CVID_CHIP_TYPE(version) == TEST_CHIP) ? true : false) #define IS_NORMAL_CHIP(version) \ ((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false) @@ -60,7 +57,5 @@ struct HAL_VERSION { /* HAL_VENDOR_E */ #define IS_CHIP_VENDOR_TSMC(version) \ ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? true : false) -#define IS_CHIP_VENDOR_UMC(version) \ - ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false) #endif -- cgit From bc7fc5fe846a20cbacaabae8c01f2b89727c6445 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:52 +0100 Subject: staging: r8188eu: remove obsolete defines and comments Remove some unused phycfg defines and obsolete comments. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 302b15b2874d..c06a332f6b20 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -8,25 +8,6 @@ #include "../include/rtw_iol.h" #include "../include/rtl8188e_hal.h" -/*---------------------------Define Local Constant---------------------------*/ -/* Channel switch:The size of command tables for switch channel*/ -#define MAX_PRECMD_CNT 16 -#define MAX_RFDEPENDCMD_CNT 16 -#define MAX_POSTCMD_CNT 16 - -#define MAX_DOZE_WAITING_TIMES_9x 64 - -/*---------------------------Define Local Constant---------------------------*/ - -/*------------------------Define global variable-----------------------------*/ - -/*------------------------Define local variable------------------------------*/ - -/*--------------------Define export function prototype-----------------------*/ -/* Please refer to header file */ -/*--------------------Define export function prototype-----------------------*/ - -/*----------------------------Function Body----------------------------------*/ /* */ /* 1. BB register R/W API */ /* */ -- cgit From 269fae49e8bc232c0da9d2fa7f90243c629630c2 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:53 +0100 Subject: staging: r8188eu: CurrentBW4024GTxPwrIdx is set but not used CurrentBW4024GTxPwrIdx in struct hal_data_8188e is set but not used. It can be removed. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 1 - drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index c06a332f6b20..fe15b15ab951 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -589,7 +589,6 @@ static void phy_PowerIndexCheck88E(struct adapter *Adapter, u8 channel, u8 *cckP pHalData->CurrentCckTxPwrIdx = cckPowerLevel[0]; pHalData->CurrentOfdm24GTxPwrIdx = ofdmPowerLevel[0]; pHalData->CurrentBW2024GTxPwrIdx = BW20PowerLevel[0]; - pHalData->CurrentBW4024GTxPwrIdx = BW40PowerLevel[0]; } /*----------------------------------------------------------------------------- diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 66eadd170c9b..1c52dd9d9721 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -180,7 +180,6 @@ struct hal_data_8188e { u8 CurrentCckTxPwrIdx; u8 CurrentOfdm24GTxPwrIdx; u8 CurrentBW2024GTxPwrIdx; - u8 CurrentBW4024GTxPwrIdx; /* Read/write are allow for following hardware information variables */ u8 pwrGroupCnt; -- cgit From eb32a443937e2bd44e1717b26e5fe5e091dbc425 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:54 +0100 Subject: staging: r8188eu: CurrentBW2024GTxPwrIdx is set but not used CurrentBW2024GTxPwrIdx in struct hal_data_8188e is set but not used. It can be removed. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-8-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 1 - drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index fe15b15ab951..24b5604afbc9 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -588,7 +588,6 @@ static void phy_PowerIndexCheck88E(struct adapter *Adapter, u8 channel, u8 *cckP pHalData->CurrentCckTxPwrIdx = cckPowerLevel[0]; pHalData->CurrentOfdm24GTxPwrIdx = ofdmPowerLevel[0]; - pHalData->CurrentBW2024GTxPwrIdx = BW20PowerLevel[0]; } /*----------------------------------------------------------------------------- diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 1c52dd9d9721..0c7f5e078bed 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -179,7 +179,6 @@ struct hal_data_8188e { /* The current Tx Power Level */ u8 CurrentCckTxPwrIdx; u8 CurrentOfdm24GTxPwrIdx; - u8 CurrentBW2024GTxPwrIdx; /* Read/write are allow for following hardware information variables */ u8 pwrGroupCnt; -- cgit From b6ff06063d66e073648d480b92fcb619b9d8900d Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:55 +0100 Subject: staging: r8188eu: CurrentOfdm24GTxPwrIdx is set but not used CurrentOfdm24GTxPwrIdx in struct hal_data_8188e is set but not used. It can be removed. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 1 - drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 24b5604afbc9..a80f40fccf09 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -587,7 +587,6 @@ static void phy_PowerIndexCheck88E(struct adapter *Adapter, u8 channel, u8 *cckP struct hal_data_8188e *pHalData = &Adapter->haldata; pHalData->CurrentCckTxPwrIdx = cckPowerLevel[0]; - pHalData->CurrentOfdm24GTxPwrIdx = ofdmPowerLevel[0]; } /*----------------------------------------------------------------------------- diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 0c7f5e078bed..fd2ee1739f88 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -178,7 +178,6 @@ struct hal_data_8188e { /* The current Tx Power Level */ u8 CurrentCckTxPwrIdx; - u8 CurrentOfdm24GTxPwrIdx; /* Read/write are allow for following hardware information variables */ u8 pwrGroupCnt; -- cgit From e0d4a5e3b5512f2454b5377be84227ed627abf60 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:56 +0100 Subject: staging: r8188eu: CurrentCckTxPwrIdx is set but not used CurrentCckTxPwrIdx in struct hal_data_8188e is set but not used. It can be removed. The phy_PowerIndexCheck88E function is now empty. Remove it as well. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-10-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 10 ---------- drivers/staging/r8188eu/include/rtl8188e_hal.h | 3 --- 2 files changed, 13 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index a80f40fccf09..c1639df8b1e7 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -581,14 +581,6 @@ static void getTxPowerIndex88E(struct adapter *Adapter, u8 channel, u8 *cckPower BW40PowerLevel[RF_PATH_A] = pHalData->Index24G_BW40_Base[index]; } -static void phy_PowerIndexCheck88E(struct adapter *Adapter, u8 channel, u8 *cckPowerLevel, - u8 *ofdmPowerLevel, u8 *BW20PowerLevel, u8 *BW40PowerLevel) -{ - struct hal_data_8188e *pHalData = &Adapter->haldata; - - pHalData->CurrentCckTxPwrIdx = cckPowerLevel[0]; -} - /*----------------------------------------------------------------------------- * Function: SetTxPowerLevel8190() * @@ -619,8 +611,6 @@ PHY_SetTxPowerLevel8188E( getTxPowerIndex88E(Adapter, channel, &cckPowerLevel[0], &ofdmPowerLevel[0], &BW20PowerLevel[0], &BW40PowerLevel[0]); - phy_PowerIndexCheck88E(Adapter, channel, &cckPowerLevel[0], &ofdmPowerLevel[0], &BW20PowerLevel[0], &BW40PowerLevel[0]); - rtl8188e_PHY_RF6052SetCckTxPower(Adapter, &cckPowerLevel[0]); rtl8188e_PHY_RF6052SetOFDMTxPower(Adapter, &ofdmPowerLevel[0], &BW20PowerLevel[0], &BW40PowerLevel[0], channel); } diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index fd2ee1739f88..a24cdbfa83de 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -176,9 +176,6 @@ struct hal_data_8188e { u8 PwrGroupHT20[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; u8 PwrGroupHT40[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; - /* The current Tx Power Level */ - u8 CurrentCckTxPwrIdx; - /* Read/write are allow for following hardware information variables */ u8 pwrGroupCnt; u32 MCSTxPowerLevelOriginalOffset[MAX_PG_GROUP][16]; -- cgit From df14a12a2d4567d7ac657a502065fbf03f63b8db Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:57 +0100 Subject: staging: r8188eu: HW_VAR_MEDIA_STATUS1 is never set The HW_VAR_MEDIA_STATUS1 hal variable is never set. Remove its define and the code to set it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-11-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 9 --------- drivers/staging/r8188eu/include/hal_intf.h | 1 - 2 files changed, 10 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 38b88e6b7bdb..21cb505036b7 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1087,15 +1087,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) rtw_write8(Adapter, MSR, val8); } break; - case HW_VAR_MEDIA_STATUS1: - { - u8 val8; - - val8 = rtw_read8(Adapter, MSR) & 0x03; - val8 |= *((u8 *)val) << 2; - rtw_write8(Adapter, MSR, val8); - } - break; case HW_VAR_SET_OPMODE: hw_var_set_opmode(Adapter, variable, val); break; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 120b32994e1f..6728cb506303 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -10,7 +10,6 @@ enum hw_variables { HW_VAR_MEDIA_STATUS, - HW_VAR_MEDIA_STATUS1, HW_VAR_SET_OPMODE, HW_VAR_MAC_ADDR, HW_VAR_BSSID, -- cgit From 5495a7ea927935b957a3cc6f7ce6f5520ebbbeff Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:58 +0100 Subject: staging: r8188eu: remove HAL_*_ENABLE defines HAL_(MAC|BB|RF)_ENABLE are always set. Remove the defines and the checks where they are used. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-12-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 21cb505036b7..cc8f8c7d0734 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -13,10 +13,6 @@ #include "../include/usb_osintf.h" #include "../include/Hal8188EPwrSeq.h" -#define HAL_MAC_ENABLE 1 -#define HAL_BB_ENABLE 1 -#define HAL_RF_ENABLE 1 - static void _ConfigNormalChipOutEP_8188E(struct adapter *adapt, u8 NumOutPipe) { struct hal_data_8188e *haldata = &adapt->haldata; @@ -640,32 +636,26 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) Adapter->pwrctrlpriv.bFwCurrentInPSMode = false; haldata->LastHMEBoxNum = 0; -#if (HAL_MAC_ENABLE == 1) status = PHY_MACConfig8188E(Adapter); if (status == _FAIL) { DBG_88E(" ### Failed to init MAC ......\n "); goto exit; } -#endif /* */ /* d. Initialize BB related configurations. */ /* */ -#if (HAL_BB_ENABLE == 1) status = PHY_BBConfig8188E(Adapter); if (status == _FAIL) { DBG_88E(" ### Failed to init BB ......\n "); goto exit; } -#endif -#if (HAL_RF_ENABLE == 1) status = PHY_RFConfig8188E(Adapter); if (status == _FAIL) { DBG_88E(" ### Failed to init RF ......\n "); goto exit; } -#endif status = rtl8188e_iol_efuse_patch(Adapter); if (status == _FAIL) { -- cgit From c87c2b0d3ed07ef0f796cbba1037934111fb3c12 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 8 Jan 2022 13:49:59 +0100 Subject: staging: r8188eu: we always enqueue in rtw_set_chplan_cmd The only caller of rtw_set_chplan_cmd requests that the message be enqueued and not sent directly. Remove the enqueue parameter and the code for direct sending. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220108124959.313215-13-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_cmd.c | 26 +++++++++----------------- drivers/staging/r8188eu/include/rtw_cmd.h | 2 +- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 2 +- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index 712fd6e536c4..3d22a8888ea7 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -836,7 +836,7 @@ exit: return res; } -u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) +u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan) { struct cmd_obj *pcmdobj; struct SetChannelPlan_param *setChannelPlan_param; @@ -859,25 +859,17 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) } setChannelPlan_param->channel_plan = chplan; - if (enqueue) { - /* need enqueue, prepare cmd_obj and enqueue */ - pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); - if (!pcmdobj) { - kfree(setChannelPlan_param); - res = _FAIL; - goto exit; - } - - init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelPlan_param, GEN_CMD_CODE(_SetChannelPlan)); - res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); - } else { - /* no need to enqueue, do the cmd hdl directly and free cmd parameter */ - if (H2C_SUCCESS != set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param)) - res = _FAIL; - + /* need enqueue, prepare cmd_obj and enqueue */ + pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); + if (!pcmdobj) { kfree(setChannelPlan_param); + res = _FAIL; + goto exit; } + init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelPlan_param, GEN_CMD_CODE(_SetChannelPlan)); + res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); + /* do something based on res... */ if (res == _SUCCESS) padapter->mlmepriv.ChannelPlan = chplan; diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8188eu/include/rtw_cmd.h index cf0945ae11c1..60cecdd4ee0e 100644 --- a/drivers/staging/r8188eu/include/rtw_cmd.h +++ b/drivers/staging/r8188eu/include/rtw_cmd.h @@ -772,7 +772,7 @@ u8 rtw_ps_cmd(struct adapter*padapter); u8 rtw_chk_hi_queue_cmd(struct adapter*padapter); -u8 rtw_set_chplan_cmd(struct adapter*padapter, u8 chplan, u8 enqueue); +u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan); u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt); diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 41b457838a5b..b9f9698d70cf 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2098,7 +2098,7 @@ static int rtw_wx_set_channel_plan(struct net_device *dev, struct mlme_priv *pmlmepriv = &padapter->mlmepriv; u8 channel_plan_req = (u8)(*((int *)wrqu)); - if (_SUCCESS == rtw_set_chplan_cmd(padapter, channel_plan_req, 1)) + if (_SUCCESS == rtw_set_chplan_cmd(padapter, channel_plan_req)) DBG_88E("%s set channel_plan = 0x%02X\n", __func__, pmlmepriv->ChannelPlan); else return -EPERM; -- cgit From 9922c11a501a90ec4c5ff77f78a6799af33993ba Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 10 Jan 2022 13:46:30 +0100 Subject: staging: r8188eu: fix phy_RF6052_Config_ParaFile error handling Fix the error handling in phy_RF6052_Config_ParaFile. We can simply return rtStatus. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220110124638.6909-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c index 6e0231099986..7e4744989a66 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c @@ -406,12 +406,6 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) /*----Restore RFENV control type----*/; rtl8188e_PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); - if (rtStatus != _SUCCESS) - goto phy_RF6052_Config_ParaFile_Fail; - - return rtStatus; - -phy_RF6052_Config_ParaFile_Fail: return rtStatus; } -- cgit From b11ded5e8427127594965c877e84e4e63cf48c93 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 10 Jan 2022 13:46:31 +0100 Subject: staging: r8188eu: remove a constant variable The eRFPath variable in phy_RF6052_Config_ParaFile is always 0. Remove the variable and use 0 directly. (enum rf_radio_path)eRFPath can be replaced with RF_PATH_A, which is defined as 0. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220110124638.6909-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c index 7e4744989a66..7474db05e8af 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c @@ -374,12 +374,11 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) struct bb_reg_def *pPhyReg; struct hal_data_8188e *pHalData = &Adapter->haldata; u32 u4RegValue = 0; - u8 eRFPath = 0; int rtStatus = _SUCCESS; /* Initialize RF */ - pPhyReg = &pHalData->PHYRegDef[eRFPath]; + pPhyReg = &pHalData->PHYRegDef[0]; /*----Store original RFENV control type----*/ u4RegValue = rtl8188e_PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV); @@ -400,7 +399,7 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) udelay(1);/* PlatformStallExecution(1); */ /*----Initialize RF fom connfiguration file----*/ - if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, (enum rf_radio_path)eRFPath, (enum rf_radio_path)eRFPath)) + if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, RF_PATH_A, RF_PATH_A)) rtStatus = _FAIL; /*----Restore RFENV control type----*/; -- cgit From 25d5e8f7bab4831306511af6ca44fbf67db4fa2f Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 10 Jan 2022 13:46:32 +0100 Subject: staging: r8188eu: remove unused function parameter ODM_ConfigRFWithHeaderFile does not use its content parameter. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220110124638.6909-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_HWConfig.c | 1 - drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 2 +- drivers/staging/r8188eu/include/odm_HWConfig.h | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c index d5212a166dd2..a62af532ac82 100644 --- a/drivers/staging/r8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c @@ -363,7 +363,6 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm, } enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm, - enum rf_radio_path content, enum rf_radio_path rfpath) { if (rfpath == RF_PATH_A) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c index 7474db05e8af..a5c94be95ccb 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c @@ -399,7 +399,7 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) udelay(1);/* PlatformStallExecution(1); */ /*----Initialize RF fom connfiguration file----*/ - if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, RF_PATH_A, RF_PATH_A)) + if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, RF_PATH_A)) rtStatus = _FAIL; /*----Restore RFENV control type----*/; diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h index 3ed265e00ac1..efc809354720 100644 --- a/drivers/staging/r8188eu/include/odm_HWConfig.h +++ b/drivers/staging/r8188eu/include/odm_HWConfig.h @@ -96,7 +96,6 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *pDM_Odm, struct adapter *adapt); enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *pDM_Odm, - enum rf_radio_path Content, enum rf_radio_path eRFPath); enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *pDM_Odm, -- cgit From 1f9bd3991ba6142f0ca616299993cb7eb66e037d Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 10 Jan 2022 13:46:33 +0100 Subject: staging: r8188eu: remove constant function parameter The only caller of ODM_ConfigRFWithHeaderFile sets rfpath to RF_PATH_A. Remove the parameter and the check for RF_PATH_A inside the function. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220110124638.6909-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_HWConfig.c | 6 ++---- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 2 +- drivers/staging/r8188eu/include/odm_HWConfig.h | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c index a62af532ac82..ef35e3c31794 100644 --- a/drivers/staging/r8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c @@ -362,11 +362,9 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm, odm_Process_RSSIForDM(dm_odm, pPhyInfo, pPktinfo); } -enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm, - enum rf_radio_path rfpath) +enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm) { - if (rfpath == RF_PATH_A) - READ_AND_CONFIG(8188E, _RadioA_1T_); + READ_AND_CONFIG(8188E, _RadioA_1T_); return HAL_STATUS_SUCCESS; } diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c index a5c94be95ccb..d10a6cc2d4ab 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c @@ -399,7 +399,7 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) udelay(1);/* PlatformStallExecution(1); */ /*----Initialize RF fom connfiguration file----*/ - if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, RF_PATH_A)) + if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv)) rtStatus = _FAIL; /*----Restore RFENV control type----*/; diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h index efc809354720..aa468ce34b7e 100644 --- a/drivers/staging/r8188eu/include/odm_HWConfig.h +++ b/drivers/staging/r8188eu/include/odm_HWConfig.h @@ -95,8 +95,7 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *pDM_Odm, struct odm_per_pkt_info *pPktinfo, struct adapter *adapt); -enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *pDM_Odm, - enum rf_radio_path eRFPath); +enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *pDM_Odm); enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *pDM_Odm, enum odm_bb_config_type ConfigType); -- cgit From 05274a84e1ad675d561a609fb2040032df7f9baf Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 10 Jan 2022 13:46:34 +0100 Subject: staging: r8188eu: replace the READ_AND_CONFIG The READ_AND_CONFIG macro builds a function name from chip type and table name. Remove the macro and use the resulting function names directly. This makes the code easier to read. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220110124638.6909-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_HWConfig.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c index ef35e3c31794..2f0752418fe2 100644 --- a/drivers/staging/r8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c @@ -3,10 +3,6 @@ #include "../include/drv_types.h" -#define READ_AND_CONFIG READ_AND_CONFIG_MP - -#define READ_AND_CONFIG_MP(ic, txt) (ODM_ReadAndConfig##txt##ic(dm_odm)) - static u8 odm_QueryRxPwrPercentage(s8 AntPower) { if ((AntPower <= -100) || (AntPower >= 20)) @@ -364,7 +360,7 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm, enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm) { - READ_AND_CONFIG(8188E, _RadioA_1T_); + ODM_ReadAndConfig_RadioA_1T_8188E(dm_odm); return HAL_STATUS_SUCCESS; } @@ -372,20 +368,17 @@ enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm) enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *dm_odm, enum odm_bb_config_type config_tp) { - if (config_tp == CONFIG_BB_PHY_REG) { - READ_AND_CONFIG(8188E, _PHY_REG_1T_); - } else if (config_tp == CONFIG_BB_AGC_TAB) { - READ_AND_CONFIG(8188E, _AGC_TAB_1T_); - } else if (config_tp == CONFIG_BB_PHY_REG_PG) { - READ_AND_CONFIG(8188E, _PHY_REG_PG_); - } + if (config_tp == CONFIG_BB_PHY_REG) + ODM_ReadAndConfig_PHY_REG_1T_8188E(dm_odm); + else if (config_tp == CONFIG_BB_AGC_TAB) + ODM_ReadAndConfig_AGC_TAB_1T_8188E(dm_odm); + else if (config_tp == CONFIG_BB_PHY_REG_PG) + ODM_ReadAndConfig_PHY_REG_PG_8188E(dm_odm); return HAL_STATUS_SUCCESS; } enum HAL_STATUS ODM_ConfigMACWithHeaderFile(struct odm_dm_struct *dm_odm) { - u8 result = HAL_STATUS_SUCCESS; - result = READ_AND_CONFIG(8188E, _MAC_REG_); - return result; + return ODM_ReadAndConfig_MAC_REG_8188E(dm_odm); } -- cgit From 5c090aa8637c13e434db7dc557d41664093a2817 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 10 Jan 2022 13:46:35 +0100 Subject: staging: r8188eu: relay errors from ODM_ReadAndConfig_... Most of the ODM_ReadAndConfig_... functions return an error status. Update their callers to process these return values. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220110124638.6909-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_HWConfig.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c index 2f0752418fe2..5ec9a04be26b 100644 --- a/drivers/staging/r8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c @@ -360,22 +360,22 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm, enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm) { - ODM_ReadAndConfig_RadioA_1T_8188E(dm_odm); - - return HAL_STATUS_SUCCESS; + return ODM_ReadAndConfig_RadioA_1T_8188E(dm_odm); } enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *dm_odm, enum odm_bb_config_type config_tp) { - if (config_tp == CONFIG_BB_PHY_REG) - ODM_ReadAndConfig_PHY_REG_1T_8188E(dm_odm); - else if (config_tp == CONFIG_BB_AGC_TAB) - ODM_ReadAndConfig_AGC_TAB_1T_8188E(dm_odm); - else if (config_tp == CONFIG_BB_PHY_REG_PG) + if (config_tp == CONFIG_BB_PHY_REG) { + return ODM_ReadAndConfig_PHY_REG_1T_8188E(dm_odm); + } else if (config_tp == CONFIG_BB_AGC_TAB) { + return ODM_ReadAndConfig_AGC_TAB_1T_8188E(dm_odm); + } else if (config_tp == CONFIG_BB_PHY_REG_PG) { ODM_ReadAndConfig_PHY_REG_PG_8188E(dm_odm); + return HAL_STATUS_SUCCESS; + } - return HAL_STATUS_SUCCESS; + return HAL_STATUS_FAILURE; } enum HAL_STATUS ODM_ConfigMACWithHeaderFile(struct odm_dm_struct *dm_odm) -- cgit From a1a7f3a81bd372e8012b46a1880933c07e2dbe41 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 10 Jan 2022 13:46:36 +0100 Subject: staging: r8188eu: merge ODM_ConfigMACWithHeaderFile into PHY_MACConfig8188E The ODM_ConfigMACWithHeaderFile function is only one line. Merge it into PHY_MACConfig8188E, which is its only caller. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220110124638.6909-8-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_HWConfig.c | 5 ----- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 2 +- drivers/staging/r8188eu/include/odm_HWConfig.h | 3 --- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c index 5ec9a04be26b..1c3074fc6be4 100644 --- a/drivers/staging/r8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c @@ -377,8 +377,3 @@ enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *dm_odm, return HAL_STATUS_FAILURE; } - -enum HAL_STATUS ODM_ConfigMACWithHeaderFile(struct odm_dm_struct *dm_odm) -{ - return ODM_ReadAndConfig_MAC_REG_8188E(dm_odm); -} diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index c1639df8b1e7..15370b674e53 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -342,7 +342,7 @@ s32 PHY_MACConfig8188E(struct adapter *Adapter) /* */ /* Config MAC */ /* */ - if (HAL_STATUS_FAILURE == ODM_ConfigMACWithHeaderFile(&pHalData->odmpriv)) + if (HAL_STATUS_FAILURE == ODM_ReadAndConfig_MAC_REG_8188E(&pHalData->odmpriv)) rtStatus = _FAIL; /* 2010.07.13 AMPDU aggregation number B */ diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h index aa468ce34b7e..3a8c041dbb66 100644 --- a/drivers/staging/r8188eu/include/odm_HWConfig.h +++ b/drivers/staging/r8188eu/include/odm_HWConfig.h @@ -99,7 +99,4 @@ enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *pDM_Odm); enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *pDM_Odm, enum odm_bb_config_type ConfigType); - -enum HAL_STATUS ODM_ConfigMACWithHeaderFile(struct odm_dm_struct *pDM_Odm); - #endif -- cgit From af5df1e7f94cb891719b64cd2d18ffb1b17b4b42 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 10 Jan 2022 13:46:37 +0100 Subject: staging: r8188eu: remove unused cck, ofdm and mcs rate defines Remove some unused defines for cck, ofdm and mcs rates. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220110124638.6909-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/odm_HWConfig.h | 29 -------------------------- 1 file changed, 29 deletions(-) diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h index 3a8c041dbb66..1bd6f254bf53 100644 --- a/drivers/staging/r8188eu/include/odm_HWConfig.h +++ b/drivers/staging/r8188eu/include/odm_HWConfig.h @@ -4,42 +4,13 @@ #ifndef __HALHWOUTSRC_H__ #define __HALHWOUTSRC_H__ -/* Definition */ /* CCK Rates, TxHT = 0 */ #define DESC92C_RATE1M 0x00 -#define DESC92C_RATE2M 0x01 -#define DESC92C_RATE5_5M 0x02 #define DESC92C_RATE11M 0x03 -/* OFDM Rates, TxHT = 0 */ -#define DESC92C_RATE6M 0x04 -#define DESC92C_RATE9M 0x05 -#define DESC92C_RATE12M 0x06 -#define DESC92C_RATE18M 0x07 -#define DESC92C_RATE24M 0x08 -#define DESC92C_RATE36M 0x09 -#define DESC92C_RATE48M 0x0a -#define DESC92C_RATE54M 0x0b - /* MCS Rates, TxHT = 1 */ -#define DESC92C_RATEMCS0 0x0c -#define DESC92C_RATEMCS1 0x0d -#define DESC92C_RATEMCS2 0x0e -#define DESC92C_RATEMCS3 0x0f -#define DESC92C_RATEMCS4 0x10 -#define DESC92C_RATEMCS5 0x11 -#define DESC92C_RATEMCS6 0x12 -#define DESC92C_RATEMCS7 0x13 #define DESC92C_RATEMCS8 0x14 -#define DESC92C_RATEMCS9 0x15 -#define DESC92C_RATEMCS10 0x16 -#define DESC92C_RATEMCS11 0x17 -#define DESC92C_RATEMCS12 0x18 -#define DESC92C_RATEMCS13 0x19 -#define DESC92C_RATEMCS14 0x1a #define DESC92C_RATEMCS15 0x1b -#define DESC92C_RATEMCS15_SG 0x1c -#define DESC92C_RATEMCS32 0x20 /* structure and define */ -- cgit From 67396d2dfef3fee70a113a679ccf5fc0d4d3fd71 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 10 Jan 2022 13:46:38 +0100 Subject: staging: r8188eu: merge ODM_ConfigBBWithHeaderFile with its callers ODM_ConfigBBWithHeaderFile is a "multiplexer" for ODM_ReadAndConfig_... functions. It's called only from phy_BB8188E_Config_ParaFile. We can remove ODM_ConfigBBWithHeaderFile and call the ODM_ReadAndConfig_... functions directly. ODM_ReadAndConfig_PHY_REG_PG_8188E does not return an error status, there's no need for a check. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220110124638.6909-10-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_HWConfig.c | 15 --------------- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 8 +++----- drivers/staging/r8188eu/include/odm_HWConfig.h | 3 --- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c index 1c3074fc6be4..dcc38b036280 100644 --- a/drivers/staging/r8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c @@ -362,18 +362,3 @@ enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm) { return ODM_ReadAndConfig_RadioA_1T_8188E(dm_odm); } - -enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *dm_odm, - enum odm_bb_config_type config_tp) -{ - if (config_tp == CONFIG_BB_PHY_REG) { - return ODM_ReadAndConfig_PHY_REG_1T_8188E(dm_odm); - } else if (config_tp == CONFIG_BB_AGC_TAB) { - return ODM_ReadAndConfig_AGC_TAB_1T_8188E(dm_odm); - } else if (config_tp == CONFIG_BB_PHY_REG_PG) { - ODM_ReadAndConfig_PHY_REG_PG_8188E(dm_odm); - return HAL_STATUS_SUCCESS; - } - - return HAL_STATUS_FAILURE; -} diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 15370b674e53..0b0690dfb947 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -493,7 +493,7 @@ static int phy_BB8188E_Config_ParaFile(struct adapter *Adapter) /* 1. Read PHY_REG.TXT BB INIT!! */ /* We will separate as 88C / 92C according to chip version */ /* */ - if (HAL_STATUS_FAILURE == ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG)) + if (HAL_STATUS_FAILURE == ODM_ReadAndConfig_PHY_REG_1T_8188E(&pHalData->odmpriv)) rtStatus = _FAIL; if (rtStatus != _SUCCESS) goto phy_BB8190_Config_ParaFile_Fail; @@ -501,16 +501,14 @@ static int phy_BB8188E_Config_ParaFile(struct adapter *Adapter) /* 2. If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */ if (!pEEPROM->bautoload_fail_flag) { pHalData->pwrGroupCnt = 0; - - if (HAL_STATUS_FAILURE == ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG)) - rtStatus = _FAIL; + ODM_ReadAndConfig_PHY_REG_PG_8188E(&pHalData->odmpriv); } if (rtStatus != _SUCCESS) goto phy_BB8190_Config_ParaFile_Fail; /* 3. BB AGC table Initialization */ - if (HAL_STATUS_FAILURE == ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_AGC_TAB)) + if (HAL_STATUS_FAILURE == ODM_ReadAndConfig_AGC_TAB_1T_8188E(&pHalData->odmpriv)) rtStatus = _FAIL; if (rtStatus != _SUCCESS) diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h index 1bd6f254bf53..b37962edb2ed 100644 --- a/drivers/staging/r8188eu/include/odm_HWConfig.h +++ b/drivers/staging/r8188eu/include/odm_HWConfig.h @@ -67,7 +67,4 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *pDM_Odm, struct adapter *adapt); enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *pDM_Odm); - -enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *pDM_Odm, - enum odm_bb_config_type ConfigType); #endif -- cgit From bf9450db43ab48cf712663af26902573fe64551d Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:54:54 +0100 Subject: staging: wfx: fix Makefile and Kconfig licenses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License was missing in Kconfig. Makefile license was GPL-2.0 while rest of the driver use GPL-2.0-only. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-2-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/Kconfig | 1 + drivers/staging/wfx/Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig index 83ee4d0ca8c6..01ea09cb9697 100644 --- a/drivers/staging/wfx/Kconfig +++ b/drivers/staging/wfx/Kconfig @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile index 0e0cc982ceab..1e99e6ffe044 100644 --- a/drivers/staging/wfx/Makefile +++ b/drivers/staging/wfx/Makefile @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: GPL-2.0 +# SPDX-License-Identifier: GPL-2.0-only # Necessary for CREATE_TRACE_POINTS CFLAGS_debug.o = -I$(src) -- cgit From 131e78fa4a0994f86980266c5fe07b5028a74e8c Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:54:55 +0100 Subject: staging: wfx: fix HIF API license MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apache-2.0 is not allowed in the kernel. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-3-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_api_cmd.h | 2 +- drivers/staging/wfx/hif_api_general.h | 2 +- drivers/staging/wfx/hif_api_mib.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h index b0aa13b23a51..b1829d01a5d9 100644 --- a/drivers/staging/wfx/hif_api_cmd.h +++ b/drivers/staging/wfx/hif_api_cmd.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: Apache-2.0 */ +/* SPDX-License-Identifier: GPL-2.0-only or Apache-2.0 */ /* * WF200 hardware interface definitions * diff --git a/drivers/staging/wfx/hif_api_general.h b/drivers/staging/wfx/hif_api_general.h index 5f74f829b7df..3e5c92e12d35 100644 --- a/drivers/staging/wfx/hif_api_general.h +++ b/drivers/staging/wfx/hif_api_general.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: Apache-2.0 */ +/* SPDX-License-Identifier: GPL-2.0-only or Apache-2.0 */ /* * WF200 hardware interface definitions * diff --git a/drivers/staging/wfx/hif_api_mib.h b/drivers/staging/wfx/hif_api_mib.h index da534f244757..be76e2766880 100644 --- a/drivers/staging/wfx/hif_api_mib.h +++ b/drivers/staging/wfx/hif_api_mib.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: Apache-2.0 */ +/* SPDX-License-Identifier: GPL-2.0-only or Apache-2.0 */ /* * WF200 hardware interface definitions * -- cgit From a8589360f515f6332f9c5b7da6c728641f9d5b63 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:54:56 +0100 Subject: staging: wfx: fix missing headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each headers files should include every types it needs to compile (ie. "gcc $CFLAGS -xc file.h" should compile) Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-4-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bh.h | 1 + drivers/staging/wfx/hif_tx.h | 4 ++++ drivers/staging/wfx/hif_tx_mib.h | 7 ++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wfx/bh.h b/drivers/staging/wfx/bh.h index 6c121ce4dd3f..a44c8b421b7c 100644 --- a/drivers/staging/wfx/bh.h +++ b/drivers/staging/wfx/bh.h @@ -10,6 +10,7 @@ #include #include +#include #include struct wfx_dev; diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index e57eabdcfa77..f7895845686f 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -10,6 +10,10 @@ #ifndef WFX_HIF_TX_H #define WFX_HIF_TX_H +#include +#include +#include + struct ieee80211_channel; struct ieee80211_bss_conf; struct ieee80211_tx_queue_params; diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index 2a3b84868ee4..fe08a69412ab 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -9,8 +9,13 @@ #ifndef WFX_HIF_TX_MIB_H #define WFX_HIF_TX_MIB_H -struct wfx_vif; +#include + struct sk_buff; +struct wfx_vif; +struct wfx_dev; +struct hif_ie_table_entry; +struct hif_mib_extended_count_table; int hif_set_output_power(struct wfx_vif *wvif, int val); int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, -- cgit From 7a1fa8a4363b0cb3610a0808e98eb2d35f262398 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:54:57 +0100 Subject: staging: wfx: fix comment correctness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using DMA with stack allocated buffers is not supported, whatever the value of CONFIG_VMAP_STACK. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-5-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hwio.c | 12 ------------ drivers/staging/wfx/hwio.h | 4 ++++ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c index 30eb888830d2..393bcb1e2f4e 100644 --- a/drivers/staging/wfx/hwio.c +++ b/drivers/staging/wfx/hwio.c @@ -14,18 +14,6 @@ #include "bus.h" #include "traces.h" -/* - * Internal helpers. - * - * About CONFIG_VMAP_STACK: - * When CONFIG_VMAP_STACK is enabled, it is not possible to run DMA on stack - * allocated data. Functions below that work with registers (aka functions - * ending with "32") automatically reallocate buffers with kmalloc. However, - * functions that work with arbitrary length buffers let's caller to handle - * memory location. In doubt, enable CONFIG_DEBUG_SG to detect badly located - * buffer. - */ - static int read32(struct wfx_dev *wdev, int reg, u32 *val) { int ret; diff --git a/drivers/staging/wfx/hwio.h b/drivers/staging/wfx/hwio.h index ff09575dd1af..d34baae47017 100644 --- a/drivers/staging/wfx/hwio.h +++ b/drivers/staging/wfx/hwio.h @@ -12,6 +12,10 @@ struct wfx_dev; +/* Caution: in the functions below, 'buf' will used with a DMA. So, it must be + * kmalloc'd (do not use stack allocated buffers). In doubt, enable + * CONFIG_DEBUG_SG to detect badly located buffer. + */ int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len); int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t buf_len); -- cgit From cc6205be682acf532e0854ba7026fa1a15296205 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:54:58 +0100 Subject: staging: wfx: explain uncommon Makefile statement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I have got questions about this line from several reviewers. A comment is definitively welcome. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-6-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile index 1e99e6ffe044..ae94c6552d77 100644 --- a/drivers/staging/wfx/Makefile +++ b/drivers/staging/wfx/Makefile @@ -20,6 +20,7 @@ wfx-y := \ sta.o \ debug.o wfx-$(CONFIG_SPI) += bus_spi.o +# When CONFIG_MMC == m, append to 'wfx-y' (and not to 'wfx-m') wfx-$(subst m,y,$(CONFIG_MMC)) += bus_sdio.o obj-$(CONFIG_WFX) += wfx.o -- cgit From 122cbf784e695223e1d69308ba6197a70f22a31b Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:54:59 +0100 Subject: staging: wfx: remove unnecessary braces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Braces are not necessary for single statement blocks Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-7-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 858d778cc589..ddc95ea16b6d 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -438,12 +438,11 @@ int wfx_probe(struct wfx_dev *wdev) eth_zero_addr(wdev->addresses[i].addr); err = of_get_mac_address(wdev->dev->of_node, wdev->addresses[i].addr); - if (!err) { + if (!err) wdev->addresses[i].addr[ETH_ALEN - 1] += i; - } else { + else ether_addr_copy(wdev->addresses[i].addr, wdev->hw_caps.mac_addr[i]); - } if (!is_valid_ether_addr(wdev->addresses[i].addr)) { dev_warn(wdev->dev, "using random MAC address\n"); eth_random_addr(wdev->addresses[i].addr); -- cgit From 1431555257928da7babfd0d6020d46b6cde30fd7 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:00 +0100 Subject: staging: wfx: remove useless #ifdef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the old days, this file was shared with other projects. Obviously, this "#ifdef __KERNEL__" have no reasons to be in the kernel. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-8-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_api_general.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/wfx/hif_api_general.h b/drivers/staging/wfx/hif_api_general.h index 3e5c92e12d35..8244676112a5 100644 --- a/drivers/staging/wfx/hif_api_general.h +++ b/drivers/staging/wfx/hif_api_general.h @@ -8,14 +8,8 @@ #ifndef WFX_HIF_API_GENERAL_H #define WFX_HIF_API_GENERAL_H -#ifdef __KERNEL__ #include #include -#else -#include -#include -#define __packed __attribute__((__packed__)) -#endif #define HIF_ID_IS_INDICATION 0x80 #define HIF_COUNTER_MAX 7 -- cgit From dbf798da2ff1733e7ee6089626d8a0eafca604f8 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:01 +0100 Subject: staging: wfx: use IS_ALIGNED() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It "IS_ALIGNED(ptr, 4)" is more explicit than "ptr & 3". Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-9-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bus_sdio.c | 9 +++++---- drivers/staging/wfx/hwio.c | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index a670176ba06f..42aeab30bf0a 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "bus.h" #include "wfx.h" @@ -40,8 +41,8 @@ static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id, int ret; WARN(reg_id > 7, "chip only has 7 registers"); - WARN(((uintptr_t)dst) & 3, "unaligned buffer size"); - WARN(count & 3, "unaligned buffer address"); + WARN(!IS_ALIGNED((uintptr_t)dst, 4), "unaligned buffer address"); + WARN(!IS_ALIGNED(count, 4), "unaligned buffer size"); /* Use queue mode buffers */ if (reg_id == WFX_REG_IN_OUT_QUEUE) @@ -61,8 +62,8 @@ static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id, int ret; WARN(reg_id > 7, "chip only has 7 registers"); - WARN(((uintptr_t)src) & 3, "unaligned buffer size"); - WARN(count & 3, "unaligned buffer address"); + WARN(!IS_ALIGNED((uintptr_t)src, 4), "unaligned buffer address"); + WARN(!IS_ALIGNED(count, 4), "unaligned buffer size"); /* Use queue mode buffers */ if (reg_id == WFX_REG_IN_OUT_QUEUE) diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c index 393bcb1e2f4e..a2a37efc51a6 100644 --- a/drivers/staging/wfx/hwio.c +++ b/drivers/staging/wfx/hwio.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "hwio.h" #include "wfx.h" @@ -221,7 +222,7 @@ int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t len) { int ret; - WARN((long)buf & 3, "%s: unaligned buffer", __func__); + WARN(!IS_ALIGNED((uintptr_t)buf, 4), "unaligned buffer"); wdev->hwbus_ops->lock(wdev->hwbus_priv); ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, WFX_REG_IN_OUT_QUEUE, buf, len); @@ -237,7 +238,7 @@ int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t len) { int ret; - WARN((long)buf & 3, "%s: unaligned buffer", __func__); + WARN(!IS_ALIGNED((uintptr_t)buf, 4), "unaligned buffer"); wdev->hwbus_ops->lock(wdev->hwbus_priv); ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, WFX_REG_IN_OUT_QUEUE, buf, len); -- cgit From fa2b25321d3d8c666d6aa9991476867602f31e78 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:02 +0100 Subject: staging: wfx: replace magic value by WFX_HIF_BUFFER_SIZE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Magic values are not recommended. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-10-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hwio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c index a2a37efc51a6..977b9325f496 100644 --- a/drivers/staging/wfx/hwio.c +++ b/drivers/staging/wfx/hwio.c @@ -15,6 +15,8 @@ #include "bus.h" #include "traces.h" +#define WFX_HIF_BUFFER_SIZE 0x2000 + static int read32(struct wfx_dev *wdev, int reg, u32 *val) { int ret; @@ -103,7 +105,7 @@ static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr, u32 cfg; u32 prefetch; - WARN_ON(len >= 0x2000); + WARN_ON(len >= WFX_HIF_BUFFER_SIZE); WARN_ON(reg != WFX_REG_AHB_DPORT && reg != WFX_REG_SRAM_DPORT); if (reg == WFX_REG_AHB_DPORT) @@ -151,7 +153,7 @@ static int indirect_write(struct wfx_dev *wdev, int reg, u32 addr, { int ret; - WARN_ON(len >= 0x2000); + WARN_ON(len >= WFX_HIF_BUFFER_SIZE); WARN_ON(reg != WFX_REG_AHB_DPORT && reg != WFX_REG_SRAM_DPORT); ret = write32(wdev, WFX_REG_BASE_ADDR, addr); if (ret < 0) -- cgit From 357e36e2106769950be404e958279770077c968f Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:03 +0100 Subject: stagigg: wfx: replace magic number by HIF_ID_IS_INDICATION MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Magic values are not recommended. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-11-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index 6963b54d5593..5e675d2c3e82 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -405,7 +405,7 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) goto free; } } - if (hif_id & 0x80) + if (hif_id & HIF_ID_IS_INDICATION) dev_err(wdev->dev, "unsupported HIF indication: ID %02x\n", hif_id); else -- cgit From af915de6bade0fe6a561e36a943ea2ada47756d1 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:04 +0100 Subject: staging: wfx: preserve endianness of struct hif_ind_startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hardware fills struct hif_ind_startup with little endian values. So, declare it with little endian fields. It is now a bit more verbose to access to fields of struct hif_ind_startup, but it is less confusing. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-12-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bh.c | 8 ++++---- drivers/staging/wfx/data_tx.c | 4 ++-- drivers/staging/wfx/hif_api_general.h | 12 ++++-------- drivers/staging/wfx/hif_rx.c | 5 ----- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index a0f9d1b53019..bbcf8d6a39c4 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -182,9 +182,9 @@ static void tx_helper(struct wfx_dev *wdev, struct hif_msg *hif) wdev->hif.tx_seqnum = (wdev->hif.tx_seqnum + 1) % (HIF_COUNTER_MAX + 1); data = hif; - WARN(len > wdev->hw_caps.size_inp_ch_buf, - "%s: request exceed the chip capability: %zu > %d\n", __func__, - len, wdev->hw_caps.size_inp_ch_buf); + WARN(len > le16_to_cpu(wdev->hw_caps.size_inp_ch_buf), + "request exceed the chip capability: %zu > %d\n", + len, le16_to_cpu(wdev->hw_caps.size_inp_ch_buf)); len = wdev->hwbus_ops->align_size(wdev->hwbus_priv, len); ret = wfx_data_write(wdev, data, len); if (ret) @@ -204,7 +204,7 @@ static int bh_work_tx(struct wfx_dev *wdev, int max_msg) for (i = 0; i < max_msg; i++) { hif = NULL; - if (wdev->hif.tx_buffers_used < wdev->hw_caps.num_inp_ch_bufs) { + if (wdev->hif.tx_buffers_used < le16_to_cpu(wdev->hw_caps.num_inp_ch_bufs)) { if (try_wait_for_completion(&wdev->hif_cmd.ready)) { WARN(!mutex_is_locked(&wdev->hif_cmd.lock), "data locking error"); hif = wdev->hif_cmd.buf_send; diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 052a19161dc5..5492375fe80a 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -359,10 +359,10 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, hif_msg->len = cpu_to_le16(skb->len); hif_msg->id = HIF_REQ_ID_TX; hif_msg->interface = wvif->id; - if (skb->len > wvif->wdev->hw_caps.size_inp_ch_buf) { + if (skb->len > le16_to_cpu(wvif->wdev->hw_caps.size_inp_ch_buf)) { dev_warn(wvif->wdev->dev, "requested frame size (%d) is larger than maximum supported (%d)\n", - skb->len, wvif->wdev->hw_caps.size_inp_ch_buf); + skb->len, le16_to_cpu(wvif->wdev->hw_caps.size_inp_ch_buf)); skb_pull(skb, wmsg_len); return -EIO; } diff --git a/drivers/staging/wfx/hif_api_general.h b/drivers/staging/wfx/hif_api_general.h index 8244676112a5..a57789ceb209 100644 --- a/drivers/staging/wfx/hif_api_general.h +++ b/drivers/staging/wfx/hif_api_general.h @@ -108,16 +108,12 @@ enum hif_api_rate_index { }; struct hif_ind_startup { - /* As the others, this struct is interpreted as little endian by the - * device. However, this struct is also used by the driver. We prefer to - * declare it in native order and doing byte swap on reception. - */ __le32 status; - u16 hardware_id; + __le16 hardware_id; u8 opn[14]; u8 uid[8]; - u16 num_inp_ch_bufs; - u16 size_inp_ch_buf; + __le16 num_inp_ch_bufs; + __le16 size_inp_ch_buf; u8 num_links_ap; u8 num_interfaces; u8 mac_addr[2][ETH_ALEN]; @@ -138,7 +134,7 @@ struct hif_ind_startup { u8 phy1_region:3; u8 phy0_region:3; u8 otp_phy_ver:2; - u32 supported_rate_mask; + __le32 supported_rate_mask; u8 firmware_label[128]; } __packed; diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index 5e675d2c3e82..ea6d192ce28c 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -81,11 +81,6 @@ static int hif_startup_indication(struct wfx_dev *wdev, return -EINVAL; } memcpy(&wdev->hw_caps, body, sizeof(struct hif_ind_startup)); - le16_to_cpus((__le16 *)&wdev->hw_caps.hardware_id); - le16_to_cpus((__le16 *)&wdev->hw_caps.num_inp_ch_bufs); - le16_to_cpus((__le16 *)&wdev->hw_caps.size_inp_ch_buf); - le32_to_cpus((__le32 *)&wdev->hw_caps.supported_rate_mask); - complete(&wdev->firmware_ready); return 0; } -- cgit From 74507433bc9310ea86661aed7f5454445119b9e7 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:05 +0100 Subject: staging: wfx: fix ambiguous function name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prefix 'ieee80211' is reserved for mac80211. It should not been used. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-13-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/scan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index 668ef2c60837..a1fd0f850481 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -12,8 +12,8 @@ #include "sta.h" #include "hif_tx_mib.h" -static void __ieee80211_scan_completed_compat(struct ieee80211_hw *hw, - bool aborted) +static void wfx_ieee80211_scan_completed_compat(struct ieee80211_hw *hw, + bool aborted) { struct cfg80211_scan_info info = { .aborted = aborted, @@ -120,7 +120,7 @@ void wfx_hw_scan_work(struct work_struct *work) } while (ret >= 0 && chan_cur < hw_req->req.n_channels); mutex_unlock(&wvif->scan_lock); mutex_unlock(&wvif->wdev->conf_mutex); - __ieee80211_scan_completed_compat(wvif->wdev->hw, ret < 0); + wfx_ieee80211_scan_completed_compat(wvif->wdev->hw, ret < 0); } int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, -- cgit From eec453df00668de8b70582b401a02920ac051333 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:06 +0100 Subject: staging: wfx: fix ambiguous function name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prefix 'ieee80211' is reserved for mac80211. It should not been used. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-14-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/data_tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 5492375fe80a..9ff9cca5eb66 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -207,7 +207,7 @@ void wfx_tx_policy_init(struct wfx_vif *wvif) /* Tx implementation */ -static bool ieee80211_is_action_back(struct ieee80211_hdr *hdr) +static bool wfx_is_action_back(struct ieee80211_hdr *hdr) { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)hdr; @@ -420,7 +420,7 @@ void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, /* Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any * BlockAck session management frame. The check below exist just in case. */ - if (ieee80211_is_action_back(hdr)) { + if (wfx_is_action_back(hdr)) { dev_info(wdev->dev, "drop BA action\n"); goto drop; } -- cgit From 1c7804829bcdd75ffee01e9257a87bd6a9abb685 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:07 +0100 Subject: staging: wfx: prefix functions from hif_*.h with wfx_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All the functions related to a driver should use the same prefix. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-15-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/data_tx.c | 2 +- drivers/staging/wfx/debug.c | 2 +- drivers/staging/wfx/hif_rx.c | 103 ++++++++++++----------- drivers/staging/wfx/hif_tx.c | 48 ++++++----- drivers/staging/wfx/hif_tx.h | 48 +++++------ drivers/staging/wfx/hif_tx_mib.c | 177 ++++++++++++++++++++------------------- drivers/staging/wfx/hif_tx_mib.h | 67 +++++++-------- drivers/staging/wfx/key.c | 4 +- drivers/staging/wfx/main.c | 12 +-- drivers/staging/wfx/scan.c | 10 +-- drivers/staging/wfx/sta.c | 92 ++++++++++---------- 11 files changed, 291 insertions(+), 274 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 9ff9cca5eb66..54ff9bca78d6 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -173,7 +173,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif) policies[i].uploaded = true; memcpy(tmp_rates, policies[i].rates, sizeof(tmp_rates)); spin_unlock_bh(&wvif->tx_policy_cache.lock); - hif_set_tx_rate_retry_policy(wvif, i, tmp_rates); + wfx_hif_set_tx_rate_retry_policy(wvif, i, tmp_rates); } else { spin_unlock_bh(&wvif->tx_policy_cache.lock); } diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index 9f93268a3202..e5f940f19bbe 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -66,7 +66,7 @@ static int wfx_counters_show(struct seq_file *seq, void *v) struct hif_mib_extended_count_table counters[3]; for (i = 0; i < ARRAY_SIZE(counters); i++) { - ret = hif_get_counters_table(wdev, i, counters + i); + ret = wfx_hif_get_counters_table(wdev, i, counters + i); if (ret < 0) return ret; if (ret > 0) diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index ea6d192ce28c..7a2a32e3ceb9 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -16,8 +16,8 @@ #include "data_rx.h" #include "hif_api_cmd.h" -static int hif_generic_confirm(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) +static int wfx_hif_generic_confirm(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) { /* All confirm messages start with status */ int status = le32_to_cpup((__le32 *)buf); @@ -50,8 +50,8 @@ static int hif_generic_confirm(struct wfx_dev *wdev, return status; } -static int hif_tx_confirm(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) +static int wfx_hif_tx_confirm(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) { const struct hif_cnf_tx *body = buf; @@ -59,8 +59,8 @@ static int hif_tx_confirm(struct wfx_dev *wdev, return 0; } -static int hif_multi_tx_confirm(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) +static int wfx_hif_multi_tx_confirm(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) { const struct hif_cnf_multi_transmit *body = buf; int i; @@ -71,8 +71,9 @@ static int hif_multi_tx_confirm(struct wfx_dev *wdev, return 0; } -static int hif_startup_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) +static int wfx_hif_startup_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) { const struct hif_ind_startup *body = buf; @@ -85,8 +86,8 @@ static int hif_startup_indication(struct wfx_dev *wdev, return 0; } -static int hif_wakeup_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) +static int wfx_hif_wakeup_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) { if (!wdev->pdata.gpio_wakeup || gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) { @@ -96,9 +97,9 @@ static int hif_wakeup_indication(struct wfx_dev *wdev, return 0; } -static int hif_receive_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, - const void *buf, struct sk_buff *skb) +static int wfx_hif_receive_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf, struct sk_buff *skb) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); const struct hif_ind_rx *body = buf; @@ -114,8 +115,8 @@ static int hif_receive_indication(struct wfx_dev *wdev, return 0; } -static int hif_event_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) +static int wfx_hif_event_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); const struct hif_ind_event *body = buf; @@ -149,9 +150,9 @@ static int hif_event_indication(struct wfx_dev *wdev, return 0; } -static int hif_pm_mode_complete_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, - const void *buf) +static int wfx_hif_pm_mode_complete_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); @@ -164,9 +165,9 @@ static int hif_pm_mode_complete_indication(struct wfx_dev *wdev, return 0; } -static int hif_scan_complete_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, - const void *buf) +static int wfx_hif_scan_complete_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); const struct hif_ind_scan_cmpl *body = buf; @@ -181,9 +182,9 @@ static int hif_scan_complete_indication(struct wfx_dev *wdev, return 0; } -static int hif_join_complete_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, - const void *buf) +static int wfx_hif_join_complete_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); @@ -196,9 +197,9 @@ static int hif_join_complete_indication(struct wfx_dev *wdev, return 0; } -static int hif_suspend_resume_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, - const void *buf) +static int wfx_hif_suspend_resume_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) { const struct hif_ind_suspend_resume_tx *body = buf; struct wfx_vif *wvif; @@ -225,8 +226,9 @@ static int hif_suspend_resume_indication(struct wfx_dev *wdev, return 0; } -static int hif_generic_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) +static int wfx_hif_generic_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) { const struct hif_ind_generic *body = buf; int type = le32_to_cpu(body->type); @@ -305,8 +307,8 @@ static const struct { "secure link params (nonce or tag) mismatch" }, }; -static int hif_error_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) +static int wfx_hif_error_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, const void *buf) { const struct hif_ind_error *body = buf; int type = le32_to_cpu(body->type); @@ -332,8 +334,9 @@ static int hif_error_indication(struct wfx_dev *wdev, return 0; }; -static int hif_exception_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) +static int wfx_hif_exception_indication(struct wfx_dev *wdev, + const struct hif_msg *hif, + const void *buf) { const struct hif_ind_exception *body = buf; int type = le32_to_cpu(body->type); @@ -356,21 +359,21 @@ static const struct { const struct hif_msg *hif, const void *buf); } hif_handlers[] = { /* Confirmations */ - { HIF_CNF_ID_TX, hif_tx_confirm }, - { HIF_CNF_ID_MULTI_TRANSMIT, hif_multi_tx_confirm }, + { HIF_CNF_ID_TX, wfx_hif_tx_confirm }, + { HIF_CNF_ID_MULTI_TRANSMIT, wfx_hif_multi_tx_confirm }, /* Indications */ - { HIF_IND_ID_STARTUP, hif_startup_indication }, - { HIF_IND_ID_WAKEUP, hif_wakeup_indication }, - { HIF_IND_ID_JOIN_COMPLETE, hif_join_complete_indication }, - { HIF_IND_ID_SET_PM_MODE_CMPL, hif_pm_mode_complete_indication }, - { HIF_IND_ID_SCAN_CMPL, hif_scan_complete_indication }, - { HIF_IND_ID_SUSPEND_RESUME_TX, hif_suspend_resume_indication }, - { HIF_IND_ID_EVENT, hif_event_indication }, - { HIF_IND_ID_GENERIC, hif_generic_indication }, - { HIF_IND_ID_ERROR, hif_error_indication }, - { HIF_IND_ID_EXCEPTION, hif_exception_indication }, - /* FIXME: allocate skb_p from hif_receive_indication and make it generic */ - //{ HIF_IND_ID_RX, hif_receive_indication }, + { HIF_IND_ID_STARTUP, wfx_hif_startup_indication }, + { HIF_IND_ID_WAKEUP, wfx_hif_wakeup_indication }, + { HIF_IND_ID_JOIN_COMPLETE, wfx_hif_join_complete_indication }, + { HIF_IND_ID_SET_PM_MODE_CMPL, wfx_hif_pm_mode_complete_indication }, + { HIF_IND_ID_SCAN_CMPL, wfx_hif_scan_complete_indication }, + { HIF_IND_ID_SUSPEND_RESUME_TX, wfx_hif_suspend_resume_indication }, + { HIF_IND_ID_EVENT, wfx_hif_event_indication }, + { HIF_IND_ID_GENERIC, wfx_hif_generic_indication }, + { HIF_IND_ID_ERROR, wfx_hif_error_indication }, + { HIF_IND_ID_EXCEPTION, wfx_hif_exception_indication }, + /* FIXME: allocate skb_p from wfx_hif_receive_indication and make it generic */ + //{ HIF_IND_ID_RX, wfx_hif_receive_indication }, }; void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) @@ -380,8 +383,8 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) int hif_id = hif->id; if (hif_id == HIF_IND_ID_RX) { - /* hif_receive_indication take care of skb lifetime */ - hif_receive_indication(wdev, hif, hif->body, skb); + /* wfx_hif_receive_indication take care of skb lifetime */ + wfx_hif_receive_indication(wdev, hif, hif->body, skb); return; } /* Note: mutex_is_lock cause an implicit memory barrier that protect @@ -390,7 +393,7 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) if (mutex_is_locked(&wdev->hif_cmd.lock) && wdev->hif_cmd.buf_send && wdev->hif_cmd.buf_send->id == hif_id) { - hif_generic_confirm(wdev, hif, hif->body); + wfx_hif_generic_confirm(wdev, hif, hif->body); goto free; } for (i = 0; i < ARRAY_SIZE(hif_handlers); i++) { diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 2fd8bbd36e25..7c9d3d86c22e 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -122,7 +122,7 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, /* This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any * request anymore. Obviously, only call this function during device unregister. */ -int hif_shutdown(struct wfx_dev *wdev) +int wfx_hif_shutdown(struct wfx_dev *wdev) { int ret; struct hif_msg *hif; @@ -140,7 +140,7 @@ int hif_shutdown(struct wfx_dev *wdev) return ret; } -int hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len) +int wfx_hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len) { int ret; size_t buf_len = sizeof(struct hif_req_configuration) + len; @@ -157,7 +157,7 @@ int hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len) return ret; } -int hif_reset(struct wfx_vif *wvif, bool reset_stat) +int wfx_hif_reset(struct wfx_vif *wvif, bool reset_stat) { int ret; struct hif_msg *hif; @@ -172,8 +172,8 @@ int hif_reset(struct wfx_vif *wvif, bool reset_stat) return ret; } -int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *val, size_t val_len) +int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, + void *val, size_t val_len) { int ret; struct hif_msg *hif; @@ -208,8 +208,8 @@ out: return ret; } -int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *val, size_t val_len) +int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, + void *val, size_t val_len) { int ret; struct hif_msg *hif; @@ -227,8 +227,8 @@ int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, return ret; } -int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, - int chan_start_idx, int chan_num) +int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, + int chan_start_idx, int chan_num) { int ret, i; struct hif_msg *hif; @@ -276,7 +276,7 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, return ret; } -int hif_stop_scan(struct wfx_vif *wvif) +int wfx_hif_stop_scan(struct wfx_vif *wvif) { int ret; struct hif_msg *hif; @@ -291,8 +291,8 @@ int hif_stop_scan(struct wfx_vif *wvif) return ret; } -int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, - struct ieee80211_channel *channel, const u8 *ssid, int ssidlen) +int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, + struct ieee80211_channel *channel, const u8 *ssid, int ssidlen) { int ret; struct hif_msg *hif; @@ -322,7 +322,7 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, return ret; } -int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) +int wfx_hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) { int ret; struct hif_msg *hif; @@ -340,7 +340,7 @@ int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) return ret; } -int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg) +int wfx_hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg) { int ret; struct hif_msg *hif; @@ -364,7 +364,7 @@ int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg) return ret; } -int hif_remove_key(struct wfx_dev *wdev, int idx) +int wfx_hif_remove_key(struct wfx_dev *wdev, int idx) { int ret; struct hif_msg *hif; @@ -379,8 +379,8 @@ int hif_remove_key(struct wfx_dev *wdev, int idx) return ret; } -int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, - const struct ieee80211_tx_queue_params *arg) +int wfx_hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, + const struct ieee80211_tx_queue_params *arg) { int ret; struct hif_msg *hif; @@ -410,7 +410,7 @@ int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, return ret; } -int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout) +int wfx_hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout) { int ret; struct hif_msg *hif; @@ -434,8 +434,8 @@ int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout) return ret; } -int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, - const struct ieee80211_channel *channel) +int wfx_hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, + const struct ieee80211_channel *channel) { int ret; struct hif_msg *hif; @@ -458,7 +458,7 @@ int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, return ret; } -int hif_beacon_transmit(struct wfx_vif *wvif, bool enable) +int wfx_hif_beacon_transmit(struct wfx_vif *wvif, bool enable) { int ret; struct hif_msg *hif; @@ -475,7 +475,8 @@ int hif_beacon_transmit(struct wfx_vif *wvif, bool enable) return ret; } -int hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp) +int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, + bool mfp) { int ret; struct hif_msg *hif; @@ -494,7 +495,8 @@ int hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, boo return ret; } -int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len) +int wfx_hif_update_ie_beacon(struct wfx_vif *wvif, + const u8 *ies, size_t ies_len) { int ret; struct hif_msg *hif; diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index f7895845686f..b28a2ee5350a 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -36,29 +36,29 @@ void wfx_init_hif_cmd(struct wfx_hif_cmd *wfx_hif_cmd); int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, void *reply, size_t reply_len, bool async); -int hif_shutdown(struct wfx_dev *wdev); -int hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len); -int hif_reset(struct wfx_vif *wvif, bool reset_stat); -int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *buf, size_t buf_size); -int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *buf, size_t buf_size); -int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211, - int chan_start, int chan_num); -int hif_stop_scan(struct wfx_vif *wvif); -int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, - struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); -int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout); -int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count); -int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg); -int hif_remove_key(struct wfx_dev *wdev, int idx); -int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, - const struct ieee80211_tx_queue_params *arg); -int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, - const struct ieee80211_channel *channel); -int hif_beacon_transmit(struct wfx_vif *wvif, bool enable); -int hif_map_link(struct wfx_vif *wvif, - bool unmap, u8 *mac_addr, int sta_id, bool mfp); -int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len); +int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, + void *buf, size_t buf_size); +int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, + void *buf, size_t buf_size); +int wfx_hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, + const struct ieee80211_channel *channel); +int wfx_hif_reset(struct wfx_vif *wvif, bool reset_stat); +int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, + struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); +int wfx_hif_map_link(struct wfx_vif *wvif, + bool unmap, u8 *mac_addr, int sta_id, bool mfp); +int wfx_hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg); +int wfx_hif_remove_key(struct wfx_dev *wdev, int idx); +int wfx_hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout); +int wfx_hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count); +int wfx_hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, + const struct ieee80211_tx_queue_params *arg); +int wfx_hif_beacon_transmit(struct wfx_vif *wvif, bool enable); +int wfx_hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len); +int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211, + int chan_start, int chan_num); +int wfx_hif_stop_scan(struct wfx_vif *wvif); +int wfx_hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len); +int wfx_hif_shutdown(struct wfx_dev *wdev); #endif diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index 97e961e6bcf6..b79ffdf6fcd2 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -14,20 +14,20 @@ #include "hif_tx_mib.h" #include "hif_api_mib.h" -int hif_set_output_power(struct wfx_vif *wvif, int val) +int wfx_hif_set_output_power(struct wfx_vif *wvif, int val) { struct hif_mib_current_tx_power_level arg = { .power_level = cpu_to_le32(val * 10), }; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_CURRENT_TX_POWER_LEVEL, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_CURRENT_TX_POWER_LEVEL, + &arg, sizeof(arg)); } -int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, - unsigned int dtim_interval, - unsigned int listen_interval) +int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, + unsigned int dtim_interval, + unsigned int listen_interval) { struct hif_mib_beacon_wake_up_period arg = { .wakeup_period_min = dtim_interval, @@ -37,13 +37,13 @@ int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, if (dtim_interval > 0xFF || listen_interval > 0xFFFF) return -EINVAL; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BEACON_WAKEUP_PERIOD, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_BEACON_WAKEUP_PERIOD, + &arg, sizeof(arg)); } -int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, - int rssi_thold, int rssi_hyst) +int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, + int rssi_thold, int rssi_hyst) { struct hif_mib_rcpi_rssi_threshold arg = { .rolling_average_count = 8, @@ -60,37 +60,39 @@ int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, arg.lower_threshold = (arg.lower_threshold + 110) * 2; } - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_RCPI_RSSI_THRESHOLD, &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_RCPI_RSSI_THRESHOLD, + &arg, sizeof(arg)); } -int hif_get_counters_table(struct wfx_dev *wdev, int vif_id, - struct hif_mib_extended_count_table *arg) +int wfx_hif_get_counters_table(struct wfx_dev *wdev, int vif_id, + struct hif_mib_extended_count_table *arg) { if (wfx_api_older_than(wdev, 1, 3)) { /* extended_count_table is wider than count_table */ memset(arg, 0xFF, sizeof(*arg)); - return hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE, + return wfx_hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE, arg, sizeof(struct hif_mib_count_table)); } else { - return hif_read_mib(wdev, vif_id, + return wfx_hif_read_mib(wdev, vif_id, HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg, sizeof(struct hif_mib_extended_count_table)); } } -int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac) +int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac) { struct hif_mib_mac_address arg = { }; if (mac) ether_addr_copy(arg.mac_addr, mac); - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_MAC_ADDRESS, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_DOT11_MAC_ADDRESS, + &arg, sizeof(arg)); } -int hif_set_rx_filter(struct wfx_vif *wvif, - bool filter_bssid, bool filter_prbreq) +int wfx_hif_set_rx_filter(struct wfx_vif *wvif, + bool filter_bssid, bool filter_prbreq) { struct hif_mib_rx_filter arg = { }; @@ -98,12 +100,12 @@ int hif_set_rx_filter(struct wfx_vif *wvif, arg.bssid_filter = 1; if (!filter_prbreq) arg.fwd_probe_req = 1; - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_RX_FILTER, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_RX_FILTER, + &arg, sizeof(arg)); } -int hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, - const struct hif_ie_table_entry *tbl) +int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, + const struct hif_ie_table_entry *tbl) { int ret; struct hif_mib_bcn_filter_table *arg; @@ -114,37 +116,38 @@ int hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, return -ENOMEM; arg->num_of_info_elmts = cpu_to_le32(tbl_len); memcpy(arg->ie_table, tbl, flex_array_size(arg, ie_table, tbl_len)); - ret = hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BEACON_FILTER_TABLE, arg, buf_len); + ret = wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_BEACON_FILTER_TABLE, arg, buf_len); kfree(arg); return ret; } -int hif_beacon_filter_control(struct wfx_vif *wvif, - int enable, int beacon_count) +int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, + int enable, int beacon_count) { struct hif_mib_bcn_filter_enable arg = { .enable = cpu_to_le32(enable), .bcn_count = cpu_to_le32(beacon_count), }; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BEACON_FILTER_ENABLE, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_BEACON_FILTER_ENABLE, + &arg, sizeof(arg)); } -int hif_set_operational_mode(struct wfx_dev *wdev, enum hif_op_power_mode mode) +int wfx_hif_set_operational_mode(struct wfx_dev *wdev, + enum hif_op_power_mode mode) { struct hif_mib_gl_operational_power_mode arg = { .power_mode = mode, .wup_ind_activation = 1, }; - return hif_write_mib(wdev, -1, HIF_MIB_ID_GL_OPERATIONAL_POWER_MODE, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wdev, -1, HIF_MIB_ID_GL_OPERATIONAL_POWER_MODE, + &arg, sizeof(arg)); } -int hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, - u8 frame_type, int init_rate) +int wfx_hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, + u8 frame_type, int init_rate) { struct hif_mib_template_frame *arg; @@ -155,11 +158,11 @@ int hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, arg->init_rate = init_rate; arg->frame_type = frame_type; arg->frame_length = cpu_to_le16(skb->len); - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_TEMPLATE_FRAME, - arg, sizeof(*arg) + skb->len); + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_TEMPLATE_FRAME, + arg, sizeof(*arg) + skb->len); } -int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required) +int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required) { struct hif_mib_protected_mgmt_policy arg = { }; @@ -170,25 +173,26 @@ int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required) } if (!required) arg.unpmf_allowed = 1; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_PROTECTED_MGMT_POLICY, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_PROTECTED_MGMT_POLICY, + &arg, sizeof(arg)); } -int hif_set_block_ack_policy(struct wfx_vif *wvif, - u8 tx_tid_policy, u8 rx_tid_policy) +int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, + u8 tx_tid_policy, u8 rx_tid_policy) { struct hif_mib_block_ack_policy arg = { .block_ack_tx_tid_policy = tx_tid_policy, .block_ack_rx_tid_policy = rx_tid_policy, }; - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BLOCK_ACK_POLICY, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_BLOCK_ACK_POLICY, + &arg, sizeof(arg)); } -int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, - bool greenfield, bool short_preamble) +int wfx_hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, + bool greenfield, bool short_preamble) { struct hif_mib_set_association_mode arg = { .preambtype_use = 1, @@ -199,12 +203,13 @@ int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, .mpdu_start_spacing = ampdu_density, }; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_ASSOCIATION_MODE, &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_SET_ASSOCIATION_MODE, + &arg, sizeof(arg)); } -int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, - int policy_index, u8 *rates) +int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, + int policy_index, u8 *rates) { struct hif_mib_set_tx_rate_retry_policy *arg; size_t size = struct_size(arg, tx_rate_retry_policy, 1); @@ -222,23 +227,25 @@ int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, arg->tx_rate_retry_policy[0].count_init = 1; memcpy(&arg->tx_rate_retry_policy[0].rates, rates, sizeof(arg->tx_rate_retry_policy[0].rates)); - ret = hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg, size); + ret = wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY, + arg, size); kfree(arg); return ret; } -int hif_keep_alive_period(struct wfx_vif *wvif, int period) +int wfx_hif_keep_alive_period(struct wfx_vif *wvif, int period) { struct hif_mib_keep_alive_period arg = { .keep_alive_period = cpu_to_le16(period), }; - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_KEEP_ALIVE_PERIOD, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_KEEP_ALIVE_PERIOD, + &arg, sizeof(arg)); }; -int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr) +int wfx_hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr) { struct hif_mib_arp_ip_addr_table arg = { .condition_idx = idx, @@ -250,22 +257,22 @@ int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr) memcpy(arg.ipv4_address, addr, sizeof(arg.ipv4_address)); arg.arp_enable = HIF_ARP_NS_FILTERING_ENABLE; } - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE, + &arg, sizeof(arg)); } -int hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable) +int wfx_hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable) { struct hif_mib_gl_set_multi_msg arg = { .enable_multi_tx_conf = enable, }; - return hif_write_mib(wdev, -1, HIF_MIB_ID_GL_SET_MULTI_MSG, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wdev, -1, HIF_MIB_ID_GL_SET_MULTI_MSG, + &arg, sizeof(arg)); } -int hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) +int wfx_hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) { struct hif_mib_set_uapsd_information arg = { }; @@ -277,48 +284,50 @@ int hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) arg.trig_be = 1; if (val & BIT(IEEE80211_AC_BK)) arg.trig_bckgrnd = 1; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_UAPSD_INFORMATION, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_SET_UAPSD_INFORMATION, + &arg, sizeof(arg)); } -int hif_erp_use_protection(struct wfx_vif *wvif, bool enable) +int wfx_hif_erp_use_protection(struct wfx_vif *wvif, bool enable) { struct hif_mib_non_erp_protection arg = { .use_cts_to_self = enable, }; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_NON_ERP_PROTECTION, &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_NON_ERP_PROTECTION, + &arg, sizeof(arg)); } -int hif_slot_time(struct wfx_vif *wvif, int val) +int wfx_hif_slot_time(struct wfx_vif *wvif, int val) { struct hif_mib_slot_time arg = { .slot_time = cpu_to_le32(val), }; - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SLOT_TIME, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SLOT_TIME, + &arg, sizeof(arg)); } -int hif_wep_default_key_id(struct wfx_vif *wvif, int val) +int wfx_hif_wep_default_key_id(struct wfx_vif *wvif, int val) { struct hif_mib_wep_default_key_id arg = { .wep_default_key_id = val, }; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID, + &arg, sizeof(arg)); } -int hif_rts_threshold(struct wfx_vif *wvif, int val) +int wfx_hif_rts_threshold(struct wfx_vif *wvif, int val) { struct hif_mib_dot11_rts_threshold arg = { .threshold = cpu_to_le32(val >= 0 ? val : 0xFFFF), }; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_DOT11_RTS_THRESHOLD, &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_DOT11_RTS_THRESHOLD, + &arg, sizeof(arg)); } diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index fe08a69412ab..9b4c16ad5ecf 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -17,38 +17,39 @@ struct wfx_dev; struct hif_ie_table_entry; struct hif_mib_extended_count_table; -int hif_set_output_power(struct wfx_vif *wvif, int val); -int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, - unsigned int dtim_interval, - unsigned int listen_interval); -int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, - int rssi_thold, int rssi_hyst); -int hif_get_counters_table(struct wfx_dev *wdev, int vif_id, - struct hif_mib_extended_count_table *arg); -int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac); -int hif_set_rx_filter(struct wfx_vif *wvif, - bool filter_bssid, bool fwd_probe_req); -int hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, - const struct hif_ie_table_entry *tbl); -int hif_beacon_filter_control(struct wfx_vif *wvif, - int enable, int beacon_count); -int hif_set_operational_mode(struct wfx_dev *wdev, enum hif_op_power_mode mode); -int hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, - u8 frame_type, int init_rate); -int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required); -int hif_set_block_ack_policy(struct wfx_vif *wvif, - u8 tx_tid_policy, u8 rx_tid_policy); -int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, - bool greenfield, bool short_preamble); -int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, - int policy_index, u8 *rates); -int hif_keep_alive_period(struct wfx_vif *wvif, int period); -int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr); -int hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable); -int hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val); -int hif_erp_use_protection(struct wfx_vif *wvif, bool enable); -int hif_slot_time(struct wfx_vif *wvif, int val); -int hif_wep_default_key_id(struct wfx_vif *wvif, int val); -int hif_rts_threshold(struct wfx_vif *wvif, int val); +int wfx_hif_set_output_power(struct wfx_vif *wvif, int val); +int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, + unsigned int dtim_interval, + unsigned int listen_interval); +int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, + int rssi_thold, int rssi_hyst); +int wfx_hif_get_counters_table(struct wfx_dev *wdev, int vif_id, + struct hif_mib_extended_count_table *arg); +int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac); +int wfx_hif_set_rx_filter(struct wfx_vif *wvif, + bool filter_bssid, bool fwd_probe_req); +int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, + const struct hif_ie_table_entry *tbl); +int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, + int enable, int beacon_count); +int wfx_hif_set_operational_mode(struct wfx_dev *wdev, + enum hif_op_power_mode mode); +int wfx_hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, + u8 frame_type, int init_rate); +int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required); +int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, + u8 tx_tid_policy, u8 rx_tid_policy); +int wfx_hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, + bool greenfield, bool short_preamble); +int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, + int policy_index, u8 *rates); +int wfx_hif_keep_alive_period(struct wfx_vif *wvif, int period); +int wfx_hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr); +int wfx_hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable); +int wfx_hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val); +int wfx_hif_erp_use_protection(struct wfx_vif *wvif, bool enable); +int wfx_hif_slot_time(struct wfx_vif *wvif, int val); +int wfx_hif_wep_default_key_id(struct wfx_vif *wvif, int val); +int wfx_hif_rts_threshold(struct wfx_vif *wvif, int val); #endif diff --git a/drivers/staging/wfx/key.c b/drivers/staging/wfx/key.c index 65134a174683..6069be161154 100644 --- a/drivers/staging/wfx/key.c +++ b/drivers/staging/wfx/key.c @@ -205,7 +205,7 @@ static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta, wfx_free_key(wdev, idx); return -EOPNOTSUPP; } - ret = hif_add_key(wdev, &k); + ret = wfx_hif_add_key(wdev, &k); if (ret) { wfx_free_key(wdev, idx); return -EOPNOTSUPP; @@ -220,7 +220,7 @@ static int wfx_remove_key(struct wfx_vif *wvif, struct ieee80211_key_conf *key) { WARN(key->hw_key_idx >= MAX_KEY_ENTRIES, "corrupted hw_key_idx"); wfx_free_key(wvif->wdev, key->hw_key_idx); - return hif_remove_key(wvif->wdev, key->hw_key_idx); + return wfx_hif_remove_key(wvif->wdev, key->hw_key_idx); } int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index ddc95ea16b6d..abc1a6d43300 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -201,8 +201,8 @@ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) buf[i] = 0; dev_dbg(wdev->dev, "send PDS '%s}'\n", buf + start); buf[i] = '}'; - ret = hif_configuration(wdev, buf + start, - i - start + 1); + ret = wfx_hif_configuration(wdev, buf + start, + i - start + 1); if (ret > 0) { dev_err(wdev->dev, "PDS bytes %d to %d: invalid data (unsupported options?)\n", start, i); @@ -418,7 +418,7 @@ int wfx_probe(struct wfx_dev *wdev) if (err) goto err0; - err = hif_use_multi_tx_conf(wdev, true); + err = wfx_hif_use_multi_tx_conf(wdev, true); if (err) dev_err(wdev->dev, "misconfigured IRQ?\n"); @@ -429,9 +429,9 @@ int wfx_probe(struct wfx_dev *wdev) wdev->pdata.file_pds); gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); control_reg_write(wdev, 0); - hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_QUIESCENT); + wfx_hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_QUIESCENT); } else { - hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_DOZE); + wfx_hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_DOZE); } for (i = 0; i < ARRAY_SIZE(wdev->addresses); i++) { @@ -478,7 +478,7 @@ err0: void wfx_release(struct wfx_dev *wdev) { ieee80211_unregister_hw(wdev->hw); - hif_shutdown(wdev); + wfx_hif_shutdown(wdev); wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv); wfx_bh_unregister(wdev); } diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index a1fd0f850481..f61c6b2db352 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -33,7 +33,7 @@ static int update_probe_tmpl(struct wfx_vif *wvif, return -ENOMEM; skb_put_data(skb, req->ie, req->ie_len); - hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBREQ, 0); + wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBREQ, 0); dev_kfree_skb(skb); return 0; } @@ -56,14 +56,14 @@ static int send_scan_req(struct wfx_vif *wvif, wfx_tx_lock_flush(wvif->wdev); wvif->scan_abort = false; reinit_completion(&wvif->scan_complete); - ret = hif_scan(wvif, req, start_idx, i - start_idx); + ret = wfx_hif_scan(wvif, req, start_idx, i - start_idx); if (ret) { wfx_tx_unlock(wvif->wdev); return -EIO; } ret = wait_for_completion_timeout(&wvif->scan_complete, 1 * HZ); if (!ret) { - hif_stop_scan(wvif); + wfx_hif_stop_scan(wvif); ret = wait_for_completion_timeout(&wvif->scan_complete, 1 * HZ); dev_dbg(wvif->wdev->dev, "scan timeout (%d channels done)\n", wvif->scan_nb_chan_done); @@ -80,7 +80,7 @@ static int send_scan_req(struct wfx_vif *wvif, ret = wvif->scan_nb_chan_done; } if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower) - hif_set_output_power(wvif, wvif->vif->bss_conf.txpower); + wfx_hif_set_output_power(wvif, wvif->vif->bss_conf.txpower); wfx_tx_unlock(wvif->wdev); return ret; } @@ -139,7 +139,7 @@ void wfx_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; wvif->scan_abort = true; - hif_stop_scan(wvif); + wfx_hif_stop_scan(wvif); } void wfx_scan_complete(struct wfx_vif *wvif, int nb_chan_done) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 23c0425e3929..d384f2df329c 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -89,10 +89,12 @@ static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon) }; if (!filter_beacon) { - hif_beacon_filter_control(wvif, 0, 1); + wfx_hif_beacon_filter_control(wvif, 0, 1); } else { - hif_set_beacon_filter_table(wvif, ARRAY_SIZE(filter_ies), filter_ies); - hif_beacon_filter_control(wvif, HIF_BEACON_FILTER_ENABLE, 0); + wfx_hif_set_beacon_filter_table(wvif, ARRAY_SIZE(filter_ies), + filter_ies); + wfx_hif_beacon_filter_control(wvif, + HIF_BEACON_FILTER_ENABLE, 0); } } @@ -143,7 +145,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, filter_prbreq = false; else filter_prbreq = true; - hif_set_rx_filter(wvif, filter_bssid, filter_prbreq); + wfx_hif_set_rx_filter(wvif, filter_bssid, filter_prbreq); mutex_unlock(&wvif->scan_lock); } @@ -210,7 +212,7 @@ int wfx_update_pm(struct wfx_vif *wvif) TU_TO_JIFFIES(512))) dev_warn(wvif->wdev->dev, "timeout while waiting of set_pm_mode_complete\n"); - return hif_set_pm(wvif, ps, ps_timeout); + return wfx_hif_set_pm(wvif, ps, ps_timeout); } int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, @@ -224,10 +226,10 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mutex_lock(&wdev->conf_mutex); assign_bit(queue, &wvif->uapsd_mask, params->uapsd); - hif_set_edca_queue_params(wvif, queue, params); + wfx_hif_set_edca_queue_params(wvif, queue, params); if (wvif->vif->type == NL80211_IFTYPE_STATION && old_uapsd != wvif->uapsd_mask) { - hif_set_uapsd_info(wvif, wvif->uapsd_mask); + wfx_hif_set_uapsd_info(wvif, wvif->uapsd_mask); wfx_update_pm(wvif); } mutex_unlock(&wdev->conf_mutex); @@ -240,7 +242,7 @@ int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value) struct wfx_vif *wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) - hif_rts_threshold(wvif, value); + wfx_hif_rts_threshold(wvif, value); return 0; } @@ -276,7 +278,7 @@ void wfx_set_default_unicast_key(struct ieee80211_hw *hw, { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - hif_wep_default_key_id(wvif, idx); + wfx_hif_wep_default_key_id(wvif, idx); } void wfx_reset(struct wfx_vif *wvif) @@ -284,10 +286,10 @@ void wfx_reset(struct wfx_vif *wvif) struct wfx_dev *wdev = wvif->wdev; wfx_tx_lock_flush(wdev); - hif_reset(wvif, false); + wfx_hif_reset(wvif, false); wfx_tx_policy_init(wvif); if (wvif_count(wdev) <= 1) - hif_set_block_ack_policy(wvif, 0xFF, 0xFF); + wfx_hif_set_block_ack_policy(wvif, 0xFF, 0xFF); wfx_tx_unlock(wdev); wvif->join_in_progress = false; cancel_delayed_work_sync(&wvif->beacon_loss_work); @@ -305,7 +307,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, sta_priv->vif_id = wvif->id; if (vif->type == NL80211_IFTYPE_STATION) - hif_set_mfp(wvif, sta->mfp, sta->mfp); + wfx_hif_set_mfp(wvif, sta->mfp, sta->mfp); /* In station mode, the firmware interprets new link-id as a TDLS peer */ if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) @@ -314,7 +316,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wvif->link_id_map |= BIT(sta_priv->link_id); WARN_ON(!sta_priv->link_id); WARN_ON(sta_priv->link_id >= HIF_LINK_ID_MAX); - hif_map_link(wvif, false, sta->addr, sta_priv->link_id, sta->mfp); + wfx_hif_map_link(wvif, false, sta->addr, sta_priv->link_id, sta->mfp); return 0; } @@ -329,7 +331,7 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (!sta_priv->link_id) return 0; /* FIXME add a mutex? */ - hif_map_link(wvif, true, sta->addr, sta_priv->link_id, false); + wfx_hif_map_link(wvif, true, sta->addr, sta_priv->link_id, false); wvif->link_id_map &= ~BIT(sta_priv->link_id); return 0; } @@ -341,15 +343,15 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif) skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); if (!skb) return -ENOMEM; - hif_set_template_frame(wvif, skb, HIF_TMPLT_BCN, - API_RATE_INDEX_B_1MBPS); + wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_BCN, + API_RATE_INDEX_B_1MBPS); dev_kfree_skb(skb); skb = ieee80211_proberesp_get(wvif->wdev->hw, wvif->vif); if (!skb) return -ENOMEM; - hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBRES, - API_RATE_INDEX_B_1MBPS); + wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBRES, + API_RATE_INDEX_B_1MBPS); dev_kfree_skb(skb); return 0; } @@ -375,7 +377,7 @@ static void wfx_set_mfp_ap(struct wfx_vif *wvif) ptr += 1 + akm_suite_size * *ptr; if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) return; - hif_set_mfp(wvif, *ptr & BIT(7), *ptr & BIT(6)); + wfx_hif_set_mfp(wvif, *ptr & BIT(7), *ptr & BIT(6)); } } @@ -390,7 +392,7 @@ int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) wfx_update_pm(wvif); wvif = (struct wfx_vif *)vif->drv_priv; wfx_upload_ap_templates(wvif); - ret = hif_start(wvif, &vif->bss_conf, wvif->channel); + ret = wfx_hif_start(wvif, &vif->bss_conf, wvif->channel); if (ret > 0) return -EIO; wfx_set_mfp_ap(wvif); @@ -437,7 +439,7 @@ static void wfx_join(struct wfx_vif *wvif) cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); wvif->join_in_progress = true; - ret = hif_join(wvif, conf, wvif->channel, ssid, ssidlen); + ret = wfx_hif_join(wvif, conf, wvif->channel, ssid, ssidlen); if (ret) { ieee80211_connection_loss(wvif->vif); wfx_reset(wvif); @@ -470,14 +472,14 @@ static void wfx_join_finalize(struct wfx_vif *wvif, rcu_read_unlock(); wvif->join_in_progress = false; - hif_set_association_mode(wvif, ampdu_density, greenfield, - info->use_short_preamble); - hif_keep_alive_period(wvif, 0); + wfx_hif_set_association_mode(wvif, ampdu_density, greenfield, + info->use_short_preamble); + wfx_hif_keep_alive_period(wvif, 0); /* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use * the same value. */ - hif_set_bss_params(wvif, info->aid, 7); - hif_set_beacon_wakeup_period(wvif, 1, 1); + wfx_hif_set_bss_params(wvif, info->aid, 7); + wfx_hif_set_beacon_wakeup_period(wvif, 1, 1); wfx_update_pm(wvif); } @@ -508,7 +510,7 @@ static void wfx_enable_beacon(struct wfx_vif *wvif, bool enable) wvif->after_dtim_tx_allowed = true; wfx_bh_request_tx(wvif->wdev); } - hif_beacon_transmit(wvif, enable); + wfx_hif_beacon_transmit(wvif, enable); } void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, @@ -541,8 +543,8 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (vif->type != NL80211_IFTYPE_STATION) dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", __func__); - hif_set_beacon_wakeup_period(wvif, info->dtim_period, - info->dtim_period); + wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period, + info->dtim_period); /* We temporary forwarded beacon for join process. It is now no * more necessary. */ @@ -557,7 +559,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, arp_addr = NULL; if (i >= info->arp_addr_cnt) arp_addr = NULL; - hif_set_arp_ipv4_filter(wvif, i, arp_addr); + wfx_hif_set_arp_ipv4_filter(wvif, i, arp_addr); } } @@ -569,21 +571,21 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wfx_enable_beacon(wvif, info->enable_beacon); if (changed & BSS_CHANGED_KEEP_ALIVE) - hif_keep_alive_period(wvif, info->max_idle_period * - USEC_PER_TU / USEC_PER_MSEC); + wfx_hif_keep_alive_period(wvif, info->max_idle_period * + USEC_PER_TU / USEC_PER_MSEC); if (changed & BSS_CHANGED_ERP_CTS_PROT) - hif_erp_use_protection(wvif, info->use_cts_prot); + wfx_hif_erp_use_protection(wvif, info->use_cts_prot); if (changed & BSS_CHANGED_ERP_SLOT) - hif_slot_time(wvif, info->use_short_slot ? 9 : 20); + wfx_hif_slot_time(wvif, info->use_short_slot ? 9 : 20); if (changed & BSS_CHANGED_CQM) - hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold, - info->cqm_rssi_hyst); + wfx_hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold, + info->cqm_rssi_hyst); if (changed & BSS_CHANGED_TXPOWER) - hif_set_output_power(wvif, info->txpower); + wfx_hif_set_output_power(wvif, info->txpower); if (changed & BSS_CHANGED_PS) wfx_update_pm(wvif); @@ -614,7 +616,7 @@ static int wfx_update_tim(struct wfx_vif *wvif) tim_ptr[4] &= ~1; } - hif_update_ie_beacon(wvif, tim_ptr, tim_length); + wfx_hif_update_ie_beacon(wvif, tim_ptr, tim_length); dev_kfree_skb(skb); return 0; @@ -774,7 +776,7 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) } WARN(i == ARRAY_SIZE(wdev->vif), "try to instantiate more vif than supported"); - hif_set_macaddr(wvif, vif->addr); + wfx_hif_set_macaddr(wvif, vif->addr); mutex_unlock(&wdev->conf_mutex); @@ -782,9 +784,9 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { /* Combo mode does not support Block Acks. We can re-enable them */ if (wvif_count(wdev) == 1) - hif_set_block_ack_policy(wvif, 0xFF, 0xFF); + wfx_hif_set_block_ack_policy(wvif, 0xFF, 0xFF); else - hif_set_block_ack_policy(wvif, 0x00, 0x00); + wfx_hif_set_block_ack_policy(wvif, 0x00, 0x00); } return ret; } @@ -800,8 +802,8 @@ void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mutex_lock(&wdev->conf_mutex); WARN(wvif->link_id_map != 1, "corrupted state"); - hif_reset(wvif, false); - hif_set_macaddr(wvif, NULL); + wfx_hif_reset(wvif, false); + wfx_hif_set_macaddr(wvif, NULL); wfx_tx_policy_init(wvif); cancel_delayed_work_sync(&wvif->beacon_loss_work); @@ -814,9 +816,9 @@ void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { /* Combo mode does not support Block Acks. We can re-enable them */ if (wvif_count(wdev) == 1) - hif_set_block_ack_policy(wvif, 0xFF, 0xFF); + wfx_hif_set_block_ack_policy(wvif, 0xFF, 0xFF); else - hif_set_block_ack_policy(wvif, 0x00, 0x00); + wfx_hif_set_block_ack_policy(wvif, 0x00, 0x00); } } -- cgit From c1d193c5058e72c418e150e93e9f65bc925e196c Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:08 +0100 Subject: staging: wfx: prefix functions from hwio.h with wfx_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All the functions related to a driver should use the same prefix. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-16-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bh.c | 8 +-- drivers/staging/wfx/fwio.c | 78 ++++++++++++------------- drivers/staging/wfx/hif_tx.c | 2 +- drivers/staging/wfx/hwio.c | 135 +++++++++++++++++++++++-------------------- drivers/staging/wfx/hwio.h | 32 +++++----- drivers/staging/wfx/main.c | 2 +- 6 files changed, 133 insertions(+), 124 deletions(-) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index bbcf8d6a39c4..b7fa0aeafd78 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -227,11 +227,11 @@ static void ack_sdio_data(struct wfx_dev *wdev) { u32 cfg_reg; - config_reg_read(wdev, &cfg_reg); + wfx_config_reg_read(wdev, &cfg_reg); if (cfg_reg & 0xFF) { dev_warn(wdev->dev, "chip reports errors: %02x\n", cfg_reg & 0xFF); - config_reg_write_bits(wdev, 0xFF, 0x00); + wfx_config_reg_write_bits(wdev, 0xFF, 0x00); } } @@ -270,7 +270,7 @@ void wfx_bh_request_rx(struct wfx_dev *wdev) { u32 cur, prev; - control_reg_read(wdev, &cur); + wfx_control_reg_read(wdev, &cur); prev = atomic_xchg(&wdev->hif.ctrl_reg, cur); complete(&wdev->hif.ctrl_ready); queue_work(system_highpri_wq, &wdev->hif.bh); @@ -304,7 +304,7 @@ void wfx_bh_poll_irq(struct wfx_dev *wdev) WARN(!wdev->poll_irq, "unexpected IRQ polling can mask IRQ"); start = ktime_get(); for (;;) { - control_reg_read(wdev, ®); + wfx_control_reg_read(wdev, ®); now = ktime_get(); if (reg & 0xFFF) break; diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c index 98a9391b2bee..c9a54c519e8a 100644 --- a/drivers/staging/wfx/fwio.c +++ b/drivers/staging/wfx/fwio.c @@ -79,8 +79,8 @@ static const char * const fwio_errors[] = { * NOTE: it may also be possible to use 'pages' from struct firmware and avoid * bounce buffer */ -static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, - size_t len) +static int wfx_sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, + const u8 *buf, size_t len) { int ret; const u8 *tmp; @@ -92,7 +92,7 @@ static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, } else { tmp = buf; } - ret = sram_buf_write(wdev, addr, tmp, len); + ret = wfx_sram_buf_write(wdev, addr, tmp, len); if (tmp != buf) kfree(tmp); return ret; @@ -156,7 +156,7 @@ static int wait_ncp_status(struct wfx_dev *wdev, u32 status) start = ktime_get(); for (;;) { - ret = sram_reg_read(wdev, WFX_DCA_NCP_STATUS, ®); + ret = wfx_sram_reg_read(wdev, WFX_DCA_NCP_STATUS, ®); if (ret < 0) return -EIO; now = ktime_get(); @@ -192,7 +192,7 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) break; if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT))) return -ETIMEDOUT; - ret = sram_reg_read(wdev, WFX_DCA_GET, &bytes_done); + ret = wfx_sram_reg_read(wdev, WFX_DCA_GET, &bytes_done); if (ret < 0) return ret; } @@ -200,9 +200,9 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) dev_dbg(wdev->dev, "answer after %lldus\n", ktime_us_delta(now, start)); - ret = sram_write_dma_safe(wdev, WFX_DNLD_FIFO + - (offs % DNLD_FIFO_SIZE), - data + offs, DNLD_BLOCK_SIZE); + ret = wfx_sram_write_dma_safe(wdev, + WFX_DNLD_FIFO + (offs % DNLD_FIFO_SIZE), + data + offs, DNLD_BLOCK_SIZE); if (ret < 0) return ret; @@ -210,7 +210,7 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) * during first loop */ offs += DNLD_BLOCK_SIZE; - ret = sram_reg_write(wdev, WFX_DCA_PUT, offs); + ret = wfx_sram_reg_write(wdev, WFX_DCA_PUT, offs); if (ret < 0) return ret; } @@ -221,10 +221,10 @@ static void print_boot_status(struct wfx_dev *wdev) { u32 reg; - sram_reg_read(wdev, WFX_STATUS_INFO, ®); + wfx_sram_reg_read(wdev, WFX_STATUS_INFO, ®); if (reg == 0x12345678) return; - sram_reg_read(wdev, WFX_ERR_INFO, ®); + wfx_sram_reg_read(wdev, WFX_ERR_INFO, ®); if (reg < ARRAY_SIZE(fwio_errors) && fwio_errors[reg]) dev_info(wdev->dev, "secure boot: %s\n", fwio_errors[reg]); else @@ -245,36 +245,36 @@ static int load_firmware_secure(struct wfx_dev *wdev) if (!buf) return -ENOMEM; - sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_READY); + wfx_sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_READY); ret = wait_ncp_status(wdev, NCP_INFO_READY); if (ret) goto error; - sram_buf_read(wdev, WFX_BOOTLOADER_LABEL, buf, BOOTLOADER_LABEL_SIZE); + wfx_sram_buf_read(wdev, WFX_BOOTLOADER_LABEL, buf, BOOTLOADER_LABEL_SIZE); buf[BOOTLOADER_LABEL_SIZE] = 0; dev_dbg(wdev->dev, "bootloader: \"%s\"\n", buf); - sram_buf_read(wdev, WFX_PTE_INFO, buf, PTE_INFO_SIZE); + wfx_sram_buf_read(wdev, WFX_PTE_INFO, buf, PTE_INFO_SIZE); ret = get_firmware(wdev, buf[PTE_INFO_KEYSET_IDX], &fw, &fw_offset); if (ret) goto error; header_size = fw_offset + FW_SIGNATURE_SIZE + FW_HASH_SIZE; - sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_INFO_READ); + wfx_sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_INFO_READ); ret = wait_ncp_status(wdev, NCP_READY); if (ret) goto error; - sram_reg_write(wdev, WFX_DNLD_FIFO, 0xFFFFFFFF); /* Fifo init */ - sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00", - FW_VERSION_SIZE); - sram_write_dma_safe(wdev, WFX_DCA_FW_SIGNATURE, fw->data + fw_offset, - FW_SIGNATURE_SIZE); - sram_write_dma_safe(wdev, WFX_DCA_FW_HASH, - fw->data + fw_offset + FW_SIGNATURE_SIZE, - FW_HASH_SIZE); - sram_reg_write(wdev, WFX_DCA_IMAGE_SIZE, fw->size - header_size); - sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_PENDING); + wfx_sram_reg_write(wdev, WFX_DNLD_FIFO, 0xFFFFFFFF); /* Fifo init */ + wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00", + FW_VERSION_SIZE); + wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_SIGNATURE, fw->data + fw_offset, + FW_SIGNATURE_SIZE); + wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_HASH, + fw->data + fw_offset + FW_SIGNATURE_SIZE, + FW_HASH_SIZE); + wfx_sram_reg_write(wdev, WFX_DCA_IMAGE_SIZE, fw->size - header_size); + wfx_sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_PENDING); ret = wait_ncp_status(wdev, NCP_DOWNLOAD_PENDING); if (ret) goto error; @@ -287,14 +287,14 @@ static int load_firmware_secure(struct wfx_dev *wdev) dev_dbg(wdev->dev, "firmware load after %lldus\n", ktime_us_delta(ktime_get(), start)); - sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_COMPLETE); + wfx_sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_COMPLETE); ret = wait_ncp_status(wdev, NCP_AUTH_OK); /* Legacy ROM support */ if (ret < 0) ret = wait_ncp_status(wdev, NCP_PUB_KEY_RDY); if (ret < 0) goto error; - sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_OK_TO_JUMP); + wfx_sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_OK_TO_JUMP); error: kfree(buf); @@ -320,8 +320,8 @@ static int init_gpr(struct wfx_dev *wdev) }; for (i = 0; i < ARRAY_SIZE(gpr_init); i++) { - ret = igpr_reg_write(wdev, gpr_init[i].index, - gpr_init[i].value); + ret = wfx_igpr_reg_write(wdev, gpr_init[i].index, + gpr_init[i].value); if (ret < 0) return ret; dev_dbg(wdev->dev, " index %02x: %08x\n", @@ -341,13 +341,13 @@ int wfx_init_device(struct wfx_dev *wdev) reg = CFG_DIRECT_ACCESS_MODE | CFG_CPU_RESET | CFG_BYTE_ORDER_ABCD; if (wdev->pdata.use_rising_clk) reg |= CFG_CLK_RISE_EDGE; - ret = config_reg_write(wdev, reg); + ret = wfx_config_reg_write(wdev, reg); if (ret < 0) { dev_err(wdev->dev, "bus returned an error during first write access. Host configuration error?\n"); return -EIO; } - ret = config_reg_read(wdev, ®); + ret = wfx_config_reg_read(wdev, ®); if (ret < 0) { dev_err(wdev->dev, "bus returned an error during first read access. Bus configuration error?\n"); return -EIO; @@ -374,12 +374,12 @@ int wfx_init_device(struct wfx_dev *wdev) if (ret < 0) return ret; - ret = control_reg_write(wdev, CTRL_WLAN_WAKEUP); + ret = wfx_control_reg_write(wdev, CTRL_WLAN_WAKEUP); if (ret < 0) return -EIO; start = ktime_get(); for (;;) { - ret = control_reg_read(wdev, ®); + ret = wfx_control_reg_read(wdev, ®); now = ktime_get(); if (reg & CTRL_WLAN_READY) break; @@ -391,15 +391,15 @@ int wfx_init_device(struct wfx_dev *wdev) dev_dbg(wdev->dev, "chip wake up after %lldus\n", ktime_us_delta(now, start)); - ret = config_reg_write_bits(wdev, CFG_CPU_RESET, 0); + ret = wfx_config_reg_write_bits(wdev, CFG_CPU_RESET, 0); if (ret < 0) return ret; ret = load_firmware_secure(wdev); if (ret < 0) return ret; - return config_reg_write_bits(wdev, - CFG_DIRECT_ACCESS_MODE | - CFG_IRQ_ENABLE_DATA | - CFG_IRQ_ENABLE_WRDY, - CFG_IRQ_ENABLE_DATA); + return wfx_config_reg_write_bits(wdev, + CFG_DIRECT_ACCESS_MODE | + CFG_IRQ_ENABLE_DATA | + CFG_IRQ_ENABLE_WRDY, + CFG_IRQ_ENABLE_DATA); } diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 7c9d3d86c22e..9899e7b62203 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -135,7 +135,7 @@ int wfx_hif_shutdown(struct wfx_dev *wdev) if (wdev->pdata.gpio_wakeup) gpiod_set_value(wdev->pdata.gpio_wakeup, 0); else - control_reg_write(wdev, 0); + wfx_control_reg_write(wdev, 0); kfree(hif); return ret; } diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c index 977b9325f496..c53b36d36687 100644 --- a/drivers/staging/wfx/hwio.c +++ b/drivers/staging/wfx/hwio.c @@ -17,7 +17,7 @@ #define WFX_HIF_BUFFER_SIZE 0x2000 -static int read32(struct wfx_dev *wdev, int reg, u32 *val) +static int wfx_read32(struct wfx_dev *wdev, int reg, u32 *val) { int ret; __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); @@ -36,7 +36,7 @@ static int read32(struct wfx_dev *wdev, int reg, u32 *val) return ret; } -static int write32(struct wfx_dev *wdev, int reg, u32 val) +static int wfx_write32(struct wfx_dev *wdev, int reg, u32 val) { int ret; __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); @@ -53,29 +53,30 @@ static int write32(struct wfx_dev *wdev, int reg, u32 val) return ret; } -static int read32_locked(struct wfx_dev *wdev, int reg, u32 *val) +static int wfx_read32_locked(struct wfx_dev *wdev, int reg, u32 *val) { int ret; wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = read32(wdev, reg, val); + ret = wfx_read32(wdev, reg, val); _trace_io_read32(reg, *val); wdev->hwbus_ops->unlock(wdev->hwbus_priv); return ret; } -static int write32_locked(struct wfx_dev *wdev, int reg, u32 val) +static int wfx_write32_locked(struct wfx_dev *wdev, int reg, u32 val) { int ret; wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = write32(wdev, reg, val); + ret = wfx_write32(wdev, reg, val); _trace_io_write32(reg, val); wdev->hwbus_ops->unlock(wdev->hwbus_priv); return ret; } -static int write32_bits_locked(struct wfx_dev *wdev, int reg, u32 mask, u32 val) +static int wfx_write32_bits_locked(struct wfx_dev *wdev, + int reg, u32 mask, u32 val) { int ret; u32 val_r, val_w; @@ -83,13 +84,13 @@ static int write32_bits_locked(struct wfx_dev *wdev, int reg, u32 mask, u32 val) WARN_ON(~mask & val); val &= mask; wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = read32(wdev, reg, &val_r); + ret = wfx_read32(wdev, reg, &val_r); _trace_io_read32(reg, val_r); if (ret < 0) goto err; val_w = (val_r & ~mask) | val; if (val_w != val_r) { - ret = write32(wdev, reg, val_w); + ret = wfx_write32(wdev, reg, val_w); _trace_io_write32(reg, val_w); } err: @@ -97,8 +98,8 @@ err: return ret; } -static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr, - void *buf, size_t len) +static int wfx_indirect_read(struct wfx_dev *wdev, int reg, u32 addr, + void *buf, size_t len) { int ret; int i; @@ -115,20 +116,20 @@ static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr, else return -ENODEV; - ret = write32(wdev, WFX_REG_BASE_ADDR, addr); + ret = wfx_write32(wdev, WFX_REG_BASE_ADDR, addr); if (ret < 0) goto err; - ret = read32(wdev, WFX_REG_CONFIG, &cfg); + ret = wfx_read32(wdev, WFX_REG_CONFIG, &cfg); if (ret < 0) goto err; - ret = write32(wdev, WFX_REG_CONFIG, cfg | prefetch); + ret = wfx_write32(wdev, WFX_REG_CONFIG, cfg | prefetch); if (ret < 0) goto err; for (i = 0; i < 20; i++) { - ret = read32(wdev, WFX_REG_CONFIG, &cfg); + ret = wfx_read32(wdev, WFX_REG_CONFIG, &cfg); if (ret < 0) goto err; if (!(cfg & prefetch)) @@ -148,46 +149,46 @@ err: return ret; } -static int indirect_write(struct wfx_dev *wdev, int reg, u32 addr, - const void *buf, size_t len) +static int wfx_indirect_write(struct wfx_dev *wdev, int reg, u32 addr, + const void *buf, size_t len) { int ret; WARN_ON(len >= WFX_HIF_BUFFER_SIZE); WARN_ON(reg != WFX_REG_AHB_DPORT && reg != WFX_REG_SRAM_DPORT); - ret = write32(wdev, WFX_REG_BASE_ADDR, addr); + ret = wfx_write32(wdev, WFX_REG_BASE_ADDR, addr); if (ret < 0) return ret; return wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, buf, len); } -static int indirect_read_locked(struct wfx_dev *wdev, int reg, u32 addr, - void *buf, size_t len) +static int wfx_indirect_read_locked(struct wfx_dev *wdev, int reg, u32 addr, + void *buf, size_t len) { int ret; wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = indirect_read(wdev, reg, addr, buf, len); + ret = wfx_indirect_read(wdev, reg, addr, buf, len); _trace_io_ind_read(reg, addr, buf, len); wdev->hwbus_ops->unlock(wdev->hwbus_priv); return ret; } -static int indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr, - const void *buf, size_t len) +static int wfx_indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr, + const void *buf, size_t len) { int ret; wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = indirect_write(wdev, reg, addr, buf, len); + ret = wfx_indirect_write(wdev, reg, addr, buf, len); _trace_io_ind_write(reg, addr, buf, len); wdev->hwbus_ops->unlock(wdev->hwbus_priv); return ret; } -static int indirect_read32_locked(struct wfx_dev *wdev, int reg, - u32 addr, u32 *val) +static int wfx_indirect_read32_locked(struct wfx_dev *wdev, int reg, + u32 addr, u32 *val) { int ret; __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); @@ -195,7 +196,7 @@ static int indirect_read32_locked(struct wfx_dev *wdev, int reg, if (!tmp) return -ENOMEM; wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = indirect_read(wdev, reg, addr, tmp, sizeof(u32)); + ret = wfx_indirect_read(wdev, reg, addr, tmp, sizeof(u32)); *val = le32_to_cpu(*tmp); _trace_io_ind_read32(reg, addr, *val); wdev->hwbus_ops->unlock(wdev->hwbus_priv); @@ -203,8 +204,8 @@ static int indirect_read32_locked(struct wfx_dev *wdev, int reg, return ret; } -static int indirect_write32_locked(struct wfx_dev *wdev, int reg, - u32 addr, u32 val) +static int wfx_indirect_write32_locked(struct wfx_dev *wdev, int reg, + u32 addr, u32 val) { int ret; __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); @@ -213,7 +214,7 @@ static int indirect_write32_locked(struct wfx_dev *wdev, int reg, return -ENOMEM; *tmp = cpu_to_le32(val); wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = indirect_write(wdev, reg, addr, tmp, sizeof(u32)); + ret = wfx_indirect_write(wdev, reg, addr, tmp, sizeof(u32)); _trace_io_ind_write32(reg, addr, val); wdev->hwbus_ops->unlock(wdev->hwbus_priv); kfree(tmp); @@ -252,92 +253,100 @@ int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t len) return ret; } -int sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) +int wfx_sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) { - return indirect_read_locked(wdev, WFX_REG_SRAM_DPORT, addr, buf, len); + return wfx_indirect_read_locked(wdev, WFX_REG_SRAM_DPORT, + addr, buf, len); } -int ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) +int wfx_ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) { - return indirect_read_locked(wdev, WFX_REG_AHB_DPORT, addr, buf, len); + return wfx_indirect_read_locked(wdev, WFX_REG_AHB_DPORT, + addr, buf, len); } -int sram_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len) +int wfx_sram_buf_write(struct wfx_dev *wdev, u32 addr, + const void *buf, size_t len) { - return indirect_write_locked(wdev, WFX_REG_SRAM_DPORT, addr, buf, len); + return wfx_indirect_write_locked(wdev, WFX_REG_SRAM_DPORT, + addr, buf, len); } -int ahb_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len) +int wfx_ahb_buf_write(struct wfx_dev *wdev, u32 addr, + const void *buf, size_t len) { - return indirect_write_locked(wdev, WFX_REG_AHB_DPORT, addr, buf, len); + return wfx_indirect_write_locked(wdev, WFX_REG_AHB_DPORT, + addr, buf, len); } -int sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) +int wfx_sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) { - return indirect_read32_locked(wdev, WFX_REG_SRAM_DPORT, addr, val); + return wfx_indirect_read32_locked(wdev, WFX_REG_SRAM_DPORT, + addr, val); } -int ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) +int wfx_ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) { - return indirect_read32_locked(wdev, WFX_REG_AHB_DPORT, addr, val); + return wfx_indirect_read32_locked(wdev, WFX_REG_AHB_DPORT, + addr, val); } -int sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val) +int wfx_sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val) { - return indirect_write32_locked(wdev, WFX_REG_SRAM_DPORT, addr, val); + return wfx_indirect_write32_locked(wdev, WFX_REG_SRAM_DPORT, addr, val); } -int ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val) +int wfx_ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val) { - return indirect_write32_locked(wdev, WFX_REG_AHB_DPORT, addr, val); + return wfx_indirect_write32_locked(wdev, WFX_REG_AHB_DPORT, addr, val); } -int config_reg_read(struct wfx_dev *wdev, u32 *val) +int wfx_config_reg_read(struct wfx_dev *wdev, u32 *val) { - return read32_locked(wdev, WFX_REG_CONFIG, val); + return wfx_read32_locked(wdev, WFX_REG_CONFIG, val); } -int config_reg_write(struct wfx_dev *wdev, u32 val) +int wfx_config_reg_write(struct wfx_dev *wdev, u32 val) { - return write32_locked(wdev, WFX_REG_CONFIG, val); + return wfx_write32_locked(wdev, WFX_REG_CONFIG, val); } -int config_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val) +int wfx_config_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val) { - return write32_bits_locked(wdev, WFX_REG_CONFIG, mask, val); + return wfx_write32_bits_locked(wdev, WFX_REG_CONFIG, mask, val); } -int control_reg_read(struct wfx_dev *wdev, u32 *val) +int wfx_control_reg_read(struct wfx_dev *wdev, u32 *val) { - return read32_locked(wdev, WFX_REG_CONTROL, val); + return wfx_read32_locked(wdev, WFX_REG_CONTROL, val); } -int control_reg_write(struct wfx_dev *wdev, u32 val) +int wfx_control_reg_write(struct wfx_dev *wdev, u32 val) { - return write32_locked(wdev, WFX_REG_CONTROL, val); + return wfx_write32_locked(wdev, WFX_REG_CONTROL, val); } -int control_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val) +int wfx_control_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val) { - return write32_bits_locked(wdev, WFX_REG_CONTROL, mask, val); + return wfx_write32_bits_locked(wdev, WFX_REG_CONTROL, mask, val); } -int igpr_reg_read(struct wfx_dev *wdev, int index, u32 *val) +int wfx_igpr_reg_read(struct wfx_dev *wdev, int index, u32 *val) { int ret; *val = ~0; /* Never return undefined value */ - ret = write32_locked(wdev, WFX_REG_SET_GEN_R_W, IGPR_RW | index << 24); + ret = wfx_write32_locked(wdev, WFX_REG_SET_GEN_R_W, IGPR_RW | index << 24); if (ret) return ret; - ret = read32_locked(wdev, WFX_REG_SET_GEN_R_W, val); + ret = wfx_read32_locked(wdev, WFX_REG_SET_GEN_R_W, val); if (ret) return ret; *val &= IGPR_VALUE; return ret; } -int igpr_reg_write(struct wfx_dev *wdev, int index, u32 val) +int wfx_igpr_reg_write(struct wfx_dev *wdev, int index, u32 val) { - return write32_locked(wdev, WFX_REG_SET_GEN_R_W, index << 24 | val); + return wfx_write32_locked(wdev, WFX_REG_SET_GEN_R_W, index << 24 | val); } diff --git a/drivers/staging/wfx/hwio.h b/drivers/staging/wfx/hwio.h index d34baae47017..8c8fe76871f8 100644 --- a/drivers/staging/wfx/hwio.h +++ b/drivers/staging/wfx/hwio.h @@ -19,17 +19,17 @@ struct wfx_dev; int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len); int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t buf_len); -int sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len); -int sram_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len); +int wfx_sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len); +int wfx_sram_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len); -int ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len); -int ahb_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len); +int wfx_ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len); +int wfx_ahb_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len); -int sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val); -int sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val); +int wfx_sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val); +int wfx_sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val); -int ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val); -int ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val); +int wfx_ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val); +int wfx_ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val); #define CFG_ERR_SPI_FRAME 0x00000001 /* only with SPI */ #define CFG_ERR_SDIO_BUF_MISMATCH 0x00000001 /* only with SDIO */ @@ -59,21 +59,21 @@ int ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val); #define CFG_DEVICE_ID_MAJOR 0x07000000 #define CFG_DEVICE_ID_RESERVED 0x78000000 #define CFG_DEVICE_ID_TYPE 0x80000000 -int config_reg_read(struct wfx_dev *wdev, u32 *val); -int config_reg_write(struct wfx_dev *wdev, u32 val); -int config_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val); +int wfx_config_reg_read(struct wfx_dev *wdev, u32 *val); +int wfx_config_reg_write(struct wfx_dev *wdev, u32 val); +int wfx_config_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val); #define CTRL_NEXT_LEN_MASK 0x00000FFF #define CTRL_WLAN_WAKEUP 0x00001000 #define CTRL_WLAN_READY 0x00002000 -int control_reg_read(struct wfx_dev *wdev, u32 *val); -int control_reg_write(struct wfx_dev *wdev, u32 val); -int control_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val); +int wfx_control_reg_read(struct wfx_dev *wdev, u32 *val); +int wfx_control_reg_write(struct wfx_dev *wdev, u32 val); +int wfx_control_reg_write_bits(struct wfx_dev *wdev, u32 mask, u32 val); #define IGPR_RW 0x80000000 #define IGPR_INDEX 0x7F000000 #define IGPR_VALUE 0x00FFFFFF -int igpr_reg_read(struct wfx_dev *wdev, int index, u32 *val); -int igpr_reg_write(struct wfx_dev *wdev, int index, u32 val); +int wfx_igpr_reg_read(struct wfx_dev *wdev, int index, u32 *val); +int wfx_igpr_reg_write(struct wfx_dev *wdev, int index, u32 val); #endif diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index abc1a6d43300..43947f8f2e0c 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -428,7 +428,7 @@ int wfx_probe(struct wfx_dev *wdev) "enable 'quiescent' power mode with wakeup GPIO and PDS file %s\n", wdev->pdata.file_pds); gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); - control_reg_write(wdev, 0); + wfx_control_reg_write(wdev, 0); wfx_hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_QUIESCENT); } else { wfx_hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_DOZE); -- cgit From 5ea9415b27c46a8d3bd12c073b482c72d9ca11e4 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:09 +0100 Subject: staging: wfx: prefix functions from debug.h with wfx_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All the functions related to a driver should use the same prefix. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-17-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/debug.c | 6 +++--- drivers/staging/wfx/debug.h | 6 +++--- drivers/staging/wfx/hif_tx.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index e5f940f19bbe..9324248b1d20 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -44,17 +44,17 @@ static const char *get_symbol(unsigned long val, return "unknown"; } -const char *get_hif_name(unsigned long id) +const char *wfx_get_hif_name(unsigned long id) { return get_symbol(id, hif_msg_print_map); } -const char *get_mib_name(unsigned long id) +const char *wfx_get_mib_name(unsigned long id) { return get_symbol(id, hif_mib_print_map); } -const char *get_reg_name(unsigned long id) +const char *wfx_get_reg_name(unsigned long id) { return get_symbol(id, wfx_reg_print_map); } diff --git a/drivers/staging/wfx/debug.h b/drivers/staging/wfx/debug.h index 4b9c49a9fffb..3840575e5e28 100644 --- a/drivers/staging/wfx/debug.h +++ b/drivers/staging/wfx/debug.h @@ -12,8 +12,8 @@ struct wfx_dev; int wfx_debug_init(struct wfx_dev *wdev); -const char *get_hif_name(unsigned long id); -const char *get_mib_name(unsigned long id); -const char *get_reg_name(unsigned long id); +const char *wfx_get_hif_name(unsigned long id); +const char *wfx_get_mib_name(unsigned long id); +const char *wfx_get_reg_name(unsigned long id); #endif diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 9899e7b62203..67f1847c1fc1 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -106,15 +106,15 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, if (ret && (cmd == HIF_REQ_ID_READ_MIB || cmd == HIF_REQ_ID_WRITE_MIB)) { - mib_name = get_mib_name(((u16 *)request)[2]); + mib_name = wfx_get_mib_name(((u16 *)request)[2]); mib_sep = "/"; } if (ret < 0) dev_err(wdev->dev, "hardware request %s%s%s (%#.2x) on vif %d returned error %d\n", - get_hif_name(cmd), mib_sep, mib_name, cmd, vif, ret); + wfx_get_hif_name(cmd), mib_sep, mib_name, cmd, vif, ret); if (ret > 0) dev_warn(wdev->dev, "hardware request %s%s%s (%#.2x) on vif %d returned status %d\n", - get_hif_name(cmd), mib_sep, mib_name, cmd, vif, ret); + wfx_get_hif_name(cmd), mib_sep, mib_name, cmd, vif, ret); return ret; } @@ -196,7 +196,7 @@ int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, } if (ret == -ENOMEM) dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n", - get_mib_name(mib_id), val_len, + wfx_get_mib_name(mib_id), val_len, le16_to_cpu(reply->length)); if (!ret) memcpy(val, &reply->mib_data, le16_to_cpu(reply->length)); -- cgit From 822d24997bd377274a00e2472d8b5507815fc644 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:10 +0100 Subject: staging: wfx: prefix tx_policy_is_equal() with wfx_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tx_policy_is_equal() was the only function from data_tx.c without the prefix wfx_. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-18-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/data_tx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 54ff9bca78d6..c3efbcdcc8c3 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -66,8 +66,8 @@ static void wfx_tx_policy_build(struct wfx_vif *wvif, struct tx_policy *policy, } } -static bool tx_policy_is_equal(const struct tx_policy *a, - const struct tx_policy *b) +static bool wfx_tx_policy_is_equal(const struct tx_policy *a, + const struct tx_policy *b) { return !memcmp(a->rates, b->rates, sizeof(a->rates)); } @@ -78,10 +78,10 @@ static int wfx_tx_policy_find(struct tx_policy_cache *cache, struct tx_policy *it; list_for_each_entry(it, &cache->used, link) - if (tx_policy_is_equal(wanted, it)) + if (wfx_tx_policy_is_equal(wanted, it)) return it - cache->cache; list_for_each_entry(it, &cache->free, link) - if (tx_policy_is_equal(wanted, it)) + if (wfx_tx_policy_is_equal(wanted, it)) return it - cache->cache; return -1; } -- cgit From 9d3586feb25c85e2ccc4f4b13fad5f2434fbb09e Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:11 +0100 Subject: staging: wfx: prefix structs hif_* with wfx_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All the types related to a driver should use the same prefix. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-19-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bh.c | 12 +-- drivers/staging/wfx/data_rx.c | 2 +- drivers/staging/wfx/data_rx.h | 4 +- drivers/staging/wfx/data_tx.c | 30 +++---- drivers/staging/wfx/data_tx.h | 8 +- drivers/staging/wfx/debug.c | 10 +-- drivers/staging/wfx/hif_api_cmd.h | 142 +++++++++++++++++----------------- drivers/staging/wfx/hif_api_general.h | 44 +++++------ drivers/staging/wfx/hif_api_mib.h | 66 ++++++++-------- drivers/staging/wfx/hif_rx.c | 57 +++++++------- drivers/staging/wfx/hif_tx.c | 95 ++++++++++++----------- drivers/staging/wfx/hif_tx.h | 20 ++--- drivers/staging/wfx/hif_tx_mib.c | 54 ++++++------- drivers/staging/wfx/hif_tx_mib.h | 10 +-- drivers/staging/wfx/key.c | 20 ++--- drivers/staging/wfx/main.c | 4 +- drivers/staging/wfx/queue.c | 22 +++--- drivers/staging/wfx/queue.h | 2 +- drivers/staging/wfx/sta.c | 2 +- drivers/staging/wfx/traces.h | 10 +-- drivers/staging/wfx/wfx.h | 6 +- 21 files changed, 311 insertions(+), 309 deletions(-) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index b7fa0aeafd78..872f3298dc87 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -67,7 +67,7 @@ static void device_release(struct wfx_dev *wdev) static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) { struct sk_buff *skb; - struct hif_msg *hif; + struct wfx_hif_msg *hif; size_t alloc_len; size_t computed_len; int release_count; @@ -88,9 +88,9 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) piggyback = le16_to_cpup((__le16 *)(skb->data + alloc_len - 2)); _trace_piggyback(piggyback, false); - hif = (struct hif_msg *)skb->data; + hif = (struct wfx_hif_msg *)skb->data; WARN(hif->encrypted & 0x3, "encryption is unsupported"); - if (WARN(read_len < sizeof(struct hif_msg), "corrupted read")) + if (WARN(read_len < sizeof(struct wfx_hif_msg), "corrupted read")) goto err; computed_len = le16_to_cpu(hif->len); computed_len = round_up(computed_len, 2); @@ -105,7 +105,7 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) if (!(hif->id & HIF_ID_IS_INDICATION)) { (*is_cnf)++; if (hif->id == HIF_CNF_ID_MULTI_TRANSMIT) - release_count = ((struct hif_cnf_multi_transmit *)hif->body)->num_tx_confs; + release_count = ((struct wfx_hif_cnf_multi_transmit *)hif->body)->num_tx_confs; else release_count = 1; WARN(wdev->hif.tx_buffers_used < release_count, "corrupted buffer counter"); @@ -169,7 +169,7 @@ static int bh_work_rx(struct wfx_dev *wdev, int max_msg, int *num_cnf) return i; } -static void tx_helper(struct wfx_dev *wdev, struct hif_msg *hif) +static void tx_helper(struct wfx_dev *wdev, struct wfx_hif_msg *hif) { int ret; void *data; @@ -199,7 +199,7 @@ end: static int bh_work_tx(struct wfx_dev *wdev, int max_msg) { - struct hif_msg *hif; + struct wfx_hif_msg *hif; int i; for (i = 0; i < max_msg; i++) { diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c index bfc3961b7b89..3fe67c4815e7 100644 --- a/drivers/staging/wfx/data_rx.c +++ b/drivers/staging/wfx/data_rx.c @@ -35,7 +35,7 @@ static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt) } void wfx_rx_cb(struct wfx_vif *wvif, - const struct hif_ind_rx *arg, struct sk_buff *skb) + const struct wfx_hif_ind_rx *arg, struct sk_buff *skb) { struct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb); struct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb->data; diff --git a/drivers/staging/wfx/data_rx.h b/drivers/staging/wfx/data_rx.h index 84d0e3c0507b..7d77cdbbc31b 100644 --- a/drivers/staging/wfx/data_rx.h +++ b/drivers/staging/wfx/data_rx.h @@ -10,9 +10,9 @@ struct wfx_vif; struct sk_buff; -struct hif_ind_rx; +struct wfx_hif_ind_rx; void wfx_rx_cb(struct wfx_vif *wvif, - const struct hif_ind_rx *arg, struct sk_buff *skb); + const struct wfx_hif_ind_rx *arg, struct sk_buff *skb); #endif diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index c3efbcdcc8c3..c004f455bb47 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -329,16 +329,16 @@ static int wfx_tx_get_icv_len(struct ieee80211_key_conf *hw_key) static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct sk_buff *skb) { - struct hif_msg *hif_msg; - struct hif_req_tx *req; + struct wfx_hif_msg *hif_msg; + struct wfx_hif_req_tx *req; struct wfx_tx_priv *tx_priv; struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; int queue_id = skb_get_queue_mapping(skb); size_t offset = (size_t)skb->data & 3; - int wmsg_len = sizeof(struct hif_msg) + - sizeof(struct hif_req_tx) + offset; + int wmsg_len = sizeof(struct wfx_hif_msg) + + sizeof(struct wfx_hif_req_tx) + offset; WARN(queue_id >= IEEE80211_NUM_ACS, "unsupported queue_id"); wfx_tx_fixup_rates(tx_info->driver_rates); @@ -355,7 +355,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, skb_put(skb, tx_priv->icv_size); skb_push(skb, wmsg_len); memset(skb->data, 0, wmsg_len); - hif_msg = (struct hif_msg *)skb->data; + hif_msg = (struct wfx_hif_msg *)skb->data; hif_msg->len = cpu_to_le16(skb->len); hif_msg->id = HIF_REQ_ID_TX; hif_msg->interface = wvif->id; @@ -368,7 +368,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, } /* Fill tx request */ - req = (struct hif_req_tx *)hif_msg->body; + req = (struct wfx_hif_req_tx *)hif_msg->body; /* packet_id just need to be unique on device. 32bits are more than * necessary for that task, so we tae advantage of it to add some extra * data for debug. @@ -435,10 +435,10 @@ drop: static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) { - struct hif_msg *hif = (struct hif_msg *)skb->data; - struct hif_req_tx *req = (struct hif_req_tx *)hif->body; - unsigned int offset = sizeof(struct hif_msg) + - sizeof(struct hif_req_tx) + + struct wfx_hif_msg *hif = (struct hif_msg *)skb->data; + struct wfx_hif_req_tx *req = (struct hif_req_tx *)hif->body; + unsigned int offset = sizeof(struct wfx_hif_msg) + + sizeof(struct wfx_hif_req_tx) + req->fc_offset; if (!wvif) { @@ -452,7 +452,7 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) static void wfx_tx_fill_rates(struct wfx_dev *wdev, struct ieee80211_tx_info *tx_info, - const struct hif_cnf_tx *arg) + const struct wfx_hif_cnf_tx *arg) { struct ieee80211_tx_rate *rate; int tx_count; @@ -488,7 +488,7 @@ static void wfx_tx_fill_rates(struct wfx_dev *wdev, dev_dbg(wdev->dev, "%d more retries than expected\n", tx_count); } -void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg) +void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg) { const struct wfx_tx_priv *tx_priv; struct ieee80211_tx_info *tx_info; @@ -503,7 +503,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg) } tx_info = IEEE80211_SKB_CB(skb); tx_priv = wfx_skb_tx_priv(skb); - wvif = wdev_to_wvif(wdev, ((struct hif_msg *)skb->data)->interface); + wvif = wdev_to_wvif(wdev, ((struct wfx_hif_msg *)skb->data)->interface); WARN_ON(!wvif); if (!wvif) return; @@ -572,7 +572,7 @@ void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct wfx_dev *wdev = hw->priv; struct sk_buff_head dropped; struct wfx_vif *wvif; - struct hif_msg *hif; + struct wfx_hif_msg *hif; struct sk_buff *skb; skb_queue_head_init(&dropped); @@ -588,7 +588,7 @@ void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (wdev->chip_frozen) wfx_pending_drop(wdev, &dropped); while ((skb = skb_dequeue(&dropped)) != NULL) { - hif = (struct hif_msg *)skb->data; + hif = (struct wfx_hif_msg *)skb->data; wvif = wdev_to_wvif(wdev, hif->interface); ieee80211_tx_info_clear_status(IEEE80211_SKB_CB(skb)); wfx_skb_dtor(wvif, skb); diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h index 15590a8faefe..c901a03ee4d8 100644 --- a/drivers/staging/wfx/data_tx.h +++ b/drivers/staging/wfx/data_tx.h @@ -43,7 +43,7 @@ void wfx_tx_policy_upload_work(struct work_struct *work); void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb); -void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg); +void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg); void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop); @@ -57,10 +57,10 @@ static inline struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb) return (struct wfx_tx_priv *)tx_info->rate_driver_data; } -static inline struct hif_req_tx *wfx_skb_txreq(struct sk_buff *skb) +static inline struct wfx_hif_req_tx *wfx_skb_txreq(struct sk_buff *skb) { - struct hif_msg *hif = (struct hif_msg *)skb->data; - struct hif_req_tx *req = (struct hif_req_tx *)hif->body; + struct wfx_hif_msg *hif = (struct hif_msg *)skb->data; + struct wfx_hif_req_tx *req = (struct hif_req_tx *)hif->body; return req; } diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index 9324248b1d20..f0796eb2afff 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -63,7 +63,7 @@ static int wfx_counters_show(struct seq_file *seq, void *v) { int ret, i; struct wfx_dev *wdev = seq->private; - struct hif_mib_extended_count_table counters[3]; + struct wfx_hif_mib_extended_count_table counters[3]; for (i = 0; i < ARRAY_SIZE(counters); i++) { ret = wfx_hif_get_counters_table(wdev, i, counters + i); @@ -153,7 +153,7 @@ static const char * const channel_names[] = { static int wfx_rx_stats_show(struct seq_file *seq, void *v) { struct wfx_dev *wdev = seq->private; - struct hif_rx_stats *st = &wdev->rx_stats; + struct wfx_hif_rx_stats *st = &wdev->rx_stats; int i; mutex_lock(&wdev->rx_stats_lock); @@ -185,7 +185,7 @@ DEFINE_SHOW_ATTRIBUTE(wfx_rx_stats); static int wfx_tx_power_loop_show(struct seq_file *seq, void *v) { struct wfx_dev *wdev = seq->private; - struct hif_tx_power_loop_info *st = &wdev->tx_power_loop_info; + struct wfx_hif_tx_power_loop_info *st = &wdev->tx_power_loop_info; int tmp; mutex_lock(&wdev->tx_power_loop_info_lock); @@ -247,13 +247,13 @@ static ssize_t wfx_send_hif_msg_write(struct file *file, { struct dbgfs_hif_msg *context = file->private_data; struct wfx_dev *wdev = context->wdev; - struct hif_msg *request; + struct wfx_hif_msg *request; if (completion_done(&context->complete)) { dev_dbg(wdev->dev, "read previous result before start a new one\n"); return -EBUSY; } - if (count < sizeof(struct hif_msg)) + if (count < sizeof(struct wfx_hif_msg)) return -EINVAL; /* wfx_cmd_send() checks that reply buffer is wide enough, but does not diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h index b1829d01a5d9..463532b25939 100644 --- a/drivers/staging/wfx/hif_api_cmd.h +++ b/drivers/staging/wfx/hif_api_cmd.h @@ -12,7 +12,7 @@ #include "hif_api_general.h" -enum hif_requests_ids { +enum wfx_hif_requests_ids { HIF_REQ_ID_RESET = 0x0a, HIF_REQ_ID_READ_MIB = 0x05, HIF_REQ_ID_WRITE_MIB = 0x06, @@ -31,7 +31,7 @@ enum hif_requests_ids { HIF_REQ_ID_MAP_LINK = 0x1c, }; -enum hif_confirmations_ids { +enum wfx_hif_confirmations_ids { HIF_CNF_ID_RESET = 0x0a, HIF_CNF_ID_READ_MIB = 0x05, HIF_CNF_ID_WRITE_MIB = 0x06, @@ -51,7 +51,7 @@ enum hif_confirmations_ids { HIF_CNF_ID_MAP_LINK = 0x1c, }; -enum hif_indications_ids { +enum wfx_hif_indications_ids { HIF_IND_ID_RX = 0x84, HIF_IND_ID_SCAN_CMPL = 0x86, HIF_IND_ID_JOIN_COMPLETE = 0x8f, @@ -60,40 +60,40 @@ enum hif_indications_ids { HIF_IND_ID_EVENT = 0x85 }; -struct hif_req_reset { +struct wfx_hif_req_reset { u8 reset_stat:1; u8 reset_all_int:1; u8 reserved1:6; u8 reserved2[3]; } __packed; -struct hif_cnf_reset { +struct wfx_hif_cnf_reset { __le32 status; } __packed; -struct hif_req_read_mib { +struct wfx_hif_req_read_mib { __le16 mib_id; __le16 reserved; } __packed; -struct hif_cnf_read_mib { +struct wfx_hif_cnf_read_mib { __le32 status; __le16 mib_id; __le16 length; u8 mib_data[]; } __packed; -struct hif_req_write_mib { +struct wfx_hif_req_write_mib { __le16 mib_id; __le16 length; u8 mib_data[]; } __packed; -struct hif_cnf_write_mib { +struct wfx_hif_cnf_write_mib { __le32 status; } __packed; -struct hif_req_update_ie { +struct wfx_hif_req_update_ie { u8 beacon:1; u8 probe_resp:1; u8 probe_req:1; @@ -103,11 +103,11 @@ struct hif_req_update_ie { u8 ie[]; } __packed; -struct hif_cnf_update_ie { +struct wfx_hif_cnf_update_ie { __le32 status; } __packed; -struct hif_ssid_def { +struct wfx_hif_ssid_def { __le32 ssid_length; u8 ssid[IEEE80211_MAX_SSID_LEN]; } __packed; @@ -115,7 +115,7 @@ struct hif_ssid_def { #define HIF_API_MAX_NB_SSIDS 2 #define HIF_API_MAX_NB_CHANNELS 14 -struct hif_req_start_scan_alt { +struct wfx_hif_req_start_scan_alt { u8 band; u8 maintain_current_bss:1; u8 periodic:1; @@ -135,45 +135,45 @@ struct hif_req_start_scan_alt { __le32 min_channel_time; __le32 max_channel_time; __le32 tx_power_level; /* signed value */ - struct hif_ssid_def ssid_def[HIF_API_MAX_NB_SSIDS]; + struct wfx_hif_ssid_def ssid_def[HIF_API_MAX_NB_SSIDS]; u8 channel_list[]; } __packed; -struct hif_cnf_start_scan { +struct wfx_hif_cnf_start_scan { __le32 status; } __packed; -struct hif_cnf_stop_scan { +struct wfx_hif_cnf_stop_scan { __le32 status; } __packed; -enum hif_pm_mode_status { +enum wfx_hif_pm_mode_status { HIF_PM_MODE_ACTIVE = 0x0, HIF_PM_MODE_PS = 0x1, HIF_PM_MODE_UNDETERMINED = 0x2 }; -struct hif_ind_scan_cmpl { +struct wfx_hif_ind_scan_cmpl { __le32 status; u8 pm_mode; u8 num_channels_completed; __le16 reserved; } __packed; -enum hif_queue_id { +enum wfx_hif_queue_id { HIF_QUEUE_ID_BACKGROUND = 0x0, HIF_QUEUE_ID_BESTEFFORT = 0x1, HIF_QUEUE_ID_VIDEO = 0x2, HIF_QUEUE_ID_VOICE = 0x3 }; -enum hif_frame_format { +enum wfx_hif_frame_format { HIF_FRAME_FORMAT_NON_HT = 0x0, HIF_FRAME_FORMAT_MIXED_FORMAT_HT = 0x1, HIF_FRAME_FORMAT_GF_HT_11N = 0x2 }; -struct hif_req_tx { +struct wfx_hif_req_tx { /* packet_id is not interpreted by the device, so it is not necessary to * declare it little endian */ @@ -203,16 +203,16 @@ struct hif_req_tx { u8 frame[]; } __packed; -enum hif_qos_ackplcy { +enum wfx_hif_qos_ackplcy { HIF_QOS_ACKPLCY_NORMAL = 0x0, HIF_QOS_ACKPLCY_TXNOACK = 0x1, HIF_QOS_ACKPLCY_NOEXPACK = 0x2, HIF_QOS_ACKPLCY_BLCKACK = 0x3 }; -struct hif_cnf_tx { +struct wfx_hif_cnf_tx { __le32 status; - /* packet_id is copied from struct hif_req_tx without been interpreted + /* packet_id is copied from struct wfx_hif_req_tx without been interpreted * by the device, so it is not necessary to declare it little endian */ u32 packet_id; @@ -228,13 +228,13 @@ struct hif_cnf_tx { __le32 tx_queue_delay; } __packed; -struct hif_cnf_multi_transmit { +struct wfx_hif_cnf_multi_transmit { u8 num_tx_confs; u8 reserved[3]; - struct hif_cnf_tx tx_conf_payload[]; + struct wfx_hif_cnf_tx tx_conf_payload[]; } __packed; -enum hif_ri_flags_encrypt { +enum wfx_hif_ri_flags_encrypt { HIF_RI_FLAGS_UNENCRYPTED = 0x0, HIF_RI_FLAGS_WEP_ENCRYPTED = 0x1, HIF_RI_FLAGS_TKIP_ENCRYPTED = 0x2, @@ -242,7 +242,7 @@ enum hif_ri_flags_encrypt { HIF_RI_FLAGS_WAPI_ENCRYPTED = 0x4 }; -struct hif_ind_rx { +struct wfx_hif_ind_rx { __le32 status; u8 channel_number; u8 reserved1; @@ -274,7 +274,7 @@ struct hif_ind_rx { u8 frame[]; } __packed; -struct hif_req_edca_queue_params { +struct wfx_hif_req_edca_queue_params { u8 queue_id; u8 reserved1; u8 aifsn; @@ -286,11 +286,11 @@ struct hif_req_edca_queue_params { __le32 reserved3; } __packed; -struct hif_cnf_edca_queue_params { +struct wfx_hif_cnf_edca_queue_params { __le32 status; } __packed; -struct hif_req_join { +struct wfx_hif_req_join { u8 infrastructure_bss_mode:1; u8 reserved1:7; u8 band; @@ -312,15 +312,15 @@ struct hif_req_join { __le32 basic_rate_set; } __packed; -struct hif_cnf_join { +struct wfx_hif_cnf_join { __le32 status; } __packed; -struct hif_ind_join_complete { +struct wfx_hif_ind_join_complete { __le32 status; } __packed; -struct hif_req_set_bss_params { +struct wfx_hif_req_set_bss_params { u8 lost_count_only:1; u8 reserved:7; u8 beacon_lost_count; @@ -328,11 +328,11 @@ struct hif_req_set_bss_params { __le32 operational_rate_set; } __packed; -struct hif_cnf_set_bss_params { +struct wfx_hif_cnf_set_bss_params { __le32 status; } __packed; -struct hif_req_set_pm_mode { +struct wfx_hif_req_set_pm_mode { u8 enter_psm:1; u8 reserved:6; u8 fast_psm:1; @@ -341,17 +341,17 @@ struct hif_req_set_pm_mode { u8 min_auto_ps_poll_period; } __packed; -struct hif_cnf_set_pm_mode { +struct wfx_hif_cnf_set_pm_mode { __le32 status; } __packed; -struct hif_ind_set_pm_mode_cmpl { +struct wfx_hif_ind_set_pm_mode_cmpl { __le32 status; u8 pm_mode; u8 reserved[3]; } __packed; -struct hif_req_start { +struct wfx_hif_req_start { u8 mode; u8 band; u8 channel_number; @@ -367,23 +367,23 @@ struct hif_req_start { __le32 basic_rate_set; } __packed; -struct hif_cnf_start { +struct wfx_hif_cnf_start { __le32 status; } __packed; -struct hif_req_beacon_transmit { +struct wfx_hif_req_beacon_transmit { u8 enable_beaconing; u8 reserved[3]; } __packed; -struct hif_cnf_beacon_transmit { +struct wfx_hif_cnf_beacon_transmit { __le32 status; } __packed; #define HIF_LINK_ID_MAX 14 #define HIF_LINK_ID_NOT_ASSOCIATED (HIF_LINK_ID_MAX + 1) -struct hif_req_map_link { +struct wfx_hif_req_map_link { u8 mac_addr[ETH_ALEN]; u8 unmap:1; u8 mfpc:1; @@ -391,11 +391,11 @@ struct hif_req_map_link { u8 peer_sta_id; } __packed; -struct hif_cnf_map_link { +struct wfx_hif_cnf_map_link { __le32 status; } __packed; -struct hif_ind_suspend_resume_tx { +struct wfx_hif_ind_suspend_resume_tx { u8 resume:1; u8 reserved1:2; u8 bc_mc_only:1; @@ -417,7 +417,7 @@ struct hif_ind_suspend_resume_tx { #define HIF_API_RX_SEQUENCE_COUNTER_SIZE 8 #define HIF_API_IPN_SIZE 8 -enum hif_key_type { +enum wfx_hif_key_type { HIF_KEY_TYPE_WEP_DEFAULT = 0x0, HIF_KEY_TYPE_WEP_PAIRWISE = 0x1, HIF_KEY_TYPE_TKIP_GROUP = 0x2, @@ -430,21 +430,21 @@ enum hif_key_type { HIF_KEY_TYPE_NONE = 0x9 }; -struct hif_wep_pairwise_key { +struct wfx_hif_wep_pairwise_key { u8 peer_address[ETH_ALEN]; u8 reserved; u8 key_length; u8 key_data[HIF_API_WEP_KEY_DATA_SIZE]; } __packed; -struct hif_wep_group_key { +struct wfx_hif_wep_group_key { u8 key_id; u8 key_length; u8 reserved[2]; u8 key_data[HIF_API_WEP_KEY_DATA_SIZE]; } __packed; -struct hif_tkip_pairwise_key { +struct wfx_hif_tkip_pairwise_key { u8 peer_address[ETH_ALEN]; u8 reserved[2]; u8 tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE]; @@ -452,7 +452,7 @@ struct hif_tkip_pairwise_key { u8 tx_mic_key[HIF_API_TX_MIC_KEY_SIZE]; } __packed; -struct hif_tkip_group_key { +struct wfx_hif_tkip_group_key { u8 tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE]; u8 rx_mic_key[HIF_API_RX_MIC_KEY_SIZE]; u8 key_id; @@ -460,20 +460,20 @@ struct hif_tkip_group_key { u8 rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE]; } __packed; -struct hif_aes_pairwise_key { +struct wfx_hif_aes_pairwise_key { u8 peer_address[ETH_ALEN]; u8 reserved[2]; u8 aes_key_data[HIF_API_AES_KEY_DATA_SIZE]; } __packed; -struct hif_aes_group_key { +struct wfx_hif_aes_group_key { u8 aes_key_data[HIF_API_AES_KEY_DATA_SIZE]; u8 key_id; u8 reserved[3]; u8 rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE]; } __packed; -struct hif_wapi_pairwise_key { +struct wfx_hif_wapi_pairwise_key { u8 peer_address[ETH_ALEN]; u8 key_id; u8 reserved; @@ -481,53 +481,53 @@ struct hif_wapi_pairwise_key { u8 mic_key_data[HIF_API_MIC_KEY_DATA_SIZE]; } __packed; -struct hif_wapi_group_key { +struct wfx_hif_wapi_group_key { u8 wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE]; u8 mic_key_data[HIF_API_MIC_KEY_DATA_SIZE]; u8 key_id; u8 reserved[3]; } __packed; -struct hif_igtk_group_key { +struct wfx_hif_igtk_group_key { u8 igtk_key_data[HIF_API_IGTK_KEY_DATA_SIZE]; u8 key_id; u8 reserved[3]; u8 ipn[HIF_API_IPN_SIZE]; } __packed; -struct hif_req_add_key { +struct wfx_hif_req_add_key { u8 type; u8 entry_index; u8 int_id:2; u8 reserved1:6; u8 reserved2; union { - struct hif_wep_pairwise_key wep_pairwise_key; - struct hif_wep_group_key wep_group_key; - struct hif_tkip_pairwise_key tkip_pairwise_key; - struct hif_tkip_group_key tkip_group_key; - struct hif_aes_pairwise_key aes_pairwise_key; - struct hif_aes_group_key aes_group_key; - struct hif_wapi_pairwise_key wapi_pairwise_key; - struct hif_wapi_group_key wapi_group_key; - struct hif_igtk_group_key igtk_group_key; + struct wfx_hif_wep_pairwise_key wep_pairwise_key; + struct wfx_hif_wep_group_key wep_group_key; + struct wfx_hif_tkip_pairwise_key tkip_pairwise_key; + struct wfx_hif_tkip_group_key tkip_group_key; + struct wfx_hif_aes_pairwise_key aes_pairwise_key; + struct wfx_hif_aes_group_key aes_group_key; + struct wfx_hif_wapi_pairwise_key wapi_pairwise_key; + struct wfx_hif_wapi_group_key wapi_group_key; + struct wfx_hif_igtk_group_key igtk_group_key; } key; } __packed; -struct hif_cnf_add_key { +struct wfx_hif_cnf_add_key { __le32 status; } __packed; -struct hif_req_remove_key { +struct wfx_hif_req_remove_key { u8 entry_index; u8 reserved[3]; } __packed; -struct hif_cnf_remove_key { +struct wfx_hif_cnf_remove_key { __le32 status; } __packed; -enum hif_event_ind { +enum wfx_hif_event_ind { HIF_EVENT_IND_BSSLOST = 0x1, HIF_EVENT_IND_BSSREGAINED = 0x2, HIF_EVENT_IND_RCPI_RSSI = 0x3, @@ -535,7 +535,7 @@ enum hif_event_ind { HIF_EVENT_IND_INACTIVITY = 0x5 }; -enum hif_ps_mode_error { +enum wfx_hif_ps_mode_error { HIF_PS_ERROR_NO_ERROR = 0, HIF_PS_ERROR_AP_NOT_RESP_TO_POLL = 1, HIF_PS_ERROR_AP_NOT_RESP_TO_UAPSD_TRIGGER = 2, @@ -543,7 +543,7 @@ enum hif_ps_mode_error { HIF_PS_ERROR_AP_NO_DATA_AFTER_TIM = 4 }; -struct hif_ind_event { +struct wfx_hif_ind_event { __le32 event_id; union { u8 rcpi_rssi; diff --git a/drivers/staging/wfx/hif_api_general.h b/drivers/staging/wfx/hif_api_general.h index a57789ceb209..4d400fdc2252 100644 --- a/drivers/staging/wfx/hif_api_general.h +++ b/drivers/staging/wfx/hif_api_general.h @@ -14,7 +14,7 @@ #define HIF_ID_IS_INDICATION 0x80 #define HIF_COUNTER_MAX 7 -struct hif_msg { +struct wfx_hif_msg { __le16 len; u8 id; u8 reserved:1; @@ -24,7 +24,7 @@ struct hif_msg { u8 body[]; } __packed; -enum hif_general_requests_ids { +enum wfx_hif_general_requests_ids { HIF_REQ_ID_CONFIGURATION = 0x09, HIF_REQ_ID_CONTROL_GPIO = 0x26, HIF_REQ_ID_SET_SL_MAC_KEY = 0x27, @@ -37,7 +37,7 @@ enum hif_general_requests_ids { HIF_REQ_ID_SHUT_DOWN = 0x32, }; -enum hif_general_confirmations_ids { +enum wfx_hif_general_confirmations_ids { HIF_CNF_ID_CONFIGURATION = 0x09, HIF_CNF_ID_CONTROL_GPIO = 0x26, HIF_CNF_ID_SET_SL_MAC_KEY = 0x27, @@ -50,7 +50,7 @@ enum hif_general_confirmations_ids { HIF_CNF_ID_SHUT_DOWN = 0x32, }; -enum hif_general_indications_ids { +enum wfx_hif_general_indications_ids { HIF_IND_ID_EXCEPTION = 0xe0, HIF_IND_ID_STARTUP = 0xe1, HIF_IND_ID_WAKEUP = 0xe2, @@ -81,7 +81,7 @@ enum hif_general_indications_ids { #define HIF_STATUS_ROLLBACK_SUCCESS (cpu_to_le32(0x1234)) #define HIF_STATUS_ROLLBACK_FAIL (cpu_to_le32(0x1256)) -enum hif_api_rate_index { +enum wfx_hif_api_rate_index { API_RATE_INDEX_B_1MBPS = 0, API_RATE_INDEX_B_2MBPS = 1, API_RATE_INDEX_B_5P5MBPS = 2, @@ -107,7 +107,7 @@ enum hif_api_rate_index { API_RATE_NUM_ENTRIES = 22 }; -struct hif_ind_startup { +struct wfx_hif_ind_startup { __le32 status; __le16 hardware_id; u8 opn[14]; @@ -138,19 +138,19 @@ struct hif_ind_startup { u8 firmware_label[128]; } __packed; -struct hif_ind_wakeup { +struct wfx_hif_ind_wakeup { } __packed; -struct hif_req_configuration { +struct wfx_hif_req_configuration { __le16 length; u8 pds_data[]; } __packed; -struct hif_cnf_configuration { +struct wfx_hif_cnf_configuration { __le32 status; } __packed; -enum hif_gpio_mode { +enum wfx_hif_gpio_mode { HIF_GPIO_MODE_D0 = 0x0, HIF_GPIO_MODE_D1 = 0x1, HIF_GPIO_MODE_OD0 = 0x2, @@ -160,24 +160,24 @@ enum hif_gpio_mode { HIF_GPIO_MODE_READ = 0x6 }; -struct hif_req_control_gpio { +struct wfx_hif_req_control_gpio { u8 gpio_label; u8 gpio_mode; } __packed; -struct hif_cnf_control_gpio { +struct wfx_hif_cnf_control_gpio { __le32 status; __le32 value; } __packed; -enum hif_generic_indication_type { +enum wfx_hif_generic_indication_type { HIF_GENERIC_INDICATION_TYPE_RAW = 0x0, HIF_GENERIC_INDICATION_TYPE_STRING = 0x1, HIF_GENERIC_INDICATION_TYPE_RX_STATS = 0x2, HIF_GENERIC_INDICATION_TYPE_TX_POWER_LOOP_INFO = 0x3, }; -struct hif_rx_stats { +struct wfx_hif_rx_stats { __le32 nb_rx_frame; __le32 nb_crc_frame; __le32 per_total; @@ -193,7 +193,7 @@ struct hif_rx_stats { s8 current_temp; } __packed; -struct hif_tx_power_loop_info { +struct wfx_hif_tx_power_loop_info { __le16 tx_gain_dig; __le16 tx_gain_pa; __le16 target_pout; /* signed value */ @@ -203,15 +203,15 @@ struct hif_tx_power_loop_info { u8 reserved; } __packed; -struct hif_ind_generic { +struct wfx_hif_ind_generic { __le32 type; union { - struct hif_rx_stats rx_stats; - struct hif_tx_power_loop_info tx_power_loop_info; + struct wfx_hif_rx_stats rx_stats; + struct wfx_hif_tx_power_loop_info tx_power_loop_info; } data; } __packed; -enum hif_error { +enum wfx_hif_error { HIF_ERROR_FIRMWARE_ROLLBACK = 0x00, HIF_ERROR_FIRMWARE_DEBUG_ENABLED = 0x01, HIF_ERROR_SLK_OUTDATED_SESSION_KEY = 0x02, @@ -232,17 +232,17 @@ enum hif_error { HIF_ERROR_SLK_UNCONFIGURED = 0x11, }; -struct hif_ind_error { +struct wfx_hif_ind_error { __le32 type; u8 data[]; } __packed; -struct hif_ind_exception { +struct wfx_hif_ind_exception { __le32 type; u8 data[]; } __packed; -enum hif_secure_link_state { +enum wfx_hif_secure_link_state { SEC_LINK_UNAVAILABLE = 0x0, SEC_LINK_RESERVED = 0x1, SEC_LINK_EVAL = 0x2, diff --git a/drivers/staging/wfx/hif_api_mib.h b/drivers/staging/wfx/hif_api_mib.h index be76e2766880..7b68b83866c9 100644 --- a/drivers/staging/wfx/hif_api_mib.h +++ b/drivers/staging/wfx/hif_api_mib.h @@ -13,7 +13,7 @@ #define HIF_API_IPV4_ADDRESS_SIZE 4 #define HIF_API_IPV6_ADDRESS_SIZE 16 -enum hif_mib_ids { +enum wfx_hif_mib_ids { HIF_MIB_ID_GL_OPERATIONAL_POWER_MODE = 0x2000, HIF_MIB_ID_GL_BLOCK_ACK_INFO = 0x2001, HIF_MIB_ID_GL_SET_MULTI_MSG = 0x2002, @@ -63,39 +63,39 @@ enum hif_mib_ids { HIF_MIB_ID_BEACON_STATS = 0x2056, }; -enum hif_op_power_mode { +enum wfx_hif_op_power_mode { HIF_OP_POWER_MODE_ACTIVE = 0x0, HIF_OP_POWER_MODE_DOZE = 0x1, HIF_OP_POWER_MODE_QUIESCENT = 0x2 }; -struct hif_mib_gl_operational_power_mode { +struct wfx_hif_mib_gl_operational_power_mode { u8 power_mode:4; u8 reserved1:3; u8 wup_ind_activation:1; u8 reserved2[3]; } __packed; -struct hif_mib_gl_set_multi_msg { +struct wfx_hif_mib_gl_set_multi_msg { u8 enable_multi_tx_conf:1; u8 reserved1:7; u8 reserved2[3]; } __packed; -enum hif_arp_ns_frame_treatment { +enum wfx_hif_arp_ns_frame_treatment { HIF_ARP_NS_FILTERING_DISABLE = 0x0, HIF_ARP_NS_FILTERING_ENABLE = 0x1, HIF_ARP_NS_REPLY_ENABLE = 0x2 }; -struct hif_mib_arp_ip_addr_table { +struct wfx_hif_mib_arp_ip_addr_table { u8 condition_idx; u8 arp_enable; u8 reserved[2]; u8 ipv4_address[HIF_API_IPV4_ADDRESS_SIZE]; } __packed; -struct hif_mib_rx_filter { +struct wfx_hif_mib_rx_filter { u8 reserved1:1; u8 bssid_filter:1; u8 reserved2:1; @@ -105,7 +105,7 @@ struct hif_mib_rx_filter { u8 reserved4[3]; } __packed; -struct hif_ie_table_entry { +struct wfx_hif_ie_table_entry { u8 ie_id; u8 has_changed:1; u8 no_longer:1; @@ -116,23 +116,23 @@ struct hif_ie_table_entry { u8 match_data[3]; } __packed; -struct hif_mib_bcn_filter_table { +struct wfx_hif_mib_bcn_filter_table { __le32 num_of_info_elmts; - struct hif_ie_table_entry ie_table[]; + struct wfx_hif_ie_table_entry ie_table[]; } __packed; -enum hif_beacon_filter { +enum wfx_hif_beacon_filter { HIF_BEACON_FILTER_DISABLE = 0x0, HIF_BEACON_FILTER_ENABLE = 0x1, HIF_BEACON_FILTER_AUTO_ERP = 0x2 }; -struct hif_mib_bcn_filter_enable { +struct wfx_hif_mib_bcn_filter_enable { __le32 enable; __le32 bcn_count; } __packed; -struct hif_mib_extended_count_table { +struct wfx_hif_mib_extended_count_table { __le32 count_drop_plcp; __le32 count_drop_fcs; __le32 count_tx_frames; @@ -164,7 +164,7 @@ struct hif_mib_extended_count_table { __le32 reserved[12]; } __packed; -struct hif_mib_count_table { +struct wfx_hif_mib_count_table { __le32 count_drop_plcp; __le32 count_drop_fcs; __le32 count_tx_frames; @@ -190,35 +190,35 @@ struct hif_mib_count_table { __le32 count_drop_bip_mic; } __packed; -struct hif_mib_mac_address { +struct wfx_hif_mib_mac_address { u8 mac_addr[ETH_ALEN]; __le16 reserved; } __packed; -struct hif_mib_wep_default_key_id { +struct wfx_hif_mib_wep_default_key_id { u8 wep_default_key_id; u8 reserved[3]; } __packed; -struct hif_mib_dot11_rts_threshold { +struct wfx_hif_mib_dot11_rts_threshold { __le32 threshold; } __packed; -struct hif_mib_slot_time { +struct wfx_hif_mib_slot_time { __le32 slot_time; } __packed; -struct hif_mib_current_tx_power_level { +struct wfx_hif_mib_current_tx_power_level { __le32 power_level; /* signed value */ } __packed; -struct hif_mib_non_erp_protection { +struct wfx_hif_mib_non_erp_protection { u8 use_cts_to_self:1; u8 reserved1:7; u8 reserved2[3]; } __packed; -enum hif_tmplt { +enum wfx_hif_tmplt { HIF_TMPLT_PRBREQ = 0x0, HIF_TMPLT_BCN = 0x1, HIF_TMPLT_NULL = 0x2, @@ -231,7 +231,7 @@ enum hif_tmplt { #define HIF_API_MAX_TEMPLATE_FRAME_SIZE 700 -struct hif_mib_template_frame { +struct wfx_hif_mib_template_frame { u8 frame_type; u8 init_rate:7; u8 mode:1; @@ -239,7 +239,7 @@ struct hif_mib_template_frame { u8 frame[]; } __packed; -struct hif_mib_beacon_wake_up_period { +struct wfx_hif_mib_beacon_wake_up_period { u8 wakeup_period_min; u8 receive_dtim:1; u8 reserved1:7; @@ -247,7 +247,7 @@ struct hif_mib_beacon_wake_up_period { u8 reserved2; } __packed; -struct hif_mib_rcpi_rssi_threshold { +struct wfx_hif_mib_rcpi_rssi_threshold { u8 detection:1; u8 rcpi_rssi:1; u8 upperthresh:1; @@ -260,14 +260,14 @@ struct hif_mib_rcpi_rssi_threshold { #define DEFAULT_BA_MAX_RX_BUFFER_SIZE 16 -struct hif_mib_block_ack_policy { +struct wfx_hif_mib_block_ack_policy { u8 block_ack_tx_tid_policy; u8 reserved1; u8 block_ack_rx_tid_policy; u8 block_ack_rx_max_buffer_size; } __packed; -enum hif_mpdu_start_spacing { +enum wfx_hif_mpdu_start_spacing { HIF_MPDU_START_SPACING_NO_RESTRIC = 0x0, HIF_MPDU_START_SPACING_QUARTER = 0x1, HIF_MPDU_START_SPACING_HALF = 0x2, @@ -278,7 +278,7 @@ enum hif_mpdu_start_spacing { HIF_MPDU_START_SPACING_SIXTEEN = 0x7 }; -struct hif_mib_set_association_mode { +struct wfx_hif_mib_set_association_mode { u8 preambtype_use:1; u8 mode:1; u8 rateset:1; @@ -292,7 +292,7 @@ struct hif_mib_set_association_mode { __le32 basic_rate_set; } __packed; -struct hif_mib_set_uapsd_information { +struct wfx_hif_mib_set_uapsd_information { u8 trig_bckgrnd:1; u8 trig_be:1; u8 trig_video:1; @@ -308,7 +308,7 @@ struct hif_mib_set_uapsd_information { __le16 auto_trigger_step; } __packed; -struct hif_tx_rate_retry_policy { +struct wfx_hif_tx_rate_retry_policy { u8 policy_index; u8 short_retry_count; u8 long_retry_count; @@ -324,13 +324,13 @@ struct hif_tx_rate_retry_policy { #define HIF_TX_RETRY_POLICY_MAX 15 #define HIF_TX_RETRY_POLICY_INVALID HIF_TX_RETRY_POLICY_MAX -struct hif_mib_set_tx_rate_retry_policy { +struct wfx_hif_mib_set_tx_rate_retry_policy { u8 num_tx_rate_policies; u8 reserved[3]; - struct hif_tx_rate_retry_policy tx_rate_retry_policy[]; + struct wfx_hif_tx_rate_retry_policy tx_rate_retry_policy[]; } __packed; -struct hif_mib_protected_mgmt_policy { +struct wfx_hif_mib_protected_mgmt_policy { u8 pmf_enable:1; u8 unpmf_allowed:1; u8 host_enc_auth_frames:1; @@ -338,7 +338,7 @@ struct hif_mib_protected_mgmt_policy { u8 reserved2[3]; } __packed; -struct hif_mib_keep_alive_period { +struct wfx_hif_mib_keep_alive_period { __le16 keep_alive_period; u8 reserved[2]; } __packed; diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index 7a2a32e3ceb9..f2564a20bdcf 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -17,7 +17,7 @@ #include "hif_api_cmd.h" static int wfx_hif_generic_confirm(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { /* All confirm messages start with status */ int status = le32_to_cpup((__le32 *)buf); @@ -51,18 +51,18 @@ static int wfx_hif_generic_confirm(struct wfx_dev *wdev, } static int wfx_hif_tx_confirm(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { - const struct hif_cnf_tx *body = buf; + const struct wfx_hif_cnf_tx *body = buf; wfx_tx_confirm_cb(wdev, body); return 0; } static int wfx_hif_multi_tx_confirm(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { - const struct hif_cnf_multi_transmit *body = buf; + const struct wfx_hif_cnf_multi_transmit *body = buf; int i; WARN(body->num_tx_confs <= 0, "corrupted message"); @@ -72,22 +72,23 @@ static int wfx_hif_multi_tx_confirm(struct wfx_dev *wdev, } static int wfx_hif_startup_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, + const struct wfx_hif_msg *hif, const void *buf) { - const struct hif_ind_startup *body = buf; + const struct wfx_hif_ind_startup *body = buf; if (body->status || body->firmware_type > 4) { dev_err(wdev->dev, "received invalid startup indication"); return -EINVAL; } - memcpy(&wdev->hw_caps, body, sizeof(struct hif_ind_startup)); + memcpy(&wdev->hw_caps, body, sizeof(struct wfx_hif_ind_startup)); complete(&wdev->firmware_ready); return 0; } static int wfx_hif_wakeup_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) + const struct wfx_hif_msg *hif, + const void *buf) { if (!wdev->pdata.gpio_wakeup || gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) { @@ -98,28 +99,28 @@ static int wfx_hif_wakeup_indication(struct wfx_dev *wdev, } static int wfx_hif_receive_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, + const struct wfx_hif_msg *hif, const void *buf, struct sk_buff *skb) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - const struct hif_ind_rx *body = buf; + const struct wfx_hif_ind_rx *body = buf; if (!wvif) { dev_warn(wdev->dev, "%s: ignore rx data for non-existent vif %d\n", __func__, hif->interface); return -EIO; } - skb_pull(skb, sizeof(struct hif_msg) + sizeof(struct hif_ind_rx)); + skb_pull(skb, sizeof(struct wfx_hif_msg) + sizeof(struct hif_ind_rx)); wfx_rx_cb(wvif, body, skb); return 0; } static int wfx_hif_event_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - const struct hif_ind_event *body = buf; + const struct wfx_hif_ind_event *body = buf; int type = le32_to_cpu(body->event_id); if (!wvif) { @@ -151,7 +152,7 @@ static int wfx_hif_event_indication(struct wfx_dev *wdev, } static int wfx_hif_pm_mode_complete_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, + const struct wfx_hif_msg *hif, const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); @@ -166,11 +167,11 @@ static int wfx_hif_pm_mode_complete_indication(struct wfx_dev *wdev, } static int wfx_hif_scan_complete_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, + const struct wfx_hif_msg *hif, const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - const struct hif_ind_scan_cmpl *body = buf; + const struct wfx_hif_ind_scan_cmpl *body = buf; if (!wvif) { dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); @@ -183,7 +184,7 @@ static int wfx_hif_scan_complete_indication(struct wfx_dev *wdev, } static int wfx_hif_join_complete_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, + const struct wfx_hif_msg *hif, const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); @@ -198,10 +199,10 @@ static int wfx_hif_join_complete_indication(struct wfx_dev *wdev, } static int wfx_hif_suspend_resume_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, + const struct wfx_hif_msg *hif, const void *buf) { - const struct hif_ind_suspend_resume_tx *body = buf; + const struct wfx_hif_ind_suspend_resume_tx *body = buf; struct wfx_vif *wvif; if (body->bc_mc_only) { @@ -227,10 +228,10 @@ static int wfx_hif_suspend_resume_indication(struct wfx_dev *wdev, } static int wfx_hif_generic_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, + const struct wfx_hif_msg *hif, const void *buf) { - const struct hif_ind_generic *body = buf; + const struct wfx_hif_ind_generic *body = buf; int type = le32_to_cpu(body->type); switch (type) { @@ -308,9 +309,9 @@ static const struct { }; static int wfx_hif_error_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { - const struct hif_ind_error *body = buf; + const struct wfx_hif_ind_error *body = buf; int type = le32_to_cpu(body->type); int param = (s8)body->data[0]; int i; @@ -335,10 +336,10 @@ static int wfx_hif_error_indication(struct wfx_dev *wdev, }; static int wfx_hif_exception_indication(struct wfx_dev *wdev, - const struct hif_msg *hif, + const struct wfx_hif_msg *hif, const void *buf) { - const struct hif_ind_exception *body = buf; + const struct wfx_hif_ind_exception *body = buf; int type = le32_to_cpu(body->type); if (type == 4) @@ -356,7 +357,7 @@ static int wfx_hif_exception_indication(struct wfx_dev *wdev, static const struct { int msg_id; int (*handler)(struct wfx_dev *wdev, - const struct hif_msg *hif, const void *buf); + const struct wfx_hif_msg *hif, const void *buf); } hif_handlers[] = { /* Confirmations */ { HIF_CNF_ID_TX, wfx_hif_tx_confirm }, @@ -379,7 +380,7 @@ static const struct { void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) { int i; - const struct hif_msg *hif = (const struct hif_msg *)skb->data; + const struct wfx_hif_msg *hif = (const struct hif_msg *)skb->data; int hif_id = hif->id; if (hif_id == HIF_IND_ID_RX) { diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 67f1847c1fc1..429c70b991e1 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -22,7 +22,7 @@ void wfx_init_hif_cmd(struct wfx_hif_cmd *hif_cmd) mutex_init(&hif_cmd->lock); } -static void wfx_fill_header(struct hif_msg *hif, int if_id, +static void wfx_fill_header(struct wfx_hif_msg *hif, int if_id, unsigned int cmd, size_t size) { if (if_id == -1) @@ -37,16 +37,16 @@ static void wfx_fill_header(struct hif_msg *hif, int if_id, hif->interface = if_id; } -static void *wfx_alloc_hif(size_t body_len, struct hif_msg **hif) +static void *wfx_alloc_hif(size_t body_len, struct wfx_hif_msg **hif) { - *hif = kzalloc(sizeof(struct hif_msg) + body_len, GFP_KERNEL); + *hif = kzalloc(sizeof(struct wfx_hif_msg) + body_len, GFP_KERNEL); if (*hif) return (*hif)->body; else return NULL; } -int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, +int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request, void *reply, size_t reply_len, bool no_reply) { const char *mib_name = ""; @@ -125,7 +125,7 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, int wfx_hif_shutdown(struct wfx_dev *wdev) { int ret; - struct hif_msg *hif; + struct wfx_hif_msg *hif; wfx_alloc_hif(0, &hif); if (!hif) @@ -143,9 +143,9 @@ int wfx_hif_shutdown(struct wfx_dev *wdev) int wfx_hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len) { int ret; - size_t buf_len = sizeof(struct hif_req_configuration) + len; - struct hif_msg *hif; - struct hif_req_configuration *body = wfx_alloc_hif(buf_len, &hif); + size_t buf_len = sizeof(struct wfx_hif_req_configuration) + len; + struct wfx_hif_msg *hif; + struct wfx_hif_req_configuration *body = wfx_alloc_hif(buf_len, &hif); if (!hif) return -ENOMEM; @@ -160,8 +160,8 @@ int wfx_hif_configuration(struct wfx_dev *wdev, const u8 *conf, size_t len) int wfx_hif_reset(struct wfx_vif *wvif, bool reset_stat) { int ret; - struct hif_msg *hif; - struct hif_req_reset *body = wfx_alloc_hif(sizeof(*body), &hif); + struct wfx_hif_msg *hif; + struct wfx_hif_req_reset *body = wfx_alloc_hif(sizeof(*body), &hif); if (!hif) return -ENOMEM; @@ -176,10 +176,10 @@ int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, size_t val_len) { int ret; - struct hif_msg *hif; - int buf_len = sizeof(struct hif_cnf_read_mib) + val_len; - struct hif_req_read_mib *body = wfx_alloc_hif(sizeof(*body), &hif); - struct hif_cnf_read_mib *reply = kmalloc(buf_len, GFP_KERNEL); + struct wfx_hif_msg *hif; + int buf_len = sizeof(struct wfx_hif_cnf_read_mib) + val_len; + struct wfx_hif_req_read_mib *body = wfx_alloc_hif(sizeof(*body), &hif); + struct wfx_hif_cnf_read_mib *reply = kmalloc(buf_len, GFP_KERNEL); if (!body || !reply) { ret = -ENOMEM; @@ -212,9 +212,9 @@ int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, size_t val_len) { int ret; - struct hif_msg *hif; - int buf_len = sizeof(struct hif_req_write_mib) + val_len; - struct hif_req_write_mib *body = wfx_alloc_hif(buf_len, &hif); + struct wfx_hif_msg *hif; + int buf_len = sizeof(struct wfx_hif_req_write_mib) + val_len; + struct wfx_hif_req_write_mib *body = wfx_alloc_hif(buf_len, &hif); if (!hif) return -ENOMEM; @@ -231,10 +231,10 @@ int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, int chan_start_idx, int chan_num) { int ret, i; - struct hif_msg *hif; - size_t buf_len = - sizeof(struct hif_req_start_scan_alt) + chan_num * sizeof(u8); - struct hif_req_start_scan_alt *body = wfx_alloc_hif(buf_len, &hif); + struct wfx_hif_msg *hif; + size_t buf_len = sizeof(struct wfx_hif_req_start_scan_alt) + + chan_num * sizeof(u8); + struct wfx_hif_req_start_scan_alt *body = wfx_alloc_hif(buf_len, &hif); WARN(chan_num > HIF_API_MAX_NB_CHANNELS, "invalid params"); WARN(req->n_ssids > HIF_API_MAX_NB_SSIDS, "invalid params"); @@ -279,7 +279,7 @@ int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, int wfx_hif_stop_scan(struct wfx_vif *wvif) { int ret; - struct hif_msg *hif; + struct wfx_hif_msg *hif; /* body associated to HIF_REQ_ID_STOP_SCAN is empty */ wfx_alloc_hif(0, &hif); @@ -295,8 +295,8 @@ int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, struct ieee80211_channel *channel, const u8 *ssid, int ssidlen) { int ret; - struct hif_msg *hif; - struct hif_req_join *body = wfx_alloc_hif(sizeof(*body), &hif); + struct wfx_hif_msg *hif; + struct wfx_hif_req_join *body = wfx_alloc_hif(sizeof(*body), &hif); WARN_ON(!conf->beacon_int); WARN_ON(!conf->basic_rates); @@ -325,9 +325,9 @@ int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, int wfx_hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) { int ret; - struct hif_msg *hif; - struct hif_req_set_bss_params *body = - wfx_alloc_hif(sizeof(*body), &hif); + struct wfx_hif_msg *hif; + struct wfx_hif_req_set_bss_params *body = wfx_alloc_hif(sizeof(*body), + &hif); if (!hif) return -ENOMEM; @@ -340,12 +340,12 @@ int wfx_hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) return ret; } -int wfx_hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg) +int wfx_hif_add_key(struct wfx_dev *wdev, const struct wfx_hif_req_add_key *arg) { int ret; - struct hif_msg *hif; + struct wfx_hif_msg *hif; /* FIXME: only send necessary bits */ - struct hif_req_add_key *body = wfx_alloc_hif(sizeof(*body), &hif); + struct wfx_hif_req_add_key *body = wfx_alloc_hif(sizeof(*body), &hif); if (!hif) return -ENOMEM; @@ -367,8 +367,8 @@ int wfx_hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg) int wfx_hif_remove_key(struct wfx_dev *wdev, int idx) { int ret; - struct hif_msg *hif; - struct hif_req_remove_key *body = wfx_alloc_hif(sizeof(*body), &hif); + struct wfx_hif_msg *hif; + struct wfx_hif_req_remove_key *body = wfx_alloc_hif(sizeof(*body), &hif); if (!hif) return -ENOMEM; @@ -383,9 +383,9 @@ int wfx_hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, const struct ieee80211_tx_queue_params *arg) { int ret; - struct hif_msg *hif; - struct hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body), - &hif); + struct wfx_hif_msg *hif; + struct wfx_hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body), + &hif); if (!body) return -ENOMEM; @@ -413,8 +413,9 @@ int wfx_hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, int wfx_hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout) { int ret; - struct hif_msg *hif; - struct hif_req_set_pm_mode *body = wfx_alloc_hif(sizeof(*body), &hif); + struct wfx_hif_msg *hif; + struct wfx_hif_req_set_pm_mode *body = wfx_alloc_hif(sizeof(*body), + &hif); if (!body) return -ENOMEM; @@ -438,8 +439,8 @@ int wfx_hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, const struct ieee80211_channel *channel) { int ret; - struct hif_msg *hif; - struct hif_req_start *body = wfx_alloc_hif(sizeof(*body), &hif); + struct wfx_hif_msg *hif; + struct wfx_hif_req_start *body = wfx_alloc_hif(sizeof(*body), &hif); WARN_ON(!conf->beacon_int); if (!hif) @@ -461,9 +462,9 @@ int wfx_hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, int wfx_hif_beacon_transmit(struct wfx_vif *wvif, bool enable) { int ret; - struct hif_msg *hif; - struct hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), - &hif); + struct wfx_hif_msg *hif; + struct wfx_hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), + &hif); if (!hif) return -ENOMEM; @@ -479,8 +480,8 @@ int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp) { int ret; - struct hif_msg *hif; - struct hif_req_map_link *body = wfx_alloc_hif(sizeof(*body), &hif); + struct wfx_hif_msg *hif; + struct wfx_hif_req_map_link *body = wfx_alloc_hif(sizeof(*body), &hif); if (!hif) return -ENOMEM; @@ -499,9 +500,9 @@ int wfx_hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len) { int ret; - struct hif_msg *hif; - int buf_len = sizeof(struct hif_req_update_ie) + ies_len; - struct hif_req_update_ie *body = wfx_alloc_hif(buf_len, &hif); + struct wfx_hif_msg *hif; + int buf_len = sizeof(struct wfx_hif_req_update_ie) + ies_len; + struct wfx_hif_req_update_ie *body = wfx_alloc_hif(buf_len, &hif); if (!hif) return -ENOMEM; diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index b28a2ee5350a..36caffa4d1eb 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -18,22 +18,22 @@ struct ieee80211_channel; struct ieee80211_bss_conf; struct ieee80211_tx_queue_params; struct cfg80211_scan_request; -struct hif_req_add_key; +struct wfx_hif_req_add_key; struct wfx_dev; struct wfx_vif; struct wfx_hif_cmd { - struct mutex lock; - struct completion ready; - struct completion done; - struct hif_msg *buf_send; - void *buf_recv; - size_t len_recv; - int ret; + struct mutex lock; + struct completion ready; + struct completion done; + struct wfx_hif_msg *buf_send; + void *buf_recv; + size_t len_recv; + int ret; }; void wfx_init_hif_cmd(struct wfx_hif_cmd *wfx_hif_cmd); -int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, +int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request, void *reply, size_t reply_len, bool async); int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, @@ -47,7 +47,7 @@ int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp); -int wfx_hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg); +int wfx_hif_add_key(struct wfx_dev *wdev, const struct wfx_hif_req_add_key *arg); int wfx_hif_remove_key(struct wfx_dev *wdev, int idx); int wfx_hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout); int wfx_hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count); diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index b79ffdf6fcd2..daf966693f67 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -16,7 +16,7 @@ int wfx_hif_set_output_power(struct wfx_vif *wvif, int val) { - struct hif_mib_current_tx_power_level arg = { + struct wfx_hif_mib_current_tx_power_level arg = { .power_level = cpu_to_le32(val * 10), }; @@ -29,7 +29,7 @@ int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, unsigned int dtim_interval, unsigned int listen_interval) { - struct hif_mib_beacon_wake_up_period arg = { + struct wfx_hif_mib_beacon_wake_up_period arg = { .wakeup_period_min = dtim_interval, .receive_dtim = 0, .wakeup_period_max = listen_interval, @@ -45,7 +45,7 @@ int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, int rssi_thold, int rssi_hyst) { - struct hif_mib_rcpi_rssi_threshold arg = { + struct wfx_hif_mib_rcpi_rssi_threshold arg = { .rolling_average_count = 8, .detection = 1, }; @@ -66,23 +66,23 @@ int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, } int wfx_hif_get_counters_table(struct wfx_dev *wdev, int vif_id, - struct hif_mib_extended_count_table *arg) + struct wfx_hif_mib_extended_count_table *arg) { if (wfx_api_older_than(wdev, 1, 3)) { /* extended_count_table is wider than count_table */ memset(arg, 0xFF, sizeof(*arg)); return wfx_hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE, - arg, sizeof(struct hif_mib_count_table)); + arg, sizeof(struct wfx_hif_mib_count_table)); } else { return wfx_hif_read_mib(wdev, vif_id, HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg, - sizeof(struct hif_mib_extended_count_table)); + sizeof(struct wfx_hif_mib_extended_count_table)); } } int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac) { - struct hif_mib_mac_address arg = { }; + struct wfx_hif_mib_mac_address arg = { }; if (mac) ether_addr_copy(arg.mac_addr, mac); @@ -94,7 +94,7 @@ int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac) int wfx_hif_set_rx_filter(struct wfx_vif *wvif, bool filter_bssid, bool filter_prbreq) { - struct hif_mib_rx_filter arg = { }; + struct wfx_hif_mib_rx_filter arg = { }; if (filter_bssid) arg.bssid_filter = 1; @@ -105,10 +105,10 @@ int wfx_hif_set_rx_filter(struct wfx_vif *wvif, } int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, - const struct hif_ie_table_entry *tbl) + const struct wfx_hif_ie_table_entry *tbl) { int ret; - struct hif_mib_bcn_filter_table *arg; + struct wfx_hif_mib_bcn_filter_table *arg; int buf_len = struct_size(arg, ie_table, tbl_len); arg = kzalloc(buf_len, GFP_KERNEL); @@ -125,7 +125,7 @@ int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, int enable, int beacon_count) { - struct hif_mib_bcn_filter_enable arg = { + struct wfx_hif_mib_bcn_filter_enable arg = { .enable = cpu_to_le32(enable), .bcn_count = cpu_to_le32(beacon_count), }; @@ -135,9 +135,9 @@ int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, } int wfx_hif_set_operational_mode(struct wfx_dev *wdev, - enum hif_op_power_mode mode) + enum wfx_hif_op_power_mode mode) { - struct hif_mib_gl_operational_power_mode arg = { + struct wfx_hif_mib_gl_operational_power_mode arg = { .power_mode = mode, .wup_ind_activation = 1, }; @@ -149,11 +149,11 @@ int wfx_hif_set_operational_mode(struct wfx_dev *wdev, int wfx_hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, u8 frame_type, int init_rate) { - struct hif_mib_template_frame *arg; + struct wfx_hif_mib_template_frame *arg; WARN(skb->len > HIF_API_MAX_TEMPLATE_FRAME_SIZE, "frame is too big"); skb_push(skb, 4); - arg = (struct hif_mib_template_frame *)skb->data; + arg = (struct wfx_hif_mib_template_frame *)skb->data; skb_pull(skb, 4); arg->init_rate = init_rate; arg->frame_type = frame_type; @@ -164,7 +164,7 @@ int wfx_hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required) { - struct hif_mib_protected_mgmt_policy arg = { }; + struct wfx_hif_mib_protected_mgmt_policy arg = { }; WARN(required && !capable, "incoherent arguments"); if (capable) { @@ -181,7 +181,7 @@ int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required) int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, u8 tx_tid_policy, u8 rx_tid_policy) { - struct hif_mib_block_ack_policy arg = { + struct wfx_hif_mib_block_ack_policy arg = { .block_ack_tx_tid_policy = tx_tid_policy, .block_ack_rx_tid_policy = rx_tid_policy, }; @@ -194,7 +194,7 @@ int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, int wfx_hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, bool greenfield, bool short_preamble) { - struct hif_mib_set_association_mode arg = { + struct wfx_hif_mib_set_association_mode arg = { .preambtype_use = 1, .mode = 1, .spacing = 1, @@ -211,7 +211,7 @@ int wfx_hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int policy_index, u8 *rates) { - struct hif_mib_set_tx_rate_retry_policy *arg; + struct wfx_hif_mib_set_tx_rate_retry_policy *arg; size_t size = struct_size(arg, tx_rate_retry_policy, 1); int ret; @@ -236,7 +236,7 @@ int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int wfx_hif_keep_alive_period(struct wfx_vif *wvif, int period) { - struct hif_mib_keep_alive_period arg = { + struct wfx_hif_mib_keep_alive_period arg = { .keep_alive_period = cpu_to_le16(period), }; @@ -247,7 +247,7 @@ int wfx_hif_keep_alive_period(struct wfx_vif *wvif, int period) int wfx_hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr) { - struct hif_mib_arp_ip_addr_table arg = { + struct wfx_hif_mib_arp_ip_addr_table arg = { .condition_idx = idx, .arp_enable = HIF_ARP_NS_FILTERING_DISABLE, }; @@ -264,7 +264,7 @@ int wfx_hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr) int wfx_hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable) { - struct hif_mib_gl_set_multi_msg arg = { + struct wfx_hif_mib_gl_set_multi_msg arg = { .enable_multi_tx_conf = enable, }; @@ -274,7 +274,7 @@ int wfx_hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable) int wfx_hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) { - struct hif_mib_set_uapsd_information arg = { }; + struct wfx_hif_mib_set_uapsd_information arg = { }; if (val & BIT(IEEE80211_AC_VO)) arg.trig_voice = 1; @@ -291,7 +291,7 @@ int wfx_hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) int wfx_hif_erp_use_protection(struct wfx_vif *wvif, bool enable) { - struct hif_mib_non_erp_protection arg = { + struct wfx_hif_mib_non_erp_protection arg = { .use_cts_to_self = enable, }; @@ -302,7 +302,7 @@ int wfx_hif_erp_use_protection(struct wfx_vif *wvif, bool enable) int wfx_hif_slot_time(struct wfx_vif *wvif, int val) { - struct hif_mib_slot_time arg = { + struct wfx_hif_mib_slot_time arg = { .slot_time = cpu_to_le32(val), }; @@ -312,7 +312,7 @@ int wfx_hif_slot_time(struct wfx_vif *wvif, int val) int wfx_hif_wep_default_key_id(struct wfx_vif *wvif, int val) { - struct hif_mib_wep_default_key_id arg = { + struct wfx_hif_mib_wep_default_key_id arg = { .wep_default_key_id = val, }; @@ -323,7 +323,7 @@ int wfx_hif_wep_default_key_id(struct wfx_vif *wvif, int val) int wfx_hif_rts_threshold(struct wfx_vif *wvif, int val) { - struct hif_mib_dot11_rts_threshold arg = { + struct wfx_hif_mib_dot11_rts_threshold arg = { .threshold = cpu_to_le32(val >= 0 ? val : 0xFFFF), }; diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index 9b4c16ad5ecf..e7e556b05c9a 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -14,8 +14,8 @@ struct sk_buff; struct wfx_vif; struct wfx_dev; -struct hif_ie_table_entry; -struct hif_mib_extended_count_table; +struct wfx_hif_ie_table_entry; +struct wfx_hif_mib_extended_count_table; int wfx_hif_set_output_power(struct wfx_vif *wvif, int val); int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, @@ -24,16 +24,16 @@ int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, int rssi_thold, int rssi_hyst); int wfx_hif_get_counters_table(struct wfx_dev *wdev, int vif_id, - struct hif_mib_extended_count_table *arg); + struct wfx_hif_mib_extended_count_table *arg); int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac); int wfx_hif_set_rx_filter(struct wfx_vif *wvif, bool filter_bssid, bool fwd_probe_req); int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, - const struct hif_ie_table_entry *tbl); + const struct wfx_hif_ie_table_entry *tbl); int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, int enable, int beacon_count); int wfx_hif_set_operational_mode(struct wfx_dev *wdev, - enum hif_op_power_mode mode); + enum wfx_hif_op_power_mode mode); int wfx_hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, u8 frame_type, int init_rate); int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required); diff --git a/drivers/staging/wfx/key.c b/drivers/staging/wfx/key.c index 6069be161154..dea8238f9916 100644 --- a/drivers/staging/wfx/key.c +++ b/drivers/staging/wfx/key.c @@ -30,7 +30,7 @@ static void wfx_free_key(struct wfx_dev *wdev, int idx) wdev->key_map &= ~BIT(idx); } -static u8 fill_wep_pair(struct hif_wep_pairwise_key *msg, +static u8 fill_wep_pair(struct wfx_hif_wep_pairwise_key *msg, struct ieee80211_key_conf *key, u8 *peer_addr) { WARN(key->keylen > sizeof(msg->key_data), "inconsistent data"); @@ -40,7 +40,7 @@ static u8 fill_wep_pair(struct hif_wep_pairwise_key *msg, return HIF_KEY_TYPE_WEP_PAIRWISE; } -static u8 fill_wep_group(struct hif_wep_group_key *msg, +static u8 fill_wep_group(struct wfx_hif_wep_group_key *msg, struct ieee80211_key_conf *key) { WARN(key->keylen > sizeof(msg->key_data), "inconsistent data"); @@ -50,7 +50,7 @@ static u8 fill_wep_group(struct hif_wep_group_key *msg, return HIF_KEY_TYPE_WEP_DEFAULT; } -static u8 fill_tkip_pair(struct hif_tkip_pairwise_key *msg, +static u8 fill_tkip_pair(struct wfx_hif_tkip_pairwise_key *msg, struct ieee80211_key_conf *key, u8 *peer_addr) { u8 *keybuf = key->key; @@ -67,7 +67,7 @@ static u8 fill_tkip_pair(struct hif_tkip_pairwise_key *msg, return HIF_KEY_TYPE_TKIP_PAIRWISE; } -static u8 fill_tkip_group(struct hif_tkip_group_key *msg, +static u8 fill_tkip_group(struct wfx_hif_tkip_group_key *msg, struct ieee80211_key_conf *key, struct ieee80211_key_seq *seq, enum nl80211_iftype iftype) @@ -92,7 +92,7 @@ static u8 fill_tkip_group(struct hif_tkip_group_key *msg, return HIF_KEY_TYPE_TKIP_GROUP; } -static u8 fill_ccmp_pair(struct hif_aes_pairwise_key *msg, +static u8 fill_ccmp_pair(struct wfx_hif_aes_pairwise_key *msg, struct ieee80211_key_conf *key, u8 *peer_addr) { WARN(key->keylen != sizeof(msg->aes_key_data), "inconsistent data"); @@ -101,7 +101,7 @@ static u8 fill_ccmp_pair(struct hif_aes_pairwise_key *msg, return HIF_KEY_TYPE_AES_PAIRWISE; } -static u8 fill_ccmp_group(struct hif_aes_group_key *msg, +static u8 fill_ccmp_group(struct wfx_hif_aes_group_key *msg, struct ieee80211_key_conf *key, struct ieee80211_key_seq *seq) { @@ -113,7 +113,7 @@ static u8 fill_ccmp_group(struct hif_aes_group_key *msg, return HIF_KEY_TYPE_AES_GROUP; } -static u8 fill_sms4_pair(struct hif_wapi_pairwise_key *msg, +static u8 fill_sms4_pair(struct wfx_hif_wapi_pairwise_key *msg, struct ieee80211_key_conf *key, u8 *peer_addr) { u8 *keybuf = key->key; @@ -128,7 +128,7 @@ static u8 fill_sms4_pair(struct hif_wapi_pairwise_key *msg, return HIF_KEY_TYPE_WAPI_PAIRWISE; } -static u8 fill_sms4_group(struct hif_wapi_group_key *msg, +static u8 fill_sms4_group(struct wfx_hif_wapi_group_key *msg, struct ieee80211_key_conf *key) { u8 *keybuf = key->key; @@ -142,7 +142,7 @@ static u8 fill_sms4_group(struct hif_wapi_group_key *msg, return HIF_KEY_TYPE_WAPI_GROUP; } -static u8 fill_aes_cmac_group(struct hif_igtk_group_key *msg, +static u8 fill_aes_cmac_group(struct wfx_hif_igtk_group_key *msg, struct ieee80211_key_conf *key, struct ieee80211_key_seq *seq) { @@ -158,7 +158,7 @@ static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key) { int ret; - struct hif_req_add_key k = { }; + struct wfx_hif_req_add_key k = { }; struct ieee80211_key_seq seq; struct wfx_dev *wdev = wvif->wdev; int idx = wfx_alloc_key(wvif->wdev); diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 43947f8f2e0c..f34cfed503d4 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -288,8 +288,8 @@ struct wfx_dev *wfx_init_common(struct device *dev, hw->queues = 4; hw->max_rates = 8; hw->max_rate_tries = 8; - hw->extra_tx_headroom = sizeof(struct hif_msg) - + sizeof(struct hif_req_tx) + hw->extra_tx_headroom = sizeof(struct wfx_hif_msg) + + sizeof(struct wfx_hif_req_tx) + 4 /* alignment */ + 8 /* TKIP IV */; hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 7a3ba3c38925..71c6ef94a904 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -127,13 +127,13 @@ void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped) { struct wfx_queue *queue; struct wfx_vif *wvif; - struct hif_msg *hif; + struct wfx_hif_msg *hif; struct sk_buff *skb; WARN(!wdev->chip_frozen, "%s should only be used to recover a frozen device", __func__); while ((skb = skb_dequeue(&wdev->tx_pending)) != NULL) { - hif = (struct hif_msg *)skb->data; + hif = (struct wfx_hif_msg *)skb->data; wvif = wdev_to_wvif(wdev, hif->interface); if (wvif) { queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; @@ -148,15 +148,15 @@ void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped) struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id) { struct wfx_queue *queue; - struct hif_req_tx *req; + struct wfx_hif_req_tx *req; struct wfx_vif *wvif; - struct hif_msg *hif; + struct wfx_hif_msg *hif; struct sk_buff *skb; spin_lock_bh(&wdev->tx_pending.lock); skb_queue_walk(&wdev->tx_pending, skb) { - hif = (struct hif_msg *)skb->data; - req = (struct hif_req_tx *)hif->body; + hif = (struct wfx_hif_msg *)skb->data; + req = (struct wfx_hif_req_tx *)hif->body; if (req->packet_id != packet_id) continue; spin_unlock_bh(&wdev->tx_pending.lock); @@ -179,7 +179,7 @@ void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms) { ktime_t now = ktime_get(); struct wfx_tx_priv *tx_priv; - struct hif_req_tx *req; + struct wfx_hif_req_tx *req; struct sk_buff *skb; bool first = true; @@ -236,7 +236,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) struct wfx_queue *queues[IEEE80211_NUM_ACS * ARRAY_SIZE(wdev->vif)]; int i, j, num_queues = 0; struct wfx_vif *wvif; - struct hif_msg *hif; + struct wfx_hif_msg *hif; struct sk_buff *skb; /* sort the queues */ @@ -265,7 +265,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) * and only one vif can be AP, all queued frames has * same interface id */ - hif = (struct hif_msg *)skb->data; + hif = (struct wfx_hif_msg *)skb->data; WARN_ON(hif->interface != wvif->id); WARN_ON(queues[i] != &wvif->tx_queue[skb_get_queue_mapping(skb)]); @@ -289,7 +289,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) return NULL; } -struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) +struct wfx_hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) { struct wfx_tx_priv *tx_priv; struct sk_buff *skb; @@ -303,5 +303,5 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) wake_up(&wdev->tx_dequeue); tx_priv = wfx_skb_tx_priv(skb); tx_priv->xmit_timestamp = ktime_get(); - return (struct hif_msg *)skb->data; + return (struct wfx_hif_msg *)skb->data; } diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index edd0d018b198..66596a9abe30 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -30,7 +30,7 @@ void wfx_tx_queues_init(struct wfx_vif *wvif); void wfx_tx_queues_check_empty(struct wfx_vif *wvif); bool wfx_tx_queues_has_cab(struct wfx_vif *wvif); void wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb); -struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev); +struct wfx_hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev); bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue); void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index d384f2df329c..620d8c912f95 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -63,7 +63,7 @@ void wfx_suspend_hot_dev(struct wfx_dev *wdev, enum sta_notify_cmd cmd) static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon) { - static const struct hif_ie_table_entry filter_ies[] = { + static const struct wfx_hif_ie_table_entry filter_ies[] = { { .ie_id = WLAN_EID_VENDOR_SPECIFIC, .has_changed = 1, diff --git a/drivers/staging/wfx/traces.h b/drivers/staging/wfx/traces.h index e90dc73c4b01..99bd1808111e 100644 --- a/drivers/staging/wfx/traces.h +++ b/drivers/staging/wfx/traces.h @@ -158,7 +158,7 @@ hif_mib_list_enum #define hif_mib_list hif_mib_list_enum { -1, NULL } DECLARE_EVENT_CLASS(hif_data, - TP_PROTO(const struct hif_msg *hif, int tx_fill_level, bool is_recv), + TP_PROTO(const struct wfx_hif_msg *hif, int tx_fill_level, bool is_recv), TP_ARGS(hif, tx_fill_level, is_recv), TP_STRUCT__entry( __field(int, tx_fill_level) @@ -192,7 +192,7 @@ DECLARE_EVENT_CLASS(hif_data, } __entry->buf_len = min_t(int, __entry->msg_len, sizeof(__entry->buf)) - - sizeof(struct hif_msg) - header_len; + - sizeof(struct wfx_hif_msg) - header_len; memcpy(__entry->buf, hif->body + header_len, __entry->buf_len); ), TP_printk("%d:%d:%s_%s%s%s: %s%s (%d bytes)", @@ -208,12 +208,12 @@ DECLARE_EVENT_CLASS(hif_data, ) ); DEFINE_EVENT(hif_data, hif_send, - TP_PROTO(const struct hif_msg *hif, int tx_fill_level, bool is_recv), + TP_PROTO(const struct wfx_hif_msg *hif, int tx_fill_level, bool is_recv), TP_ARGS(hif, tx_fill_level, is_recv)); #define _trace_hif_send(hif, tx_fill_level)\ trace_hif_send(hif, tx_fill_level, false) DEFINE_EVENT(hif_data, hif_recv, - TP_PROTO(const struct hif_msg *hif, int tx_fill_level, bool is_recv), + TP_PROTO(const struct wfx_hif_msg *hif, int tx_fill_level, bool is_recv), TP_ARGS(hif, tx_fill_level, is_recv)); #define _trace_hif_recv(hif, tx_fill_level)\ trace_hif_recv(hif, tx_fill_level, true) @@ -364,7 +364,7 @@ TRACE_EVENT(bh_stats, trace_bh_stats(ind, req, cnf, busy, release) TRACE_EVENT(tx_stats, - TP_PROTO(const struct hif_cnf_tx *tx_cnf, const struct sk_buff *skb, + TP_PROTO(const struct wfx_hif_cnf_tx *tx_cnf, const struct sk_buff *skb, int delay), TP_ARGS(tx_cnf, skb, delay), TP_STRUCT__entry( diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index f8df59ad1639..1c06430e5996 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -38,7 +38,7 @@ struct wfx_dev { u8 keyset; struct completion firmware_ready; - struct hif_ind_startup hw_caps; + struct wfx_hif_ind_startup hw_caps; struct wfx_hif hif; struct delayed_work cooling_timeout_work; bool poll_irq; @@ -53,9 +53,9 @@ struct wfx_dev { atomic_t packet_id; u32 key_map; - struct hif_rx_stats rx_stats; + struct wfx_hif_rx_stats rx_stats; struct mutex rx_stats_lock; - struct hif_tx_power_loop_info tx_power_loop_info; + struct wfx_hif_tx_power_loop_info tx_power_loop_info; struct mutex tx_power_loop_info_lock; int force_ps_timeout; }; -- cgit From 07874db4b30a2bf872ac0ec2ff7fe224c8a3a9f5 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:12 +0100 Subject: staging: wfx: prefix structs tx_policy and hwbus_ops with wfx_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All the types related to a driver should use the same prefix. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-20-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bus.h | 2 +- drivers/staging/wfx/bus_sdio.c | 2 +- drivers/staging/wfx/bus_spi.c | 2 +- drivers/staging/wfx/data_tx.c | 38 +++++++++++++++++++------------------- drivers/staging/wfx/data_tx.h | 10 +++++----- drivers/staging/wfx/hif_rx.c | 4 ++-- drivers/staging/wfx/main.c | 2 +- drivers/staging/wfx/main.h | 4 ++-- drivers/staging/wfx/wfx.h | 6 +++--- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/staging/wfx/bus.h b/drivers/staging/wfx/bus.h index ca04b3da6204..91b5a545b8ff 100644 --- a/drivers/staging/wfx/bus.h +++ b/drivers/staging/wfx/bus.h @@ -20,7 +20,7 @@ #define WFX_REG_SET_GEN_R_W 0x6 #define WFX_REG_FRAME_OUT 0x7 -struct hwbus_ops { +struct wfx_hwbus_ops { int (*copy_from_io)(void *bus_priv, unsigned int addr, void *dst, size_t count); int (*copy_to_io)(void *bus_priv, unsigned int addr, diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 42aeab30bf0a..abcb507a48b3 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -159,7 +159,7 @@ static size_t wfx_sdio_align_size(void *priv, size_t size) return sdio_align_size(bus->func, size); } -static const struct hwbus_ops wfx_sdio_hwbus_ops = { +static const struct wfx_hwbus_ops wfx_sdio_hwbus_ops = { .copy_from_io = wfx_sdio_copy_from_io, .copy_to_io = wfx_sdio_copy_to_io, .irq_subscribe = wfx_sdio_irq_subscribe, diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index 55ffcd7c42e2..99d33a128830 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -168,7 +168,7 @@ static size_t wfx_spi_align_size(void *priv, size_t size) return ALIGN(size, 4); } -static const struct hwbus_ops wfx_spi_hwbus_ops = { +static const struct wfx_hwbus_ops wfx_spi_hwbus_ops = { .copy_from_io = wfx_spi_copy_from_io, .copy_to_io = wfx_spi_copy_to_io, .irq_subscribe = wfx_spi_irq_subscribe, diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index c004f455bb47..fec30d773e62 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -44,7 +44,7 @@ static int wfx_get_hw_rate(struct wfx_dev *wdev, /* TX policy cache implementation */ -static void wfx_tx_policy_build(struct wfx_vif *wvif, struct tx_policy *policy, +static void wfx_tx_policy_build(struct wfx_vif *wvif, struct wfx_tx_policy *policy, struct ieee80211_tx_rate *rates) { struct wfx_dev *wdev = wvif->wdev; @@ -66,16 +66,16 @@ static void wfx_tx_policy_build(struct wfx_vif *wvif, struct tx_policy *policy, } } -static bool wfx_tx_policy_is_equal(const struct tx_policy *a, - const struct tx_policy *b) +static bool wfx_tx_policy_is_equal(const struct wfx_tx_policy *a, + const struct wfx_tx_policy *b) { return !memcmp(a->rates, b->rates, sizeof(a->rates)); } -static int wfx_tx_policy_find(struct tx_policy_cache *cache, - struct tx_policy *wanted) +static int wfx_tx_policy_find(struct wfx_tx_policy_cache *cache, + struct wfx_tx_policy *wanted) { - struct tx_policy *it; + struct wfx_tx_policy *it; list_for_each_entry(it, &cache->used, link) if (wfx_tx_policy_is_equal(wanted, it)) @@ -86,15 +86,15 @@ static int wfx_tx_policy_find(struct tx_policy_cache *cache, return -1; } -static void wfx_tx_policy_use(struct tx_policy_cache *cache, - struct tx_policy *entry) +static void wfx_tx_policy_use(struct wfx_tx_policy_cache *cache, + struct wfx_tx_policy *entry) { ++entry->usage_count; list_move(&entry->link, &cache->used); } -static int wfx_tx_policy_release(struct tx_policy_cache *cache, - struct tx_policy *entry) +static int wfx_tx_policy_release(struct wfx_tx_policy_cache *cache, + struct wfx_tx_policy *entry) { int ret = --entry->usage_count; @@ -107,9 +107,9 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif, struct ieee80211_tx_rate *rates, bool *renew) { int idx; - struct tx_policy_cache *cache = &wvif->tx_policy_cache; - struct tx_policy wanted; - struct tx_policy *entry; + struct wfx_tx_policy_cache *cache = &wvif->tx_policy_cache; + struct wfx_tx_policy wanted; + struct wfx_tx_policy *entry; wfx_tx_policy_build(wvif, &wanted, rates); @@ -127,7 +127,7 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif, * entry in "free" list */ *renew = true; - entry = list_entry(cache->free.prev, struct tx_policy, link); + entry = list_entry(cache->free.prev, struct wfx_tx_policy, link); memcpy(entry->rates, wanted.rates, sizeof(entry->rates)); entry->uploaded = false; entry->usage_count = 0; @@ -143,7 +143,7 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif, static void wfx_tx_policy_put(struct wfx_vif *wvif, int idx) { int usage, locked; - struct tx_policy_cache *cache = &wvif->tx_policy_cache; + struct wfx_tx_policy_cache *cache = &wvif->tx_policy_cache; if (idx == HIF_TX_RETRY_POLICY_INVALID) return; @@ -157,7 +157,7 @@ static void wfx_tx_policy_put(struct wfx_vif *wvif, int idx) static int wfx_tx_policy_upload(struct wfx_vif *wvif) { - struct tx_policy *policies = wvif->tx_policy_cache.cache; + struct wfx_tx_policy *policies = wvif->tx_policy_cache.cache; u8 tmp_rates[12]; int i, is_used; @@ -192,7 +192,7 @@ void wfx_tx_policy_upload_work(struct work_struct *work) void wfx_tx_policy_init(struct wfx_vif *wvif) { - struct tx_policy_cache *cache = &wvif->tx_policy_cache; + struct wfx_tx_policy_cache *cache = &wvif->tx_policy_cache; int i; memset(cache, 0, sizeof(*cache)); @@ -435,8 +435,8 @@ drop: static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) { - struct wfx_hif_msg *hif = (struct hif_msg *)skb->data; - struct wfx_hif_req_tx *req = (struct hif_req_tx *)hif->body; + struct wfx_hif_msg *hif = (struct wfx_hif_msg *)skb->data; + struct wfx_hif_req_tx *req = (struct wfx_hif_req_tx *)hif->body; unsigned int offset = sizeof(struct wfx_hif_msg) + sizeof(struct wfx_hif_req_tx) + req->fc_offset; diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h index c901a03ee4d8..040f731e62ae 100644 --- a/drivers/staging/wfx/data_tx.h +++ b/drivers/staging/wfx/data_tx.h @@ -18,15 +18,15 @@ struct wfx_tx_priv; struct wfx_dev; struct wfx_vif; -struct tx_policy { +struct wfx_tx_policy { struct list_head link; int usage_count; u8 rates[12]; bool uploaded; }; -struct tx_policy_cache { - struct tx_policy cache[HIF_TX_RETRY_POLICY_MAX]; +struct wfx_tx_policy_cache { + struct wfx_tx_policy cache[HIF_TX_RETRY_POLICY_MAX]; /* FIXME: use a trees and drop hash from tx_policy */ struct list_head used; struct list_head free; @@ -59,8 +59,8 @@ static inline struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb) static inline struct wfx_hif_req_tx *wfx_skb_txreq(struct sk_buff *skb) { - struct wfx_hif_msg *hif = (struct hif_msg *)skb->data; - struct wfx_hif_req_tx *req = (struct hif_req_tx *)hif->body; + struct wfx_hif_msg *hif = (struct wfx_hif_msg *)skb->data; + struct wfx_hif_req_tx *req = (struct wfx_hif_req_tx *)hif->body; return req; } diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index f2564a20bdcf..2073ac43bebd 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -110,7 +110,7 @@ static int wfx_hif_receive_indication(struct wfx_dev *wdev, __func__, hif->interface); return -EIO; } - skb_pull(skb, sizeof(struct wfx_hif_msg) + sizeof(struct hif_ind_rx)); + skb_pull(skb, sizeof(struct wfx_hif_msg) + sizeof(struct wfx_hif_ind_rx)); wfx_rx_cb(wvif, body, skb); return 0; @@ -380,7 +380,7 @@ static const struct { void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) { int i; - const struct wfx_hif_msg *hif = (const struct hif_msg *)skb->data; + const struct wfx_hif_msg *hif = (const struct wfx_hif_msg *)skb->data; int hif_id = hif->id; if (hif_id == HIF_IND_ID_RX) { diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index f34cfed503d4..7b9d75f219fb 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -262,7 +262,7 @@ static void wfx_free_common(void *data) struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_data *pdata, - const struct hwbus_ops *hwbus_ops, + const struct wfx_hwbus_ops *hwbus_ops, void *hwbus_priv) { struct ieee80211_hw *hw; diff --git a/drivers/staging/wfx/main.h b/drivers/staging/wfx/main.h index 115abd2d4378..68a7807c5fb6 100644 --- a/drivers/staging/wfx/main.h +++ b/drivers/staging/wfx/main.h @@ -16,7 +16,7 @@ #include "hif_api_general.h" struct wfx_dev; -struct hwbus_ops; +struct wfx_hwbus_ops; struct wfx_platform_data { /* Keyset and ".sec" extension will be appended to this string */ @@ -31,7 +31,7 @@ struct wfx_platform_data { struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_data *pdata, - const struct hwbus_ops *hwbus_ops, + const struct wfx_hwbus_ops *hwbus_ops, void *hwbus_priv); int wfx_probe(struct wfx_dev *wdev); diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 1c06430e5996..189b96cd3d13 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -25,7 +25,7 @@ #define USEC_PER_TXOP 32 /* see struct ieee80211_tx_queue_params */ #define USEC_PER_TU 1024 -struct hwbus_ops; +struct wfx_hwbus_ops; struct wfx_dev { struct wfx_platform_data pdata; @@ -33,7 +33,7 @@ struct wfx_dev { struct ieee80211_hw *hw; struct ieee80211_vif *vif[2]; struct mac_address addresses[2]; - const struct hwbus_ops *hwbus_ops; + const struct wfx_hwbus_ops *hwbus_ops; void *hwbus_priv; u8 keyset; @@ -74,7 +74,7 @@ struct wfx_vif { struct delayed_work beacon_loss_work; struct wfx_queue tx_queue[4]; - struct tx_policy_cache tx_policy_cache; + struct wfx_tx_policy_cache tx_policy_cache; struct work_struct tx_policy_upload_work; struct work_struct update_tim_work; -- cgit From 381d32954f06ed2c84a3ac2d2628443497febf84 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:13 +0100 Subject: staging: wfx: reformat code on 100 columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until now, this driver was written in 80 columns style. However, since all the functions are prefixed with "wfx_", this constraint is no more respected in the last patches. From the perspective of kernel Coding Style, it is not a problem since it is now allowed to write code on 100 columns. This patch just unify the code to use 100 columns. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-21-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bh.c | 12 +++--- drivers/staging/wfx/bus.h | 6 +-- drivers/staging/wfx/bus_sdio.c | 12 ++---- drivers/staging/wfx/bus_spi.c | 24 ++++-------- drivers/staging/wfx/data_rx.c | 6 +-- drivers/staging/wfx/data_rx.h | 3 +- drivers/staging/wfx/data_tx.c | 71 ++++++++++++---------------------- drivers/staging/wfx/data_tx.h | 6 +-- drivers/staging/wfx/debug.c | 27 +++++-------- drivers/staging/wfx/fwio.c | 33 ++++++---------- drivers/staging/wfx/hif_rx.c | 60 ++++++++++------------------- drivers/staging/wfx/hif_tx.c | 63 ++++++++++-------------------- drivers/staging/wfx/hif_tx.h | 9 ++--- drivers/staging/wfx/hif_tx_mib.c | 81 ++++++++++++++------------------------- drivers/staging/wfx/hif_tx_mib.h | 21 ++++------ drivers/staging/wfx/hwio.c | 51 ++++++++---------------- drivers/staging/wfx/key.c | 62 ++++++++++++------------------ drivers/staging/wfx/key.h | 5 +-- drivers/staging/wfx/main.c | 56 +++++++++++---------------- drivers/staging/wfx/main.h | 6 +-- drivers/staging/wfx/queue.c | 24 ++++-------- drivers/staging/wfx/queue.h | 3 +- drivers/staging/wfx/scan.c | 12 ++---- drivers/staging/wfx/sta.c | 83 ++++++++++++++-------------------------- drivers/staging/wfx/sta.h | 22 ++++------- drivers/staging/wfx/traces.h | 14 +++---- drivers/staging/wfx/wfx.h | 3 +- 27 files changed, 269 insertions(+), 506 deletions(-) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index 872f3298dc87..b9a351913868 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -37,8 +37,7 @@ static void device_wakeup(struct wfx_dev *wdev) * wait_for_completion_done_timeout()). So we have to emulate * it. */ - if (wait_for_completion_timeout(&wdev->hif.ctrl_ready, - msecs_to_jiffies(2))) { + if (wait_for_completion_timeout(&wdev->hif.ctrl_ready, msecs_to_jiffies(2))) { complete(&wdev->hif.ctrl_ready); return; } else if (max_retry-- > 0) { @@ -105,7 +104,8 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) if (!(hif->id & HIF_ID_IS_INDICATION)) { (*is_cnf)++; if (hif->id == HIF_CNF_ID_MULTI_TRANSMIT) - release_count = ((struct wfx_hif_cnf_multi_transmit *)hif->body)->num_tx_confs; + release_count = + ((struct wfx_hif_cnf_multi_transmit *)hif->body)->num_tx_confs; else release_count = 1; WARN(wdev->hif.tx_buffers_used < release_count, "corrupted buffer counter"); @@ -229,8 +229,7 @@ static void ack_sdio_data(struct wfx_dev *wdev) wfx_config_reg_read(wdev, &cfg_reg); if (cfg_reg & 0xFF) { - dev_warn(wdev->dev, "chip reports errors: %02x\n", - cfg_reg & 0xFF); + dev_warn(wdev->dev, "chip reports errors: %02x\n", cfg_reg & 0xFF); wfx_config_reg_write_bits(wdev, 0xFF, 0x00); } } @@ -261,8 +260,7 @@ static void bh_work(struct work_struct *work) device_release(wdev); release_chip = true; } - _trace_bh_stats(stats_ind, stats_req, stats_cnf, - wdev->hif.tx_buffers_used, release_chip); + _trace_bh_stats(stats_ind, stats_req, stats_cnf, wdev->hif.tx_buffers_used, release_chip); } /* An IRQ from chip did occur */ diff --git a/drivers/staging/wfx/bus.h b/drivers/staging/wfx/bus.h index 91b5a545b8ff..ccadfdd6873c 100644 --- a/drivers/staging/wfx/bus.h +++ b/drivers/staging/wfx/bus.h @@ -21,10 +21,8 @@ #define WFX_REG_FRAME_OUT 0x7 struct wfx_hwbus_ops { - int (*copy_from_io)(void *bus_priv, unsigned int addr, - void *dst, size_t count); - int (*copy_to_io)(void *bus_priv, unsigned int addr, - const void *src, size_t count); + int (*copy_from_io)(void *bus_priv, unsigned int addr, void *dst, size_t count); + int (*copy_to_io)(void *bus_priv, unsigned int addr, const void *src, size_t count); int (*irq_subscribe)(void *bus_priv); int (*irq_unsubscribe)(void *bus_priv); void (*lock)(void *bus_priv); diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index abcb507a48b3..a3da661e355c 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -33,8 +33,7 @@ struct wfx_sdio_priv { int of_irq; }; -static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id, - void *dst, size_t count) +static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id, void *dst, size_t count) { struct wfx_sdio_priv *bus = priv; unsigned int sdio_addr = reg_id << 2; @@ -54,8 +53,7 @@ static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id, return ret; } -static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id, - const void *src, size_t count) +static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id, const void *src, size_t count) { struct wfx_sdio_priv *bus = priv; unsigned int sdio_addr = reg_id << 2; @@ -126,8 +124,7 @@ static int wfx_sdio_irq_subscribe(void *priv) flags = IRQF_TRIGGER_HIGH; flags |= IRQF_ONESHOT; ret = devm_request_threaded_irq(&bus->func->dev, bus->of_irq, NULL, - wfx_sdio_irq_handler_ext, flags, - "wfx", bus); + wfx_sdio_irq_handler_ext, flags, "wfx", bus); if (ret) return ret; sdio_claim_host(bus->func); @@ -176,8 +173,7 @@ static const struct of_device_id wfx_sdio_of_match[] = { }; MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); -static int wfx_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) +static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { struct device_node *np = func->dev.of_node; struct wfx_sdio_priv *bus; diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index 99d33a128830..43bc6e147d5f 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -46,8 +46,7 @@ struct wfx_spi_priv { * natively. The code below to support big endian host and commonly used SPI * 8bits. */ -static int wfx_spi_copy_from_io(void *priv, unsigned int addr, - void *dst, size_t count) +static int wfx_spi_copy_from_io(void *priv, unsigned int addr, void *dst, size_t count) { struct wfx_spi_priv *bus = priv; u16 regaddr = (addr << 12) | (count / 2) | SET_READ; @@ -80,8 +79,7 @@ static int wfx_spi_copy_from_io(void *priv, unsigned int addr, return ret; } -static int wfx_spi_copy_to_io(void *priv, unsigned int addr, - const void *src, size_t count) +static int wfx_spi_copy_to_io(void *priv, unsigned int addr, const void *src, size_t count) { struct wfx_spi_priv *bus = priv; u16 regaddr = (addr << 12) | (count / 2); @@ -149,8 +147,7 @@ static int wfx_spi_irq_subscribe(void *priv) flags = IRQF_TRIGGER_HIGH; flags |= IRQF_ONESHOT; return devm_request_threaded_irq(&bus->func->dev, bus->func->irq, NULL, - wfx_spi_irq_handler, IRQF_ONESHOT, - "wfx", bus); + wfx_spi_irq_handler, IRQF_ONESHOT, "wfx", bus); } static int wfx_spi_irq_unsubscribe(void *priv) @@ -190,14 +187,11 @@ static int wfx_spi_probe(struct spi_device *func) return ret; /* Trace below is also displayed by spi_setup() if compiled with DEBUG */ dev_dbg(&func->dev, "SPI params: CS=%d, mode=%d bits/word=%d speed=%d\n", - func->chip_select, func->mode, func->bits_per_word, - func->max_speed_hz); + func->chip_select, func->mode, func->bits_per_word, func->max_speed_hz); if (func->bits_per_word != 16 && func->bits_per_word != 8) - dev_warn(&func->dev, "unusual bits/word value: %d\n", - func->bits_per_word); + dev_warn(&func->dev, "unusual bits/word value: %d\n", func->bits_per_word); if (func->max_speed_hz > 50000000) - dev_warn(&func->dev, "%dHz is a very high speed\n", - func->max_speed_hz); + dev_warn(&func->dev, "%dHz is a very high speed\n", func->max_speed_hz); bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); if (!bus) @@ -207,13 +201,11 @@ static int wfx_spi_probe(struct spi_device *func) bus->need_swab = true; spi_set_drvdata(func, bus); - bus->gpio_reset = devm_gpiod_get_optional(&func->dev, "reset", - GPIOD_OUT_LOW); + bus->gpio_reset = devm_gpiod_get_optional(&func->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(bus->gpio_reset)) return PTR_ERR(bus->gpio_reset); if (!bus->gpio_reset) { - dev_warn(&func->dev, - "gpio reset is not defined, trying to load firmware anyway\n"); + dev_warn(&func->dev, "gpio reset is not defined, trying to load firmware anyway\n"); } else { gpiod_set_consumer_name(bus->gpio_reset, "wfx reset"); if (spi_get_device_id(func)->driver_data & WFX_RESET_INVERTED) diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c index 3fe67c4815e7..4beee2624998 100644 --- a/drivers/staging/wfx/data_rx.c +++ b/drivers/staging/wfx/data_rx.c @@ -34,8 +34,7 @@ static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt) } } -void wfx_rx_cb(struct wfx_vif *wvif, - const struct wfx_hif_ind_rx *arg, struct sk_buff *skb) +void wfx_rx_cb(struct wfx_vif *wvif, const struct wfx_hif_ind_rx *arg, struct sk_buff *skb) { struct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb); struct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb->data; @@ -54,8 +53,7 @@ void wfx_rx_cb(struct wfx_vif *wvif, } hdr->band = NL80211_BAND_2GHZ; - hdr->freq = ieee80211_channel_to_frequency(arg->channel_number, - hdr->band); + hdr->freq = ieee80211_channel_to_frequency(arg->channel_number, hdr->band); if (arg->rxed_rate >= 14) { hdr->encoding = RX_ENC_HT; diff --git a/drivers/staging/wfx/data_rx.h b/drivers/staging/wfx/data_rx.h index 7d77cdbbc31b..cf708f16d602 100644 --- a/drivers/staging/wfx/data_rx.h +++ b/drivers/staging/wfx/data_rx.h @@ -12,7 +12,6 @@ struct wfx_vif; struct sk_buff; struct wfx_hif_ind_rx; -void wfx_rx_cb(struct wfx_vif *wvif, - const struct wfx_hif_ind_rx *arg, struct sk_buff *skb); +void wfx_rx_cb(struct wfx_vif *wvif, const struct wfx_hif_ind_rx *arg, struct sk_buff *skb); #endif diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index fec30d773e62..0bfbf57cc035 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -17,8 +17,7 @@ #include "traces.h" #include "hif_tx_mib.h" -static int wfx_get_hw_rate(struct wfx_dev *wdev, - const struct ieee80211_tx_rate *rate) +static int wfx_get_hw_rate(struct wfx_dev *wdev, const struct ieee80211_tx_rate *rate) { struct ieee80211_supported_band *band; @@ -66,14 +65,12 @@ static void wfx_tx_policy_build(struct wfx_vif *wvif, struct wfx_tx_policy *poli } } -static bool wfx_tx_policy_is_equal(const struct wfx_tx_policy *a, - const struct wfx_tx_policy *b) +static bool wfx_tx_policy_is_equal(const struct wfx_tx_policy *a, const struct wfx_tx_policy *b) { return !memcmp(a->rates, b->rates, sizeof(a->rates)); } -static int wfx_tx_policy_find(struct wfx_tx_policy_cache *cache, - struct wfx_tx_policy *wanted) +static int wfx_tx_policy_find(struct wfx_tx_policy_cache *cache, struct wfx_tx_policy *wanted) { struct wfx_tx_policy *it; @@ -86,15 +83,13 @@ static int wfx_tx_policy_find(struct wfx_tx_policy_cache *cache, return -1; } -static void wfx_tx_policy_use(struct wfx_tx_policy_cache *cache, - struct wfx_tx_policy *entry) +static void wfx_tx_policy_use(struct wfx_tx_policy_cache *cache, struct wfx_tx_policy *entry) { ++entry->usage_count; list_move(&entry->link, &cache->used); } -static int wfx_tx_policy_release(struct wfx_tx_policy_cache *cache, - struct wfx_tx_policy *entry) +static int wfx_tx_policy_release(struct wfx_tx_policy_cache *cache, struct wfx_tx_policy *entry) { int ret = --entry->usage_count; @@ -103,8 +98,7 @@ static int wfx_tx_policy_release(struct wfx_tx_policy_cache *cache, return ret; } -static int wfx_tx_policy_get(struct wfx_vif *wvif, - struct ieee80211_tx_rate *rates, bool *renew) +static int wfx_tx_policy_get(struct wfx_vif *wvif, struct ieee80211_tx_rate *rates, bool *renew) { int idx; struct wfx_tx_policy_cache *cache = &wvif->tx_policy_cache; @@ -164,8 +158,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif) do { spin_lock_bh(&wvif->tx_policy_cache.lock); for (i = 0; i < ARRAY_SIZE(wvif->tx_policy_cache.cache); ++i) { - is_used = memzcmp(policies[i].rates, - sizeof(policies[i].rates)); + is_used = memzcmp(policies[i].rates, sizeof(policies[i].rates)); if (!policies[i].uploaded && is_used) break; } @@ -183,8 +176,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif) void wfx_tx_policy_upload_work(struct work_struct *work) { - struct wfx_vif *wvif = - container_of(work, struct wfx_vif, tx_policy_upload_work); + struct wfx_vif *wvif = container_of(work, struct wfx_vif, tx_policy_upload_work); wfx_tx_policy_upload(wvif); wfx_tx_unlock(wvif->wdev); @@ -221,8 +213,7 @@ static bool wfx_is_action_back(struct ieee80211_hdr *hdr) static u8 wfx_tx_get_link_id(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct ieee80211_hdr *hdr) { - struct wfx_sta_priv *sta_priv = - sta ? (struct wfx_sta_priv *)&sta->drv_priv : NULL; + struct wfx_sta_priv *sta_priv = sta ? (struct wfx_sta_priv *)&sta->drv_priv : NULL; const u8 *da = ieee80211_get_DA(hdr); if (sta_priv && sta_priv->link_id) @@ -276,8 +267,7 @@ static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates) if (rates[i].idx == -1) { rates[i].idx = 0; rates[i].count = 8; /* == hw->max_rate_tries */ - rates[i].flags = rates[i - 1].flags & - IEEE80211_TX_RC_MCS; + rates[i].flags = rates[i - 1].flags & IEEE80211_TX_RC_MCS; break; } } @@ -286,8 +276,7 @@ static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates) rates[i].flags &= ~IEEE80211_TX_RC_SHORT_GI; } -static u8 wfx_tx_get_retry_policy_id(struct wfx_vif *wvif, - struct ieee80211_tx_info *tx_info) +static u8 wfx_tx_get_retry_policy_id(struct wfx_vif *wvif, struct ieee80211_tx_info *tx_info) { bool tx_policy_renew = false; u8 ret; @@ -326,8 +315,7 @@ static int wfx_tx_get_icv_len(struct ieee80211_key_conf *hw_key) return hw_key->icv_len + mic_space; } -static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, - struct sk_buff *skb) +static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct sk_buff *skb) { struct wfx_hif_msg *hif_msg; struct wfx_hif_req_tx *req; @@ -337,8 +325,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; int queue_id = skb_get_queue_mapping(skb); size_t offset = (size_t)skb->data & 3; - int wmsg_len = sizeof(struct wfx_hif_msg) + - sizeof(struct wfx_hif_req_tx) + offset; + int wmsg_len = sizeof(struct wfx_hif_msg) + sizeof(struct wfx_hif_req_tx) + offset; WARN(queue_id >= IEEE80211_NUM_ACS, "unsupported queue_id"); wfx_tx_fixup_rates(tx_info->driver_rates); @@ -396,16 +383,14 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, return 0; } -void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, - struct sk_buff *skb) +void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb) { struct wfx_dev *wdev = hw->priv; struct wfx_vif *wvif; struct ieee80211_sta *sta = control ? control->sta : NULL; struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - size_t driver_data_room = sizeof_field(struct ieee80211_tx_info, - rate_driver_data); + size_t driver_data_room = sizeof_field(struct ieee80211_tx_info, rate_driver_data); compiletime_assert(sizeof(struct wfx_tx_priv) <= driver_data_room, "struct tx_priv is too large"); @@ -437,8 +422,7 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) { struct wfx_hif_msg *hif = (struct wfx_hif_msg *)skb->data; struct wfx_hif_req_tx *req = (struct wfx_hif_req_tx *)hif->body; - unsigned int offset = sizeof(struct wfx_hif_msg) + - sizeof(struct wfx_hif_req_tx) + + unsigned int offset = sizeof(struct wfx_hif_msg) + sizeof(struct wfx_hif_req_tx) + req->fc_offset; if (!wvif) { @@ -450,8 +434,7 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) ieee80211_tx_status_irqsafe(wvif->wdev->hw, skb); } -static void wfx_tx_fill_rates(struct wfx_dev *wdev, - struct ieee80211_tx_info *tx_info, +static void wfx_tx_fill_rates(struct wfx_dev *wdev, struct ieee80211_tx_info *tx_info, const struct wfx_hif_cnf_tx *arg) { struct ieee80211_tx_rate *rate; @@ -465,8 +448,7 @@ static void wfx_tx_fill_rates(struct wfx_dev *wdev, rate = &tx_info->status.rates[i]; if (rate->idx < 0) break; - if (tx_count < rate->count && - arg->status == HIF_STATUS_TX_FAIL_RETRIES && + if (tx_count < rate->count && arg->status == HIF_STATUS_TX_FAIL_RETRIES && arg->ack_failures) dev_dbg(wdev->dev, "all retries were not consumed: %d != %d\n", rate->count, tx_count); @@ -521,9 +503,8 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg) memset(tx_info->pad, 0, sizeof(tx_info->pad)); if (!arg->status) { - tx_info->status.tx_time = - le32_to_cpu(arg->media_delay) - - le32_to_cpu(arg->tx_queue_delay); + tx_info->status.tx_time = le32_to_cpu(arg->media_delay) - + le32_to_cpu(arg->tx_queue_delay); if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) tx_info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED; else @@ -539,8 +520,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg) wfx_skb_dtor(wvif, skb); } -static void wfx_flush_vif(struct wfx_vif *wvif, u32 queues, - struct sk_buff_head *dropped) +static void wfx_flush_vif(struct wfx_vif *wvif, u32 queues, struct sk_buff_head *dropped) { struct wfx_queue *queue; int i; @@ -558,16 +538,13 @@ static void wfx_flush_vif(struct wfx_vif *wvif, u32 queues, if (!(BIT(i) & queues)) continue; queue = &wvif->tx_queue[i]; - if (wait_event_timeout(wvif->wdev->tx_dequeue, - wfx_tx_queue_empty(wvif, queue), + if (wait_event_timeout(wvif->wdev->tx_dequeue, wfx_tx_queue_empty(wvif, queue), msecs_to_jiffies(1000)) <= 0) - dev_warn(wvif->wdev->dev, - "frames queued while flushing tx queues?"); + dev_warn(wvif->wdev->dev, "frames queued while flushing tx queues?"); } } -void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u32 queues, bool drop) +void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop) { struct wfx_dev *wdev = hw->priv; struct sk_buff_head dropped; diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h index 040f731e62ae..983470705e4b 100644 --- a/drivers/staging/wfx/data_tx.h +++ b/drivers/staging/wfx/data_tx.h @@ -41,11 +41,9 @@ struct wfx_tx_priv { void wfx_tx_policy_init(struct wfx_vif *wvif); void wfx_tx_policy_upload_work(struct work_struct *work); -void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, - struct sk_buff *skb); +void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb); void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg); -void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u32 queues, bool drop); +void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop); static inline struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb) { diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index f0796eb2afff..210e2336d43a 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -31,8 +31,7 @@ static const struct trace_print_flags wfx_reg_print_map[] = { wfx_reg_list, }; -static const char *get_symbol(unsigned long val, - const struct trace_print_flags *symbol_array) +static const char *get_symbol(unsigned long val, const struct trace_print_flags *symbol_array) { int i; @@ -73,8 +72,7 @@ static int wfx_counters_show(struct seq_file *seq, void *v) return -EIO; } - seq_printf(seq, "%-24s %12s %12s %12s\n", - "", "global", "iface 0", "iface 1"); + seq_printf(seq, "%-24s %12s %12s %12s\n", "", "global", "iface 0", "iface 1"); #define PUT_COUNTER(name) \ seq_printf(seq, "%-24s %12d %12d %12d\n", #name, \ @@ -159,10 +157,8 @@ static int wfx_rx_stats_show(struct seq_file *seq, void *v) mutex_lock(&wdev->rx_stats_lock); seq_printf(seq, "Timestamp: %dus\n", st->date); seq_printf(seq, "Low power clock: frequency %uHz, external %s\n", - le32_to_cpu(st->pwr_clk_freq), - st->is_ext_pwr_clk ? "yes" : "no"); - seq_printf(seq, - "Num. of frames: %d, PER (x10e4): %d, Throughput: %dKbps/s\n", + le32_to_cpu(st->pwr_clk_freq), st->is_ext_pwr_clk ? "yes" : "no"); + seq_printf(seq, "Num. of frames: %d, PER (x10e4): %d, Throughput: %dKbps/s\n", st->nb_rx_frame, st->per_total, st->throughput); seq_puts(seq, " Num. of PER RSSI SNR CFO\n"); seq_puts(seq, " frames (x10e4) (dBm) (dB) (kHz)\n"); @@ -206,8 +202,7 @@ static int wfx_tx_power_loop_show(struct seq_file *seq, void *v) } DEFINE_SHOW_ATTRIBUTE(wfx_tx_power_loop); -static ssize_t wfx_send_pds_write(struct file *file, - const char __user *user_buf, +static ssize_t wfx_send_pds_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { struct wfx_dev *wdev = file->private_data; @@ -241,8 +236,7 @@ struct dbgfs_hif_msg { int ret; }; -static ssize_t wfx_send_hif_msg_write(struct file *file, - const char __user *user_buf, +static ssize_t wfx_send_hif_msg_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { struct dbgfs_hif_msg *context = file->private_data; @@ -268,8 +262,7 @@ static ssize_t wfx_send_hif_msg_write(struct file *file, kfree(request); return -EINVAL; } - context->ret = wfx_cmd_send(wdev, request, context->reply, - sizeof(context->reply), false); + context->ret = wfx_cmd_send(wdev, request, context->reply, sizeof(context->reply), false); kfree(request); complete(&context->complete); @@ -354,11 +347,9 @@ int wfx_debug_init(struct wfx_dev *wdev) d = debugfs_create_dir("wfx", wdev->hw->wiphy->debugfsdir); debugfs_create_file("counters", 0444, d, wdev, &wfx_counters_fops); debugfs_create_file("rx_stats", 0444, d, wdev, &wfx_rx_stats_fops); - debugfs_create_file("tx_power_loop", 0444, d, wdev, - &wfx_tx_power_loop_fops); + debugfs_create_file("tx_power_loop", 0444, d, wdev, &wfx_tx_power_loop_fops); debugfs_create_file("send_pds", 0200, d, wdev, &wfx_send_pds_fops); - debugfs_create_file("send_hif_msg", 0600, d, wdev, - &wfx_send_hif_msg_fops); + debugfs_create_file("send_hif_msg", 0600, d, wdev, &wfx_send_hif_msg_fops); debugfs_create_file("ps_timeout", 0600, d, wdev, &wfx_ps_timeout_fops); return 0; diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c index c9a54c519e8a..89a46fb0e789 100644 --- a/drivers/staging/wfx/fwio.c +++ b/drivers/staging/wfx/fwio.c @@ -79,8 +79,7 @@ static const char * const fwio_errors[] = { * NOTE: it may also be possible to use 'pages' from struct firmware and avoid * bounce buffer */ -static int wfx_sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, - const u8 *buf, size_t len) +static int wfx_sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, size_t len) { int ret; const u8 *tmp; @@ -112,8 +111,7 @@ static int get_firmware(struct wfx_dev *wdev, u32 keyset_chip, if (ret) { dev_info(wdev->dev, "can't load %s, falling back to %s.sec\n", filename, wdev->pdata.file_fw); - snprintf(filename, sizeof(filename), "%s.sec", - wdev->pdata.file_fw); + snprintf(filename, sizeof(filename), "%s.sec", wdev->pdata.file_fw); ret = request_firmware(fw, filename, wdev->dev); if (ret) { dev_err(wdev->dev, "can't load %s\n", filename); @@ -166,8 +164,7 @@ static int wait_ncp_status(struct wfx_dev *wdev, u32 status) return -ETIMEDOUT; } if (ktime_compare(now, start)) - dev_dbg(wdev->dev, "chip answer after %lldus\n", - ktime_us_delta(now, start)); + dev_dbg(wdev->dev, "chip answer after %lldus\n", ktime_us_delta(now, start)); else dev_dbg(wdev->dev, "chip answer immediately\n"); return 0; @@ -200,8 +197,7 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) dev_dbg(wdev->dev, "answer after %lldus\n", ktime_us_delta(now, start)); - ret = wfx_sram_write_dma_safe(wdev, - WFX_DNLD_FIFO + (offs % DNLD_FIFO_SIZE), + ret = wfx_sram_write_dma_safe(wdev, WFX_DNLD_FIFO + (offs % DNLD_FIFO_SIZE), data + offs, DNLD_BLOCK_SIZE); if (ret < 0) return ret; @@ -266,12 +262,10 @@ static int load_firmware_secure(struct wfx_dev *wdev) goto error; wfx_sram_reg_write(wdev, WFX_DNLD_FIFO, 0xFFFFFFFF); /* Fifo init */ - wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00", - FW_VERSION_SIZE); + wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00", FW_VERSION_SIZE); wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_SIGNATURE, fw->data + fw_offset, FW_SIGNATURE_SIZE); - wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_HASH, - fw->data + fw_offset + FW_SIGNATURE_SIZE, + wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_HASH, fw->data + fw_offset + FW_SIGNATURE_SIZE, FW_HASH_SIZE); wfx_sram_reg_write(wdev, WFX_DCA_IMAGE_SIZE, fw->size - header_size); wfx_sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_PENDING); @@ -280,8 +274,7 @@ static int load_firmware_secure(struct wfx_dev *wdev) goto error; start = ktime_get(); - ret = upload_firmware(wdev, fw->data + header_size, - fw->size - header_size); + ret = upload_firmware(wdev, fw->data + header_size, fw->size - header_size); if (ret) goto error; dev_dbg(wdev->dev, "firmware load after %lldus\n", @@ -320,12 +313,10 @@ static int init_gpr(struct wfx_dev *wdev) }; for (i = 0; i < ARRAY_SIZE(gpr_init); i++) { - ret = wfx_igpr_reg_write(wdev, gpr_init[i].index, - gpr_init[i].value); + ret = wfx_igpr_reg_write(wdev, gpr_init[i].index, gpr_init[i].value); if (ret < 0) return ret; - dev_dbg(wdev->dev, " index %02x: %08x\n", - gpr_init[i].index, gpr_init[i].value); + dev_dbg(wdev->dev, " index %02x: %08x\n", gpr_init[i].index, gpr_init[i].value); } return 0; } @@ -360,8 +351,7 @@ int wfx_init_device(struct wfx_dev *wdev) hw_revision = FIELD_GET(CFG_DEVICE_ID_MAJOR, reg); if (hw_revision == 0) { - dev_err(wdev->dev, "bad hardware revision number: %d\n", - hw_revision); + dev_err(wdev->dev, "bad hardware revision number: %d\n", hw_revision); return -ENODEV; } hw_type = FIELD_GET(CFG_DEVICE_ID_TYPE, reg); @@ -388,8 +378,7 @@ int wfx_init_device(struct wfx_dev *wdev) return -ETIMEDOUT; } } - dev_dbg(wdev->dev, "chip wake up after %lldus\n", - ktime_us_delta(now, start)); + dev_dbg(wdev->dev, "chip wake up after %lldus\n", ktime_us_delta(now, start)); ret = wfx_config_reg_write_bits(wdev, CFG_CPU_RESET, 0); if (ret < 0) diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index 2073ac43bebd..1ddf8c51c303 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -32,8 +32,7 @@ static int wfx_hif_generic_confirm(struct wfx_dev *wdev, } if (cmd != wdev->hif_cmd.buf_send->id) { - dev_warn(wdev->dev, - "chip response mismatch request: 0x%.2x vs 0x%.2x\n", + dev_warn(wdev->dev, "chip response mismatch request: 0x%.2x vs 0x%.2x\n", cmd, wdev->hif_cmd.buf_send->id); return -EINVAL; } @@ -72,8 +71,7 @@ static int wfx_hif_multi_tx_confirm(struct wfx_dev *wdev, } static int wfx_hif_startup_indication(struct wfx_dev *wdev, - const struct wfx_hif_msg *hif, - const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { const struct wfx_hif_ind_startup *body = buf; @@ -87,19 +85,16 @@ static int wfx_hif_startup_indication(struct wfx_dev *wdev, } static int wfx_hif_wakeup_indication(struct wfx_dev *wdev, - const struct wfx_hif_msg *hif, - const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { - if (!wdev->pdata.gpio_wakeup || - gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) { + if (!wdev->pdata.gpio_wakeup || gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) { dev_warn(wdev->dev, "unexpected wake-up indication\n"); return -EIO; } return 0; } -static int wfx_hif_receive_indication(struct wfx_dev *wdev, - const struct wfx_hif_msg *hif, +static int wfx_hif_receive_indication(struct wfx_dev *wdev, const struct wfx_hif_msg *hif, const void *buf, struct sk_buff *skb) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); @@ -144,16 +139,14 @@ static int wfx_hif_event_indication(struct wfx_dev *wdev, le32_to_cpu(body->event_data.ps_mode_error)); break; default: - dev_warn(wdev->dev, "unhandled event indication: %.2x\n", - type); + dev_warn(wdev->dev, "unhandled event indication: %.2x\n", type); break; } return 0; } static int wfx_hif_pm_mode_complete_indication(struct wfx_dev *wdev, - const struct wfx_hif_msg *hif, - const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); @@ -167,8 +160,7 @@ static int wfx_hif_pm_mode_complete_indication(struct wfx_dev *wdev, } static int wfx_hif_scan_complete_indication(struct wfx_dev *wdev, - const struct wfx_hif_msg *hif, - const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); const struct wfx_hif_ind_scan_cmpl *body = buf; @@ -184,8 +176,7 @@ static int wfx_hif_scan_complete_indication(struct wfx_dev *wdev, } static int wfx_hif_join_complete_indication(struct wfx_dev *wdev, - const struct wfx_hif_msg *hif, - const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); @@ -199,8 +190,7 @@ static int wfx_hif_join_complete_indication(struct wfx_dev *wdev, } static int wfx_hif_suspend_resume_indication(struct wfx_dev *wdev, - const struct wfx_hif_msg *hif, - const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { const struct wfx_hif_ind_suspend_resume_tx *body = buf; struct wfx_vif *wvif; @@ -228,8 +218,7 @@ static int wfx_hif_suspend_resume_indication(struct wfx_dev *wdev, } static int wfx_hif_generic_indication(struct wfx_dev *wdev, - const struct wfx_hif_msg *hif, - const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { const struct wfx_hif_ind_generic *body = buf; int type = le32_to_cpu(body->type); @@ -246,14 +235,12 @@ static int wfx_hif_generic_indication(struct wfx_dev *wdev, if (!wfx_api_older_than(wdev, 1, 4)) dev_info(wdev->dev, "Rx test ongoing. Temperature: %d degrees C\n", body->data.rx_stats.current_temp); - memcpy(&wdev->rx_stats, &body->data.rx_stats, - sizeof(wdev->rx_stats)); + memcpy(&wdev->rx_stats, &body->data.rx_stats, sizeof(wdev->rx_stats)); mutex_unlock(&wdev->rx_stats_lock); return 0; case HIF_GENERIC_INDICATION_TYPE_TX_POWER_LOOP_INFO: mutex_lock(&wdev->tx_power_loop_info_lock); - memcpy(&wdev->tx_power_loop_info, - &body->data.tx_power_loop_info, + memcpy(&wdev->tx_power_loop_info, &body->data.tx_power_loop_info, sizeof(wdev->tx_power_loop_info)); mutex_unlock(&wdev->tx_power_loop_info_lock); return 0; @@ -324,8 +311,7 @@ static int wfx_hif_error_indication(struct wfx_dev *wdev, dev_err(wdev->dev, "asynchronous error: %s: %d\n", hif_errors[i].str, param); else - dev_err(wdev->dev, "asynchronous error: %s\n", - hif_errors[i].str); + dev_err(wdev->dev, "asynchronous error: %s\n", hif_errors[i].str); else dev_err(wdev->dev, "asynchronous error: unknown: %08x\n", type); print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, @@ -336,15 +322,13 @@ static int wfx_hif_error_indication(struct wfx_dev *wdev, }; static int wfx_hif_exception_indication(struct wfx_dev *wdev, - const struct wfx_hif_msg *hif, - const void *buf) + const struct wfx_hif_msg *hif, const void *buf) { const struct wfx_hif_ind_exception *body = buf; int type = le32_to_cpu(body->type); if (type == 4) - dev_err(wdev->dev, "firmware assert %d\n", - le32_to_cpup((__le32 *)body->data)); + dev_err(wdev->dev, "firmware assert %d\n", le32_to_cpup((__le32 *)body->data)); else dev_err(wdev->dev, "firmware exception\n"); print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, @@ -356,8 +340,7 @@ static int wfx_hif_exception_indication(struct wfx_dev *wdev, static const struct { int msg_id; - int (*handler)(struct wfx_dev *wdev, - const struct wfx_hif_msg *hif, const void *buf); + int (*handler)(struct wfx_dev *wdev, const struct wfx_hif_msg *hif, const void *buf); } hif_handlers[] = { /* Confirmations */ { HIF_CNF_ID_TX, wfx_hif_tx_confirm }, @@ -392,8 +375,7 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) * buf_send */ if (mutex_is_locked(&wdev->hif_cmd.lock) && - wdev->hif_cmd.buf_send && - wdev->hif_cmd.buf_send->id == hif_id) { + wdev->hif_cmd.buf_send && wdev->hif_cmd.buf_send->id == hif_id) { wfx_hif_generic_confirm(wdev, hif, hif->body); goto free; } @@ -405,11 +387,9 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) } } if (hif_id & HIF_ID_IS_INDICATION) - dev_err(wdev->dev, "unsupported HIF indication: ID %02x\n", - hif_id); + dev_err(wdev->dev, "unsupported HIF indication: ID %02x\n", hif_id); else - dev_err(wdev->dev, "unexpected HIF confirmation: ID %02x\n", - hif_id); + dev_err(wdev->dev, "unexpected HIF confirmation: ID %02x\n", hif_id); free: dev_kfree_skb(skb); } diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 429c70b991e1..b88a73077b48 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -22,8 +22,7 @@ void wfx_init_hif_cmd(struct wfx_hif_cmd *hif_cmd) mutex_init(&hif_cmd->lock); } -static void wfx_fill_header(struct wfx_hif_msg *hif, int if_id, - unsigned int cmd, size_t size) +static void wfx_fill_header(struct wfx_hif_msg *hif, int if_id, unsigned int cmd, size_t size) { if (if_id == -1) if_id = 2; @@ -190,14 +189,12 @@ int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, ret = wfx_cmd_send(wdev, hif, reply, buf_len, false); if (!ret && mib_id != le16_to_cpu(reply->mib_id)) { - dev_warn(wdev->dev, "%s: confirmation mismatch request\n", - __func__); + dev_warn(wdev->dev, "%s: confirmation mismatch request\n", __func__); ret = -EIO; } if (ret == -ENOMEM) dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n", - wfx_get_mib_name(mib_id), val_len, - le16_to_cpu(reply->length)); + wfx_get_mib_name(mib_id), val_len, le16_to_cpu(reply->length)); if (!ret) memcpy(val, &reply->mib_data, le16_to_cpu(reply->length)); else @@ -208,8 +205,7 @@ out: return ret; } -int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *val, size_t val_len) +int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, size_t val_len) { int ret; struct wfx_hif_msg *hif; @@ -232,8 +228,7 @@ int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, { int ret, i; struct wfx_hif_msg *hif; - size_t buf_len = sizeof(struct wfx_hif_req_start_scan_alt) + - chan_num * sizeof(u8); + size_t buf_len = sizeof(struct wfx_hif_req_start_scan_alt) + chan_num * sizeof(u8); struct wfx_hif_req_start_scan_alt *body = wfx_alloc_hif(buf_len, &hif); WARN(chan_num > HIF_API_MAX_NB_CHANNELS, "invalid params"); @@ -242,20 +237,16 @@ int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, if (!hif) return -ENOMEM; for (i = 0; i < req->n_ssids; i++) { - memcpy(body->ssid_def[i].ssid, req->ssids[i].ssid, - IEEE80211_MAX_SSID_LEN); - body->ssid_def[i].ssid_length = - cpu_to_le32(req->ssids[i].ssid_len); + memcpy(body->ssid_def[i].ssid, req->ssids[i].ssid, IEEE80211_MAX_SSID_LEN); + body->ssid_def[i].ssid_length = cpu_to_le32(req->ssids[i].ssid_len); } body->num_of_ssids = HIF_API_MAX_NB_SSIDS; body->maintain_current_bss = 1; body->disallow_ps = 1; - body->tx_power_level = - cpu_to_le32(req->channels[chan_start_idx]->max_power); + body->tx_power_level = cpu_to_le32(req->channels[chan_start_idx]->max_power); body->num_of_channels = chan_num; for (i = 0; i < chan_num; i++) - body->channel_list[i] = - req->channels[i + chan_start_idx]->hw_value; + body->channel_list[i] = req->channels[i + chan_start_idx]->hw_value; if (req->no_cck) body->max_transmit_rate = API_RATE_INDEX_G_6MBPS; else @@ -309,8 +300,7 @@ int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, body->probe_for_join = !(channel->flags & IEEE80211_CHAN_NO_IR); body->channel_number = channel->hw_value; body->beacon_interval = cpu_to_le32(conf->beacon_int); - body->basic_rate_set = - cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates)); + body->basic_rate_set = cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates)); memcpy(body->bssid, conf->bssid, sizeof(body->bssid)); if (ssid) { body->ssid_length = cpu_to_le32(ssidlen); @@ -326,15 +316,13 @@ int wfx_hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) { int ret; struct wfx_hif_msg *hif; - struct wfx_hif_req_set_bss_params *body = wfx_alloc_hif(sizeof(*body), - &hif); + struct wfx_hif_req_set_bss_params *body = wfx_alloc_hif(sizeof(*body), &hif); if (!hif) return -ENOMEM; body->aid = cpu_to_le16(aid); body->beacon_lost_count = beacon_lost_count; - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS, - sizeof(*body)); + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS, sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); kfree(hif); return ret; @@ -355,8 +343,7 @@ int wfx_hif_add_key(struct wfx_dev *wdev, const struct wfx_hif_req_add_key *arg) /* Legacy firmwares expect that add_key to be sent on right * interface. */ - wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY, - sizeof(*body)); + wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY, sizeof(*body)); else wfx_fill_header(hif, -1, HIF_REQ_ID_ADD_KEY, sizeof(*body)); ret = wfx_cmd_send(wdev, hif, NULL, 0, false); @@ -384,8 +371,7 @@ int wfx_hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, { int ret; struct wfx_hif_msg *hif; - struct wfx_hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body), - &hif); + struct wfx_hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body), &hif); if (!body) return -ENOMEM; @@ -403,8 +389,7 @@ int wfx_hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, body->queue_id = HIF_QUEUE_ID_BACKGROUND; if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BK) body->queue_id = HIF_QUEUE_ID_BESTEFFORT; - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_EDCA_QUEUE_PARAMS, - sizeof(*body)); + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_EDCA_QUEUE_PARAMS, sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); kfree(hif); return ret; @@ -414,8 +399,7 @@ int wfx_hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout) { int ret; struct wfx_hif_msg *hif; - struct wfx_hif_req_set_pm_mode *body = wfx_alloc_hif(sizeof(*body), - &hif); + struct wfx_hif_req_set_pm_mode *body = wfx_alloc_hif(sizeof(*body), &hif); if (!body) return -ENOMEM; @@ -449,8 +433,7 @@ int wfx_hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, body->short_preamble = conf->use_short_preamble; body->channel_number = channel->hw_value; body->beacon_interval = cpu_to_le32(conf->beacon_int); - body->basic_rate_set = - cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates)); + body->basic_rate_set = cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates)); body->ssid_length = conf->ssid_len; memcpy(body->ssid, conf->ssid, conf->ssid_len); wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START, sizeof(*body)); @@ -463,21 +446,18 @@ int wfx_hif_beacon_transmit(struct wfx_vif *wvif, bool enable) { int ret; struct wfx_hif_msg *hif; - struct wfx_hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), - &hif); + struct wfx_hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), &hif); if (!hif) return -ENOMEM; body->enable_beaconing = enable ? 1 : 0; - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_BEACON_TRANSMIT, - sizeof(*body)); + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_BEACON_TRANSMIT, sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); kfree(hif); return ret; } -int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, - bool mfp) +int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp) { int ret; struct wfx_hif_msg *hif; @@ -496,8 +476,7 @@ int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, return ret; } -int wfx_hif_update_ie_beacon(struct wfx_vif *wvif, - const u8 *ies, size_t ies_len) +int wfx_hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len) { int ret; struct wfx_hif_msg *hif; diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index 36caffa4d1eb..71817a6571f0 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -36,17 +36,14 @@ void wfx_init_hif_cmd(struct wfx_hif_cmd *wfx_hif_cmd); int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request, void *reply, size_t reply_len, bool async); -int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *buf, size_t buf_size); -int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *buf, size_t buf_size); +int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *buf, size_t buf_size); +int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *buf, size_t buf_size); int wfx_hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, const struct ieee80211_channel *channel); int wfx_hif_reset(struct wfx_vif *wvif, bool reset_stat); int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); -int wfx_hif_map_link(struct wfx_vif *wvif, - bool unmap, u8 *mac_addr, int sta_id, bool mfp); +int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp); int wfx_hif_add_key(struct wfx_dev *wdev, const struct wfx_hif_req_add_key *arg); int wfx_hif_remove_key(struct wfx_dev *wdev, int idx); int wfx_hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout); diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index daf966693f67..1c57dd2b697c 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -20,14 +20,12 @@ int wfx_hif_set_output_power(struct wfx_vif *wvif, int val) .power_level = cpu_to_le32(val * 10), }; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_CURRENT_TX_POWER_LEVEL, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_CURRENT_TX_POWER_LEVEL, &arg, sizeof(arg)); } int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, - unsigned int dtim_interval, - unsigned int listen_interval) + unsigned int dtim_interval, unsigned int listen_interval) { struct wfx_hif_mib_beacon_wake_up_period arg = { .wakeup_period_min = dtim_interval, @@ -37,13 +35,11 @@ int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, if (dtim_interval > 0xFF || listen_interval > 0xFFFF) return -EINVAL; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BEACON_WAKEUP_PERIOD, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BEACON_WAKEUP_PERIOD, &arg, sizeof(arg)); } -int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, - int rssi_thold, int rssi_hyst) +int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, int rssi_thold, int rssi_hyst) { struct wfx_hif_mib_rcpi_rssi_threshold arg = { .rolling_average_count = 8, @@ -60,8 +56,7 @@ int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, arg.lower_threshold = (arg.lower_threshold + 110) * 2; } - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_RCPI_RSSI_THRESHOLD, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_RCPI_RSSI_THRESHOLD, &arg, sizeof(arg)); } @@ -74,9 +69,8 @@ int wfx_hif_get_counters_table(struct wfx_dev *wdev, int vif_id, return wfx_hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE, arg, sizeof(struct wfx_hif_mib_count_table)); } else { - return wfx_hif_read_mib(wdev, vif_id, - HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg, - sizeof(struct wfx_hif_mib_extended_count_table)); + return wfx_hif_read_mib(wdev, vif_id, HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, + arg, sizeof(struct wfx_hif_mib_extended_count_table)); } } @@ -86,8 +80,7 @@ int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac) if (mac) ether_addr_copy(arg.mac_addr, mac); - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_DOT11_MAC_ADDRESS, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_MAC_ADDRESS, &arg, sizeof(arg)); } @@ -100,8 +93,7 @@ int wfx_hif_set_rx_filter(struct wfx_vif *wvif, arg.bssid_filter = 1; if (!filter_prbreq) arg.fwd_probe_req = 1; - return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_RX_FILTER, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_RX_FILTER, &arg, sizeof(arg)); } int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, @@ -116,26 +108,23 @@ int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, return -ENOMEM; arg->num_of_info_elmts = cpu_to_le32(tbl_len); memcpy(arg->ie_table, tbl, flex_array_size(arg, ie_table, tbl_len)); - ret = wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BEACON_FILTER_TABLE, arg, buf_len); + ret = wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BEACON_FILTER_TABLE, + arg, buf_len); kfree(arg); return ret; } -int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, - int enable, int beacon_count) +int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, int enable, int beacon_count) { struct wfx_hif_mib_bcn_filter_enable arg = { .enable = cpu_to_le32(enable), .bcn_count = cpu_to_le32(beacon_count), }; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BEACON_FILTER_ENABLE, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BEACON_FILTER_ENABLE, &arg, sizeof(arg)); } -int wfx_hif_set_operational_mode(struct wfx_dev *wdev, - enum wfx_hif_op_power_mode mode) +int wfx_hif_set_operational_mode(struct wfx_dev *wdev, enum wfx_hif_op_power_mode mode) { struct wfx_hif_mib_gl_operational_power_mode arg = { .power_mode = mode, @@ -173,21 +162,18 @@ int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required) } if (!required) arg.unpmf_allowed = 1; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_PROTECTED_MGMT_POLICY, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_PROTECTED_MGMT_POLICY, &arg, sizeof(arg)); } -int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, - u8 tx_tid_policy, u8 rx_tid_policy) +int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, u8 tx_tid_policy, u8 rx_tid_policy) { struct wfx_hif_mib_block_ack_policy arg = { .block_ack_tx_tid_policy = tx_tid_policy, .block_ack_rx_tid_policy = rx_tid_policy, }; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BLOCK_ACK_POLICY, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BLOCK_ACK_POLICY, &arg, sizeof(arg)); } @@ -203,13 +189,11 @@ int wfx_hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, .mpdu_start_spacing = ampdu_density, }; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_ASSOCIATION_MODE, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SET_ASSOCIATION_MODE, &arg, sizeof(arg)); } -int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, - int policy_index, u8 *rates) +int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int policy_index, u8 *rates) { struct wfx_hif_mib_set_tx_rate_retry_policy *arg; size_t size = struct_size(arg, tx_rate_retry_policy, 1); @@ -227,8 +211,7 @@ int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, arg->tx_rate_retry_policy[0].count_init = 1; memcpy(&arg->tx_rate_retry_policy[0].rates, rates, sizeof(arg->tx_rate_retry_policy[0].rates)); - ret = wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY, + ret = wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg, size); kfree(arg); return ret; @@ -240,8 +223,7 @@ int wfx_hif_keep_alive_period(struct wfx_vif *wvif, int period) .keep_alive_period = cpu_to_le16(period), }; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_KEEP_ALIVE_PERIOD, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_KEEP_ALIVE_PERIOD, &arg, sizeof(arg)); }; @@ -257,8 +239,7 @@ int wfx_hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr) memcpy(arg.ipv4_address, addr, sizeof(arg.ipv4_address)); arg.arp_enable = HIF_ARP_NS_FILTERING_ENABLE; } - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE, &arg, sizeof(arg)); } @@ -268,8 +249,7 @@ int wfx_hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable) .enable_multi_tx_conf = enable, }; - return wfx_hif_write_mib(wdev, -1, HIF_MIB_ID_GL_SET_MULTI_MSG, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wdev, -1, HIF_MIB_ID_GL_SET_MULTI_MSG, &arg, sizeof(arg)); } int wfx_hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) @@ -284,8 +264,7 @@ int wfx_hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) arg.trig_be = 1; if (val & BIT(IEEE80211_AC_BK)) arg.trig_bckgrnd = 1; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_UAPSD_INFORMATION, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SET_UAPSD_INFORMATION, &arg, sizeof(arg)); } @@ -295,8 +274,7 @@ int wfx_hif_erp_use_protection(struct wfx_vif *wvif, bool enable) .use_cts_to_self = enable, }; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_NON_ERP_PROTECTION, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_NON_ERP_PROTECTION, &arg, sizeof(arg)); } @@ -306,8 +284,7 @@ int wfx_hif_slot_time(struct wfx_vif *wvif, int val) .slot_time = cpu_to_le32(val), }; - return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SLOT_TIME, - &arg, sizeof(arg)); + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SLOT_TIME, &arg, sizeof(arg)); } int wfx_hif_wep_default_key_id(struct wfx_vif *wvif, int val) @@ -316,8 +293,7 @@ int wfx_hif_wep_default_key_id(struct wfx_vif *wvif, int val) .wep_default_key_id = val, }; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID, &arg, sizeof(arg)); } @@ -327,7 +303,6 @@ int wfx_hif_rts_threshold(struct wfx_vif *wvif, int val) .threshold = cpu_to_le32(val >= 0 ? val : 0xFFFF), }; - return wfx_hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_DOT11_RTS_THRESHOLD, + return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_RTS_THRESHOLD, &arg, sizeof(arg)); } diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index e7e556b05c9a..bcd4ef6a8497 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -19,30 +19,23 @@ struct wfx_hif_mib_extended_count_table; int wfx_hif_set_output_power(struct wfx_vif *wvif, int val); int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, - unsigned int dtim_interval, - unsigned int listen_interval); -int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, - int rssi_thold, int rssi_hyst); + unsigned int dtim_interval, unsigned int listen_interval); +int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, int rssi_thold, int rssi_hyst); int wfx_hif_get_counters_table(struct wfx_dev *wdev, int vif_id, struct wfx_hif_mib_extended_count_table *arg); int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac); -int wfx_hif_set_rx_filter(struct wfx_vif *wvif, - bool filter_bssid, bool fwd_probe_req); +int wfx_hif_set_rx_filter(struct wfx_vif *wvif, bool filter_bssid, bool fwd_probe_req); int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, const struct wfx_hif_ie_table_entry *tbl); -int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, - int enable, int beacon_count); -int wfx_hif_set_operational_mode(struct wfx_dev *wdev, - enum wfx_hif_op_power_mode mode); +int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, int enable, int beacon_count); +int wfx_hif_set_operational_mode(struct wfx_dev *wdev, enum wfx_hif_op_power_mode mode); int wfx_hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, u8 frame_type, int init_rate); int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required); -int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, - u8 tx_tid_policy, u8 rx_tid_policy); +int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, u8 tx_tid_policy, u8 rx_tid_policy); int wfx_hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, bool greenfield, bool short_preamble); -int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, - int policy_index, u8 *rates); +int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int policy_index, u8 *rates); int wfx_hif_keep_alive_period(struct wfx_vif *wvif, int period); int wfx_hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr); int wfx_hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable); diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c index c53b36d36687..c15810bdaecb 100644 --- a/drivers/staging/wfx/hwio.c +++ b/drivers/staging/wfx/hwio.c @@ -25,14 +25,12 @@ static int wfx_read32(struct wfx_dev *wdev, int reg, u32 *val) *val = ~0; /* Never return undefined value */ if (!tmp) return -ENOMEM; - ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, tmp, - sizeof(u32)); + ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, tmp, sizeof(u32)); if (ret >= 0) *val = le32_to_cpu(*tmp); kfree(tmp); if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", - __func__, ret); + dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret); return ret; } @@ -44,12 +42,10 @@ static int wfx_write32(struct wfx_dev *wdev, int reg, u32 val) if (!tmp) return -ENOMEM; *tmp = cpu_to_le32(val); - ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, tmp, - sizeof(u32)); + ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, tmp, sizeof(u32)); kfree(tmp); if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", - __func__, ret); + dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret); return ret; } @@ -187,8 +183,7 @@ static int wfx_indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr, return ret; } -static int wfx_indirect_read32_locked(struct wfx_dev *wdev, int reg, - u32 addr, u32 *val) +static int wfx_indirect_read32_locked(struct wfx_dev *wdev, int reg, u32 addr, u32 *val) { int ret; __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); @@ -227,13 +222,11 @@ int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t len) WARN(!IS_ALIGNED((uintptr_t)buf, 4), "unaligned buffer"); wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, - WFX_REG_IN_OUT_QUEUE, buf, len); + ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, WFX_REG_IN_OUT_QUEUE, buf, len); _trace_io_read(WFX_REG_IN_OUT_QUEUE, buf, len); wdev->hwbus_ops->unlock(wdev->hwbus_priv); if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", - __func__, ret); + dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret); return ret; } @@ -243,52 +236,42 @@ int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t len) WARN(!IS_ALIGNED((uintptr_t)buf, 4), "unaligned buffer"); wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, - WFX_REG_IN_OUT_QUEUE, buf, len); + ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, WFX_REG_IN_OUT_QUEUE, buf, len); _trace_io_write(WFX_REG_IN_OUT_QUEUE, buf, len); wdev->hwbus_ops->unlock(wdev->hwbus_priv); if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", - __func__, ret); + dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret); return ret; } int wfx_sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) { - return wfx_indirect_read_locked(wdev, WFX_REG_SRAM_DPORT, - addr, buf, len); + return wfx_indirect_read_locked(wdev, WFX_REG_SRAM_DPORT, addr, buf, len); } int wfx_ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) { - return wfx_indirect_read_locked(wdev, WFX_REG_AHB_DPORT, - addr, buf, len); + return wfx_indirect_read_locked(wdev, WFX_REG_AHB_DPORT, addr, buf, len); } -int wfx_sram_buf_write(struct wfx_dev *wdev, u32 addr, - const void *buf, size_t len) +int wfx_sram_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len) { - return wfx_indirect_write_locked(wdev, WFX_REG_SRAM_DPORT, - addr, buf, len); + return wfx_indirect_write_locked(wdev, WFX_REG_SRAM_DPORT, addr, buf, len); } -int wfx_ahb_buf_write(struct wfx_dev *wdev, u32 addr, - const void *buf, size_t len) +int wfx_ahb_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len) { - return wfx_indirect_write_locked(wdev, WFX_REG_AHB_DPORT, - addr, buf, len); + return wfx_indirect_write_locked(wdev, WFX_REG_AHB_DPORT, addr, buf, len); } int wfx_sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) { - return wfx_indirect_read32_locked(wdev, WFX_REG_SRAM_DPORT, - addr, val); + return wfx_indirect_read32_locked(wdev, WFX_REG_SRAM_DPORT, addr, val); } int wfx_ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) { - return wfx_indirect_read32_locked(wdev, WFX_REG_AHB_DPORT, - addr, val); + return wfx_indirect_read32_locked(wdev, WFX_REG_AHB_DPORT, addr, val); } int wfx_sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val) diff --git a/drivers/staging/wfx/key.c b/drivers/staging/wfx/key.c index dea8238f9916..8f23e8d42bd4 100644 --- a/drivers/staging/wfx/key.c +++ b/drivers/staging/wfx/key.c @@ -55,9 +55,8 @@ static u8 fill_tkip_pair(struct wfx_hif_tkip_pairwise_key *msg, { u8 *keybuf = key->key; - WARN(key->keylen != sizeof(msg->tkip_key_data) - + sizeof(msg->tx_mic_key) - + sizeof(msg->rx_mic_key), "inconsistent data"); + WARN(key->keylen != sizeof(msg->tkip_key_data) + sizeof(msg->tx_mic_key) + + sizeof(msg->rx_mic_key), "inconsistent data"); memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data)); keybuf += sizeof(msg->tkip_key_data); memcpy(msg->tx_mic_key, keybuf, sizeof(msg->tx_mic_key)); @@ -67,20 +66,16 @@ static u8 fill_tkip_pair(struct wfx_hif_tkip_pairwise_key *msg, return HIF_KEY_TYPE_TKIP_PAIRWISE; } -static u8 fill_tkip_group(struct wfx_hif_tkip_group_key *msg, - struct ieee80211_key_conf *key, - struct ieee80211_key_seq *seq, - enum nl80211_iftype iftype) +static u8 fill_tkip_group(struct wfx_hif_tkip_group_key *msg, struct ieee80211_key_conf *key, + struct ieee80211_key_seq *seq, enum nl80211_iftype iftype) { u8 *keybuf = key->key; - WARN(key->keylen != sizeof(msg->tkip_key_data) - + 2 * sizeof(msg->rx_mic_key), "inconsistent data"); + WARN(key->keylen != sizeof(msg->tkip_key_data) + 2 * sizeof(msg->rx_mic_key), + "inconsistent data"); msg->key_id = key->keyidx; - memcpy(msg->rx_sequence_counter, - &seq->tkip.iv16, sizeof(seq->tkip.iv16)); - memcpy(msg->rx_sequence_counter + sizeof(u16), - &seq->tkip.iv32, sizeof(seq->tkip.iv32)); + memcpy(msg->rx_sequence_counter, &seq->tkip.iv16, sizeof(seq->tkip.iv16)); + memcpy(msg->rx_sequence_counter + sizeof(u16), &seq->tkip.iv32, sizeof(seq->tkip.iv32)); memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data)); keybuf += sizeof(msg->tkip_key_data); if (iftype == NL80211_IFTYPE_AP) @@ -102,8 +97,7 @@ static u8 fill_ccmp_pair(struct wfx_hif_aes_pairwise_key *msg, } static u8 fill_ccmp_group(struct wfx_hif_aes_group_key *msg, - struct ieee80211_key_conf *key, - struct ieee80211_key_seq *seq) + struct ieee80211_key_conf *key, struct ieee80211_key_seq *seq) { WARN(key->keylen != sizeof(msg->aes_key_data), "inconsistent data"); memcpy(msg->aes_key_data, key->key, key->keylen); @@ -118,8 +112,8 @@ static u8 fill_sms4_pair(struct wfx_hif_wapi_pairwise_key *msg, { u8 *keybuf = key->key; - WARN(key->keylen != sizeof(msg->wapi_key_data) - + sizeof(msg->mic_key_data), "inconsistent data"); + WARN(key->keylen != sizeof(msg->wapi_key_data) + sizeof(msg->mic_key_data), + "inconsistent data"); ether_addr_copy(msg->peer_address, peer_addr); memcpy(msg->wapi_key_data, keybuf, sizeof(msg->wapi_key_data)); keybuf += sizeof(msg->wapi_key_data); @@ -133,8 +127,8 @@ static u8 fill_sms4_group(struct wfx_hif_wapi_group_key *msg, { u8 *keybuf = key->key; - WARN(key->keylen != sizeof(msg->wapi_key_data) - + sizeof(msg->mic_key_data), "inconsistent data"); + WARN(key->keylen != sizeof(msg->wapi_key_data) + sizeof(msg->mic_key_data), + "inconsistent data"); memcpy(msg->wapi_key_data, keybuf, sizeof(msg->wapi_key_data)); keybuf += sizeof(msg->wapi_key_data); memcpy(msg->mic_key_data, keybuf, sizeof(msg->mic_key_data)); @@ -143,8 +137,7 @@ static u8 fill_sms4_group(struct wfx_hif_wapi_group_key *msg, } static u8 fill_aes_cmac_group(struct wfx_hif_igtk_group_key *msg, - struct ieee80211_key_conf *key, - struct ieee80211_key_seq *seq) + struct ieee80211_key_conf *key, struct ieee80211_key_seq *seq) { WARN(key->keylen != sizeof(msg->igtk_key_data), "inconsistent data"); memcpy(msg->igtk_key_data, key->key, key->keylen); @@ -173,28 +166,23 @@ static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta, if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || key->cipher == WLAN_CIPHER_SUITE_WEP104) { if (pairwise) - k.type = fill_wep_pair(&k.key.wep_pairwise_key, key, - sta->addr); + k.type = fill_wep_pair(&k.key.wep_pairwise_key, key, sta->addr); else k.type = fill_wep_group(&k.key.wep_group_key, key); } else if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { if (pairwise) - k.type = fill_tkip_pair(&k.key.tkip_pairwise_key, key, - sta->addr); + k.type = fill_tkip_pair(&k.key.tkip_pairwise_key, key, sta->addr); else - k.type = fill_tkip_group(&k.key.tkip_group_key, key, - &seq, wvif->vif->type); + k.type = fill_tkip_group(&k.key.tkip_group_key, key, &seq, + wvif->vif->type); } else if (key->cipher == WLAN_CIPHER_SUITE_CCMP) { if (pairwise) - k.type = fill_ccmp_pair(&k.key.aes_pairwise_key, key, - sta->addr); + k.type = fill_ccmp_pair(&k.key.aes_pairwise_key, key, sta->addr); else - k.type = fill_ccmp_group(&k.key.aes_group_key, key, - &seq); + k.type = fill_ccmp_group(&k.key.aes_group_key, key, &seq); } else if (key->cipher == WLAN_CIPHER_SUITE_SMS4) { if (pairwise) - k.type = fill_sms4_pair(&k.key.wapi_pairwise_key, key, - sta->addr); + k.type = fill_sms4_pair(&k.key.wapi_pairwise_key, key, sta->addr); else k.type = fill_sms4_group(&k.key.wapi_group_key, key); } else if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) { @@ -210,8 +198,7 @@ static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta, wfx_free_key(wdev, idx); return -EOPNOTSUPP; } - key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE | - IEEE80211_KEY_FLAG_RESERVE_TAILROOM; + key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE | IEEE80211_KEY_FLAG_RESERVE_TAILROOM; key->hw_key_idx = idx; return 0; } @@ -223,9 +210,8 @@ static int wfx_remove_key(struct wfx_vif *wvif, struct ieee80211_key_conf *key) return wfx_hif_remove_key(wvif->wdev, key->hw_key_idx); } -int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) +int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, struct ieee80211_key_conf *key) { int ret = -EOPNOTSUPP; struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; diff --git a/drivers/staging/wfx/key.h b/drivers/staging/wfx/key.h index 2d135eff7af2..2234e36dbbcd 100644 --- a/drivers/staging/wfx/key.h +++ b/drivers/staging/wfx/key.h @@ -13,8 +13,7 @@ struct wfx_dev; struct wfx_vif; -int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key); +int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, struct ieee80211_key_conf *key); #endif diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 7b9d75f219fb..6b9ae67da286 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -94,8 +94,7 @@ static const struct ieee80211_supported_band wfx_band_2ghz = { .ht_cap = { /* Receive caps */ .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 | - IEEE80211_HT_CAP_MAX_AMSDU | - (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT), + IEEE80211_HT_CAP_MAX_AMSDU | (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT), .ht_supported = 1, .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, .ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE, @@ -260,10 +259,8 @@ static void wfx_free_common(void *data) ieee80211_free_hw(wdev->hw); } -struct wfx_dev *wfx_init_common(struct device *dev, - const struct wfx_platform_data *pdata, - const struct wfx_hwbus_ops *hwbus_ops, - void *hwbus_priv) +struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_data *pdata, + const struct wfx_hwbus_ops *hwbus_ops, void *hwbus_priv) { struct ieee80211_hw *hw; struct wfx_dev *wdev; @@ -288,9 +285,8 @@ struct wfx_dev *wfx_init_common(struct device *dev, hw->queues = 4; hw->max_rates = 8; hw->max_rate_tries = 8; - hw->extra_tx_headroom = sizeof(struct wfx_hif_msg) - + sizeof(struct wfx_hif_req_tx) - + 4 /* alignment */ + 8 /* TKIP IV */; + hw->extra_tx_headroom = sizeof(struct wfx_hif_msg) + sizeof(struct wfx_hif_req_tx) + + 4 /* alignment */ + 8 /* TKIP IV */; hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); @@ -308,8 +304,7 @@ struct wfx_dev *wfx_init_common(struct device *dev, hw->wiphy->iface_combinations = wfx_iface_combinations; hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmalloc(dev, sizeof(wfx_band_2ghz), GFP_KERNEL); /* FIXME: also copy wfx_rates and wfx_2ghz_chantable */ - memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, - sizeof(wfx_band_2ghz)); + memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, sizeof(wfx_band_2ghz)); wdev = hw->priv; wdev->hw = hw; @@ -317,10 +312,8 @@ struct wfx_dev *wfx_init_common(struct device *dev, wdev->hwbus_ops = hwbus_ops; wdev->hwbus_priv = hwbus_priv; memcpy(&wdev->pdata, pdata, sizeof(*pdata)); - of_property_read_string(dev->of_node, "config-file", - &wdev->pdata.file_pds); - wdev->pdata.gpio_wakeup = devm_gpiod_get_optional(dev, "wakeup", - GPIOD_OUT_LOW); + of_property_read_string(dev->of_node, "config-file", &wdev->pdata.file_pds); + wdev->pdata.gpio_wakeup = devm_gpiod_get_optional(dev, "wakeup", GPIOD_OUT_LOW); if (IS_ERR(wdev->pdata.gpio_wakeup)) return NULL; if (wdev->pdata.gpio_wakeup) @@ -330,8 +323,7 @@ struct wfx_dev *wfx_init_common(struct device *dev, mutex_init(&wdev->rx_stats_lock); mutex_init(&wdev->tx_power_loop_info_lock); init_completion(&wdev->firmware_ready); - INIT_DELAYED_WORK(&wdev->cooling_timeout_work, - wfx_cooling_timeout_work); + INIT_DELAYED_WORK(&wdev->cooling_timeout_work, wfx_cooling_timeout_work); skb_queue_head_init(&wdev->tx_pending); init_waitqueue_head(&wdev->tx_dequeue); wfx_init_hif_cmd(&wdev->hif_cmd); @@ -388,27 +380,27 @@ int wfx_probe(struct wfx_dev *wdev) wdev->hw_caps.firmware_build); if (wfx_api_older_than(wdev, 1, 0)) { - dev_err(wdev->dev, - "unsupported firmware API version (expect 1 while firmware returns %d)\n", + dev_err(wdev->dev, "unsupported firmware API version (expect 1 while firmware returns %d)\n", wdev->hw_caps.api_version_major); err = -ENOTSUPP; goto err0; } if (wdev->hw_caps.link_mode == SEC_LINK_ENFORCED) { - dev_err(wdev->dev, - "chip require secure_link, but can't negotiate it\n"); + dev_err(wdev->dev, "chip require secure_link, but can't negotiate it\n"); goto err0; } if (wdev->hw_caps.region_sel_mode) { - wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[11].flags |= IEEE80211_CHAN_NO_IR; - wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[12].flags |= IEEE80211_CHAN_NO_IR; - wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[13].flags |= IEEE80211_CHAN_DISABLED; + wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[11].flags |= + IEEE80211_CHAN_NO_IR; + wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[12].flags |= + IEEE80211_CHAN_NO_IR; + wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[13].flags |= + IEEE80211_CHAN_DISABLED; } - dev_dbg(wdev->dev, "sending configuration file %s\n", - wdev->pdata.file_pds); + dev_dbg(wdev->dev, "sending configuration file %s\n", wdev->pdata.file_pds); err = wfx_send_pdata_pds(wdev); if (err < 0 && err != -ENOENT) goto err0; @@ -424,8 +416,7 @@ int wfx_probe(struct wfx_dev *wdev) wdev->pdata.gpio_wakeup = gpio_saved; if (wdev->pdata.gpio_wakeup) { - dev_dbg(wdev->dev, - "enable 'quiescent' power mode with wakeup GPIO and PDS file %s\n", + dev_dbg(wdev->dev, "enable 'quiescent' power mode with wakeup GPIO and PDS file %s\n", wdev->pdata.file_pds); gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); wfx_control_reg_write(wdev, 0); @@ -436,19 +427,16 @@ int wfx_probe(struct wfx_dev *wdev) for (i = 0; i < ARRAY_SIZE(wdev->addresses); i++) { eth_zero_addr(wdev->addresses[i].addr); - err = of_get_mac_address(wdev->dev->of_node, - wdev->addresses[i].addr); + err = of_get_mac_address(wdev->dev->of_node, wdev->addresses[i].addr); if (!err) wdev->addresses[i].addr[ETH_ALEN - 1] += i; else - ether_addr_copy(wdev->addresses[i].addr, - wdev->hw_caps.mac_addr[i]); + ether_addr_copy(wdev->addresses[i].addr, wdev->hw_caps.mac_addr[i]); if (!is_valid_ether_addr(wdev->addresses[i].addr)) { dev_warn(wdev->dev, "using random MAC address\n"); eth_random_addr(wdev->addresses[i].addr); } - dev_info(wdev->dev, "MAC address %d: %pM\n", i, - wdev->addresses[i].addr); + dev_info(wdev->dev, "MAC address %d: %pM\n", i, wdev->addresses[i].addr); } wdev->hw->wiphy->n_addresses = ARRAY_SIZE(wdev->addresses); wdev->hw->wiphy->addresses = wdev->addresses; diff --git a/drivers/staging/wfx/main.h b/drivers/staging/wfx/main.h index 68a7807c5fb6..def6270bf10d 100644 --- a/drivers/staging/wfx/main.h +++ b/drivers/staging/wfx/main.h @@ -29,10 +29,8 @@ struct wfx_platform_data { bool use_rising_clk; }; -struct wfx_dev *wfx_init_common(struct device *dev, - const struct wfx_platform_data *pdata, - const struct wfx_hwbus_ops *hwbus_ops, - void *hwbus_priv); +struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_data *pdata, + const struct wfx_hwbus_ops *hwbus_ops, void *hwbus_priv); int wfx_probe(struct wfx_dev *wdev); void wfx_release(struct wfx_dev *wdev); diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 71c6ef94a904..9b49e41f06ce 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -38,8 +38,7 @@ void wfx_tx_flush(struct wfx_dev *wdev) wfx_tx_lock(wdev); mutex_lock(&wdev->hif_cmd.lock); - ret = wait_event_timeout(wdev->hif.tx_buffers_empty, - !wdev->hif.tx_buffers_used, + ret = wait_event_timeout(wdev->hif.tx_buffers_empty, !wdev->hif.tx_buffers_used, msecs_to_jiffies(3000)); if (!ret) { dev_warn(wdev->dev, "cannot flush tx buffers (%d still busy)\n", @@ -76,8 +75,7 @@ void wfx_tx_queues_init(struct wfx_vif *wvif) bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue) { - return skb_queue_empty_lockless(&queue->normal) && - skb_queue_empty_lockless(&queue->cab); + return skb_queue_empty_lockless(&queue->normal) && skb_queue_empty_lockless(&queue->cab); } void wfx_tx_queues_check_empty(struct wfx_vif *wvif) @@ -91,8 +89,7 @@ void wfx_tx_queues_check_empty(struct wfx_vif *wvif) } static void __wfx_tx_queue_drop(struct wfx_vif *wvif, - struct sk_buff_head *skb_queue, - struct sk_buff_head *dropped) + struct sk_buff_head *skb_queue, struct sk_buff_head *dropped) { struct sk_buff *skb, *tmp; @@ -130,8 +127,7 @@ void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped) struct wfx_hif_msg *hif; struct sk_buff *skb; - WARN(!wdev->chip_frozen, "%s should only be used to recover a frozen device", - __func__); + WARN(!wdev->chip_frozen, "%s should only be used to recover a frozen device", __func__); while ((skb = skb_dequeue(&wdev->tx_pending)) != NULL) { hif = (struct wfx_hif_msg *)skb->data; wvif = wdev_to_wvif(wdev, hif->interface); @@ -187,23 +183,20 @@ void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms) skb_queue_walk(&wdev->tx_pending, skb) { tx_priv = wfx_skb_tx_priv(skb); req = wfx_skb_txreq(skb); - if (ktime_after(now, ktime_add_ms(tx_priv->xmit_timestamp, - limit_ms))) { + if (ktime_after(now, ktime_add_ms(tx_priv->xmit_timestamp, limit_ms))) { if (first) { dev_info(wdev->dev, "frames stuck in firmware since %dms or more:\n", limit_ms); first = false; } dev_info(wdev->dev, " id %08x sent %lldms ago\n", - req->packet_id, - ktime_ms_delta(now, tx_priv->xmit_timestamp)); + req->packet_id, ktime_ms_delta(now, tx_priv->xmit_timestamp)); } } spin_unlock_bh(&wdev->tx_pending.lock); } -unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, - struct sk_buff *skb) +unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb) { ktime_t now = ktime_get(); struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb); @@ -267,8 +260,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) */ hif = (struct wfx_hif_msg *)skb->data; WARN_ON(hif->interface != wvif->id); - WARN_ON(queues[i] != - &wvif->tx_queue[skb_get_queue_mapping(skb)]); + WARN_ON(queues[i] != &wvif->tx_queue[skb_get_queue_mapping(skb)]); atomic_inc(&queues[i]->pending_frames); trace_queues_stats(wdev, queues[i]); return skb; diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index 66596a9abe30..2860c56fb933 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -38,8 +38,7 @@ void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id); void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped); -unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, - struct sk_buff *skb); +unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb); void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms); #endif diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index f61c6b2db352..ce0ae4c91190 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -12,8 +12,7 @@ #include "sta.h" #include "hif_tx_mib.h" -static void wfx_ieee80211_scan_completed_compat(struct ieee80211_hw *hw, - bool aborted) +static void wfx_ieee80211_scan_completed_compat(struct ieee80211_hw *hw, bool aborted) { struct cfg80211_scan_info info = { .aborted = aborted, @@ -22,13 +21,11 @@ static void wfx_ieee80211_scan_completed_compat(struct ieee80211_hw *hw, ieee80211_scan_completed(hw, &info); } -static int update_probe_tmpl(struct wfx_vif *wvif, - struct cfg80211_scan_request *req) +static int update_probe_tmpl(struct wfx_vif *wvif, struct cfg80211_scan_request *req) { struct sk_buff *skb; - skb = ieee80211_probereq_get(wvif->wdev->hw, wvif->vif->addr, - NULL, 0, req->ie_len); + skb = ieee80211_probereq_get(wvif->wdev->hw, wvif->vif->addr, NULL, 0, req->ie_len); if (!skb) return -ENOMEM; @@ -38,8 +35,7 @@ static int update_probe_tmpl(struct wfx_vif *wvif, return 0; } -static int send_scan_req(struct wfx_vif *wvif, - struct cfg80211_scan_request *req, int start_idx) +static int send_scan_req(struct wfx_vif *wvif, struct cfg80211_scan_request *req, int start_idx) { int i, ret; struct ieee80211_channel *ch_start, *ch_cur; diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 620d8c912f95..07054666fe76 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -40,8 +40,7 @@ u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates) void wfx_cooling_timeout_work(struct work_struct *work) { - struct wfx_dev *wdev = container_of(to_delayed_work(work), - struct wfx_dev, + struct wfx_dev *wdev = container_of(to_delayed_work(work), struct wfx_dev, cooling_timeout_work); wdev->chip_frozen = true; @@ -91,10 +90,8 @@ static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon) if (!filter_beacon) { wfx_hif_beacon_filter_control(wvif, 0, 1); } else { - wfx_hif_set_beacon_filter_table(wvif, ARRAY_SIZE(filter_ies), - filter_ies); - wfx_hif_beacon_filter_control(wvif, - HIF_BEACON_FILTER_ENABLE, 0); + wfx_hif_set_beacon_filter_table(wvif, ARRAY_SIZE(filter_ies), filter_ies); + wfx_hif_beacon_filter_control(wvif, HIF_BEACON_FILTER_ENABLE, 0); } } @@ -135,8 +132,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, filter_bssid = true; /* In AP mode, chip can reply to probe request itself */ - if (*total_flags & FIF_PROBE_REQ && - wvif->vif->type == NL80211_IFTYPE_AP) { + if (*total_flags & FIF_PROBE_REQ && wvif->vif->type == NL80211_IFTYPE_AP) { dev_dbg(wdev->dev, "do not forward probe request in AP mode\n"); *total_flags &= ~FIF_PROBE_REQ; } @@ -208,10 +204,8 @@ int wfx_update_pm(struct wfx_vif *wvif) if (wvif->uapsd_mask) ps_timeout = 0; - if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete, - TU_TO_JIFFIES(512))) - dev_warn(wvif->wdev->dev, - "timeout while waiting of set_pm_mode_complete\n"); + if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete, TU_TO_JIFFIES(512))) + dev_warn(wvif->wdev->dev, "timeout while waiting of set_pm_mode_complete\n"); return wfx_hif_set_pm(wvif, ps, ps_timeout); } @@ -227,8 +221,7 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mutex_lock(&wdev->conf_mutex); assign_bit(queue, &wvif->uapsd_mask, params->uapsd); wfx_hif_set_edca_queue_params(wvif, queue, params); - if (wvif->vif->type == NL80211_IFTYPE_STATION && - old_uapsd != wvif->uapsd_mask) { + if (wvif->vif->type == NL80211_IFTYPE_STATION && old_uapsd != wvif->uapsd_mask) { wfx_hif_set_uapsd_info(wvif, wvif->uapsd_mask); wfx_update_pm(wvif); } @@ -264,17 +257,15 @@ void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi) static void wfx_beacon_loss_work(struct work_struct *work) { - struct wfx_vif *wvif = container_of(to_delayed_work(work), - struct wfx_vif, beacon_loss_work); + struct wfx_vif *wvif = container_of(to_delayed_work(work), struct wfx_vif, + beacon_loss_work); struct ieee80211_bss_conf *bss_conf = &wvif->vif->bss_conf; ieee80211_beacon_loss(wvif->vif); - schedule_delayed_work(to_delayed_work(work), - msecs_to_jiffies(bss_conf->beacon_int)); + schedule_delayed_work(to_delayed_work(work), msecs_to_jiffies(bss_conf->beacon_int)); } -void wfx_set_default_unicast_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, int idx) +void wfx_set_default_unicast_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int idx) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; @@ -298,8 +289,7 @@ void wfx_reset(struct wfx_vif *wvif) wfx_update_pm(wvif); } -int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) +int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; @@ -321,8 +311,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return 0; } -int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) +int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; @@ -343,15 +332,13 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif) skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); if (!skb) return -ENOMEM; - wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_BCN, - API_RATE_INDEX_B_1MBPS); + wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_BCN, API_RATE_INDEX_B_1MBPS); dev_kfree_skb(skb); skb = ieee80211_proberesp_get(wvif->wdev->hw, wvif->vif); if (!skb) return -ENOMEM; - wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBRES, - API_RATE_INDEX_B_1MBPS); + wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBRES, API_RATE_INDEX_B_1MBPS); dev_kfree_skb(skb); return 0; } @@ -360,8 +347,7 @@ static void wfx_set_mfp_ap(struct wfx_vif *wvif) { struct sk_buff *skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); const int ieoffset = offsetof(struct ieee80211_mgmt, u.beacon.variable); - const u16 *ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, - skb->data + ieoffset, + const u16 *ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, skb->data + ieoffset, skb->len - ieoffset); const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16); const int pairwise_cipher_suite_size = 4 / sizeof(u16); @@ -417,8 +403,7 @@ static void wfx_join(struct wfx_vif *wvif) wfx_tx_lock_flush(wvif->wdev); - bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, - conf->bssid, NULL, 0, + bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, conf->bssid, NULL, 0, IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); if (!bss && !conf->ibss_joined) { wfx_tx_unlock(wvif->wdev); @@ -472,8 +457,7 @@ static void wfx_join_finalize(struct wfx_vif *wvif, rcu_read_unlock(); wvif->join_in_progress = false; - wfx_hif_set_association_mode(wvif, ampdu_density, greenfield, - info->use_short_preamble); + wfx_hif_set_association_mode(wvif, ampdu_density, greenfield, info->use_short_preamble); wfx_hif_keep_alive_period(wvif, 0); /* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use * the same value. @@ -541,10 +525,8 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (changed & BSS_CHANGED_BEACON_INFO) { if (vif->type != NL80211_IFTYPE_STATION) - dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", - __func__); - wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period, - info->dtim_period); + dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", __func__); + wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period, info->dtim_period); /* We temporary forwarded beacon for join process. It is now no * more necessary. */ @@ -563,8 +545,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, } } - if (changed & BSS_CHANGED_AP_PROBE_RESP || - changed & BSS_CHANGED_BEACON) + if (changed & BSS_CHANGED_AP_PROBE_RESP || changed & BSS_CHANGED_BEACON) wfx_upload_ap_templates(wvif); if (changed & BSS_CHANGED_BEACON_ENABLED) @@ -581,8 +562,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wfx_hif_slot_time(wvif, info->use_short_slot ? 9 : 20); if (changed & BSS_CHANGED_CQM) - wfx_hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold, - info->cqm_rssi_hyst); + wfx_hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold, info->cqm_rssi_hyst); if (changed & BSS_CHANGED_TXPOWER) wfx_hif_set_output_power(wvif, info->txpower); @@ -599,8 +579,7 @@ static int wfx_update_tim(struct wfx_vif *wvif) u16 tim_offset, tim_length; u8 *tim_ptr; - skb = ieee80211_beacon_get_tim(wvif->wdev->hw, wvif->vif, - &tim_offset, &tim_length); + skb = ieee80211_beacon_get_tim(wvif->wdev->hw, wvif->vif, &tim_offset, &tim_length); if (!skb) return -ENOENT; tim_ptr = skb->data + tim_offset; @@ -665,8 +644,7 @@ void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd) wfx_bh_request_tx(wvif->wdev); } -int wfx_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, +int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params) { /* Aggregation is implemented fully in firmware */ @@ -681,20 +659,16 @@ int wfx_ampdu_action(struct ieee80211_hw *hw, } } -int wfx_add_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf) +int wfx_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf) { return 0; } -void wfx_remove_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf) +void wfx_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf) { } -void wfx_change_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf, - u32 changed) +void wfx_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf, u32 changed) { } @@ -710,8 +684,7 @@ int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return 0; } -void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, +void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_chanctx_conf *conf) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index 4d7e38be4235..082329d7bbcd 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -23,8 +23,7 @@ int wfx_start(struct ieee80211_hw *hw); void wfx_stop(struct ieee80211_hw *hw); int wfx_config(struct ieee80211_hw *hw, u32 changed); int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value); -void wfx_set_default_unicast_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, int idx); +void wfx_set_default_unicast_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int idx); void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, u64 unused); @@ -38,25 +37,20 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, const struct ieee80211_tx_queue_params *params); void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, u32 changed); -int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); +int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta); +int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta); void wfx_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum sta_notify_cmd cmd, struct ieee80211_sta *sta); int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set); int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params); -int wfx_add_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf); -void wfx_remove_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf); -void wfx_change_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *conf, u32 changed); +int wfx_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf); +void wfx_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf); +void wfx_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf, + u32 changed); int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_chanctx_conf *conf); -void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, +void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_chanctx_conf *conf); /* Hardware API Callbacks */ diff --git a/drivers/staging/wfx/traces.h b/drivers/staging/wfx/traces.h index 99bd1808111e..9fbf0081dbf7 100644 --- a/drivers/staging/wfx/traces.h +++ b/drivers/staging/wfx/traces.h @@ -190,8 +190,7 @@ DECLARE_EVENT_CLASS(hif_data, __entry->mib = -1; header_len = 0; } - __entry->buf_len = min_t(int, __entry->msg_len, - sizeof(__entry->buf)) + __entry->buf_len = min_t(int, __entry->msg_len, sizeof(__entry->buf)) - sizeof(struct wfx_hif_msg) - header_len; memcpy(__entry->buf, hif->body + header_len, __entry->buf_len); ), @@ -250,8 +249,7 @@ DECLARE_EVENT_CLASS(io_data, __entry->reg = reg; __entry->addr = addr; __entry->msg_len = len; - __entry->buf_len = min_t(int, sizeof(__entry->buf), - __entry->msg_len); + __entry->buf_len = min_t(int, sizeof(__entry->buf), __entry->msg_len); memcpy(__entry->buf, io_buf, __entry->buf_len); if (addr >= 0) snprintf(__entry->addr_str, 10, "/%08x", addr); @@ -379,8 +377,7 @@ TRACE_EVENT(tx_stats, ), TP_fast_assign( /* Keep sync with wfx_rates definition in main.c */ - static const int hw_rate[] = { 0, 1, 2, 3, 6, 7, 8, 9, - 10, 11, 12, 13 }; + static const int hw_rate[] = { 0, 1, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13 }; const struct ieee80211_tx_info *tx_info = (const struct ieee80211_tx_info *)skb->cb; const struct ieee80211_tx_rate *rates = tx_info->driver_rates; @@ -420,9 +417,8 @@ TRACE_EVENT(tx_stats, TP_printk("packet ID: %08x, rate policy: %s %d|%d %d|%d %d|%d %d|%d -> %d attempt, Delays media/queue/total: %4dus/%4dus/%4dus", __entry->pkt_id, __print_flags(__entry->flags, NULL, - { 0x01, "M" }, { 0x02, "S" }, { 0x04, "G" }, - { 0x08, "R" }, { 0x10, "D" }, { 0x20, "F" }, - { 0x40, "Q" }), + { 0x01, "M" }, { 0x02, "S" }, { 0x04, "G" }, { 0x08, "R" }, + { 0x10, "D" }, { 0x20, "F" }, { 0x40, "Q" }), __entry->rate[0], __entry->tx_count[0], __entry->rate[1], diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 189b96cd3d13..565874815aa8 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -104,8 +104,7 @@ static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_id) return (struct wfx_vif *)wdev->vif[vif_id]->drv_priv; } -static inline struct wfx_vif *wvif_iterate(struct wfx_dev *wdev, - struct wfx_vif *cur) +static inline struct wfx_vif *wvif_iterate(struct wfx_dev *wdev, struct wfx_vif *cur) { int i; int mark = 0; -- cgit From f545b23d4775521701c3264ffd5892c36c8b1e5f Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:14 +0100 Subject: staging: wfx: reformat comments on 100 columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until now, this driver was written in 80 columns style. However, since all the functions are prefixed with "wfx_", this constraint is no more respected in the last patches. From the perspective of kernel Coding Style, it is not a problem since it is now allowed to write code on 100 columns. This patch just unify the code to use 100 columns in every comments. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-22-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bh.c | 26 +++++++++++--------------- drivers/staging/wfx/bus_spi.c | 14 ++++++-------- drivers/staging/wfx/data_rx.c | 4 ++-- drivers/staging/wfx/data_tx.c | 13 ++++++------- drivers/staging/wfx/debug.c | 10 ++++------ drivers/staging/wfx/fwio.c | 16 ++++++---------- drivers/staging/wfx/hif_api_cmd.h | 8 ++++---- drivers/staging/wfx/hif_rx.c | 4 +--- drivers/staging/wfx/hif_tx.c | 16 ++++++---------- drivers/staging/wfx/hwio.h | 5 ++--- drivers/staging/wfx/main.c | 22 ++++++++++------------ drivers/staging/wfx/main.h | 4 ++-- drivers/staging/wfx/queue.c | 5 ++--- drivers/staging/wfx/sta.c | 34 +++++++++++++--------------------- drivers/staging/wfx/traces.h | 9 ++++----- 15 files changed, 79 insertions(+), 111 deletions(-) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index b9a351913868..1ec4a4951d99 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -32,18 +32,15 @@ static void device_wakeup(struct wfx_dev *wdev) } for (;;) { gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); - /* completion.h does not provide any function to wait - * completion without consume it (a kind of - * wait_for_completion_done_timeout()). So we have to emulate - * it. + /* completion.h does not provide any function to wait completion without consume it + * (a kind of wait_for_completion_done_timeout()). So we have to emulate it. */ if (wait_for_completion_timeout(&wdev->hif.ctrl_ready, msecs_to_jiffies(2))) { complete(&wdev->hif.ctrl_ready); return; } else if (max_retry-- > 0) { - /* Older firmwares have a race in sleep/wake-up process. - * Redo the process is sufficient to unfreeze the - * chip. + /* Older firmwares have a race in sleep/wake-up process. Redo the process + * is sufficient to unfreeze the chip. */ dev_err(wdev->dev, "timeout while wake up chip\n"); gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 0); @@ -219,9 +216,9 @@ static int bh_work_tx(struct wfx_dev *wdev, int max_msg) return i; } -/* In SDIO mode, it is necessary to make an access to a register to acknowledge - * last received message. It could be possible to restrict this acknowledge to - * SDIO mode and only if last operation was rx. +/* In SDIO mode, it is necessary to make an access to a register to acknowledge last received + * message. It could be possible to restrict this acknowledge to SDIO mode and only if last + * operation was rx. */ static void ack_sdio_data(struct wfx_dev *wdev) { @@ -287,12 +284,11 @@ void wfx_bh_request_tx(struct wfx_dev *wdev) queue_work(system_highpri_wq, &wdev->hif.bh); } -/* If IRQ is not available, this function allow to manually poll the control - * register and simulate an IRQ ahen an event happened. +/* If IRQ is not available, this function allow to manually poll the control register and simulate + * an IRQ ahen an event happened. * - * Note that the device has a bug: If an IRQ raise while host read control - * register, the IRQ is lost. So, use this function carefully (only duing - * device initialisation). + * Note that the device has a bug: If an IRQ raise while host read control register, the IRQ is + * lost. So, use this function carefully (only duing device initialisation). */ void wfx_bh_poll_irq(struct wfx_dev *wdev) { diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index 43bc6e147d5f..fe39b4cb8194 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -38,13 +38,12 @@ struct wfx_spi_priv { bool need_swab; }; -/* The chip reads 16bits of data at time and place them directly into (little - * endian) CPU register. So, the chip expects bytes order to be "B1 B0 B3 B2" - * (while LE is "B0 B1 B2 B3" and BE is "B3 B2 B1 B0") +/* The chip reads 16bits of data at time and place them directly into (little endian) CPU register. + * So, the chip expects bytes order to be "B1 B0 B3 B2" (while LE is "B0 B1 B2 B3" and BE is + * "B3 B2 B1 B0") * - * A little endian host with bits_per_word == 16 should do the right job - * natively. The code below to support big endian host and commonly used SPI - * 8bits. + * A little endian host with bits_per_word == 16 should do the right job natively. The code below to + * support big endian host and commonly used SPI 8bits. */ static int wfx_spi_copy_from_io(void *priv, unsigned int addr, void *dst, size_t count) { @@ -160,8 +159,7 @@ static int wfx_spi_irq_unsubscribe(void *priv) static size_t wfx_spi_align_size(void *priv, size_t size) { - /* Most of SPI controllers avoid DMA if buffer size is not 32bit aligned - */ + /* Most of SPI controllers avoid DMA if buffer size is not 32bit aligned */ return ALIGN(size, 4); } diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c index 4beee2624998..a4b5ffe158e4 100644 --- a/drivers/staging/wfx/data_rx.c +++ b/drivers/staging/wfx/data_rx.c @@ -74,8 +74,8 @@ void wfx_rx_cb(struct wfx_vif *wvif, const struct wfx_hif_ind_rx *arg, struct sk if (arg->encryp) hdr->flag |= RX_FLAG_DECRYPTED; - /* Block ack negotiation is offloaded by the firmware. However, - * re-ordering must be done by the mac80211. + /* Block ack negotiation is offloaded by the firmware. However, re-ordering must be done by + * the mac80211. */ if (ieee80211_is_action(frame->frame_control) && mgmt->u.action.category == WLAN_CATEGORY_BACK && diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 0bfbf57cc035..ca2f24b92d24 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -30,8 +30,8 @@ static int wfx_get_hw_rate(struct wfx_dev *wdev, const struct ieee80211_tx_rate } return rate->idx + 14; } - /* The device only support 2GHz, else band information should be - * retrieved from ieee80211_tx_info + /* The device only support 2GHz, else band information should be retrieved from + * ieee80211_tx_info */ band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]; if (rate->idx >= band->n_bitrates) { @@ -356,9 +356,8 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct /* Fill tx request */ req = (struct wfx_hif_req_tx *)hif_msg->body; - /* packet_id just need to be unique on device. 32bits are more than - * necessary for that task, so we tae advantage of it to add some extra - * data for debug. + /* packet_id just need to be unique on device. 32bits are more than necessary for that task, + * so we take advantage of it to add some extra data for debug. */ req->packet_id = atomic_add_return(1, &wvif->wdev->packet_id) & 0xFFFF; req->packet_id |= IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)) << 16; @@ -402,8 +401,8 @@ void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struc wvif = wvif_iterate(wdev, NULL); if (WARN_ON(!wvif)) goto drop; - /* Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any - * BlockAck session management frame. The check below exist just in case. + /* Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any BlockAck session + * management frame. The check below exist just in case. */ if (wfx_is_action_back(hdr)) { dev_info(wdev->dev, "drop BA action\n"); diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index 210e2336d43a..c62cb5fea4eb 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -250,9 +250,9 @@ static ssize_t wfx_send_hif_msg_write(struct file *file, const char __user *user if (count < sizeof(struct wfx_hif_msg)) return -EINVAL; - /* wfx_cmd_send() checks that reply buffer is wide enough, but does not - * return precise length read. User have to know how many bytes should - * be read. Filling reply buffer with a memory pattern may help user. + /* wfx_cmd_send() checks that reply buffer is wide enough, but does not return precise + * length read. User have to know how many bytes should be read. Filling reply buffer with a + * memory pattern may help user. */ memset(context->reply, 0xFF, sizeof(context->reply)); request = memdup_user(user_buf, count); @@ -282,9 +282,7 @@ static ssize_t wfx_send_hif_msg_read(struct file *file, char __user *user_buf, return ret; if (context->ret < 0) return context->ret; - /* Be careful, write() is waiting for a full message while read() - * only returns a payload - */ + /* Be careful, write() is waiting for a full message while read() only returns a payload */ if (copy_to_user(user_buf, context->reply, count)) return -EFAULT; diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c index 89a46fb0e789..24c314b10b95 100644 --- a/drivers/staging/wfx/fwio.c +++ b/drivers/staging/wfx/fwio.c @@ -69,15 +69,13 @@ static const char * const fwio_errors[] = { [ERR_MAC_KEY] = "MAC key not initialized", }; -/* request_firmware() allocate data using vmalloc(). It is not compatible with - * underlying hardware that use DMA. Function below detect this case and - * allocate a bounce buffer if necessary. +/* request_firmware() allocate data using vmalloc(). It is not compatible with underlying hardware + * that use DMA. Function below detect this case and allocate a bounce buffer if necessary. * - * Notice that, in doubt, you can enable CONFIG_DEBUG_SG to ask kernel to - * detect this problem at runtime (else, kernel silently fail). + * Notice that, in doubt, you can enable CONFIG_DEBUG_SG to ask kernel to detect this problem at + * runtime (else, kernel silently fail). * - * NOTE: it may also be possible to use 'pages' from struct firmware and avoid - * bounce buffer + * NOTE: it may also be possible to use 'pages' from struct firmware and avoid bounce buffer */ static int wfx_sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, size_t len) { @@ -202,9 +200,7 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) if (ret < 0) return ret; - /* The device seems to not support writing 0 in this register - * during first loop - */ + /* The device seems to not support writing 0 in this register during first loop */ offs += DNLD_BLOCK_SIZE; ret = wfx_sram_reg_write(wdev, WFX_DCA_PUT, offs); if (ret < 0) diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h index 463532b25939..444ff7ed882d 100644 --- a/drivers/staging/wfx/hif_api_cmd.h +++ b/drivers/staging/wfx/hif_api_cmd.h @@ -174,8 +174,8 @@ enum wfx_hif_frame_format { }; struct wfx_hif_req_tx { - /* packet_id is not interpreted by the device, so it is not necessary to - * declare it little endian + /* packet_id is not interpreted by the device, so it is not necessary to declare it little + * endian */ u32 packet_id; u8 max_tx_rate; @@ -212,8 +212,8 @@ enum wfx_hif_qos_ackplcy { struct wfx_hif_cnf_tx { __le32 status; - /* packet_id is copied from struct wfx_hif_req_tx without been interpreted - * by the device, so it is not necessary to declare it little endian + /* packet_id is copied from struct wfx_hif_req_tx without been interpreted by the device, so + * it is not necessary to declare it little endian */ u32 packet_id; u8 txed_rate; diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index 1ddf8c51c303..5300ef57413f 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -371,9 +371,7 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) wfx_hif_receive_indication(wdev, hif, hif->body, skb); return; } - /* Note: mutex_is_lock cause an implicit memory barrier that protect - * buf_send - */ + /* Note: mutex_is_lock cause an implicit memory barrier that protect buf_send */ if (mutex_is_locked(&wdev->hif_cmd.lock) && wdev->hif_cmd.buf_send && wdev->hif_cmd.buf_send->id == hif_id) { wfx_hif_generic_confirm(wdev, hif, hif->body); diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index b88a73077b48..ea2582714bb9 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -61,8 +61,8 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request, mutex_lock(&wdev->hif_cmd.lock); WARN(wdev->hif_cmd.buf_send, "data locking error"); - /* Note: call to complete() below has an implicit memory barrier that - * hopefully protect buf_send + /* Note: call to complete() below has an implicit memory barrier that hopefully protect + * buf_send */ wdev->hif_cmd.buf_send = request; wdev->hif_cmd.buf_recv = reply; @@ -72,9 +72,7 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request, wfx_bh_request_tx(wdev); if (no_reply) { - /* Chip won't reply. Give enough time to the wq to send the - * buffer. - */ + /* Chip won't reply. Give enough time to the wq to send the buffer. */ msleep(100); wdev->hif_cmd.buf_send = NULL; mutex_unlock(&wdev->hif_cmd.lock); @@ -118,8 +116,8 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request, return ret; } -/* This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any - * request anymore. Obviously, only call this function during device unregister. +/* This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any request anymore. + * Obviously, only call this function during device unregister. */ int wfx_hif_shutdown(struct wfx_dev *wdev) { @@ -340,9 +338,7 @@ int wfx_hif_add_key(struct wfx_dev *wdev, const struct wfx_hif_req_add_key *arg) /* FIXME: swap bytes as necessary in body */ memcpy(body, arg, sizeof(*body)); if (wfx_api_older_than(wdev, 1, 5)) - /* Legacy firmwares expect that add_key to be sent on right - * interface. - */ + /* Legacy firmwares expect that add_key to be sent on right interface. */ wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY, sizeof(*body)); else wfx_fill_header(hif, -1, HIF_REQ_ID_ADD_KEY, sizeof(*body)); diff --git a/drivers/staging/wfx/hwio.h b/drivers/staging/wfx/hwio.h index 8c8fe76871f8..c6e7b065b7ff 100644 --- a/drivers/staging/wfx/hwio.h +++ b/drivers/staging/wfx/hwio.h @@ -12,9 +12,8 @@ struct wfx_dev; -/* Caution: in the functions below, 'buf' will used with a DMA. So, it must be - * kmalloc'd (do not use stack allocated buffers). In doubt, enable - * CONFIG_DEBUG_SG to detect badly located buffer. +/* Caution: in the functions below, 'buf' will used with a DMA. So, it must be kmalloc'd (do not use + * stack allocated buffers). In doubt, enable CONFIG_DEBUG_SG to detect badly located buffer. */ int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len); int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t buf_len); diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 6b9ae67da286..028d7e53d66e 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -162,19 +162,17 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) return false; } -/* The device needs data about the antenna configuration. This information in - * provided by PDS (Platform Data Set, this is the wording used in WF200 - * documentation) files. For hardware integrators, the full process to create - * PDS files is described here: +/* The device needs data about the antenna configuration. This information in provided by PDS + * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware + * integrators, the full process to create PDS files is described here: * https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md * - * So this function aims to send PDS to the device. However, the PDS file is - * often bigger than Rx buffers of the chip, so it has to be sent in multiple - * parts. + * So this function aims to send PDS to the device. However, the PDS file is often bigger than Rx + * buffers of the chip, so it has to be sent in multiple parts. * - * In add, the PDS data cannot be split anywhere. The PDS files contains tree - * structures. Braces are used to enter/leave a level of the tree (in a JSON - * fashion). PDS files can only been split between root nodes. + * In add, the PDS data cannot be split anywhere. The PDS files contains tree structures. Braces are + * used to enter/leave a level of the tree (in a JSON fashion). PDS files can only been split + * between root nodes. */ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) { @@ -341,8 +339,8 @@ int wfx_probe(struct wfx_dev *wdev) int err; struct gpio_desc *gpio_saved; - /* During first part of boot, gpio_wakeup cannot yet been used. So - * prevent bh() to touch it. + /* During first part of boot, gpio_wakeup cannot yet been used. So prevent bh() to touch + * it. */ gpio_saved = wdev->pdata.gpio_wakeup; wdev->pdata.gpio_wakeup = NULL; diff --git a/drivers/staging/wfx/main.h b/drivers/staging/wfx/main.h index def6270bf10d..68c665307153 100644 --- a/drivers/staging/wfx/main.h +++ b/drivers/staging/wfx/main.h @@ -23,8 +23,8 @@ struct wfx_platform_data { const char *file_fw; const char *file_pds; struct gpio_desc *gpio_wakeup; - /* if true HIF D_out is sampled on the rising edge of the clock - * (intended to be used in 50Mhz SDIO) + /* if true HIF D_out is sampled on the rising edge of the clock (intended to be used in + * 50Mhz SDIO) */ bool use_rising_clk; }; diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 9b49e41f06ce..9186726ff07f 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -59,9 +59,8 @@ void wfx_tx_lock_flush(struct wfx_dev *wdev) void wfx_tx_queues_init(struct wfx_vif *wvif) { - /* The device is in charge to respect the details of the QoS parameters. - * The driver just ensure that it roughtly respect the priorities to - * avoid any shortage. + /* The device is in charge to respect the details of the QoS parameters. The driver just + * ensure that it roughtly respect the priorities to avoid any shortage. */ const int priorities[IEEE80211_NUM_ACS] = { 1, 2, 64, 128 }; int i; diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 07054666fe76..f64adba350eb 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -107,8 +107,8 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, * - PS-Poll (FIF_PSPOLL) are never filtered * - RTS, CTS and Ack (FIF_CONTROL) are always filtered * - Broken frames (FIF_FCSFAIL and FIF_PLCPFAIL) are always filtered - * - Firmware does (yet) allow to forward unicast traffic sent to - * other stations (aka. promiscuous mode) + * - Firmware does (yet) allow to forward unicast traffic sent to other stations (aka. + * promiscuous mode) */ *total_flags &= FIF_BCN_PRBRESP_PROMISC | FIF_ALLMULTI | FIF_OTHER_BSS | FIF_PROBE_REQ | FIF_PSPOLL; @@ -168,9 +168,7 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) dev_info(wvif->wdev->dev, "ignoring requested PS mode"); return -1; } - /* It is necessary to enable PS if channels - * are different. - */ + /* It is necessary to enable PS if channels are different. */ if (enable_ps) *enable_ps = true; if (wvif->wdev->force_ps_timeout > -1) @@ -429,10 +427,9 @@ static void wfx_join(struct wfx_vif *wvif) ieee80211_connection_loss(wvif->vif); wfx_reset(wvif); } else { - /* Due to beacon filtering it is possible that the - * AP's beacon is not known for the mac80211 stack. - * Disable filtering temporary to make sure the stack - * receives at least one + /* Due to beacon filtering it is possible that the AP's beacon is not known for the + * mac80211 stack. Disable filtering temporary to make sure the stack receives at + * least one */ wfx_filter_beacon(wvif, false); } @@ -459,9 +456,7 @@ static void wfx_join_finalize(struct wfx_vif *wvif, wvif->join_in_progress = false; wfx_hif_set_association_mode(wvif, ampdu_density, greenfield, info->use_short_preamble); wfx_hif_keep_alive_period(wvif, 0); - /* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use - * the same value. - */ + /* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use the same value. */ wfx_hif_set_bss_params(wvif, info->aid, 7); wfx_hif_set_beacon_wakeup_period(wvif, 1, 1); wfx_update_pm(wvif); @@ -485,10 +480,9 @@ void wfx_leave_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif) static void wfx_enable_beacon(struct wfx_vif *wvif, bool enable) { - /* Driver has Content After DTIM Beacon in queue. Driver is waiting for - * a signal from the firmware. Since we are going to stop to send - * beacons, this signal will never happens. See also - * wfx_suspend_resume_mc() + /* Driver has Content After DTIM Beacon in queue. Driver is waiting for a signal from the + * firmware. Since we are going to stop to send beacons, this signal will never happens. See + * also wfx_suspend_resume_mc() */ if (!enable && wfx_tx_queues_has_cab(wvif)) { wvif->after_dtim_tx_allowed = true; @@ -527,9 +521,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (vif->type != NL80211_IFTYPE_STATION) dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", __func__); wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period, info->dtim_period); - /* We temporary forwarded beacon for join process. It is now no - * more necessary. - */ + /* We temporary forwarded beacon for join process. It is now no more necessary. */ wfx_filter_beacon(wvif, true); } @@ -629,8 +621,8 @@ void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd) if (notify_cmd != STA_NOTIFY_AWAKE) return; - /* Device won't be able to honor CAB if a scan is in progress on any - * interface. Prefer to skip this DTIM and wait for the next one. + /* Device won't be able to honor CAB if a scan is in progress on any interface. Prefer to + * skip this DTIM and wait for the next one. */ wvif_it = NULL; while ((wvif_it = wvif_iterate(wvif->wdev, wvif_it)) != NULL) diff --git a/drivers/staging/wfx/traces.h b/drivers/staging/wfx/traces.h index 9fbf0081dbf7..e011e8a46bd5 100644 --- a/drivers/staging/wfx/traces.h +++ b/drivers/staging/wfx/traces.h @@ -18,8 +18,8 @@ #include "hif_api_cmd.h" #include "hif_api_mib.h" -/* The hell below need some explanations. For each symbolic number, we need to - * define it with TRACE_DEFINE_ENUM() and in a list for __print_symbolic. +/* The hell below need some explanations. For each symbolic number, we need to define it with + * TRACE_DEFINE_ENUM() and in a list for __print_symbolic. * * 1. Define a new macro that call TRACE_DEFINE_ENUM(): * @@ -41,9 +41,8 @@ * #undef xxx_name * #define xxx_name(msg) { msg, #msg }, * - * 5. list_name can now nearly be used with __print_symbolic() but, - * __print_symbolic() dislike last comma of list. So we define a new list - * with a dummy element: + * 5. list_name can now nearly be used with __print_symbolic() but, __print_symbolic() dislike + * last comma of list. So we define a new list with a dummy element: * * #define list_for_print_symbolic list_names { -1, NULL } */ -- cgit From 76523cea867a550a641b2d86ac8c1bf70385b958 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:15 +0100 Subject: staging: wfx: fix structs alignments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some structs members were not properly aligned. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-23-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bus_sdio.c | 12 +++--- drivers/staging/wfx/bus_spi.c | 12 +++--- drivers/staging/wfx/debug.c | 2 +- drivers/staging/wfx/fwio.c | 6 +-- drivers/staging/wfx/main.c | 54 +++++++++++++------------- drivers/staging/wfx/queue.h | 8 ++-- drivers/staging/wfx/wfx.h | 86 +++++++++++++++++++++--------------------- 7 files changed, 90 insertions(+), 90 deletions(-) diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index a3da661e355c..4b77df2f463e 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -157,13 +157,13 @@ static size_t wfx_sdio_align_size(void *priv, size_t size) } static const struct wfx_hwbus_ops wfx_sdio_hwbus_ops = { - .copy_from_io = wfx_sdio_copy_from_io, - .copy_to_io = wfx_sdio_copy_to_io, - .irq_subscribe = wfx_sdio_irq_subscribe, + .copy_from_io = wfx_sdio_copy_from_io, + .copy_to_io = wfx_sdio_copy_to_io, + .irq_subscribe = wfx_sdio_irq_subscribe, .irq_unsubscribe = wfx_sdio_irq_unsubscribe, - .lock = wfx_sdio_lock, - .unlock = wfx_sdio_unlock, - .align_size = wfx_sdio_align_size, + .lock = wfx_sdio_lock, + .unlock = wfx_sdio_unlock, + .align_size = wfx_sdio_align_size, }; static const struct of_device_id wfx_sdio_of_match[] = { diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index fe39b4cb8194..417bb74c88b9 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -164,13 +164,13 @@ static size_t wfx_spi_align_size(void *priv, size_t size) } static const struct wfx_hwbus_ops wfx_spi_hwbus_ops = { - .copy_from_io = wfx_spi_copy_from_io, - .copy_to_io = wfx_spi_copy_to_io, - .irq_subscribe = wfx_spi_irq_subscribe, + .copy_from_io = wfx_spi_copy_from_io, + .copy_to_io = wfx_spi_copy_to_io, + .irq_subscribe = wfx_spi_irq_subscribe, .irq_unsubscribe = wfx_spi_irq_unsubscribe, - .lock = wfx_spi_lock, - .unlock = wfx_spi_unlock, - .align_size = wfx_spi_align_size, + .lock = wfx_spi_lock, + .unlock = wfx_spi_unlock, + .align_size = wfx_spi_align_size, }; static int wfx_spi_probe(struct spi_device *func) diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index c62cb5fea4eb..ae7895ea36d9 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -75,7 +75,7 @@ static int wfx_counters_show(struct seq_file *seq, void *v) seq_printf(seq, "%-24s %12s %12s %12s\n", "", "global", "iface 0", "iface 1"); #define PUT_COUNTER(name) \ - seq_printf(seq, "%-24s %12d %12d %12d\n", #name, \ + seq_printf(seq, "%-24s %12d %12d %12d\n", #name, \ le32_to_cpu(counters[2].count_##name), \ le32_to_cpu(counters[0].count_##name), \ le32_to_cpu(counters[1].count_##name)) diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c index 24c314b10b95..9005a6fe48c8 100644 --- a/drivers/staging/wfx/fwio.c +++ b/drivers/staging/wfx/fwio.c @@ -64,9 +64,9 @@ static const char * const fwio_errors[] = { [ERR_INVALID_SEC_TYPE] = "Invalid section type or wrong encryption", [ERR_SIG_VERIF_FAILED] = "Signature verification failed", - [ERR_AES_CTRL_KEY] = "AES control key not initialized", - [ERR_ECC_PUB_KEY] = "ECC public key not initialized", - [ERR_MAC_KEY] = "MAC key not initialized", + [ERR_AES_CTRL_KEY] = "AES control key not initialized", + [ERR_ECC_PUB_KEY] = "ECC public key not initialized", + [ERR_MAC_KEY] = "MAC key not initialized", }; /* request_firmware() allocate data using vmalloc(). It is not compatible with underlying hardware diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 028d7e53d66e..217c0c5c60d1 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -121,34 +121,34 @@ static const struct ieee80211_iface_combination wfx_iface_combinations[] = { }; static const struct ieee80211_ops wfx_ops = { - .start = wfx_start, - .stop = wfx_stop, - .add_interface = wfx_add_interface, - .remove_interface = wfx_remove_interface, - .config = wfx_config, - .tx = wfx_tx, - .join_ibss = wfx_join_ibss, - .leave_ibss = wfx_leave_ibss, - .conf_tx = wfx_conf_tx, - .hw_scan = wfx_hw_scan, - .cancel_hw_scan = wfx_cancel_hw_scan, - .start_ap = wfx_start_ap, - .stop_ap = wfx_stop_ap, - .sta_add = wfx_sta_add, - .sta_remove = wfx_sta_remove, - .set_tim = wfx_set_tim, - .set_key = wfx_set_key, - .set_rts_threshold = wfx_set_rts_threshold, + .start = wfx_start, + .stop = wfx_stop, + .add_interface = wfx_add_interface, + .remove_interface = wfx_remove_interface, + .config = wfx_config, + .tx = wfx_tx, + .join_ibss = wfx_join_ibss, + .leave_ibss = wfx_leave_ibss, + .conf_tx = wfx_conf_tx, + .hw_scan = wfx_hw_scan, + .cancel_hw_scan = wfx_cancel_hw_scan, + .start_ap = wfx_start_ap, + .stop_ap = wfx_stop_ap, + .sta_add = wfx_sta_add, + .sta_remove = wfx_sta_remove, + .set_tim = wfx_set_tim, + .set_key = wfx_set_key, + .set_rts_threshold = wfx_set_rts_threshold, .set_default_unicast_key = wfx_set_default_unicast_key, - .bss_info_changed = wfx_bss_info_changed, - .configure_filter = wfx_configure_filter, - .ampdu_action = wfx_ampdu_action, - .flush = wfx_flush, - .add_chanctx = wfx_add_chanctx, - .remove_chanctx = wfx_remove_chanctx, - .change_chanctx = wfx_change_chanctx, - .assign_vif_chanctx = wfx_assign_vif_chanctx, - .unassign_vif_chanctx = wfx_unassign_vif_chanctx, + .bss_info_changed = wfx_bss_info_changed, + .configure_filter = wfx_configure_filter, + .ampdu_action = wfx_ampdu_action, + .flush = wfx_flush, + .add_chanctx = wfx_add_chanctx, + .remove_chanctx = wfx_remove_chanctx, + .change_chanctx = wfx_change_chanctx, + .assign_vif_chanctx = wfx_assign_vif_chanctx, + .unassign_vif_chanctx = wfx_unassign_vif_chanctx, }; bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index 2860c56fb933..4731debca93d 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -15,10 +15,10 @@ struct wfx_dev; struct wfx_vif; struct wfx_queue { - struct sk_buff_head normal; - struct sk_buff_head cab; /* Content After (DTIM) Beacon */ - atomic_t pending_frames; - int priority; + struct sk_buff_head normal; + struct sk_buff_head cab; /* Content After (DTIM) Beacon */ + atomic_t pending_frames; + int priority; }; void wfx_tx_lock(struct wfx_dev *wdev); diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 565874815aa8..0fc8366d9fb3 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -28,68 +28,68 @@ struct wfx_hwbus_ops; struct wfx_dev { - struct wfx_platform_data pdata; - struct device *dev; - struct ieee80211_hw *hw; - struct ieee80211_vif *vif[2]; - struct mac_address addresses[2]; + struct wfx_platform_data pdata; + struct device *dev; + struct ieee80211_hw *hw; + struct ieee80211_vif *vif[2]; + struct mac_address addresses[2]; const struct wfx_hwbus_ops *hwbus_ops; - void *hwbus_priv; + void *hwbus_priv; - u8 keyset; - struct completion firmware_ready; + u8 keyset; + struct completion firmware_ready; struct wfx_hif_ind_startup hw_caps; - struct wfx_hif hif; - struct delayed_work cooling_timeout_work; - bool poll_irq; - bool chip_frozen; - struct mutex conf_mutex; - - struct wfx_hif_cmd hif_cmd; - struct sk_buff_head tx_pending; - wait_queue_head_t tx_dequeue; - atomic_t tx_lock; - - atomic_t packet_id; - u32 key_map; - - struct wfx_hif_rx_stats rx_stats; - struct mutex rx_stats_lock; + struct wfx_hif hif; + struct delayed_work cooling_timeout_work; + bool poll_irq; + bool chip_frozen; + struct mutex conf_mutex; + + struct wfx_hif_cmd hif_cmd; + struct sk_buff_head tx_pending; + wait_queue_head_t tx_dequeue; + atomic_t tx_lock; + + atomic_t packet_id; + u32 key_map; + + struct wfx_hif_rx_stats rx_stats; + struct mutex rx_stats_lock; struct wfx_hif_tx_power_loop_info tx_power_loop_info; - struct mutex tx_power_loop_info_lock; + struct mutex tx_power_loop_info_lock; int force_ps_timeout; }; struct wfx_vif { - struct wfx_dev *wdev; - struct ieee80211_vif *vif; - struct ieee80211_channel *channel; - int id; + struct wfx_dev *wdev; + struct ieee80211_vif *vif; + struct ieee80211_channel *channel; + int id; - u32 link_id_map; + u32 link_id_map; - bool after_dtim_tx_allowed; - bool join_in_progress; + bool after_dtim_tx_allowed; + bool join_in_progress; - struct delayed_work beacon_loss_work; + struct delayed_work beacon_loss_work; - struct wfx_queue tx_queue[4]; + struct wfx_queue tx_queue[4]; struct wfx_tx_policy_cache tx_policy_cache; - struct work_struct tx_policy_upload_work; + struct work_struct tx_policy_upload_work; - struct work_struct update_tim_work; + struct work_struct update_tim_work; - unsigned long uapsd_mask; + unsigned long uapsd_mask; /* avoid some operations in parallel with scan */ - struct mutex scan_lock; - struct work_struct scan_work; - struct completion scan_complete; - int scan_nb_chan_done; - bool scan_abort; + struct mutex scan_lock; + struct work_struct scan_work; + struct completion scan_complete; + int scan_nb_chan_done; + bool scan_abort; struct ieee80211_scan_request *scan_req; - struct completion set_pm_mode_complete; + struct completion set_pm_mode_complete; }; static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_id) -- cgit From 76bf5775de7d56afb8d8da43a178ecb76b954aa3 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:16 +0100 Subject: staging: wfx: use explicit labels for errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prefer fully named labels to handle errors instead of err0, err1, ... Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-24-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bus_sdio.c | 9 ++++----- drivers/staging/wfx/main.c | 31 +++++++++++++++---------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 4b77df2f463e..5c45ccd85a7d 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -214,26 +214,25 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i sdio_set_block_size(func, 64); sdio_release_host(func); if (ret) - goto err0; + return ret; bus->core = wfx_init_common(&func->dev, &wfx_sdio_pdata, &wfx_sdio_hwbus_ops, bus); if (!bus->core) { ret = -EIO; - goto err1; + goto sdio_release; } ret = wfx_probe(bus->core); if (ret) - goto err1; + goto sdio_release; return 0; -err1: +sdio_release: sdio_claim_host(func); sdio_disable_func(func); sdio_release_host(func); -err0: return ret; } diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 217c0c5c60d1..46fd5702e471 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -232,18 +232,17 @@ static int wfx_send_pdata_pds(struct wfx_dev *wdev) if (ret) { dev_err(wdev->dev, "can't load antenna parameters (PDS file %s). The device may be unstable.\n", wdev->pdata.file_pds); - goto err1; + return ret; } tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); if (!tmp_buf) { ret = -ENOMEM; - goto err2; + goto release_fw; } ret = wfx_send_pds(wdev, tmp_buf, pds->size); kfree(tmp_buf); -err2: +release_fw: release_firmware(pds); -err1: return ret; } @@ -350,7 +349,7 @@ int wfx_probe(struct wfx_dev *wdev) err = wfx_init_device(wdev); if (err) - goto err0; + goto bh_unregister; wfx_bh_poll_irq(wdev); err = wait_for_completion_timeout(&wdev->firmware_ready, 1 * HZ); @@ -361,7 +360,7 @@ int wfx_probe(struct wfx_dev *wdev) } else if (err == -ERESTARTSYS) { dev_info(wdev->dev, "probe interrupted by user\n"); } - goto err0; + goto bh_unregister; } /* FIXME: fill wiphy::hw_version */ @@ -380,13 +379,13 @@ int wfx_probe(struct wfx_dev *wdev) if (wfx_api_older_than(wdev, 1, 0)) { dev_err(wdev->dev, "unsupported firmware API version (expect 1 while firmware returns %d)\n", wdev->hw_caps.api_version_major); - err = -ENOTSUPP; - goto err0; + err = -EOPNOTSUPP; + goto bh_unregister; } if (wdev->hw_caps.link_mode == SEC_LINK_ENFORCED) { dev_err(wdev->dev, "chip require secure_link, but can't negotiate it\n"); - goto err0; + goto bh_unregister; } if (wdev->hw_caps.region_sel_mode) { @@ -401,12 +400,12 @@ int wfx_probe(struct wfx_dev *wdev) dev_dbg(wdev->dev, "sending configuration file %s\n", wdev->pdata.file_pds); err = wfx_send_pdata_pds(wdev); if (err < 0 && err != -ENOENT) - goto err0; + goto bh_unregister; wdev->poll_irq = false; err = wdev->hwbus_ops->irq_subscribe(wdev->hwbus_priv); if (err) - goto err0; + goto bh_unregister; err = wfx_hif_use_multi_tx_conf(wdev, true); if (err) @@ -444,19 +443,19 @@ int wfx_probe(struct wfx_dev *wdev) err = ieee80211_register_hw(wdev->hw); if (err) - goto err1; + goto irq_unsubscribe; err = wfx_debug_init(wdev); if (err) - goto err2; + goto ieee80211_unregister; return 0; -err2: +ieee80211_unregister: ieee80211_unregister_hw(wdev->hw); -err1: +irq_unsubscribe: wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv); -err0: +bh_unregister: wfx_bh_unregister(wdev); return err; } -- cgit From b9bf5fb178bed6fe6148e1e5cae21e3bd55c7797 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:17 +0100 Subject: staging: wfx: replace compiletime_assert() by BUILD_BUG_ON_MSG() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that BUILD_BUG_ON_MSG() is a bit more popular. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-25-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/data_tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index ca2f24b92d24..bfc3d4412ac6 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -391,8 +391,8 @@ void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struc struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; size_t driver_data_room = sizeof_field(struct ieee80211_tx_info, rate_driver_data); - compiletime_assert(sizeof(struct wfx_tx_priv) <= driver_data_room, - "struct tx_priv is too large"); + BUILD_BUG_ON_MSG(sizeof(struct wfx_tx_priv) > driver_data_room, + "struct tx_priv is too large"); WARN(skb->next || skb->prev, "skb is already member of a list"); /* control.vif can be NULL for injected frames */ if (tx_info->control.vif) -- cgit From ea17482269fb872d284b94a4e5d68443ac74956b Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:18 +0100 Subject: staging: wfx: do not display functions names in logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is not necessary to prefix error logs with the function name when an error message is unique in the code. Note this patch still prefixes the message 'received event for non-existent vif' with the function name since it is used several times. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-26-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bh.c | 3 +-- drivers/staging/wfx/data_tx.c | 2 +- drivers/staging/wfx/hif_rx.c | 3 +-- drivers/staging/wfx/scan.c | 3 +-- drivers/staging/wfx/sta.c | 5 ++--- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index 1ec4a4951d99..4c6ba9c342a6 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -69,8 +69,7 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) int release_count; int piggyback = 0; - WARN(read_len > round_down(0xFFF, 2) * sizeof(u16), - "%s: request exceed the chip capability", __func__); + WARN(read_len > round_down(0xFFF, 2) * sizeof(u16), "request exceed the chip capability"); /* Add 2 to take into account piggyback size */ alloc_len = wdev->hwbus_ops->align_size(wdev->hwbus_priv, read_len + 2); diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index bfc3d4412ac6..d7bcf3bae08a 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -425,7 +425,7 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) req->fc_offset; if (!wvif) { - pr_warn("%s: vif associated with the skb does not exist anymore\n", __func__); + pr_warn("vif associated with the skb does not exist anymore\n"); return; } wfx_tx_policy_put(wvif, req->retry_policy_index); diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index 5300ef57413f..302bdb2bf036 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -101,8 +101,7 @@ static int wfx_hif_receive_indication(struct wfx_dev *wdev, const struct wfx_hif const struct wfx_hif_ind_rx *body = buf; if (!wvif) { - dev_warn(wdev->dev, "%s: ignore rx data for non-existent vif %d\n", - __func__, hif->interface); + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); return -EIO; } skb_pull(skb, sizeof(struct wfx_hif_msg) + sizeof(struct wfx_hif_ind_rx)); diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index ce0ae4c91190..7f34f0d322f9 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -94,8 +94,7 @@ void wfx_hw_scan_work(struct work_struct *work) mutex_lock(&wvif->wdev->conf_mutex); mutex_lock(&wvif->scan_lock); if (wvif->join_in_progress) { - dev_info(wvif->wdev->dev, "%s: abort in-progress REQ_JOIN", - __func__); + dev_info(wvif->wdev->dev, "abort in-progress REQ_JOIN"); wfx_reset(wvif); } update_probe_tmpl(wvif, &hw_req->req); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index f64adba350eb..83f1ac87e0f2 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -513,13 +513,12 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, else if (!info->assoc && vif->type == NL80211_IFTYPE_STATION) wfx_reset(wvif); else - dev_warn(wdev->dev, "%s: misunderstood change: ASSOC\n", - __func__); + dev_warn(wdev->dev, "misunderstood change: ASSOC\n"); } if (changed & BSS_CHANGED_BEACON_INFO) { if (vif->type != NL80211_IFTYPE_STATION) - dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", __func__); + dev_warn(wdev->dev, "misunderstood change: BEACON_INFO\n"); wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period, info->dtim_period); /* We temporary forwarded beacon for join process. It is now no more necessary. */ wfx_filter_beacon(wvif, true); -- cgit From 42f14190c3684321aa7115b41a79bed258d898ac Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:19 +0100 Subject: staging: wfx: remove force_ps_timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ps_timeout should be in nl80211, not in debugfs. Let's remove it until the driver is accepted. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-27-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/debug.c | 23 ----------------------- drivers/staging/wfx/main.c | 1 - drivers/staging/wfx/sta.c | 8 ++------ drivers/staging/wfx/wfx.h | 1 - 4 files changed, 2 insertions(+), 31 deletions(-) diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index ae7895ea36d9..e8265208f9a5 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -316,28 +316,6 @@ static const struct file_operations wfx_send_hif_msg_fops = { .read = wfx_send_hif_msg_read, }; -static int wfx_ps_timeout_set(void *data, u64 val) -{ - struct wfx_dev *wdev = (struct wfx_dev *)data; - struct wfx_vif *wvif; - - wdev->force_ps_timeout = val; - wvif = NULL; - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) - wfx_update_pm(wvif); - return 0; -} - -static int wfx_ps_timeout_get(void *data, u64 *val) -{ - struct wfx_dev *wdev = (struct wfx_dev *)data; - - *val = wdev->force_ps_timeout; - return 0; -} - -DEFINE_DEBUGFS_ATTRIBUTE(wfx_ps_timeout_fops, wfx_ps_timeout_get, wfx_ps_timeout_set, "%lld\n"); - int wfx_debug_init(struct wfx_dev *wdev) { struct dentry *d; @@ -348,7 +326,6 @@ int wfx_debug_init(struct wfx_dev *wdev) debugfs_create_file("tx_power_loop", 0444, d, wdev, &wfx_tx_power_loop_fops); debugfs_create_file("send_pds", 0200, d, wdev, &wfx_send_pds_fops); debugfs_create_file("send_hif_msg", 0600, d, wdev, &wfx_send_hif_msg_fops); - debugfs_create_file("ps_timeout", 0600, d, wdev, &wfx_ps_timeout_fops); return 0; } diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 46fd5702e471..a98a261f6d76 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -324,7 +324,6 @@ struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_da skb_queue_head_init(&wdev->tx_pending); init_waitqueue_head(&wdev->tx_dequeue); wfx_init_hif_cmd(&wdev->hif_cmd); - wdev->force_ps_timeout = -1; if (devm_add_action_or_reset(dev, wfx_free_common, wdev)) return NULL; diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 83f1ac87e0f2..ba53e4d70c4f 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -171,18 +171,14 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) /* It is necessary to enable PS if channels are different. */ if (enable_ps) *enable_ps = true; - if (wvif->wdev->force_ps_timeout > -1) - return wvif->wdev->force_ps_timeout; - else if (wfx_api_older_than(wvif->wdev, 3, 2)) + if (wfx_api_older_than(wvif->wdev, 3, 2)) return 0; else return 30; } if (enable_ps) *enable_ps = wvif->vif->bss_conf.ps; - if (wvif->wdev->force_ps_timeout > -1) - return wvif->wdev->force_ps_timeout; - else if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) + if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) return conf->dynamic_ps_timeout; else return -1; diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 0fc8366d9fb3..6594cc647c2f 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -57,7 +57,6 @@ struct wfx_dev { struct mutex rx_stats_lock; struct wfx_hif_tx_power_loop_info tx_power_loop_info; struct mutex tx_power_loop_info_lock; - int force_ps_timeout; }; struct wfx_vif { -- cgit From 1ad0104e94d7019a153d4376ee0e8a8edc33ba5c Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:20 +0100 Subject: staging: wfx: map 'compatible' attribute with board name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "WF200" only designates the chip. To make a WiFi board, the chip must be associated with an antenna. The antenna configuration is located in separate files (aka PDS files in Silabs wording). Currently, user has to write in his DT something like: compatible = "silabs,wf200"; config = "brd4001a.pds"; It is far better to embed a list of known boards (chip + antenna) in the driver. So the user just have to declare: compatible = "silabs,brd4001a"; This patch add the configurations for the evaluation boards sold by Silabs. To provide a full plug-and-play experience, the associated PDS files[1] will be available in linux-firmware. This patch does not break compatibility with existing setups. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-28-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- .../bindings/net/wireless/silabs,wfx.yaml | 11 +++-- drivers/staging/wfx/bus_sdio.c | 35 ++++++++++++--- drivers/staging/wfx/bus_spi.c | 52 ++++++++++++++++++---- drivers/staging/wfx/main.h | 1 + 4 files changed, 83 insertions(+), 16 deletions(-) diff --git a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml index 510edd12ed19..44aeba0f7276 100644 --- a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml +++ b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml @@ -39,7 +39,12 @@ description: properties: compatible: - const: silabs,wf200 + items: + - enum: + - silabs,brd4001a # WGM160P Evaluation Board + - silabs,brd8022a # WF200 Evaluation Board + - silabs,brd8023a # WFM200 Evaluation Board + - const: silabs,wf200 # Chip alone without antenna reg: description: When used on SDIO bus, must be set to 1. When used on SPI bus, it is @@ -87,7 +92,7 @@ examples: #size-cells = <0>; wfx@0 { - compatible = "silabs,wf200"; + compatible = "silabs,brd8022a", "silabs,wf200"; pinctrl-names = "default"; pinctrl-0 = <&wfx_irq &wfx_gpios>; reg = <0>; @@ -115,7 +120,7 @@ examples: #size-cells = <0>; mmc@1 { - compatible = "silabs,wf200"; + compatible = "silabs,brd8022a", "silabs,wf200"; pinctrl-names = "default"; pinctrl-0 = <&wfx_wakeup>; reg = <1>; diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 5c45ccd85a7d..361585763f30 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -20,7 +21,28 @@ #include "main.h" #include "bh.h" -static const struct wfx_platform_data wfx_sdio_pdata = { +static const struct wfx_platform_data pdata_wf200 = { + .file_fw = "wfm_wf200", + .file_pds = "wf200.pds", +}; + +static const struct wfx_platform_data pdata_brd4001a = { + .file_fw = "wfm_wf200", + .file_pds = "brd4001a.pds", +}; + +static const struct wfx_platform_data pdata_brd8022a = { + .file_fw = "wfm_wf200", + .file_pds = "brd8022a.pds", +}; + +static const struct wfx_platform_data pdata_brd8023a = { + .file_fw = "wfm_wf200", + .file_pds = "brd8023a.pds", +}; + +/* Legacy DT don't use it */ +static const struct wfx_platform_data pdata_wfx_sdio = { .file_fw = "wfm_wf200", .file_pds = "wf200.pds", }; @@ -167,14 +189,18 @@ static const struct wfx_hwbus_ops wfx_sdio_hwbus_ops = { }; static const struct of_device_id wfx_sdio_of_match[] = { - { .compatible = "silabs,wfx-sdio" }, - { .compatible = "silabs,wf200" }, + { .compatible = "silabs,wf200", .data = &pdata_wf200 }, + { .compatible = "silabs,brd4001a", .data = &pdata_brd4001a }, + { .compatible = "silabs,brd8022a", .data = &pdata_brd8022a }, + { .compatible = "silabs,brd8023a", .data = &pdata_brd8023a }, + { .compatible = "silabs,wfx-sdio", .data = &pdata_wfx_sdio }, { }, }; MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { + const struct wfx_platform_data *pdata = of_device_get_match_data(&func->dev); struct device_node *np = func->dev.of_node; struct wfx_sdio_priv *bus; int ret; @@ -216,8 +242,7 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i if (ret) return ret; - bus->core = wfx_init_common(&func->dev, &wfx_sdio_pdata, - &wfx_sdio_hwbus_ops, bus); + bus->core = wfx_init_common(&func->dev, pdata, &wfx_sdio_hwbus_ops, bus); if (!bus->core) { ret = -EIO; goto sdio_release; diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index 417bb74c88b9..9aa52d76cdda 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -23,12 +23,36 @@ #define SET_WRITE 0x7FFF /* usage: and operation */ #define SET_READ 0x8000 /* usage: or operation */ -#define WFX_RESET_INVERTED 1 +static const struct wfx_platform_data pdata_wf200 = { + .file_fw = "wfm_wf200", + .file_pds = "wf200.pds", + .use_rising_clk = true, +}; + +static const struct wfx_platform_data pdata_brd4001a = { + .file_fw = "wfm_wf200", + .file_pds = "brd4001a.pds", + .use_rising_clk = true, +}; + +static const struct wfx_platform_data pdata_brd8022a = { + .file_fw = "wfm_wf200", + .file_pds = "brd8022a.pds", + .use_rising_clk = true, +}; -static const struct wfx_platform_data wfx_spi_pdata = { +static const struct wfx_platform_data pdata_brd8023a = { + .file_fw = "wfm_wf200", + .file_pds = "brd8023a.pds", + .use_rising_clk = true, +}; + +/* Legacy DT don't use it */ +static const struct wfx_platform_data pdata_wfx_spi = { .file_fw = "wfm_wf200", .file_pds = "wf200.pds", .use_rising_clk = true, + .reset_inverted = true, }; struct wfx_spi_priv { @@ -175,6 +199,7 @@ static const struct wfx_hwbus_ops wfx_spi_hwbus_ops = { static int wfx_spi_probe(struct spi_device *func) { + struct wfx_platform_data *pdata; struct wfx_spi_priv *bus; int ret; @@ -183,6 +208,12 @@ static int wfx_spi_probe(struct spi_device *func) ret = spi_setup(func); if (ret) return ret; + pdata = (struct wfx_platform_data *)spi_get_device_id(func)->driver_data; + if (!pdata) { + dev_err(&func->dev, "unable to retrieve driver data (please report)\n"); + return -ENODEV; + } + /* Trace below is also displayed by spi_setup() if compiled with DEBUG */ dev_dbg(&func->dev, "SPI params: CS=%d, mode=%d bits/word=%d speed=%d\n", func->chip_select, func->mode, func->bits_per_word, func->max_speed_hz); @@ -206,7 +237,7 @@ static int wfx_spi_probe(struct spi_device *func) dev_warn(&func->dev, "gpio reset is not defined, trying to load firmware anyway\n"); } else { gpiod_set_consumer_name(bus->gpio_reset, "wfx reset"); - if (spi_get_device_id(func)->driver_data & WFX_RESET_INVERTED) + if (pdata->reset_inverted) gpiod_toggle_active_low(bus->gpio_reset); gpiod_set_value_cansleep(bus->gpio_reset, 1); usleep_range(100, 150); @@ -214,8 +245,7 @@ static int wfx_spi_probe(struct spi_device *func) usleep_range(2000, 2500); } - bus->core = wfx_init_common(&func->dev, &wfx_spi_pdata, - &wfx_spi_hwbus_ops, bus); + bus->core = wfx_init_common(&func->dev, pdata, &wfx_spi_hwbus_ops, bus); if (!bus->core) return -EIO; @@ -235,16 +265,22 @@ static int wfx_spi_remove(struct spi_device *func) * stripped. */ static const struct spi_device_id wfx_spi_id[] = { - { "wfx-spi", WFX_RESET_INVERTED }, - { "wf200", 0 }, + { "wf200", (kernel_ulong_t)&pdata_wf200 }, + { "brd4001a", (kernel_ulong_t)&pdata_brd4001a }, + { "brd8022a", (kernel_ulong_t)&pdata_brd8022a }, + { "brd8023a", (kernel_ulong_t)&pdata_brd8023a }, + { "wfx-spi", (kernel_ulong_t)&pdata_wfx_spi }, { }, }; MODULE_DEVICE_TABLE(spi, wfx_spi_id); #ifdef CONFIG_OF static const struct of_device_id wfx_spi_of_match[] = { - { .compatible = "silabs,wfx-spi", .data = (void *)WFX_RESET_INVERTED }, { .compatible = "silabs,wf200" }, + { .compatible = "silabs,brd4001a" }, + { .compatible = "silabs,brd8022a" }, + { .compatible = "silabs,brd8023a" }, + { .compatible = "silabs,wfx-spi" }, { }, }; MODULE_DEVICE_TABLE(of, wfx_spi_of_match); diff --git a/drivers/staging/wfx/main.h b/drivers/staging/wfx/main.h index 68c665307153..fcd26b24519e 100644 --- a/drivers/staging/wfx/main.h +++ b/drivers/staging/wfx/main.h @@ -23,6 +23,7 @@ struct wfx_platform_data { const char *file_fw; const char *file_pds; struct gpio_desc *gpio_wakeup; + bool reset_inverted; /* if true HIF D_out is sampled on the rising edge of the clock (intended to be used in * 50Mhz SDIO) */ -- cgit From 6ed63359abb9db8c2b0b714ee2b846e4285ff451 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:21 +0100 Subject: staging: wfx: fix firmware location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is currently, a mismatch between the location of the firmware in linux-firmware and the path written in the driver. We take this opportunity to relocate the WF200 firmware in wfx/ instead of silabs/. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-29-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bus_sdio.c | 16 ++++++++-------- drivers/staging/wfx/bus_spi.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 361585763f30..6ead6957b751 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -22,23 +22,23 @@ #include "bh.h" static const struct wfx_platform_data pdata_wf200 = { - .file_fw = "wfm_wf200", - .file_pds = "wf200.pds", + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/wf200.pds", }; static const struct wfx_platform_data pdata_brd4001a = { - .file_fw = "wfm_wf200", - .file_pds = "brd4001a.pds", + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/brd4001a.pds", }; static const struct wfx_platform_data pdata_brd8022a = { - .file_fw = "wfm_wf200", - .file_pds = "brd8022a.pds", + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/brd8022a.pds", }; static const struct wfx_platform_data pdata_brd8023a = { - .file_fw = "wfm_wf200", - .file_pds = "brd8023a.pds", + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/brd8023a.pds", }; /* Legacy DT don't use it */ diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index 9aa52d76cdda..6b4f9fff8b44 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -24,26 +24,26 @@ #define SET_READ 0x8000 /* usage: or operation */ static const struct wfx_platform_data pdata_wf200 = { - .file_fw = "wfm_wf200", - .file_pds = "wf200.pds", + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/wf200.pds", .use_rising_clk = true, }; static const struct wfx_platform_data pdata_brd4001a = { - .file_fw = "wfm_wf200", - .file_pds = "brd4001a.pds", + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/brd4001a.pds", .use_rising_clk = true, }; static const struct wfx_platform_data pdata_brd8022a = { - .file_fw = "wfm_wf200", - .file_pds = "brd8022a.pds", + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/brd8022a.pds", .use_rising_clk = true, }; static const struct wfx_platform_data pdata_brd8023a = { - .file_fw = "wfm_wf200", - .file_pds = "brd8023a.pds", + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/brd8023a.pds", .use_rising_clk = true, }; -- cgit From 892731372821f3eae7c8c1fddefd7373691ad5a0 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:22 +0100 Subject: staging: wfx: drop legacy compatible values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Values "silabs,wfx-sdio" and "silabs,wfx-spi" are deprecated for a while now. We take advantage of getting out of the staging tree to drop them and start from a blank sheet. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-30-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- .../devicetree/bindings/net/wireless/silabs,wfx.yaml | 3 +-- drivers/staging/wfx/bus_sdio.c | 7 ------- drivers/staging/wfx/bus_spi.c | 12 ------------ drivers/staging/wfx/main.h | 1 - 4 files changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml index 44aeba0f7276..c12be18eb6ac 100644 --- a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml +++ b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml @@ -64,8 +64,7 @@ properties: reset-gpios: description: (SPI only) Phandle of gpio that will be used to reset chip during probe. Without this property, you may encounter issues with warm - boot. (For legacy purpose, the gpio in inverted when compatible == - "silabs,wfx-spi") + boot. For SDIO, the reset gpio should declared using a mmc-pwrseq. maxItems: 1 diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 6ead6957b751..6ea573221ab1 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -41,12 +41,6 @@ static const struct wfx_platform_data pdata_brd8023a = { .file_pds = "wfx/brd8023a.pds", }; -/* Legacy DT don't use it */ -static const struct wfx_platform_data pdata_wfx_sdio = { - .file_fw = "wfm_wf200", - .file_pds = "wf200.pds", -}; - struct wfx_sdio_priv { struct sdio_func *func; struct wfx_dev *core; @@ -193,7 +187,6 @@ static const struct of_device_id wfx_sdio_of_match[] = { { .compatible = "silabs,brd4001a", .data = &pdata_brd4001a }, { .compatible = "silabs,brd8022a", .data = &pdata_brd8022a }, { .compatible = "silabs,brd8023a", .data = &pdata_brd8023a }, - { .compatible = "silabs,wfx-sdio", .data = &pdata_wfx_sdio }, { }, }; MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index 6b4f9fff8b44..062826aa7e6c 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -47,14 +47,6 @@ static const struct wfx_platform_data pdata_brd8023a = { .use_rising_clk = true, }; -/* Legacy DT don't use it */ -static const struct wfx_platform_data pdata_wfx_spi = { - .file_fw = "wfm_wf200", - .file_pds = "wf200.pds", - .use_rising_clk = true, - .reset_inverted = true, -}; - struct wfx_spi_priv { struct spi_device *func; struct wfx_dev *core; @@ -237,8 +229,6 @@ static int wfx_spi_probe(struct spi_device *func) dev_warn(&func->dev, "gpio reset is not defined, trying to load firmware anyway\n"); } else { gpiod_set_consumer_name(bus->gpio_reset, "wfx reset"); - if (pdata->reset_inverted) - gpiod_toggle_active_low(bus->gpio_reset); gpiod_set_value_cansleep(bus->gpio_reset, 1); usleep_range(100, 150); gpiod_set_value_cansleep(bus->gpio_reset, 0); @@ -269,7 +259,6 @@ static const struct spi_device_id wfx_spi_id[] = { { "brd4001a", (kernel_ulong_t)&pdata_brd4001a }, { "brd8022a", (kernel_ulong_t)&pdata_brd8022a }, { "brd8023a", (kernel_ulong_t)&pdata_brd8023a }, - { "wfx-spi", (kernel_ulong_t)&pdata_wfx_spi }, { }, }; MODULE_DEVICE_TABLE(spi, wfx_spi_id); @@ -280,7 +269,6 @@ static const struct of_device_id wfx_spi_of_match[] = { { .compatible = "silabs,brd4001a" }, { .compatible = "silabs,brd8022a" }, { .compatible = "silabs,brd8023a" }, - { .compatible = "silabs,wfx-spi" }, { }, }; MODULE_DEVICE_TABLE(of, wfx_spi_of_match); diff --git a/drivers/staging/wfx/main.h b/drivers/staging/wfx/main.h index fcd26b24519e..68c665307153 100644 --- a/drivers/staging/wfx/main.h +++ b/drivers/staging/wfx/main.h @@ -23,7 +23,6 @@ struct wfx_platform_data { const char *file_fw; const char *file_pds; struct gpio_desc *gpio_wakeup; - bool reset_inverted; /* if true HIF D_out is sampled on the rising edge of the clock (intended to be used in * 50Mhz SDIO) */ -- cgit From a948178e7e78d2498d9ac066ac14ebc66a24f246 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:23 +0100 Subject: staging: wfx: rename "config-file" DT attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "config-file" is too broad. Replace it by "silabs,antenna-config-file" which is more explicit. The attribute "config-file" is probably not widely used. This patch obviously breaks setups that use this attribute. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-31-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- .../devicetree/bindings/net/wireless/silabs,wfx.yaml | 9 +++++---- drivers/staging/wfx/main.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml index c12be18eb6ac..c49496357180 100644 --- a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml +++ b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml @@ -72,10 +72,11 @@ properties: description: Phandle of gpio that will be used to wake-up chip. Without this property, driver will disable most of power saving features. maxItems: 1 - config-file: - description: Use an alternative file as PDS. Default is `wf200.pds`. Only - necessary for development/debug purpose. - maxItems: 1 + silabs,antenna-config-file: + $ref: /schemas/types.yaml#/definitions/string + description: Use an alternative file for antenna configuration (aka + "Platform Data Set" in Silabs jargon). Default depends of "compatible" + string. For "silabs,wf200", the default is 'wf200.pds'. required: - compatible diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index a98a261f6d76..8be9100847a7 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -309,7 +309,7 @@ struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_da wdev->hwbus_ops = hwbus_ops; wdev->hwbus_priv = hwbus_priv; memcpy(&wdev->pdata, pdata, sizeof(*pdata)); - of_property_read_string(dev->of_node, "config-file", &wdev->pdata.file_pds); + of_property_read_string(dev->of_node, "silabs,antenna-config-file", &wdev->pdata.file_pds); wdev->pdata.gpio_wakeup = devm_gpiod_get_optional(dev, "wakeup", GPIOD_OUT_LOW); if (IS_ERR(wdev->pdata.gpio_wakeup)) return NULL; -- cgit From 71b8331380dd26465e57ab6f95e0da78914941fc Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 13 Jan 2022 09:55:24 +0100 Subject: staging: wfx: do not probe the device if not in the DT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the WF200 VID/PID are not reliable, it's recommended to declare it in the DT. Until now, if the device was not declared, the driver just printed a warning and continue. But, the risk of a collision is too high, the driver now returns an error. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220113085524.1110708-32-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/Kconfig | 4 ++++ drivers/staging/wfx/bus_sdio.c | 21 ++++++--------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig index 01ea09cb9697..835a855409d8 100644 --- a/drivers/staging/wfx/Kconfig +++ b/drivers/staging/wfx/Kconfig @@ -7,3 +7,7 @@ config WFX help This is a driver for Silicons Labs WFxxx series (WF200 and further) chipsets. This chip can be found on SPI or SDIO buses. + + Silabs does not use a reliable SDIO vendor ID. So, to avoid conflicts, + the driver won't probe the device if it is not also declared in the + Device Tree. diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 6ea573221ab1..bc3df85a05b6 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -204,24 +204,17 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i return -ENODEV; } + if (!pdata) { + dev_warn(&func->dev, "no compatible device found in DT\n"); + return -ENODEV; + } + bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); if (!bus) return -ENOMEM; - if (np) { - if (!of_match_node(wfx_sdio_of_match, np)) { - dev_warn(&func->dev, "no compatible device found in DT\n"); - return -ENODEV; - } - bus->of_irq = irq_of_parse_and_map(np, 0); - } else { - dev_warn(&func->dev, - "device is not declared in DT, features will be limited\n"); - /* FIXME: ignore VID/PID and only rely on device tree */ - // return -ENODEV; - } - bus->func = func; + bus->of_irq = irq_of_parse_and_map(np, 0); sdio_set_drvdata(func, bus); func->card->quirks |= MMC_QUIRK_LENIENT_FN0 | MMC_QUIRK_BLKSZ_FOR_BYTE_MODE | @@ -268,8 +261,6 @@ static void wfx_sdio_remove(struct sdio_func *func) #define SDIO_DEVICE_ID_SILABS_WF200 0x1000 static const struct sdio_device_id wfx_sdio_ids[] = { { SDIO_DEVICE(SDIO_VENDOR_ID_SILABS, SDIO_DEVICE_ID_SILABS_WF200) }, - /* FIXME: ignore VID/PID and only rely on device tree */ - // { SDIO_DEVICE(SDIO_ANY_ID, SDIO_ANY_ID) }, { }, }; MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids); -- cgit From 6fb5d25a72c757a3081ba2637ce3a017171e89c7 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Tue, 18 Jan 2022 11:33:25 -0800 Subject: staging: r8188eu: Drop get_recvframe_data() When building with -Warray-bounds, the following warning is emitted: In file included from ./include/linux/string.h:253, from ./arch/x86/include/asm/page_32.h:22, from ./arch/x86/include/asm/page.h:14, from ./arch/x86/include/asm/thread_info.h:12, from ./include/linux/thread_info.h:60, from ./arch/x86/include/asm/preempt.h:7, from ./include/linux/preempt.h:78, from ./include/linux/rcupdate.h:27, from ./include/linux/rculist.h:11, from ./include/linux/sched/signal.h:5, from ./drivers/staging/rtl8723bs/include/drv_types.h:17, from drivers/staging/rtl8723bs/core/rtw_recv.c:7: In function 'memcpy', inlined from 'wlanhdr_to_ethhdr' at drivers/staging/rtl8723bs/core/rtw_recv.c:1554:2: ./include/linux/fortify-string.h:41:33: warning: '__builtin_memcpy' offset [0, 5] is out of the bounds [0, 0] [-Warray-bounds] 41 | #define __underlying_memcpy __builtin_memcpy | ^ This is because the compiler sees it is possible for "ptr" to be a NULL value, and concludes that it has zero size and attempts to copy to it would overflow. Instead, remove the get_recvframe_data() entirely, as it's not possible for this to ever be NULL. Additionally add missing NULL checks after recvframe_pull() (which are present in the rtl8712 driver). Cc: Larry Finger Cc: Phillip Potter Cc: Greg Kroah-Hartman Cc: Michael Straube Cc: Fabio Aiuto Cc: linux-staging@lists.linux.dev Reviewed-by: Hans de Goede Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220118193327.2822099-2-keescook@chromium.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 6 +++++- drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 4 +--- drivers/staging/r8188eu/include/rtw_recv.h | 9 --------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 5438a73ba06b..acc0dd87b62e 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1185,7 +1185,7 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe) struct adapter *adapter = precvframe->adapter; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - u8 *ptr = get_recvframe_data(precvframe); /* point to frame_ctrl field */ + u8 *ptr = precvframe->rx_data; /* point to frame_ctrl field */ struct rx_pkt_attrib *pattrib = &precvframe->attrib; if (pattrib->encrypt) @@ -1220,10 +1220,14 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe) eth_type = 0x8712; /* append rx status for mp test packets */ ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + 2) - 24); + if (!ptr) + return _FAIL; memcpy(ptr, get_rxmem(precvframe), 24); ptr += 24; } else { ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0))); + if (!ptr) + return _FAIL; } memcpy(ptr, pattrib->dst, ETH_ALEN); diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c index 90d426199f52..bf93ff3af140 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c @@ -128,7 +128,7 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, struct phy_stat struct rx_pkt_attrib *pattrib = &precvframe->attrib; struct hal_data_8188e *pHalData = &padapter->haldata; struct phy_info *pPHYInfo = &pattrib->phy_info; - u8 *wlanhdr; + u8 *wlanhdr = precvframe->rx_data; struct odm_per_pkt_info pkt_info; u8 *sa = NULL; struct sta_priv *pstapriv; @@ -138,8 +138,6 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, struct phy_stat pkt_info.bPacketToSelf = false; pkt_info.bPacketBeacon = false; - wlanhdr = get_recvframe_data(precvframe); - pkt_info.bPacketMatchBSSID = ((!IsFrameTypeCtrl(wlanhdr)) && !pattrib->icv_err && !pattrib->crc_err && !memcmp(get_hdr_bssid(wlanhdr), diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index b43a46887343..920f33235e00 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -296,15 +296,6 @@ static inline u8 *get_rx_status(struct recv_frame *precvframe) return get_rxmem(precvframe); } -static inline u8 *get_recvframe_data(struct recv_frame *precvframe) -{ - /* always return rx_data */ - if (precvframe == NULL) - return NULL; - - return precvframe->rx_data; -} - static inline u8 *recvframe_push(struct recv_frame *precvframe, int sz) { /* append data before rx_data */ -- cgit From c146ae45df287b73ada0f7b62375f98f64d6beb2 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Tue, 18 Jan 2022 11:33:26 -0800 Subject: staging: rtl8723bs: Drop get_recvframe_data() When building with -Warray-bounds, the following warning is emitted: In file included from ./include/linux/string.h:253, from ./arch/x86/include/asm/page_32.h:22, from ./arch/x86/include/asm/page.h:14, from ./arch/x86/include/asm/thread_info.h:12, from ./include/linux/thread_info.h:60, from ./arch/x86/include/asm/preempt.h:7, from ./include/linux/preempt.h:78, from ./include/linux/rcupdate.h:27, from ./include/linux/rculist.h:11, from ./include/linux/sched/signal.h:5, from ./drivers/staging/rtl8723bs/include/drv_types.h:17, from drivers/staging/rtl8723bs/core/rtw_recv.c:7: In function 'memcpy', inlined from 'wlanhdr_to_ethhdr' at drivers/staging/rtl8723bs/core/rtw_recv.c:1554:2: ./include/linux/fortify-string.h:41:33: warning: '__builtin_memcpy' offset [0, 5] is out of the bounds [0, 0] [-Warray-bounds] 41 | #define __underlying_memcpy __builtin_memcpy | ^ This is because the compiler sees it is possible for "ptr" to be a NULL value, and concludes that it has zero size and attempts to copy to it would overflow. Instead, remove the get_recvframe_data() entirely, as it's not possible for this to ever be NULL. Additionally add missing NULL checks after recvframe_pull() (which are present in the rtl8712 driver). Cc: Larry Finger Cc: Phillip Potter Cc: Greg Kroah-Hartman Cc: Michael Straube Cc: Fabio Aiuto Cc: linux-staging@lists.linux.dev Reviewed-by: Hans de Goede Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220118193327.2822099-3-keescook@chromium.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_recv.c | 11 ++++++++--- drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c | 3 +-- drivers/staging/rtl8723bs/include/rtw_recv.h | 11 ----------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c index 41bfca549c64..36a50bccef08 100644 --- a/drivers/staging/rtl8723bs/core/rtw_recv.c +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c @@ -465,7 +465,7 @@ static union recv_frame *portctrl(struct adapter *adapter, union recv_frame *pre auth_alg = adapter->securitypriv.dot11AuthAlgrthm; - ptr = get_recvframe_data(precv_frame); + ptr = precv_frame->u.hdr.rx_data; pfhdr = &precv_frame->u.hdr; pattrib = &pfhdr->attrib; psta_addr = pattrib->ta; @@ -1510,7 +1510,7 @@ static signed int wlanhdr_to_ethhdr(union recv_frame *precvframe) __be16 be_tmp; struct adapter *adapter = precvframe->u.hdr.adapter; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - u8 *ptr = get_recvframe_data(precvframe) ; /* point to frame_ctrl field */ + u8 *ptr = precvframe->u.hdr.rx_data; /* point to frame_ctrl field */ struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib; if (pattrib->encrypt) @@ -1546,10 +1546,15 @@ static signed int wlanhdr_to_ethhdr(union recv_frame *precvframe) eth_type = 0x8712; /* append rx status for mp test packets */ ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr)+2)-24); + if (!ptr) + return _FAIL; memcpy(ptr, get_rxmem(precvframe), 24); ptr += 24; - } else + } else { ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr) + (bsnaphdr?2:0))); + if (!ptr) + return _FAIL; + } memcpy(ptr, pattrib->dst, ETH_ALEN); memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN); diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c index c0a1a6fbeb91..74e75dc970f7 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c @@ -81,7 +81,7 @@ static void update_recvframe_phyinfo(union recv_frame *precvframe, struct odm_phy_info *p_phy_info = (struct odm_phy_info *)(&pattrib->phy_info); - u8 *wlanhdr; + u8 *wlanhdr = precvframe->u.hdr.rx_data; u8 *my_bssid; u8 *rx_bssid; u8 *rx_ra; @@ -100,7 +100,6 @@ static void update_recvframe_phyinfo(union recv_frame *precvframe, struct sta_priv *pstapriv; struct sta_info *psta; - wlanhdr = get_recvframe_data(precvframe); my_bssid = get_bssid(&padapter->mlmepriv); rx_bssid = get_hdr_bssid(wlanhdr); pkt_info.bssid_match = ((!IsFrameTypeCtrl(wlanhdr)) && diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index a88b7c088a86..44f67103503a 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -385,17 +385,6 @@ static inline u8 *get_rxmem(union recv_frame *precvframe) return precvframe->u.hdr.rx_head; } -static inline u8 *get_recvframe_data(union recv_frame *precvframe) -{ - - /* alwasy return rx_data */ - if (precvframe == NULL) - return NULL; - - return precvframe->u.hdr.rx_data; - -} - static inline u8 *recvframe_pull(union recv_frame *precvframe, signed int sz) { /* rx_data += sz; move rx_data sz bytes hereafter */ -- cgit From a0c1fe18702f0980c9c9cb242daa8cf1eb8463d5 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Tue, 18 Jan 2022 11:33:27 -0800 Subject: staging: rtl8712: Drop get_recvframe_data() As done for rtl8723bs and r8188eu, drop get_recvframe_data(), as it introduces an impossible value (NULL) for the compiler to check code paths against which could result in nonsensical warnings. Cc: Larry Finger Cc: Florian Schilhabel Cc: Greg Kroah-Hartman Cc: Christophe JAILLET Cc: Zhansaya Bagdauletkyzy Cc: Ivan Safonov Cc: linux-staging@lists.linux.dev Reviewed-by: Hans de Goede Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220118193327.2822099-4-keescook@chromium.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_recv.c | 4 ++-- drivers/staging/rtl8712/rtl871x_recv.h | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c index c23f6b376111..66cc50f24e29 100644 --- a/drivers/staging/rtl8712/rtl871x_recv.c +++ b/drivers/staging/rtl8712/rtl871x_recv.c @@ -234,7 +234,7 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter, u16 ether_type; pstapriv = &adapter->stapriv; - ptr = get_recvframe_data(precv_frame); + ptr = precv_frame->u.hdr.rx_data; pfhdr = &precv_frame->u.hdr; psta_addr = pfhdr->attrib.ta; psta = r8712_get_stainfo(pstapriv, psta_addr); @@ -593,7 +593,7 @@ int r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe) struct _adapter *adapter = precvframe->u.hdr.adapter; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - u8 *ptr = get_recvframe_data(precvframe); /*point to frame_ctrl field*/ + u8 *ptr = precvframe->u.hdr.rx_data; /*point to frame_ctrl field*/ struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib; if (pattrib->encrypt) diff --git a/drivers/staging/rtl8712/rtl871x_recv.h b/drivers/staging/rtl8712/rtl871x_recv.h index 1c8298bde033..0760bccbf389 100644 --- a/drivers/staging/rtl8712/rtl871x_recv.h +++ b/drivers/staging/rtl8712/rtl871x_recv.h @@ -139,14 +139,6 @@ static inline u8 *get_rxmem(union recv_frame *precvframe) return precvframe->u.hdr.rx_head; } -static inline u8 *get_recvframe_data(union recv_frame *precvframe) -{ - /* always return rx_data */ - if (!precvframe) - return NULL; - return precvframe->u.hdr.rx_data; -} - static inline u8 *recvframe_pull(union recv_frame *precvframe, sint sz) { /* used for extract sz bytes from rx_data, update rx_data and return -- cgit From c03de260d6101070d61aca78ceb59020cf510216 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Fri, 7 Jan 2022 20:46:20 -0300 Subject: staging: vc04_services: remove unneeded MODULE_VERSION() usage MODULE_VERSION() is useless for in-tree drivers given that only the kernel version matters. Hence, remove it. While at it, one realignment was made to improve readability. Suggested by: Greg Kroah-Hartman Signed-off-by: Gaston Gonzalez Link: https://lore.kernel.org/r/20220107234620.49900-2-gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 253d755e547f..35ac0fda6e14 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -33,7 +33,6 @@ #include "mmal-parameters.h" #include "bcm2835-camera.h" -#define BM2835_MMAL_VERSION "0.0.2" #define BM2835_MMAL_MODULE_NAME "bcm2835-v4l2" #define MIN_WIDTH 32 #define MIN_HEIGHT 32 @@ -1954,9 +1953,7 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) goto unreg_dev; } - v4l2_info(&dev->v4l2_dev, - "Broadcom 2835 MMAL video capture ver %s loaded.\n", - BM2835_MMAL_VERSION); + v4l2_info(&dev->v4l2_dev, "Broadcom 2835 MMAL video capture loaded.\n"); gdev[camera] = dev; } @@ -2008,5 +2005,4 @@ module_platform_driver(bcm2835_camera_driver) MODULE_DESCRIPTION("Broadcom 2835 MMAL video capture"); MODULE_AUTHOR("Vincent Sanders"); MODULE_LICENSE("GPL"); -MODULE_VERSION(BM2835_MMAL_VERSION); MODULE_ALIAS("platform:bcm2835-camera"); -- cgit From dc6903f9986f1c1f133f11cff38a6a2d42b2f6d8 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Fri, 7 Jan 2022 20:46:22 -0300 Subject: staging: vc04_services: use KBUILD_MODNAME instead of own module name definition Remove own module name definition and use KBUILD_MODNAME instead, which is the standard way of getting the module name. While at it, one realignment was made to improve readability. Suggested-by: Greg Kroah-Hartman Signed-off-by: Gaston Gonzalez Link: https://lore.kernel.org/r/20220107234620.49900-3-gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 35ac0fda6e14..88b1878854e0 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -33,7 +33,6 @@ #include "mmal-parameters.h" #include "bcm2835-camera.h" -#define BM2835_MMAL_MODULE_NAME "bcm2835-v4l2" #define MIN_WIDTH 32 #define MIN_HEIGHT 32 #define MIN_BUFFER_SIZE (80 * 1024) @@ -1893,8 +1892,7 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) dev->capture.fmt = &formats[3]; /* JPEG */ /* v4l device registration */ - dev->camera_num = v4l2_device_set_name(&dev->v4l2_dev, - BM2835_MMAL_MODULE_NAME, + dev->camera_num = v4l2_device_set_name(&dev->v4l2_dev, KBUILD_MODNAME, &camera_instance); ret = v4l2_device_register(NULL, &dev->v4l2_dev); if (ret) { -- cgit From 1d7280898f683ca824fc5eab5c486a583a81473b Mon Sep 17 00:00:00 2001 From: Jagath Jog J Date: Mon, 24 Jan 2022 09:14:54 +0530 Subject: Staging: rtl8723bs: Placing opening { braces in previous line Fix following checkpatch.pl error by placing opening { braces in previous line ERROR: that open brace { should be on the previous line Reviewed-by: Hans de Goede Signed-off-by: Jagath Jog J Link: https://lore.kernel.org/r/20220124034456.8665-2-jagathjog1996@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 98 ++++++++--------------- 1 file changed, 32 insertions(+), 66 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 5157b5b12597..43b5604c0bca 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -113,13 +113,10 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc( struct ieee80211_supported_band *spt_band = NULL; int n_channels, n_bitrates; - if (band == NL80211_BAND_2GHZ) - { + if (band == NL80211_BAND_2GHZ) { n_channels = RTW_2G_CHANNELS_NUM; n_bitrates = RTW_G_RATES_NUM; - } - else - { + } else { goto exit; } @@ -135,8 +132,7 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc( spt_band->n_channels = n_channels; spt_band->n_bitrates = n_bitrates; - if (band == NL80211_BAND_2GHZ) - { + if (band == NL80211_BAND_2GHZ) { rtw_2g_channels_init(spt_band->channels); rtw_2g_rates_init(spt_band->bitrates); } @@ -235,8 +231,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl { u16 wapi_len = 0; - if (rtw_get_wapi_ie(pnetwork->network.ies, pnetwork->network.ie_length, NULL, &wapi_len) > 0) - { + if (rtw_get_wapi_ie(pnetwork->network.ies, pnetwork->network.ie_length, NULL, &wapi_len) > 0) { if (wapi_len > 0) goto exit; } @@ -244,8 +239,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl /* To reduce PBC Overlap rate */ /* spin_lock_bh(&pwdev_priv->scan_req_lock); */ - if (adapter_wdev_data(padapter)->scan_request) - { + if (adapter_wdev_data(padapter)->scan_request) { u8 *psr = NULL, sr = 0; struct ndis_802_11_ssid *pssid = &pnetwork->network.ssid; struct cfg80211_scan_request *request = adapter_wdev_data(padapter)->scan_request; @@ -258,14 +252,12 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl if (wpsie && wpsielen > 0) psr = rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_SELECTED_REGISTRAR, (u8 *)(&sr), NULL); - if (sr != 0) - { - if (request->n_ssids == 1 && request->n_channels == 1) /* it means under processing WPS */ - { + if (sr != 0) { + /* it means under processing WPS */ + if (request->n_ssids == 1 && request->n_channels == 1) { if (ssids[0].ssid_len != 0 && (pssid->ssid_length != ssids[0].ssid_len || - memcmp(pssid->ssid, ssids[0].ssid, ssids[0].ssid_len))) - { + memcmp(pssid->ssid, ssids[0].ssid, ssids[0].ssid_len))) { if (psr) *psr = 0; /* clear sr */ } @@ -374,8 +366,7 @@ void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter) int freq = (int)cur_network->network.configuration.ds_config; struct ieee80211_channel *chan; - if (pwdev->iftype != NL80211_IFTYPE_ADHOC) - { + if (pwdev->iftype != NL80211_IFTYPE_ADHOC) { return; } @@ -383,14 +374,11 @@ void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter) struct wlan_bssid_ex *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network); struct wlan_network *scanned = pmlmepriv->cur_network_scanned; - if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) - { + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) { memcpy(&cur_network->network, pnetwork, sizeof(struct wlan_bssid_ex)); rtw_cfg80211_inform_bss(padapter, cur_network); - } - else - { + } else { if (!scanned) { rtw_warn_on(1); return; @@ -473,9 +461,7 @@ check_bss: roam_info.resp_ie_len = pmlmepriv->assoc_rsp_len-sizeof(struct ieee80211_hdr_3addr)-6; cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC); - } - else - { + } else { cfg80211_connect_result(padapter->pnetdev, cur_network->network.mac_address , pmlmepriv->assoc_req+sizeof(struct ieee80211_hdr_3addr)+2 , pmlmepriv->assoc_req_len-sizeof(struct ieee80211_hdr_3addr)-2 @@ -527,24 +513,19 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa param->u.crypt.err = 0; param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len) - { + if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len) { ret = -EINVAL; goto exit; } if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) - { - if (param->u.crypt.idx >= WEP_KEYS) - { + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { + if (param->u.crypt.idx >= WEP_KEYS) { ret = -EINVAL; goto exit; } - } - else - { + } else { psta = rtw_get_stainfo(pstapriv, param->sta_addr); if (!psta) /* ret = -EINVAL; */ @@ -554,24 +535,20 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa if (strcmp(param->u.crypt.alg, "none") == 0 && !psta) goto exit; - if (strcmp(param->u.crypt.alg, "WEP") == 0 && !psta) - { + if (strcmp(param->u.crypt.alg, "WEP") == 0 && !psta) { wep_key_idx = param->u.crypt.idx; wep_key_len = param->u.crypt.key_len; - if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) - { + if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) { ret = -EINVAL; goto exit; } - if (wep_key_len > 0) - { + if (wep_key_len > 0) { wep_key_len = wep_key_len <= 5 ? 5 : 13; } - if (psecuritypriv->bWepDefaultKeyIdxSet == 0) - { + if (psecuritypriv->bWepDefaultKeyIdxSet == 0) { /* wep default key has not been set, so use this key index as default key. */ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; @@ -579,8 +556,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if (wep_key_len == 13) - { + if (wep_key_len == 13) { psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } @@ -598,24 +574,19 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa } - - if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) /* group key */ - { - if (param->u.crypt.set_tx == 0) /* group key */ - { - if (strcmp(param->u.crypt.alg, "WEP") == 0) - { + /* group key */ + if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + /* group key */ + if (param->u.crypt.set_tx == 0) { + if (strcmp(param->u.crypt.alg, "WEP") == 0) { memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if (param->u.crypt.key_len == 13) - { + if (param->u.crypt.key_len == 13) { psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } - } - else if (strcmp(param->u.crypt.alg, "TKIP") == 0) - { + } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { psecuritypriv->dot118021XGrpPrivacy = _TKIP_; memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); @@ -627,15 +598,11 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa psecuritypriv->busetkipkey = true; - } - else if (strcmp(param->u.crypt.alg, "CCMP") == 0) - { + } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { psecuritypriv->dot118021XGrpPrivacy = _AES_; memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - } - else - { + } else { psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; } @@ -648,8 +615,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); pbcmc_sta = rtw_get_bcmc_stainfo(padapter); - if (pbcmc_sta) - { + if (pbcmc_sta) { pbcmc_sta->ieee8021x_blocked = false; pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ } -- cgit From 424449eff8b964153cd7d32b464f2ef9ecedc71c Mon Sep 17 00:00:00 2001 From: Jagath Jog J Date: Mon, 24 Jan 2022 09:14:55 +0530 Subject: Staging: rtl8723bs: Removed extra spaces between datatype and variable Fix following checkpatch.pl warning by placing single space between datatype and variable WARNING: please, no space before tabs Reviewed-by: Hans de Goede Signed-off-by: Jagath Jog J Link: https://lore.kernel.org/r/20220124034456.8665-3-jagathjog1996@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 54 +++++++++++++++----------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index b28351a97cd3..14d37b369273 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -531,9 +531,9 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, struct rtw_ieee80211_channel *ch, int ch_num) { u8 res = _FAIL; - struct cmd_obj *ph2c; - struct sitesurvey_parm *psurveyPara; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_obj *ph2c; + struct sitesurvey_parm *psurveyPara; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; if (check_fwstate(pmlmepriv, _FW_LINKED)) @@ -632,8 +632,8 @@ void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *p u8 rtw_createbss_cmd(struct adapter *padapter) { struct cmd_obj *pcmd; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network; u8 res = _SUCCESS; pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); @@ -707,14 +707,14 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) { u8 res = _SUCCESS; uint t_len = 0; - struct wlan_bssid_ex *psecnetwork; - struct cmd_obj *pcmd; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct qos_priv *pqospriv = &pmlmepriv->qospriv; + struct wlan_bssid_ex *psecnetwork; + struct cmd_obj *pcmd; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct qos_priv *pqospriv = &pmlmepriv->qospriv; struct security_priv *psecuritypriv = &padapter->securitypriv; struct registry_priv *pregistrypriv = &padapter->registrypriv; - struct ht_priv *phtpriv = &pmlmepriv->htpriv; + struct ht_priv *phtpriv = &pmlmepriv->htpriv; enum ndis_802_11_network_infrastructure ndis_network_mode = pnetwork->network.infrastructure_mode; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; @@ -789,9 +789,9 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) phtpriv->ht_option = false; ptmp = rtw_get_ie(&pnetwork->network.ies[12], WLAN_EID_HT_CAPABILITY, &tmp_len, pnetwork->network.ie_length-12); if (pregistrypriv->ht_enable && ptmp && tmp_len > 0) { - /* Added by Albert 2010/06/23 */ - /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ - /* Especially for Realtek 8192u SoftAP. */ + /* Added by Albert 2010/06/23 */ + /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ + /* Especially for Realtek 8192u SoftAP. */ if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) { @@ -897,12 +897,11 @@ exit: u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_key, bool enqueue) { struct cmd_obj *ph2c; - struct set_stakey_parm *psetstakey_para; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - struct set_stakey_rsp *psetstakey_rsp = NULL; - - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; + struct set_stakey_parm *psetstakey_para; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct set_stakey_rsp *psetstakey_rsp = NULL; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; u8 res = _SUCCESS; psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm)); @@ -957,9 +956,9 @@ exit: u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueue) { struct cmd_obj *ph2c; - struct set_stakey_parm *psetstakey_para; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - struct set_stakey_rsp *psetstakey_rsp = NULL; + struct set_stakey_parm *psetstakey_para; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct set_stakey_rsp *psetstakey_rsp = NULL; s16 cam_id = 0; u8 res = _SUCCESS; @@ -1009,9 +1008,9 @@ exit: u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr) { - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_obj *ph2c; - struct addBaReq_parm *paddbareq_parm; + struct addBaReq_parm *paddbareq_parm; u8 res = _SUCCESS; @@ -1228,8 +1227,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer) u16 BusyThreshold = BusyThresholdHigh; u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false; u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false; - - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; collect_traffic_statistics(padapter); @@ -1409,7 +1407,7 @@ void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type) u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) { struct cmd_obj *ph2c; - struct drvextra_cmd_parm *pdrvextra_cmd_parm; + struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; /* struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); */ u8 res = _SUCCESS; -- cgit From 56a9847a1bdb388062aa612f97403c61373c851c Mon Sep 17 00:00:00 2001 From: Jagath Jog J Date: Mon, 24 Jan 2022 09:14:56 +0530 Subject: Staging: rtl8723bs: Inserting blank line after declaration Fix following checkpatch.pl warning by inserting blank line WARNING: Missing a blank line after declarations Reviewed-by: Hans de Goede Signed-off-by: Jagath Jog J Link: https://lore.kernel.org/r/20220124034456.8665-4-jagathjog1996@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/hal_intf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c index 4868a69cdb8f..94ecefb9113d 100644 --- a/drivers/staging/rtl8723bs/hal/hal_intf.c +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c @@ -181,6 +181,7 @@ void rtw_hal_disable_interrupt(struct adapter *padapter) u8 rtw_hal_check_ips_status(struct adapter *padapter) { u8 val = false; + if (padapter->HalFunc.check_ips_status) val = padapter->HalFunc.check_ips_status(padapter); @@ -209,6 +210,7 @@ s32 rtw_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe) s32 rtw_hal_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe) { s32 ret = _FAIL; + update_mgntframe_attrib_addr(padapter, pmgntframe); /* pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; */ /* pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; */ @@ -299,6 +301,7 @@ void rtw_hal_stop_thread(struct adapter *padapter) u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask) { u32 data = 0; + if (padapter->HalFunc.read_bbreg) data = padapter->HalFunc.read_bbreg(padapter, RegAddr, BitMask); return data; @@ -312,6 +315,7 @@ void rtw_hal_write_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask, u32 u32 rtw_hal_read_rfreg(struct adapter *padapter, u32 eRFPath, u32 RegAddr, u32 BitMask) { u32 data = 0; + if (padapter->HalFunc.read_rfreg) data = padapter->HalFunc.read_rfreg(padapter, eRFPath, RegAddr, BitMask); return data; @@ -385,6 +389,7 @@ bool rtw_hal_c2h_valid(struct adapter *adapter, u8 *buf) s32 rtw_hal_c2h_handler(struct adapter *adapter, u8 *c2h_evt) { s32 ret = _FAIL; + if (adapter->HalFunc.c2h_handler) ret = adapter->HalFunc.c2h_handler(adapter, c2h_evt); return ret; -- cgit From 36c4b536012363b6cf6af1e57227eb93fde646b2 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Mon, 10 Jan 2022 09:00:14 +0000 Subject: staging: r8188eu: convert DBG_88E calls in core/rtw_ieee80211.c Convert the DBG_88E macro calls in core/rtw_ieee80211.c to use pr_debug as their information may be useful to observers, and this gets the driver closer to the point of being able to remove DBG_88E itself. These calls are at points in the call chain where use of dev_dbg or netdev_dbg isn't possible due to lack of device pointer, so plain pr_debug is appropriate here. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220110090020.6800-2-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_ieee80211.c | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_ieee80211.c b/drivers/staging/r8188eu/core/rtw_ieee80211.c index ad87954bdeb4..25445f3ab4a3 100644 --- a/drivers/staging/r8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/r8188eu/core/rtw_ieee80211.c @@ -655,8 +655,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, * sub-type. */ if (elen < 4) { if (show_errors) { - DBG_88E("short vendor specific information element ignored (len=%lu)\n", - (unsigned long)elen); + pr_debug("short vendor specific information element ignored (len=%lu)\n", + (unsigned long)elen); } return -1; } @@ -675,8 +675,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, break; case WME_OUI_TYPE: /* this is a Wi-Fi WME info. element */ if (elen < 5) { - DBG_88E("short WME information element ignored (len=%lu)\n", - (unsigned long)elen); + pr_debug("short WME information element ignored (len=%lu)\n", + (unsigned long)elen); return -1; } switch (pos[4]) { @@ -690,8 +690,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, elems->wme_tspec_len = elen; break; default: - DBG_88E("unknown WME information element ignored (subtype=%d len=%lu)\n", - pos[4], (unsigned long)elen); + pr_debug("unknown WME information element ignored (subtype=%d len=%lu)\n", + pos[4], (unsigned long)elen); return -1; } break; @@ -701,8 +701,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, elems->wps_ie_len = elen; break; default: - DBG_88E("Unknown Microsoft information element ignored (type=%d len=%lu)\n", - pos[3], (unsigned long)elen); + pr_debug("Unknown Microsoft information element ignored (type=%d len=%lu)\n", + pos[3], (unsigned long)elen); return -1; } break; @@ -714,14 +714,14 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, elems->vendor_ht_cap_len = elen; break; default: - DBG_88E("Unknown Broadcom information element ignored (type=%d len=%lu)\n", - pos[3], (unsigned long)elen); + pr_debug("Unknown Broadcom information element ignored (type=%d len=%lu)\n", + pos[3], (unsigned long)elen); return -1; } break; default: - DBG_88E("unknown vendor specific information element ignored (vendor OUI %02x:%02x:%02x len=%lu)\n", - pos[0], pos[1], pos[2], (unsigned long)elen); + pr_debug("unknown vendor specific information element ignored (vendor OUI %02x:%02x:%02x len=%lu)\n", + pos[0], pos[1], pos[2], (unsigned long)elen); return -1; } return 0; @@ -754,8 +754,8 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len, if (elen > left) { if (show_errors) { - DBG_88E("IEEE 802.11 element parse failed (id=%d elen=%d left=%lu)\n", - id, elen, (unsigned long)left); + pr_debug("IEEE 802.11 element parse failed (id=%d elen=%d left=%lu)\n", + id, elen, (unsigned long)left); } return ParseFailed; } @@ -841,8 +841,8 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len, unknown++; if (!show_errors) break; - DBG_88E("IEEE 802.11 element parse ignored unknown element (id=%d elen=%d)\n", - id, elen); + pr_debug("IEEE 802.11 element parse ignored unknown element (id=%d elen=%d)\n", + id, elen); break; } left -= elen; @@ -892,10 +892,10 @@ void rtw_macaddr_cfg(u8 *mac_addr) if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) { eth_random_addr(mac_addr); - DBG_88E("MAC Address from efuse error, assign random one !!!\n"); + pr_debug("MAC Address from efuse error, assign random one !!!\n"); } - DBG_88E("rtw_macaddr_cfg MAC Address = %pM\n", mac_addr); + pr_debug("MAC Address = %pM\n", mac_addr); } /** -- cgit From 38c75bb1dfcb79808f618e808ed89af8dd53c207 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Mon, 10 Jan 2022 09:00:15 +0000 Subject: staging: r8188eu: convert DBG_88E calls in core/rtw_xmit.c Convert the DBG_88E macro calls in core/rtw_xmit.c to use pr_debug or netdev_dbg appropriately, as their information may be useful to observers, and this gets the driver closer to the point of being able to remove DBG_88E itself. Also remove some commented out DBG_88E calls altogether. Some calls are at points in the call chain where use of dev_dbg or netdev_dbg isn't possible due to lack of device pointer, so plain pr_debug is appropriate here. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220110090020.6800-3-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_xmit.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index 8503059edc46..334644e46000 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -372,7 +372,7 @@ u8 qos_acm(u8 acm_mask, u8 priority) change_priority = 5; break; default: - DBG_88E("qos_acm(): invalid pattrib->priority: %d!!!\n", priority); + pr_debug("invalid pattrib->priority: %d!!!\n", priority); break; } @@ -489,7 +489,6 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p if (psta) { pattrib->mac_id = psta->mac_id; - /* DBG_88E("%s ==> mac_id(%d)\n", __func__, pattrib->mac_id); */ pattrib->psta = psta; } else { /* if we cannot get psta => drop the pkt */ @@ -895,7 +894,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct return _FAIL; if (!pxmitframe->buf_addr) { - DBG_88E("==> %s buf_addr == NULL\n", __func__); + netdev_dbg(padapter->pnetdev, "buf_addr == NULL\n"); return _FAIL; } @@ -906,7 +905,8 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct mem_start = pbuf_start + hw_hdr_offset; if (rtw_make_wlanhdr(padapter, mem_start, pattrib) == _FAIL) { - DBG_88E("rtw_xmitframe_coalesce: rtw_make_wlanhdr fail; drop pkt\n"); + netdev_dbg(padapter->pnetdev, + "rtw_make_wlanhdr fail; drop pkt\n"); res = _FAIL; goto exit; } @@ -1003,7 +1003,8 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct } if (xmitframe_addmic(padapter, pxmitframe) == _FAIL) { - DBG_88E("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n"); + netdev_dbg(padapter->pnetdev, + "xmitframe_addmic(padapter, pxmitframe) == _FAIL\n"); res = _FAIL; goto exit; } @@ -1134,7 +1135,7 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv) /* pxmitbuf->ext_tag = true; */ if (pxmitbuf->sctx) { - DBG_88E("%s pxmitbuf->sctx is not NULL\n", __func__); + pr_debug("pxmitbuf->sctx is not NULL\n"); rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC); } } @@ -1171,8 +1172,6 @@ struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv) struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue; unsigned long flags; - /* DBG_88E("+rtw_alloc_xmitbuf\n"); */ - spin_lock_irqsave(&pfree_xmitbuf_queue->lock, flags); if (list_empty(&pfree_xmitbuf_queue->queue)) { @@ -1191,7 +1190,7 @@ struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv) pxmitpriv->free_xmitbuf_cnt--; pxmitbuf->priv_data = NULL; if (pxmitbuf->sctx) { - DBG_88E("%s pxmitbuf->sctx is not NULL\n", __func__); + pr_debug("pxmitbuf->sctx is not NULL\n"); rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC); } } @@ -1209,7 +1208,7 @@ s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) return _FAIL; if (pxmitbuf->sctx) { - DBG_88E("%s pxmitbuf->sctx is not NULL\n", __func__); + pr_debug("pxmitbuf->sctx is not NULL\n"); rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_FREE); } @@ -1479,7 +1478,7 @@ s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe) if (!psta) { res = _FAIL; - DBG_88E("rtw_xmit_classifier: psta == NULL\n"); + netdev_dbg(padapter->pnetdev, "psta == NULL\n"); goto exit; } @@ -1725,7 +1724,8 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) pxmitframe = rtw_alloc_xmitframe(pxmitpriv); if (!pxmitframe) { - DBG_88E("DBG_TX_DROP_FRAME %s no more pxmitframe\n", __func__); + netdev_dbg(padapter->pnetdev, + "DBG_TX_DROP_FRAME no more pxmitframe\n"); return -1; } @@ -2150,7 +2150,7 @@ int rtw_sctx_wait(struct submit_ctx *sctx) if (!wait_for_completion_timeout(&sctx->done, expire)) { /* timeout, do something?? */ status = RTW_SCTX_DONE_TIMEOUT; - DBG_88E("%s timeout\n", __func__); + pr_debug("timeout\n"); } else { status = sctx->status; } @@ -2180,7 +2180,7 @@ void rtw_sctx_done_err(struct submit_ctx **sctx, int status) { if (*sctx) { if (rtw_sctx_chk_waring_status(status)) - DBG_88E("%s status:%d\n", __func__, status); + pr_debug("status:%d\n", status); (*sctx)->status = status; complete(&((*sctx)->done)); *sctx = NULL; @@ -2205,5 +2205,5 @@ void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status) if (pxmitpriv->ack_tx) rtw_sctx_done_err(&pack_tx_ops, status); else - DBG_88E("%s ack_tx not set\n", __func__); + pr_debug("ack_tx not set\n"); } -- cgit From aae91d7b8e97374dae78efca2280603c1db57fca Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Mon, 10 Jan 2022 09:00:16 +0000 Subject: staging: r8188eu: convert DBG_88E calls in core/rtw_iol.c Convert the DBG_88E macro calls in core/rtw_iol.c to use pr_debug or netdev_dbg appropriately, as their information may be useful to observers, and this gets the driver closer to the point of being able to remove DBG_88E itself. Some calls are at points in the call chain where use of dev_dbg or netdev_dbg isn't possible due to lack of device pointer, so plain pr_debug is appropriate here. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220110090020.6800-4-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_iol.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_iol.c b/drivers/staging/r8188eu/core/rtw_iol.c index 7e78b47c1284..923da2a9f6ae 100644 --- a/drivers/staging/r8188eu/core/rtw_iol.c +++ b/drivers/staging/r8188eu/core/rtw_iol.c @@ -12,13 +12,15 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter) xmit_frame = rtw_alloc_xmitframe(pxmitpriv); if (!xmit_frame) { - DBG_88E("%s rtw_alloc_xmitframe return null\n", __func__); + netdev_dbg(adapter->pnetdev, + "rtw_alloc_xmitframe return null\n"); return NULL; } xmitbuf = rtw_alloc_xmitbuf(pxmitpriv); if (!xmitbuf) { - DBG_88E("%s rtw_alloc_xmitbuf return null\n", __func__); + netdev_dbg(adapter->pnetdev, + "rtw_alloc_xmitbuf return null\n"); rtw_free_xmitframe(pxmitpriv, xmit_frame); return NULL; } @@ -49,8 +51,8 @@ int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len /* check if the io_buf can accommodate new cmds */ if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) { - DBG_88E("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", - __func__, ori_len + cmd_len + 8, MAX_XMITBUF_SZ); + pr_debug("%u is larger than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", + ori_len + cmd_len + 8, MAX_XMITBUF_SZ); return _FAIL; } -- cgit From f6cb2f7c131138ba5a32c3dc697a32ca54b49063 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Mon, 10 Jan 2022 09:00:17 +0000 Subject: staging: r8188eu: convert DBG_88E calls in core/rtw_mlme.c Convert the DBG_88E macro calls in core/rtw_mlme.c to use netdev_dbg, as their information may be useful to observers, and this gets the driver closer to the point of being able to remove DBG_88E itself. Also remove some unnecessary DBG_88E calls altogether as all they do is print the function name. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220110090020.6800-5-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme.c | 95 +++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 41 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 394e8a5ce03c..189b48b17326 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -617,7 +617,9 @@ static int rtw_is_desired_network(struct adapter *adapter, struct wlan_network * } if ((desired_encmode != Ndis802_11EncryptionDisabled) && (privacy == 0)) { - DBG_88E("desired_encmode: %d, privacy: %d\n", desired_encmode, privacy); + netdev_dbg(adapter->pnetdev, + "desired_encmode: %d, privacy: %d\n", + desired_encmode, privacy); bselected = false; } @@ -734,8 +736,9 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); rtw_indicate_connect(adapter); } else { - DBG_88E("try_to_join, but select scanning queue fail, to_roaming:%d\n", - pmlmepriv->to_roaming); + netdev_dbg(adapter->pnetdev, + "try_to_join, but select scanning queue fail, to_roaming:%d\n", + pmlmepriv->to_roaming); if (rtw_to_roaming(adapter) != 0) { if (--pmlmepriv->to_roaming == 0 || _SUCCESS != rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) { @@ -909,7 +912,6 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str psta = rtw_alloc_stainfo(pstapriv, pnetwork->network.MacAddress); if (psta) { /* update ptarget_sta */ - DBG_88E("%s\n", __func__); psta->aid = pnetwork->join_res; psta->mac_id = 0; /* sta mode */ @@ -969,8 +971,6 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *cur_network = &pmlmepriv->cur_network; - DBG_88E("%s\n", __func__); - /* why not use ptarget_wlan?? */ memcpy(&cur_network->network, &pnetwork->network, pnetwork->network.Length); /* some IEs in pnetwork is wrong, so we should use ptarget_wlan IEs */ @@ -1196,7 +1196,7 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) /* to do: init sta_info variable */ psta->qos_option = 0; psta->mac_id = (uint)pstassoc->cam_id; - DBG_88E("%s\n", __func__); + /* for ad-hoc mode */ rtl8188e_SetHalODMVar(adapter, psta, true); rtw_sta_media_status_rpt(adapter, psta, 1); @@ -1239,7 +1239,9 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) else mac_id = pstadel->mac_id; - DBG_88E("%s(mac_id=%d)=%pM\n", __func__, mac_id, pstadel->macaddr); + netdev_dbg(adapter->pnetdev, + "(mac_id=%d)=%pM\n", + mac_id, pstadel->macaddr); if (mac_id >= 0) { u16 media_status; @@ -1330,7 +1332,7 @@ void _rtw_join_timeout_handler (struct adapter *adapter) struct mlme_priv *pmlmepriv = &adapter->mlmepriv; int do_join_r; - DBG_88E("%s, fw_state=%x\n", __func__, get_fwstate(pmlmepriv)); + netdev_dbg(adapter->pnetdev, "fw_state=%x\n", get_fwstate(pmlmepriv)); if (adapter->bDriverStopped || adapter->bSurpriseRemoved) return; @@ -1341,15 +1343,19 @@ void _rtw_join_timeout_handler (struct adapter *adapter) while (1) { pmlmepriv->to_roaming--; if (rtw_to_roaming(adapter) != 0) { /* try another */ - DBG_88E("%s try another roaming\n", __func__); + netdev_dbg(adapter->pnetdev, + "try another roaming\n"); do_join_r = rtw_do_join(adapter); if (_SUCCESS != do_join_r) { - DBG_88E("%s roaming do_join return %d\n", __func__, do_join_r); + netdev_dbg(adapter->pnetdev, + "roaming do_join return %d\n", + do_join_r); continue; } break; } else { - DBG_88E("%s We've try roaming but fail\n", __func__); + netdev_dbg(adapter->pnetdev, + "We've tried roaming but failed\n"); rtw_indicate_disconnect(adapter); break; } @@ -1370,7 +1376,7 @@ void rtw_scan_timeout_handler (struct adapter *adapter) { struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - DBG_88E(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv)); + netdev_dbg(adapter->pnetdev, "fw_state=%x\n", get_fwstate(pmlmepriv)); spin_lock_bh(&pmlmepriv->lock); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); spin_unlock_bh(&pmlmepriv->lock); @@ -1385,7 +1391,6 @@ static void rtw_auto_scan_handler(struct adapter *padapter) if (pmlmepriv->scan_interval > 0) { pmlmepriv->scan_interval--; if (pmlmepriv->scan_interval == 0) { - DBG_88E("%s\n", __func__); rtw_set_802_11_bssid_list_scan(padapter, NULL, 0); pmlmepriv->scan_interval = SCAN_INTERVAL;/* 30*2 sec = 60sec */ } @@ -1476,13 +1481,15 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv updated = true; } if (updated) { - DBG_88E("[by_bssid:%u][assoc_ssid:%s]new candidate: %s(%pM rssi:%d\n", - pmlmepriv->assoc_by_bssid, - pmlmepriv->assoc_ssid.Ssid, - (*candidate)->network.Ssid.Ssid, - (*candidate)->network.MacAddress, - (int)(*candidate)->network.Rssi); - DBG_88E("[to_roaming:%u]\n", rtw_to_roaming(adapter)); + netdev_dbg(adapter->pnetdev, + "[by_bssid:%u][assoc_ssid:%s]new candidate: %s(%pM rssi:%d\n", + pmlmepriv->assoc_by_bssid, + pmlmepriv->assoc_ssid.Ssid, + (*candidate)->network.Ssid.Ssid, + (*candidate)->network.MacAddress, + (int)(*candidate)->network.Rssi); + netdev_dbg(adapter->pnetdev, + "[to_roaming:%u]\n", rtw_to_roaming(adapter)); } exit: @@ -1520,18 +1527,20 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) rtw_check_join_candidate(pmlmepriv, &candidate, pnetwork); } if (!candidate) { - DBG_88E("%s: return _FAIL(candidate==NULL)\n", __func__); + netdev_dbg(adapter->pnetdev, + "return _FAIL(candidate==NULL)\n"); ret = _FAIL; goto exit; } else { - DBG_88E("%s: candidate: %s(%pM ch:%u)\n", __func__, - candidate->network.Ssid.Ssid, candidate->network.MacAddress, - candidate->network.Configuration.DSConfig); + netdev_dbg(adapter->pnetdev, "candidate: %s(%pM ch:%u)\n", + candidate->network.Ssid.Ssid, candidate->network.MacAddress, + candidate->network.Configuration.DSConfig); } /* check for situation of _FW_LINKED */ if (check_fwstate(pmlmepriv, _FW_LINKED)) { - DBG_88E("%s: _FW_LINKED while ask_for_joinbss!!!\n", __func__); + netdev_dbg(adapter->pnetdev, + "_FW_LINKED while ask_for_joinbss!!!\n"); rtw_disassoc_cmd(adapter, 0, true); rtw_indicate_disconnect(adapter); @@ -1542,10 +1551,9 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) if (supp_ant_div) { u8 cur_ant; GetHalDefVar8188EUsb(adapter, HAL_DEF_CURRENT_ANTENNA, &cur_ant); - DBG_88E("#### Opt_Ant_(%s), cur_Ant(%s)\n", - (2 == candidate->network.PhyInfo.Optimum_antenna) ? "A" : "B", - (2 == cur_ant) ? "A" : "B" - ); + netdev_dbg(adapter->pnetdev, "Opt_Ant_(%s), cur_Ant(%s)\n", + (candidate->network.PhyInfo.Optimum_antenna == 2) ? "A" : "B", + (cur_ant == 2) ? "A" : "B"); } ret = rtw_joinbss_cmd(adapter, candidate); @@ -1617,8 +1625,10 @@ int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, in psetkeyparm->keyid = (u8)keyid;/* 0~3 */ psetkeyparm->set_tx = set_tx; pmlmepriv->key_mask |= BIT(psetkeyparm->keyid); - DBG_88E("==> rtw_set_key algorithm(%x), keyid(%x), key_mask(%x)\n", - psetkeyparm->algorithm, psetkeyparm->keyid, pmlmepriv->key_mask); + netdev_dbg(adapter->pnetdev, + "algorithm(%x), keyid(%x), key_mask(%x)\n", + psetkeyparm->algorithm, psetkeyparm->keyid, + pmlmepriv->key_mask); switch (psetkeyparm->algorithm) { case _WEP40_: @@ -1970,8 +1980,6 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) if ((!pmlmeinfo->HT_info_enable) || (!pmlmeinfo->HT_caps_enable)) return; - DBG_88E("+rtw_update_ht_cap()\n"); - /* maybe needs check if ap supports rx ampdu. */ if ((!phtpriv->ampdu_enable) && (pregistrypriv->ampdu_enable == 1)) { if (pregistrypriv->wifi_spec == 1) @@ -2022,7 +2030,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) /* Config SM Power Save setting */ pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2; if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) - DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __func__); + netdev_dbg(padapter->pnetdev, "WLAN_HT_CAP_SM_PS_STATIC\n"); /* Config current HT Protection mode. */ pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; @@ -2057,7 +2065,7 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr issued |= (phtpriv->candidate_tid_bitmap >> priority) & 0x1; if (0 == issued) { - DBG_88E("rtw_issue_addbareq_cmd, p=%d\n", priority); + netdev_dbg(padapter->pnetdev, "p=%d\n", priority); psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority); rtw_addbareq_cmd(padapter, (u8)priority, pattrib->ra); } @@ -2085,9 +2093,11 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) pnetwork = &pmlmepriv->cur_network; if (0 < rtw_to_roaming(padapter)) { - DBG_88E("roaming from %s(%pM length:%d\n", - pnetwork->network.Ssid.Ssid, pnetwork->network.MacAddress, - pnetwork->network.Ssid.SsidLength); + netdev_dbg(padapter->pnetdev, + "roaming from %s(%pM length:%d\n", + pnetwork->network.Ssid.Ssid, + pnetwork->network.MacAddress, + pnetwork->network.Ssid.SsidLength); memcpy(&pmlmepriv->assoc_ssid, &pnetwork->network.Ssid, sizeof(struct ndis_802_11_ssid)); pmlmepriv->assoc_by_bssid = false; @@ -2097,13 +2107,16 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) if (_SUCCESS == do_join_r) { break; } else { - DBG_88E("roaming do_join return %d\n", do_join_r); + netdev_dbg(padapter->pnetdev, + "roaming do_join return %d\n", + do_join_r); pmlmepriv->to_roaming--; if (0 < pmlmepriv->to_roaming) { continue; } else { - DBG_88E("%s(%d) -to roaming fail, indicate_disconnect\n", __func__, __LINE__); + netdev_dbg(padapter->pnetdev, + "-to roaming fail, indicate_disconnect\n"); rtw_indicate_disconnect(padapter); break; } -- cgit From 60a43cf1fa3e62ec70e4cdab136576ceb8a56b08 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Mon, 10 Jan 2022 09:00:18 +0000 Subject: staging: r8188eu: convert DBG_88E calls in core/rtw_ioctl_set.c Convert the DBG_88E macro calls in core/rtw_ioctl_set.c to use netdev_dbg, as their information may be useful to observers, and this gets the driver closer to the point of being able to remove DBG_88E itself. Also remove one unnecessary DBG_88E call which was already commented out. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220110090020.6800-6-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_ioctl_set.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_ioctl_set.c b/drivers/staging/r8188eu/core/rtw_ioctl_set.c index eadfbdb94dd5..c95ca471ae55 100644 --- a/drivers/staging/r8188eu/core/rtw_ioctl_set.c +++ b/drivers/staging/r8188eu/core/rtw_ioctl_set.c @@ -122,7 +122,8 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid) spin_lock_bh(&pmlmepriv->lock); - DBG_88E("Set BSSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv)); + netdev_dbg(padapter->pnetdev, "Set BSSID under fw_state = 0x%08x\n", + get_fwstate(pmlmepriv)); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) goto handle_tkip_countermeasure; else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) @@ -195,7 +196,8 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) spin_lock_bh(&pmlmepriv->lock); - DBG_88E("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv)); + netdev_dbg(padapter->pnetdev, "Set SSID under fw_state = 0x%08x\n", + get_fwstate(pmlmepriv)); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { goto handle_tkip_countermeasure; } else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { @@ -280,8 +282,6 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter, if (*pold_state != networktype) { spin_lock_bh(&pmlmepriv->lock); - /* DBG_88E("change mode, old_mode =%d, new_mode =%d, fw_state = 0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); */ - if (*pold_state == Ndis802_11APMode) { /* change to other mode from Ndis802_11APMode */ cur_network->join_res = -1; @@ -364,7 +364,7 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s res = true; } else { if (rtw_is_scan_deny(padapter)) { - DBG_88E(FUNC_ADPT_FMT": scan deny\n", FUNC_ADPT_ARG(padapter)); + netdev_dbg(padapter->pnetdev, "scan deny\n"); indicate_wx_scan_complete_event(padapter); return _SUCCESS; } -- cgit From 666dc625dbfddde6efbb64f4856d33ff52c54b1e Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Mon, 10 Jan 2022 09:00:19 +0000 Subject: staging: r8188eu: convert DBG_88E calls in core/rtw_mlme_ext.c Convert the DBG_88E macro calls in core/rtw_mlme_ext.c to use pr_debug or netdev_dbg appropriately, as their information may be useful to observers, and this gets the driver closer to the point of being able to remove DBG_88E itself. Also remove some commented out or unnecessary DBG_88E calls altogether. Some calls are at points in the call chain where use of dev_dbg or netdev_dbg isn't possible due to lack of device pointer, so plain pr_debug is appropriate here. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220110090020.6800-7-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 431 ++++++++++++++++------------ 1 file changed, 245 insertions(+), 186 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index a169a7a39ebc..aa5ed6ecc432 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -315,7 +315,9 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_c memset(channel_set, 0, sizeof(struct rt_channel_info) * MAX_CHANNEL_NUM); if (ChannelPlan >= RT_CHANNEL_DOMAIN_MAX && ChannelPlan != RT_CHANNEL_DOMAIN_REALTEK_DEFINE) { - DBG_88E("ChannelPlan ID %x error !!!!!\n", ChannelPlan); + netdev_dbg(padapter->pnetdev, + "ChannelPlan ID %x error !!!!!\n", + ChannelPlan); return chanset_size; } @@ -436,7 +438,9 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) if (GetRetry(pframe)) { if (precv_frame->attrib.seq_num == psta->RxMgmtFrameSeqNum) { /* drop the duplicate management frame */ - DBG_88E("Drop duplicate management frame with seq_num=%d.\n", precv_frame->attrib.seq_num); + netdev_dbg(padapter->pnetdev, + "Drop duplicate management frame with seq_num=%d.\n", + precv_frame->attrib.seq_num); return; } } @@ -573,7 +577,8 @@ unsigned int OnProbeRsp(struct adapter *padapter, struct recv_frame *precv_frame return _SUCCESS; } else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) { if (pwdinfo->nego_req_info.benable) { - DBG_88E("[%s] P2P State is GONEGO ING!\n", __func__); + netdev_dbg(padapter->pnetdev, + "P2P State is GONEGO ING!\n"); if (!memcmp(pwdinfo->nego_req_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN)) { pwdinfo->nego_req_info.benable = false; issue_p2p_GO_request(padapter, pwdinfo->nego_req_info.peerDevAddr); @@ -581,7 +586,8 @@ unsigned int OnProbeRsp(struct adapter *padapter, struct recv_frame *precv_frame } } else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_INVITE_REQ)) { if (pwdinfo->invitereq_info.benable) { - DBG_88E("[%s] P2P_STATE_TX_INVITE_REQ!\n", __func__); + netdev_dbg(padapter->pnetdev, + "P2P_STATE_TX_INVITE_REQ!\n"); if (!memcmp(pwdinfo->invitereq_info.peer_macaddr, GetAddr2Ptr(pframe), ETH_ALEN)) { pwdinfo->invitereq_info.benable = false; issue_p2p_invitation_request(padapter, pwdinfo->invitereq_info.peer_macaddr); @@ -707,15 +713,13 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE) return _FAIL; - DBG_88E("+OnAuth\n"); - sa = GetAddr2Ptr(pframe); auth_mode = psecuritypriv->dot11AuthAlgrthm; seq = le16_to_cpu(*(__le16 *)((size_t)pframe + WLAN_HDR_A3_LEN + 2)); algorithm = le16_to_cpu(*(__le16 *)((size_t)pframe + WLAN_HDR_A3_LEN)); - DBG_88E("auth alg=%x, seq=%X\n", algorithm, seq); + netdev_dbg(padapter->pnetdev, "auth alg=%x, seq=%X\n", algorithm, seq); if (auth_mode == 2 && psecuritypriv->dot11PrivacyAlgrthm != _WEP40_ && psecuritypriv->dot11PrivacyAlgrthm != _WEP104_) @@ -723,8 +727,9 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) if ((algorithm > 0 && auth_mode == 0) || /* rx a shared-key auth but shared not enabled */ (algorithm == 0 && auth_mode == 1)) { /* rx a open-system auth but shared-key is enabled */ - DBG_88E("auth rejected due to bad alg [alg=%d, auth_mib=%d] %02X%02X%02X%02X%02X%02X\n", - algorithm, auth_mode, sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); + netdev_dbg(padapter->pnetdev, + "auth rejected due to bad alg [alg=%d, auth_mib=%d] %02X%02X%02X%02X%02X%02X\n", + algorithm, auth_mode, sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); status = _STATS_NO_SUPP_ALG_; @@ -739,10 +744,12 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) pstat = rtw_get_stainfo(pstapriv, sa); if (!pstat) { /* allocate a new one */ - DBG_88E("going to alloc stainfo for sa=%pM\n", sa); + netdev_dbg(padapter->pnetdev, + "going to alloc stainfo for sa=%pM\n", sa); pstat = rtw_alloc_stainfo(pstapriv, sa); if (!pstat) { - DBG_88E(" Exceed the upper limit of supported clients...\n"); + netdev_dbg(padapter->pnetdev, + "Exceed the upper limit of supported clients...\n"); status = _STATS_UNABLE_HANDLE_STA_; goto auth_fail; } @@ -773,8 +780,9 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) pstat->expire_to = pstapriv->auth_to; if ((pstat->auth_seq + 1) != seq) { - DBG_88E("(1)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", - seq, pstat->auth_seq + 1); + netdev_dbg(padapter->pnetdev, + "(1)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", + seq, pstat->auth_seq + 1); status = _STATS_OUT_OF_AUTH_SEQ_; goto auth_fail; } @@ -786,8 +794,9 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) pstat->expire_to = pstapriv->assoc_to; pstat->authalg = algorithm; } else { - DBG_88E("(2)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", - seq, pstat->auth_seq + 1); + netdev_dbg(padapter->pnetdev, + "(2)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", + seq, pstat->auth_seq + 1); status = _STATS_OUT_OF_AUTH_SEQ_; goto auth_fail; } @@ -801,13 +810,14 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) pstat->auth_seq = 2; } else if (seq == 3) { /* checking for challenging txt... */ - DBG_88E("checking for challenging txt...\n"); + netdev_dbg(padapter->pnetdev, "checking for challenging txt...\n"); p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_, _CHLGETXT_IE_, (int *)&ie_len, len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ - 4); if (!p || ie_len <= 0) { - DBG_88E("auth rejected because challenge failure!(1)\n"); + netdev_dbg(padapter->pnetdev, + "auth rejected because challenge failure!(1)\n"); status = _STATS_CHALLENGE_FAIL_; goto auth_fail; } @@ -818,13 +828,15 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) /* challenging txt is correct... */ pstat->expire_to = pstapriv->assoc_to; } else { - DBG_88E("auth rejected because challenge failure!\n"); + netdev_dbg(padapter->pnetdev, + "auth rejected because challenge failure!\n"); status = _STATS_CHALLENGE_FAIL_; goto auth_fail; } } else { - DBG_88E("(3)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", - seq, pstat->auth_seq + 1); + netdev_dbg(padapter->pnetdev, + "(3)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", + seq, pstat->auth_seq + 1); status = _STATS_OUT_OF_AUTH_SEQ_; goto auth_fail; } @@ -864,8 +876,6 @@ unsigned int OnAuthClient(struct adapter *padapter, struct recv_frame *precv_fra u8 *pframe = precv_frame->rx_data; uint pkt_len = precv_frame->len; - DBG_88E("%s\n", __func__); - /* check A1 matches or not */ if (memcmp(myid(&padapter->eeprompriv), get_da(pframe), ETH_ALEN)) return _SUCCESS; @@ -879,7 +889,8 @@ unsigned int OnAuthClient(struct adapter *padapter, struct recv_frame *precv_fra status = le16_to_cpu(*(__le16 *)((size_t)pframe + WLAN_HDR_A3_LEN + offset + 4)); if (status != 0) { - DBG_88E("clnt auth fail, status: %d\n", status); + netdev_dbg(padapter->pnetdev, + "clnt auth fail, status: %d\n", status); if (status == 13) { /* pmlmeinfo->auth_algo == dot11AuthAlgrthm_Auto) */ if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) pmlmeinfo->auth_algo = dot11AuthAlgrthm_Open; @@ -967,8 +978,9 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame } if (pkt_len < IEEE80211_3ADDR_LEN + ie_offset) { - DBG_88E("handle_assoc(reassoc=%d) - too short payload (len=%lu)" - "\n", reassoc, (unsigned long)pkt_len); + netdev_dbg(padapter->pnetdev, + "handle_assoc(reassoc=%d) - too short payload (len=%lu)\n", + reassoc, (unsigned long)pkt_len); return _FAIL; } @@ -983,8 +995,6 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame left = pkt_len - (IEEE80211_3ADDR_LEN + ie_offset); pos = pframe + (IEEE80211_3ADDR_LEN + ie_offset); - DBG_88E("%s\n", __func__); - /* check if this stat has been successfully authenticated/assocated */ if (!((pstat->state) & WIFI_FW_AUTH_SUCCESS)) { if (!((pstat->state) & WIFI_FW_ASSOC_SUCCESS)) { @@ -1002,8 +1012,9 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame /* now parse all ieee802_11 ie to point to elems */ if (rtw_ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed || !elems.ssid) { - DBG_88E("STA %pM sent invalid association request\n", - pstat->hwaddr); + netdev_dbg(padapter->pnetdev, + "STA %pM sent invalid association request\n", + pstat->hwaddr); status = _STATS_FAILURE_; goto OnAssocReqFail; } @@ -1032,7 +1043,8 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame /* check if the supported rate is ok */ p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _SUPPORTEDRATES_IE_, &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset); if (!p) { - DBG_88E("Rx a sta assoc-req which supported rate is empty!\n"); + netdev_dbg(padapter->pnetdev, + "Rx a sta assoc-req which supported rate is empty!\n"); /* use our own rate set as statoin used */ /* memcpy(supportRate, AP_BSSRATE, AP_BSSRATE_LEN); */ /* supportRateNum = AP_BSSRATE_LEN; */ @@ -1122,17 +1134,15 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS); if (!wpa_ie) { if (elems.wps_ie) { - DBG_88E("STA included WPS IE in " - "(Re)Association Request - assume WPS is " - "used\n"); + netdev_dbg(padapter->pnetdev, + "STA included WPS IE in (Re)Association Request - assume WPS is used\n"); pstat->flags |= WLAN_STA_WPS; /* wpabuf_free(sta->wps_ie); */ /* sta->wps_ie = wpabuf_alloc_copy(elems.wps_ie + 4, */ /* elems.wps_ie_len - 4); */ } else { - DBG_88E("STA did not include WPA/RSN IE " - "in (Re)Association Request - possible WPS " - "use\n"); + netdev_dbg(padapter->pnetdev, + "STA did not include WPA/RSN IE in (Re)Association Request - possible WPS use\n"); pstat->flags |= WLAN_STA_MAYBE_WPS; } @@ -1145,7 +1155,8 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame rtw_get_wps_attr_content(pmlmepriv->wps_beacon_ie, pmlmepriv->wps_beacon_ie_len, WPS_ATTR_SELECTED_REGISTRAR, &selected_registrar, NULL); if (!selected_registrar) { - DBG_88E("selected_registrar is false , or AP is not ready to do WPS\n"); + netdev_dbg(padapter->pnetdev, + "selected_registrar is false , or AP is not ready to do WPS\n"); status = _STATS_UNABLE_HANDLE_STA_; @@ -1157,8 +1168,9 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame int copy_len; if (psecuritypriv->wpa_psk == 0) { - DBG_88E("STA %pM: WPA/RSN IE in association " - "request, but AP don't support WPA/RSN\n", pstat->hwaddr); + netdev_dbg(padapter->pnetdev, + "STA %pM: WPA/RSN IE in association request, but AP don't support WPA/RSN\n", + pstat->hwaddr); status = WLAN_STATUS_INVALID_IE; @@ -1166,9 +1178,8 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame } if (elems.wps_ie) { - DBG_88E("STA included WPS IE in " - "(Re)Association Request - WPS is " - "used\n"); + netdev_dbg(padapter->pnetdev, + "STA included WPS IE in (Re)Association Request - WPS is used\n"); pstat->flags |= WLAN_STA_WPS; copy_len = 0; } else { @@ -1253,8 +1264,9 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame if ((pstat->flags & WLAN_STA_HT) && ((pstat->wpa2_pairwise_cipher & WPA_CIPHER_TKIP) || (pstat->wpa_pairwise_cipher & WPA_CIPHER_TKIP))) { - DBG_88E("HT: %pM tried to " - "use TKIP with HT association\n", pstat->hwaddr); + netdev_dbg(padapter->pnetdev, + "HT: %pM tried to use TKIP with HT association\n", + pstat->hwaddr); /* status = WLAN_STATUS_CIPHER_REJECTED_PER_POLICY; */ /* goto OnAssocReqFail; */ @@ -1299,7 +1311,7 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame /* get a unique AID */ if (pstat->aid > 0) { - DBG_88E(" old AID %d\n", pstat->aid); + netdev_dbg(padapter->pnetdev, "old AID %d\n", pstat->aid); } else { for (pstat->aid = 1; pstat->aid <= NUM_STA; pstat->aid++) if (!pstapriv->sta_aid[pstat->aid - 1]) @@ -1309,14 +1321,16 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame if (pstat->aid > pstapriv->max_num_sta) { pstat->aid = 0; - DBG_88E(" no room for more AIDs\n"); + netdev_dbg(padapter->pnetdev, + "no room for more AIDs\n"); status = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; goto OnAssocReqFail; } else { pstapriv->sta_aid[pstat->aid - 1] = pstat; - DBG_88E("allocate new AID=(%d)\n", pstat->aid); + netdev_dbg(padapter->pnetdev, + "allocate new AID=(%d)\n", pstat->aid); } } @@ -1351,7 +1365,8 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame issue_asocrsp(padapter, status, pstat, WIFI_REASSOCRSP); /* 2 - report to upper layer */ - DBG_88E("indicate_sta_join_event to upper layer - hostapd\n"); + netdev_dbg(padapter->pnetdev, + "indicate_sta_join_event to upper layer - hostapd\n"); rtw_indicate_sta_assoc_event(padapter, pstat); /* 3-(1) report sta add event */ @@ -1390,8 +1405,6 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame u8 *pframe = precv_frame->rx_data; uint pkt_len = precv_frame->len; - DBG_88E("%s\n", __func__); - /* check A1 matches or not */ if (memcmp(myid(&padapter->eeprompriv), get_da(pframe), ETH_ALEN)) return _SUCCESS; @@ -1407,7 +1420,8 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame /* status */ status = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + 2)); if (status > 0) { - DBG_88E("assoc reject, status code: %d\n", status); + netdev_dbg(padapter->pnetdev, + "assoc reject, status code: %d\n", status); pmlmeinfo->state = WIFI_FW_NULL_STATE; res = -4; goto report_assoc_result; @@ -1487,7 +1501,7 @@ unsigned int OnDeAuth(struct adapter *padapter, struct recv_frame *precv_frame) reason = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN)); - DBG_88E("%s Reason code(%d)\n", __func__, reason); + netdev_dbg(padapter->pnetdev, "Reason code(%d)\n", reason); if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { struct sta_info *psta; @@ -1562,7 +1576,7 @@ unsigned int OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame reason = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN)); - DBG_88E("%s Reason code(%d)\n", __func__, reason); + netdev_dbg(padapter->pnetdev, "Reason code(%d)\n", reason); if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { struct sta_info *psta; @@ -1601,7 +1615,6 @@ unsigned int OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame unsigned int OnAtim(struct adapter *padapter, struct recv_frame *precv_frame) { - DBG_88E("%s\n", __func__); return _SUCCESS; } @@ -1615,8 +1628,6 @@ unsigned int on_action_spct(struct adapter *padapter, struct recv_frame *precv_f u8 category; u8 action; - DBG_88E(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev)); - psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); if (!psta) @@ -1669,8 +1680,6 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr if (memcmp(myid(&padapter->eeprompriv), GetAddr1Ptr(pframe), ETH_ALEN))/* for if1, sta/ap mode */ return _SUCCESS; - DBG_88E("%s\n", __func__); - if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE) if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) return _SUCCESS; @@ -1688,7 +1697,7 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr if (!pmlmeinfo->HT_enable) return _SUCCESS; action = frame_body[1]; - DBG_88E("%s, action=%d\n", __func__, action); + netdev_dbg(padapter->pnetdev, "action=%d\n", action); switch (action) { case RTW_WLAN_ACTION_ADDBA_REQ: /* ADDBA request */ memcpy(&pmlmeinfo->ADDBA_req, &frame_body[2], sizeof(struct ADDBA_request)); @@ -1703,7 +1712,8 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr status = get_unaligned_le16(&frame_body[3]); tid = ((frame_body[5] >> 2) & 0x7); if (status == 0) { /* successful */ - DBG_88E("agg_enable for TID=%d\n", tid); + netdev_dbg(padapter->pnetdev, + "agg_enable for TID=%d\n", tid); psta->htpriv.agg_enable_bitmap |= 1 << tid; psta->htpriv.candidate_tid_bitmap &= ~BIT(tid); } else { @@ -1721,7 +1731,10 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr preorder_ctrl->enable = false; preorder_ctrl->indicate_seq = 0xffff; } - DBG_88E("%s(): DELBA: %x(%x)\n", __func__, pmlmeinfo->agg_enable_bitmap, reason_code); + netdev_dbg(padapter->pnetdev, + "DELBA: %x(%x)\n", + pmlmeinfo->agg_enable_bitmap, + reason_code); /* todo: how to notify the host while receiving DELETE BA */ break; default: @@ -1765,7 +1778,6 @@ void issue_p2p_GO_request(struct adapter *padapter, u8 *raddr) if (!pmgntframe) return; - DBG_88E("[%s] In\n", __func__); /* update attribute */ pattrib = &pmgntframe->attrib; update_mgntframe_attrib(padapter, pattrib); @@ -2101,7 +2113,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8 *raddr, u8 *frame if (!pmgntframe) return; - DBG_88E("[%s] In, result=%d\n", __func__, result); + netdev_dbg(padapter->pnetdev, "result=%d\n", result); /* update attribute */ pattrib = &pmgntframe->attrib; update_mgntframe_attrib(padapter, pattrib); @@ -2459,7 +2471,6 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8 *raddr, u8 result) if (!pmgntframe) return; - DBG_88E("[%s] In\n", __func__); /* update attribute */ pattrib = &pmgntframe->attrib; update_mgntframe_attrib(padapter, pattrib); @@ -3059,7 +3070,6 @@ void issue_p2p_provision_request(struct adapter *padapter, u8 *pssid, u8 ussidle if (!pmgntframe) return; - DBG_88E("[%s] In\n", __func__); /* update attribute */ pattrib = &pmgntframe->attrib; update_mgntframe_attrib(padapter, pattrib); @@ -3135,16 +3145,18 @@ static u8 is_matched_in_profilelist(u8 *peermacaddr, struct profile_info *profil { u8 i, match_result = 0; - DBG_88E("[%s] peermac=%.2X %.2X %.2X %.2X %.2X %.2X\n", __func__, - peermacaddr[0], peermacaddr[1], peermacaddr[2], peermacaddr[3], peermacaddr[4], peermacaddr[5]); + pr_debug("peermac=%.2X %.2X %.2X %.2X %.2X %.2X\n", + peermacaddr[0], peermacaddr[1], peermacaddr[2], + peermacaddr[3], peermacaddr[4], peermacaddr[5]); for (i = 0; i < P2P_MAX_PERSISTENT_GROUP_NUM; i++, profileinfo++) { - DBG_88E("[%s] profileinfo_mac=%.2X %.2X %.2X %.2X %.2X %.2X\n", __func__, - profileinfo->peermac[0], profileinfo->peermac[1], profileinfo->peermac[2], - profileinfo->peermac[3], profileinfo->peermac[4], profileinfo->peermac[5]); + pr_debug("profileinfo_mac=%.2X %.2X %.2X %.2X %.2X %.2X\n", + profileinfo->peermac[0], profileinfo->peermac[1], + profileinfo->peermac[2], profileinfo->peermac[3], + profileinfo->peermac[4], profileinfo->peermac[5]); if (!memcmp(peermacaddr, profileinfo->peermac, ETH_ALEN)) { match_result = 1; - DBG_88E("[%s] Match!\n", __func__); + pr_debug("Match!\n"); break; } } @@ -3696,14 +3708,16 @@ static s32 rtw_action_public_decache(struct recv_frame *recv_frame, s32 token) if (GetRetry(frame)) { if (token >= 0) { if ((seq_ctrl == mlmeext->action_public_rxseq) && (token == mlmeext->action_public_dialog_token)) { - DBG_88E(FUNC_ADPT_FMT" seq_ctrl = 0x%x, rxseq = 0x%x, token:%d\n", - FUNC_ADPT_ARG(adapter), seq_ctrl, mlmeext->action_public_rxseq, token); + netdev_dbg(adapter->pnetdev, + "seq_ctrl = 0x%x, rxseq = 0x%x, token:%d\n", + seq_ctrl, mlmeext->action_public_rxseq, token); return _FAIL; } } else { if (seq_ctrl == mlmeext->action_public_rxseq) { - DBG_88E(FUNC_ADPT_FMT" seq_ctrl = 0x%x, rxseq = 0x%x\n", - FUNC_ADPT_ARG(adapter), seq_ctrl, mlmeext->action_public_rxseq); + netdev_dbg(adapter->pnetdev, + "seq_ctrl = 0x%x, rxseq = 0x%x\n", + seq_ctrl, mlmeext->action_public_rxseq); return _FAIL; } } @@ -3746,7 +3760,7 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) switch (frame_body[6]) { /* OUI Subtype */ case P2P_GO_NEGO_REQ: - DBG_88E("[%s] Got GO Nego Req Frame\n", __func__); + netdev_dbg(padapter->pnetdev, "Got GO Nego Req Frame\n"); memset(&pwdinfo->groupid_info, 0x00, sizeof(struct group_id_info)); if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ)) @@ -3758,7 +3772,9 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) _cancel_timer_ex(&pwdinfo->restore_p2p_state_timer); /* Restore the previous p2p state */ rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); - DBG_88E("[%s] Restore the previous p2p state to %d\n", __func__, rtw_p2p_state(pwdinfo)); + netdev_dbg(padapter->pnetdev, + "Restore the previous p2p state to %d\n", + rtw_p2p_state(pwdinfo)); } /* Commented by Kurt 20110902 */ @@ -3779,7 +3795,7 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) _set_timer(&pwdinfo->restore_p2p_state_timer, 5000); break; case P2P_GO_NEGO_RESP: - DBG_88E("[%s] Got GO Nego Resp Frame\n", __func__); + netdev_dbg(padapter->pnetdev, "Got GO Nego Resp Frame\n"); if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) { /* Commented by Albert 20110425 */ @@ -3800,11 +3816,12 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL)) _set_timer(&pwdinfo->restore_p2p_state_timer, 5000); } else { - DBG_88E("[%s] Skipped GO Nego Resp Frame (p2p_state != P2P_STATE_GONEGO_ING)\n", __func__); + netdev_dbg(padapter->pnetdev, + "Skipped GO Nego Resp Frame (p2p_state != P2P_STATE_GONEGO_ING)\n"); } break; case P2P_GO_NEGO_CONF: - DBG_88E("[%s] Got GO Nego Confirm Frame\n", __func__); + netdev_dbg(padapter->pnetdev, "Got GO Nego Confirm Frame\n"); result = process_p2p_group_negotation_confirm(pwdinfo, frame_body, len); if (P2P_STATUS_SUCCESS == result) { if (rtw_p2p_role(pwdinfo) == P2P_ROLE_CLIENT) { @@ -3818,7 +3835,7 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) /* Added by Albert 2010/10/05 */ /* Received the P2P Invite Request frame. */ - DBG_88E("[%s] Got invite request frame!\n", __func__); + netdev_dbg(padapter->pnetdev, "Got invite request frame!\n"); p2p_ie = rtw_get_p2p_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &p2p_ielen); if (p2p_ie) { /* Parse the necessary information from the P2P Invitation Request frame. */ @@ -3838,10 +3855,14 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) /* After having the peer interface address, the sigma can find the correct conf file for wpa_supplicant. */ if (attr_contentlen) { - DBG_88E("[%s] GO's BSSID = %.2X %.2X %.2X %.2X %.2X %.2X\n", __func__, - pwdinfo->p2p_peer_interface_addr[0], pwdinfo->p2p_peer_interface_addr[1], - pwdinfo->p2p_peer_interface_addr[2], pwdinfo->p2p_peer_interface_addr[3], - pwdinfo->p2p_peer_interface_addr[4], pwdinfo->p2p_peer_interface_addr[5]); + netdev_dbg(padapter->pnetdev, + "GO's BSSID = %.2X %.2X %.2X %.2X %.2X %.2X\n", + pwdinfo->p2p_peer_interface_addr[0], + pwdinfo->p2p_peer_interface_addr[1], + pwdinfo->p2p_peer_interface_addr[2], + pwdinfo->p2p_peer_interface_addr[3], + pwdinfo->p2p_peer_interface_addr[4], + pwdinfo->p2p_peer_interface_addr[5]); } if (invitation_flag & P2P_INVITATION_FLAGS_PERSISTENT) { @@ -3889,7 +3910,8 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) } } } else { - DBG_88E("[%s] P2P Group ID Attribute NOT FOUND!\n", __func__); + netdev_dbg(padapter->pnetdev, + "P2P Group ID Attribute NOT FOUND!\n"); status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE; } } else { @@ -3915,16 +3937,19 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) status_code = P2P_STATUS_SUCCESS; } } else { - DBG_88E("[%s] P2P Group ID Attribute NOT FOUND!\n", __func__); + netdev_dbg(padapter->pnetdev, + "P2P Group ID Attribute NOT FOUND!\n"); status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE; } } } else { - DBG_88E("[%s] P2P Invitation Flags Attribute NOT FOUND!\n", __func__); + netdev_dbg(padapter->pnetdev, + "P2P Invitation Flags Attribute NOT FOUND!\n"); status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE; } - DBG_88E("[%s] status_code = %d\n", __func__, status_code); + netdev_dbg(padapter->pnetdev, + "status_code = %d\n", status_code); pwdinfo->inviteresp_info.token = frame_body[7]; issue_p2p_invitation_response(padapter, GetAddr2Ptr(pframe), pwdinfo->inviteresp_info.token, status_code); @@ -3934,14 +3959,15 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) u8 attr_content = 0x00; u32 attr_contentlen = 0; - DBG_88E("[%s] Got invite response frame!\n", __func__); + netdev_dbg(padapter->pnetdev, "Got invite response frame!\n"); _cancel_timer_ex(&pwdinfo->restore_p2p_state_timer); p2p_ie = rtw_get_p2p_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &p2p_ielen); if (p2p_ie) { rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_STATUS, &attr_content, &attr_contentlen); if (attr_contentlen == 1) { - DBG_88E("[%s] Status = %d\n", __func__, attr_content); + netdev_dbg(padapter->pnetdev, + "Status = %d\n", attr_content); pwdinfo->invitereq_info.benable = false; if (attr_content == P2P_STATUS_SUCCESS) { @@ -3975,7 +4001,8 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) process_p2p_devdisc_resp(pwdinfo, pframe, len); break; case P2P_PROVISION_DISC_REQ: - DBG_88E("[%s] Got Provisioning Discovery Request Frame\n", __func__); + netdev_dbg(padapter->pnetdev, + "Got Provisioning Discovery Request Frame\n"); process_p2p_provdisc_req(pwdinfo, pframe, len); memcpy(pwdinfo->rx_prov_disc_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN); @@ -3990,7 +4017,8 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) case P2P_PROVISION_DISC_RESP: /* Commented by Albert 20110707 */ /* Should we check the pwdinfo->tx_prov_disc_info.bsent flag here?? */ - DBG_88E("[%s] Got Provisioning Discovery Response Frame\n", __func__); + netdev_dbg(padapter->pnetdev, + "Got Provisioning Discovery Response Frame\n"); /* Commented by Albert 20110426 */ /* The restore timer is enabled when issuing the provisioing request frame in rtw_p2p_prov_disc function. */ _cancel_timer_ex(&pwdinfo->restore_p2p_state_timer); @@ -4081,8 +4109,6 @@ unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_fra uint len = precv_frame->len; struct wifidirect_info *pwdinfo = &padapter->wdinfo; - DBG_88E("%s\n", __func__); - /* check RA matches or not */ if (memcmp(myid(&padapter->eeprompriv), GetAddr1Ptr(pframe), ETH_ALEN))/* for if1, sta/ap mode */ return _SUCCESS; @@ -4147,13 +4173,13 @@ struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv) pmgntframe = rtw_alloc_xmitframe(pxmitpriv); if (!pmgntframe) { - DBG_88E("%s, alloc xmitframe fail\n", __func__); + pr_debug("alloc xmitframe fail\n"); return NULL; } pxmitbuf = rtw_alloc_xmitbuf_ext(pxmitpriv); if (!pxmitbuf) { - DBG_88E("%s, alloc xmitbuf fail\n", __func__); + pr_debug("alloc xmitbuf fail\n"); rtw_free_xmitframe(pxmitpriv, pmgntframe); return NULL; } @@ -4175,7 +4201,7 @@ void update_mgnt_tx_rate(struct adapter *padapter, u8 rate) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; pmlmeext->tx_rate = rate; - DBG_88E("%s(): rate = %x\n", __func__, rate); + netdev_dbg(padapter->pnetdev, "rate = %x\n", rate); } void update_mgntframe_attrib(struct adapter *padapter, struct pkt_attrib *pattrib) @@ -4312,7 +4338,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) { - DBG_88E("%s, alloc mgnt frame fail\n", __func__); + netdev_dbg(padapter->pnetdev, "alloc mgnt frame fail\n"); return; } spin_lock_bh(&pmlmepriv->bcn_update_lock); @@ -4495,13 +4521,12 @@ _issue_bcn: spin_unlock_bh(&pmlmepriv->bcn_update_lock); if ((pattrib->pktlen + TXDESC_SIZE) > 512) { - DBG_88E("beacon frame too large\n"); + netdev_dbg(padapter->pnetdev, "beacon frame too large\n"); return; } pattrib->last_txcmdsz = pattrib->pktlen; - /* DBG_88E("issue bcn_sz=%d\n", pattrib->last_txcmdsz); */ if (timeout_ms > 0) dump_mgntframe_and_wait(padapter, pmgntframe, timeout_ms); else @@ -4528,7 +4553,8 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) { - DBG_88E("%s, alloc mgnt frame fail\n", __func__); + netdev_dbg(padapter->pnetdev, + "alloc mgnt frame fail\n"); return; } @@ -4776,13 +4802,17 @@ int issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, if (try_cnt && wait_ms) { if (da) - DBG_88E(FUNC_ADPT_FMT" to %pM, ch:%u%s, %d/%d in %u ms\n", - FUNC_ADPT_ARG(padapter), da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + netdev_dbg(padapter->pnetdev, + "to %pM, ch:%u%s, %d/%d in %u ms\n", + da, rtw_get_oper_ch(padapter), + ret == _SUCCESS ? ", acked" : "", + i, try_cnt, rtw_get_passing_time_ms(start)); else - DBG_88E(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n", - FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + netdev_dbg(padapter->pnetdev, + "ch:%u%s, %d/%d in %u ms\n", + rtw_get_oper_ch(padapter), + ret == _SUCCESS ? ", acked" : "", + i, try_cnt, rtw_get_passing_time_ms(start)); } exit: return ret; @@ -4912,7 +4942,6 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short pattrib->last_txcmdsz = pattrib->pktlen; rtw_wep_encrypt(padapter, pmgntframe); - DBG_88E("%s\n", __func__); dump_mgntframe(padapter, pmgntframe); } @@ -4933,8 +4962,6 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i __le16 lestatus, leval; struct wifidirect_info *pwdinfo = &padapter->wdinfo; - DBG_88E("%s\n", __func__); - pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) return; @@ -5121,7 +5148,9 @@ void issue_assocreq(struct adapter *padapter) for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) { if (pmlmeinfo->network.SupportedRates[i] == 0) break; - DBG_88E("network.SupportedRates[%d]=%02X\n", i, pmlmeinfo->network.SupportedRates[i]); + netdev_dbg(padapter->pnetdev, + "network.SupportedRates[%d]=%02X\n", + i, pmlmeinfo->network.SupportedRates[i]); } for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) { @@ -5138,7 +5167,9 @@ void issue_assocreq(struct adapter *padapter) if (j == sta_bssrate_len) { /* the rate is not supported by STA */ - DBG_88E("%s(): the rate[%d]=%02X is not supported by STA!\n", __func__, i, pmlmeinfo->network.SupportedRates[i]); + netdev_dbg(padapter->pnetdev, + "the rate[%d]=%02X is not supported by STA!\n", + i, pmlmeinfo->network.SupportedRates[i]); } else { /* the rate is supported by STA */ bssrate[index++] = pmlmeinfo->network.SupportedRates[i]; @@ -5146,7 +5177,7 @@ void issue_assocreq(struct adapter *padapter) } bssrate_len = index; - DBG_88E("bssrate_len=%d\n", bssrate_len); + netdev_dbg(padapter->pnetdev, "bssrate_len=%d\n", bssrate_len); if (bssrate_len == 0) { rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); @@ -5458,13 +5489,17 @@ int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int pow if (try_cnt && wait_ms) { if (da) - DBG_88E(FUNC_ADPT_FMT" to %pM, ch:%u%s, %d/%d in %u ms\n", - FUNC_ADPT_ARG(padapter), da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + netdev_dbg(padapter->pnetdev, + "to %pM, ch:%u%s, %d/%d in %u ms\n", + da, rtw_get_oper_ch(padapter), + ret == _SUCCESS ? ", acked" : "", + i, try_cnt, rtw_get_passing_time_ms(start)); else - DBG_88E(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n", - FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + netdev_dbg(padapter->pnetdev, + "ch:%u%s, %d/%d in %u ms\n", + rtw_get_oper_ch(padapter), + ret == _SUCCESS ? ", acked" : "", + i, try_cnt, rtw_get_passing_time_ms(start)); } exit: return ret; @@ -5484,8 +5519,6 @@ static int _issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - DBG_88E("%s\n", __func__); - pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) goto exit; @@ -5578,13 +5611,17 @@ int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int if (try_cnt && wait_ms) { if (da) - DBG_88E(FUNC_ADPT_FMT" to %pM, ch:%u%s, %d/%d in %u ms\n", - FUNC_ADPT_ARG(padapter), da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + netdev_dbg(padapter->pnetdev, + "to %pM, ch:%u%s, %d/%d in %u ms\n", + da, rtw_get_oper_ch(padapter), + ret == _SUCCESS ? ", acked" : "", + i, try_cnt, rtw_get_passing_time_ms(start)); else - DBG_88E(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n", - FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + netdev_dbg(padapter->pnetdev, + "ch:%u%s, %d/%d in %u ms\n", + rtw_get_oper_ch(padapter), + ret == _SUCCESS ? ", acked" : "", + i, try_cnt, rtw_get_passing_time_ms(start)); } exit: return ret; @@ -5655,7 +5692,7 @@ exit: int issue_deauth(struct adapter *padapter, unsigned char *da, unsigned short reason) { - DBG_88E("%s to %pM\n", __func__, da); + netdev_dbg(padapter->pnetdev, "to %pM\n", da); return _issue_deauth(padapter, da, reason, false); } @@ -5685,13 +5722,17 @@ int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason, int if (try_cnt && wait_ms) { if (da) - DBG_88E(FUNC_ADPT_FMT" to %pM, ch:%u%s, %d/%d in %u ms\n", - FUNC_ADPT_ARG(padapter), da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + netdev_dbg(padapter->pnetdev, + "to %pM, ch:%u%s, %d/%d in %u ms\n", + da, rtw_get_oper_ch(padapter), + ret == _SUCCESS ? ", acked" : "", + i, try_cnt, rtw_get_passing_time_ms(start)); else - DBG_88E(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n", - FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + netdev_dbg(padapter->pnetdev, + "ch:%u%s, %d/%d in %u ms\n", + rtw_get_oper_ch(padapter), + ret == _SUCCESS ? ", acked" : "", + i, try_cnt, rtw_get_passing_time_ms(start)); } exit: return ret; @@ -5719,7 +5760,9 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch struct sta_priv *pstapriv = &padapter->stapriv; struct registry_priv *pregpriv = &padapter->registrypriv; - DBG_88E("%s, category=%d, action=%d, status=%d\n", __func__, category, action, status); + netdev_dbg(padapter->pnetdev, + "category=%d, action=%d, status=%d\n", + category, action, status); pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) @@ -5772,7 +5815,9 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch if (psta) { start_seq = (psta->sta_xmitpriv.txseq_tid[status & 0x07] & 0xfff) + 1; - DBG_88E("BA_starting_seqctrl=%d for TID=%d\n", start_seq, status & 0x07); + netdev_dbg(padapter->pnetdev, + "BA_starting_seqctrl=%d for TID=%d\n", + start_seq, status & 0x07); psta->BA_starting_seqctrl[status & 0x07] = start_seq; @@ -5855,8 +5900,6 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) if (pmlmeinfo->bwmode_updated) return; - DBG_88E("%s\n", __func__); - category = RTW_WLAN_CATEGORY_PUBLIC; action = ACT_PUBLIC_BSSCOEXIST; @@ -5981,7 +6024,8 @@ unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr) if (initiator == 0) { /* recipient */ for (tid = 0; tid < MAXTID; tid++) { if (psta->recvreorder_ctrl[tid].enable) { - DBG_88E("rx agg disable tid(%d)\n", tid); + netdev_dbg(padapter->pnetdev, + "rx agg disable tid(%d)\n", tid); issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, (((tid << 1) | initiator) & 0x1F)); psta->recvreorder_ctrl[tid].enable = false; psta->recvreorder_ctrl[tid].indicate_seq = 0xffff; @@ -5990,7 +6034,8 @@ unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr) } else if (initiator == 1) { /* originator */ for (tid = 0; tid < MAXTID; tid++) { if (psta->htpriv.agg_enable_bitmap & BIT(tid)) { - DBG_88E("tx agg disable tid(%d)\n", tid); + netdev_dbg(padapter->pnetdev, + "tx agg disable tid(%d)\n", tid); issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, (((tid << 1) | initiator) & 0x1F)); psta->htpriv.agg_enable_bitmap &= ~BIT(tid); psta->htpriv.candidate_tid_bitmap &= ~BIT(tid); @@ -6023,13 +6068,16 @@ unsigned int send_beacon(struct adapter *padapter) if (padapter->bSurpriseRemoved || padapter->bDriverStopped) return _FAIL; if (!bxmitok) { - DBG_88E("%s fail! %u ms\n", __func__, rtw_get_passing_time_ms(start)); + netdev_dbg(padapter->pnetdev, "fail! %u ms\n", + rtw_get_passing_time_ms(start)); return _FAIL; } else { u32 passing_time = rtw_get_passing_time_ms(start); if (passing_time > 100 || issue > 3) - DBG_88E("%s success, issue:%d, poll:%d, %u ms\n", __func__, issue, poll, rtw_get_passing_time_ms(start)); + netdev_dbg(padapter->pnetdev, + "success, issue:%d, poll:%d, %u ms\n", + issue, poll, rtw_get_passing_time_ms(start)); return _SUCCESS; } } @@ -6238,13 +6286,16 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st /* checking SSID */ p = rtw_get_ie(bssid->IEs + ie_offset, _SSID_IE_, &len, bssid->IELength - ie_offset); if (!p) { - DBG_88E("marc: cannot find SSID for survey event\n"); + netdev_dbg(padapter->pnetdev, + "marc: cannot find SSID for survey event\n"); return _FAIL; } if (*(p + 1)) { if (len > NDIS_802_11_LENGTH_SSID) { - DBG_88E("%s()-%d: IE too long (%d) for survey event\n", __func__, __LINE__, len); + netdev_dbg(padapter->pnetdev, + "IE too long (%d) for survey event\n", + len); return _FAIL; } memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1)); @@ -6260,7 +6311,9 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st p = rtw_get_ie(bssid->IEs + ie_offset, _SUPPORTEDRATES_IE_, &len, bssid->IELength - ie_offset); if (p) { if (len > NDIS_802_11_LENGTH_RATES_EX) { - DBG_88E("%s()-%d: IE too long (%d) for survey event\n", __func__, __LINE__, len); + netdev_dbg(padapter->pnetdev, + "IE too long (%d) for survey event\n", + len); return _FAIL; } memcpy(bssid->SupportedRates, (p + 2), len); @@ -6270,7 +6323,9 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st p = rtw_get_ie(bssid->IEs + ie_offset, _EXT_SUPPORTEDRATES_IE_, &len, bssid->IELength - ie_offset); if (p) { if (len > (NDIS_802_11_LENGTH_RATES_EX - i)) { - DBG_88E("%s()-%d: IE too long (%d) for survey event\n", __func__, __LINE__, len); + netdev_dbg(padapter->pnetdev, + "IE too long (%d) for survey event\n", + len); return _FAIL; } memcpy(bssid->SupportedRates + i, (p + 2), len); @@ -6387,7 +6442,7 @@ void start_create_ibss(struct adapter *padapter) rtw_indicate_connect(padapter); } } else { - DBG_88E("start_create_ibss, invalid cap:%x\n", caps); + netdev_dbg(padapter->pnetdev, "invalid cap:%x\n", caps); return; } /* update bc/mc sta_info */ @@ -6502,8 +6557,6 @@ unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr if (!(!memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN))) return _SUCCESS; - DBG_88E("%s\n", __func__); - if ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) { if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) { pmlmeinfo->state = WIFI_FW_NULL_STATE; @@ -6761,7 +6814,8 @@ void report_surveydone_event(struct adapter *padapter) psurveydone_evt = (struct surveydone_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); psurveydone_evt->bss_cnt = pmlmeext->sitesurvey_res.bss_cnt; - DBG_88E("survey done event(%x)\n", psurveydone_evt->bss_cnt); + netdev_dbg(padapter->pnetdev, "survey done event(%x)\n", + psurveydone_evt->bss_cnt); rtw_enqueue_cmd(pcmdpriv, pcmd_obj); } @@ -6807,7 +6861,7 @@ void report_join_res(struct adapter *padapter, int res) pjoinbss_evt->network.join_res = res; pjoinbss_evt->network.aid = res; - DBG_88E("report_join_res(%d)\n", res); + netdev_dbg(padapter->pnetdev, "res=%d\n", res); rtw_joinbss_event_prehandle(padapter, (u8 *)&pjoinbss_evt->network); @@ -6863,7 +6917,7 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi pdel_sta_evt->mac_id = mac_id; - DBG_88E("report_del_sta_event: delete STA, mac_id =%d\n", mac_id); + netdev_dbg(padapter->pnetdev, "delete STA, mac_id = %d\n", mac_id); rtw_enqueue_cmd(pcmdpriv, pcmd_obj); } @@ -6907,7 +6961,7 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int memcpy((unsigned char *)(&padd_sta_evt->macaddr), MacAddr, ETH_ALEN); padd_sta_evt->cam_id = cam_idx; - DBG_88E("report_add_sta_event: add STA\n"); + netdev_dbg(padapter->pnetdev, "add STA\n"); rtw_enqueue_cmd(pcmdpriv, pcmd_obj); } @@ -6977,7 +7031,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) /* restore to initial setting. */ update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode); - goto exit_mlmeext_joinbss_event_callback; + return; } if ((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE) { @@ -7033,10 +7087,6 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) correct_TSF(padapter, pmlmeext); } rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_CONNECT, 0); - -exit_mlmeext_joinbss_event_callback: - - DBG_88E("=>%s\n", __func__); } void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *psta) @@ -7045,8 +7095,6 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; u8 join_type; - DBG_88E("%s\n", __func__); - if ((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE) { if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) {/* adhoc master or sta_count>1 */ /* nothing to do */ @@ -7126,7 +7174,8 @@ static void _linked_rx_signal_strength_display(struct adapter *padapter) GetHalDefVar8188EUsb(padapter, HW_DEF_RA_INFO_DUMP, &mac_id); GetHalDefVar8188EUsb(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); - DBG_88E("UndecoratedSmoothedPWDB:%d\n", UndecoratedSmoothedPWDB); + netdev_dbg(padapter->pnetdev, + "UndecoratedSmoothedPWDB:%d\n", UndecoratedSmoothedPWDB); } static u8 chk_ap_is_alive(struct adapter *padapter, struct sta_info *psta) @@ -7151,15 +7200,20 @@ static void rtl8188e_sreset_linked_status_check(struct adapter *padapter) u8 fw_status; if (rx_dma_status != 0x00) { - DBG_88E("%s REG_RXDMA_STATUS:0x%08x\n", __func__, rx_dma_status); + netdev_dbg(padapter->pnetdev, "REG_RXDMA_STATUS:0x%08x\n", + rx_dma_status); rtw_write32(padapter, REG_RXDMA_STATUS, rx_dma_status); } fw_status = rtw_read8(padapter, REG_FMETHR); if (fw_status == 1) - DBG_88E("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !!\n", __func__, fw_status); + netdev_dbg(padapter->pnetdev, + "REG_FW_STATUS (0x%02x), Read_Efuse_Fail !!\n", + fw_status); else if (fw_status == 2) - DBG_88E("%s REG_FW_STATUS (0x%02x), Condition_No_Match !!\n", __func__, fw_status); + netdev_dbg(padapter->pnetdev, + "REG_FW_STATUS (0x%02x), Condition_No_Match !!\n", + fw_status); } void linked_status_chk(struct adapter *padapter) @@ -7295,15 +7349,15 @@ void survey_timer_hdl(struct adapter *padapter) if (!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE)) { rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_MAX); pmlmeext->sitesurvey_res.channel_idx = 3; - DBG_88E("%s idx:%d, cnt:%u\n", __func__ - , pmlmeext->sitesurvey_res.channel_idx - , pwdinfo->find_phase_state_exchange_cnt - ); + netdev_dbg(padapter->pnetdev, + "idx:%d, cnt:%u\n", + pmlmeext->sitesurvey_res.channel_idx, + pwdinfo->find_phase_state_exchange_cnt); } else { pmlmeext->sitesurvey_res.channel_idx = pmlmeext->sitesurvey_res.ch_num; - DBG_88E("%s idx:%d\n", __func__ - , pmlmeext->sitesurvey_res.channel_idx - ); + netdev_dbg(padapter->pnetdev, + "idx:%d\n", + pmlmeext->sitesurvey_res.channel_idx); } pmlmeext->scan_abort = false;/* reset */ @@ -7333,7 +7387,7 @@ void link_timer_hdl(struct adapter *padapter) struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { - DBG_88E("link_timer_hdl:no beacon while connecting\n"); + netdev_dbg(padapter->pnetdev, "no beacon while connecting\n"); pmlmeinfo->state = WIFI_FW_NULL_STATE; report_join_res(padapter, -3); } else if (pmlmeinfo->state & WIFI_FW_AUTH_STATE) { @@ -7344,7 +7398,7 @@ void link_timer_hdl(struct adapter *padapter) return; } - DBG_88E("link_timer_hdl: auth timeout and try again\n"); + netdev_dbg(padapter->pnetdev, "auth timeout and try again\n"); pmlmeinfo->auth_seq = 1; issue_auth(padapter, NULL, 0); set_link_timer(pmlmeext, REAUTH_TO); @@ -7356,7 +7410,7 @@ void link_timer_hdl(struct adapter *padapter) return; } - DBG_88E("link_timer_hdl: assoc timeout and try again\n"); + netdev_dbg(padapter->pnetdev, "assoc timeout and try again\n"); issue_assocreq(padapter); set_link_timer(pmlmeext, REASSOC_TO); } @@ -7547,7 +7601,8 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) break; } - DBG_88E("set ch/bw before connected\n"); + netdev_dbg(padapter->pnetdev, + "set ch/bw before connected\n"); } } break; @@ -7806,24 +7861,29 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) if (psta) { ctrl = (BIT(15) | ((pparm->algorithm) << 2)); - DBG_88E("r871x_set_stakey_hdl(): enc_algorithm=%d\n", pparm->algorithm); + netdev_dbg(padapter->pnetdev, "enc_algorithm=%d\n", + pparm->algorithm); if ((psta->mac_id < 1) || (psta->mac_id > (NUM_STA - 4))) { - DBG_88E("r871x_set_stakey_hdl():set_stakey failed, mac_id(aid)=%d\n", psta->mac_id); + netdev_dbg(padapter->pnetdev, + "set_stakey failed, mac_id(aid)=%d\n", + psta->mac_id); return H2C_REJECTED; } cam_id = (psta->mac_id + 3);/* 0~3 for default key, cmd_id = macid + 3, macid = aid+1; */ - DBG_88E("Write CAM, mac_addr =%x:%x:%x:%x:%x:%x, cam_entry=%d\n", pparm->addr[0], - pparm->addr[1], pparm->addr[2], pparm->addr[3], pparm->addr[4], - pparm->addr[5], cam_id); + netdev_dbg(padapter->pnetdev, + "Write CAM, mac_addr =%x:%x:%x:%x:%x:%x, cam_entry=%d\n", + pparm->addr[0], pparm->addr[1], pparm->addr[2], + pparm->addr[3], pparm->addr[4], pparm->addr[5], + cam_id); write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key); return H2C_SUCCESS_RSP; } else { - DBG_88E("r871x_set_stakey_hdl(): sta has been free\n"); + netdev_dbg(padapter->pnetdev, "sta has been free\n"); return H2C_REJECTED; } } @@ -7947,7 +8007,7 @@ u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf) u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) { if (send_beacon(padapter) == _FAIL) { - DBG_88E("issue_beacon, fail!\n"); + netdev_dbg(padapter->pnetdev, "issue_beacon, fail!\n"); return H2C_PARAMETERS_ERROR; } else { /* tx bc/mc frames after update TIM */ @@ -8006,9 +8066,8 @@ u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf) set_ch_parm = (struct set_ch_parm *)pbuf; - DBG_88E(FUNC_NDEV_FMT" ch:%u, bw:%u, ch_offset:%u\n", - FUNC_NDEV_ARG(padapter->pnetdev), - set_ch_parm->ch, set_ch_parm->bw, set_ch_parm->ch_offset); + netdev_dbg(padapter->pnetdev, "ch:%u, bw:%u, ch_offset:%u\n", + set_ch_parm->ch, set_ch_parm->bw, set_ch_parm->ch_offset); pmlmeext->cur_channel = set_ch_parm->ch; pmlmeext->cur_ch_offset = set_ch_parm->ch_offset; -- cgit From c4b548f94abc64bc991d3a27f13ef0819961a60b Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Mon, 10 Jan 2022 09:00:20 +0000 Subject: staging: r8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c Convert the DBG_88E macro calls in core/rtw_sta_mgt.c to use pr_debug, as their information may be useful to observers, and this gets the driver closer to the point of being able to remove DBG_88E itself. These calls are at points in the call chain where use of dev_dbg or netdev_dbg isn't possible due to lack of device pointer, so plain pr_debug is appropriate here. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220110090020.6800-8-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_sta_mgt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c index 54561ff239a0..de5406a5870c 100644 --- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c @@ -104,7 +104,7 @@ inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta) int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info); if (!stainfo_offset_valid(offset)) - DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset); + pr_debug("invalid offset(%d), out of range!!!", offset); return offset; } @@ -112,7 +112,7 @@ inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta) inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset) { if (!stainfo_offset_valid(offset)) - DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset); + pr_debug("invalid offset(%d), out of range!!!", offset); return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info)); } -- cgit From abadf920bc7f00b8080ea55b3c922481cf9e4bd4 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:26 +0100 Subject: staging: r8188eu: remove unused externl variables Remove a group of external variables which are not used in osdep_service.h or in the files where osdep_service.h is included. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220115165536.231210-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/osdep_service.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index 6c8241372a06..f42e15117c95 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -99,12 +99,6 @@ static inline void rtw_netif_stop_queue(struct net_device *pnetdev) extern int RTW_STATUS_CODE(int error_code); -extern unsigned char MCS_rate_2R[16]; -extern unsigned char MCS_rate_1R[16]; -extern unsigned char RTW_WPA_OUI[]; -extern unsigned char WPA_TKIP_CIPHER[4]; -extern unsigned char RSN_TKIP_CIPHER[4]; - void *rtw_malloc2d(int h, int w, int size); #define rtw_init_queue(q) \ -- cgit From ea9eb1b550638d14af93661735c7001c2a0c0482 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:27 +0100 Subject: staging: r8188eu: remove unused macros Remove some unused macros from osdep_service.h. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220115165536.231210-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/osdep_service.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index f42e15117c95..2f6b8acd0a10 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -70,10 +70,6 @@ static inline void _cancel_timer(struct timer_list *ptimer,u8 *bcancelled) *bcancelled= true;/* true ==1; false==0 */ } -#define RTW_TIMER_HDL_ARGS void *FunctionContext -#define RTW_TIMER_HDL_NAME(name) rtw_##name##_timer_hdl -#define RTW_DECLARE_TIMER_HDL(name) void RTW_TIMER_HDL_NAME(name)(RTW_TIMER_HDL_ARGS) - static inline int rtw_netif_queue_stopped(struct net_device *pnetdev) { return netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) && -- cgit From 0bf66e3a362930912ecbcb7bf74378fda1ae3bfd Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:28 +0100 Subject: staging: r8188eu: remove unused bitshift function The bitshift function from osdep_service.h is not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220115165536.231210-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/osdep_service.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index 2f6b8acd0a10..6d03e135d1e3 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -163,15 +163,6 @@ static inline u32 _RND512(u32 sz) return val; } -static inline u32 bitshift(u32 bitmask) -{ - u32 i; - - for (i = 0; i <= 31; i++) - if (((bitmask>>i) & 0x1) == 1) break; - return i; -} - /* limitation of path length */ #define PATH_LENGTH_MAX PATH_MAX -- cgit From 4b583386e03dc5fcd2ef7d2d1c554655e66cc5c8 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:29 +0100 Subject: staging: r8188eu: remove unused PATH_LENGTH_MAX define PATH_LENGTH_MAX in osdep_service.h is not used and can be removed. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220115165536.231210-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/osdep_service.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index 6d03e135d1e3..c5de424842cc 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -163,9 +163,6 @@ static inline u32 _RND512(u32 sz) return val; } -/* limitation of path length */ -#define PATH_LENGTH_MAX PATH_MAX - struct rtw_netdev_priv_indicator { void *priv; u32 sizeof_priv; -- cgit From 9224cda4afc4e3700125a9eb883f4827fe15fe66 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:30 +0100 Subject: staging: r8188eu: remove rtw_list_delete wrapper Remove the rtw_list_delete wrapper function. Call list_del_init directly. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220115165536.231210-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_cmd.c | 2 +- drivers/staging/r8188eu/include/osdep_service.h | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index 3d22a8888ea7..410b5dacfaa7 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -133,7 +133,7 @@ static struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue) obj = NULL; } else { obj = container_of((&queue->queue)->next, struct cmd_obj, list); - rtw_list_delete(&obj->list); + list_del_init(&obj->list); } spin_unlock_irqrestore(&queue->lock, flags); diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index c5de424842cc..8ca9f86e3c9b 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -54,11 +54,6 @@ static inline struct list_head *get_list_head(struct __queue *queue) return (&(queue->queue)); } -static inline void rtw_list_delete(struct list_head *plist) -{ - list_del_init(plist); -} - static inline void _set_timer(struct timer_list *ptimer,u32 delay_time) { mod_timer(ptimer , (jiffies+(delay_time*HZ/1000))); -- cgit From 2bd4aa6acb115d6fd9225401e3cf38852f6ec7de Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:31 +0100 Subject: staging: r8188eu: remove _cancel_timer wrapper Remove the _cancel_timer wrapper function and call del_timer_sync directly. None of the callers needs the bcancelled variable that's populated by _cancel_timer, these variables can be removed in the calling functions. rtw_surveydone_event_callback calls _cancel_timer only if it believes that the timer is currently running. We can drop this. It's safe to call del_timer_sync when the timer is not running. The timer in question, scan_to_timer, is used only for the site survey command (the rtw_survey functions) so we won't be stopping it while it's in use by someone else. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220115165536.231210-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_cmd.c | 3 +-- drivers/staging/r8188eu/core/rtw_mlme.c | 14 ++++---------- drivers/staging/r8188eu/core/rtw_p2p.c | 4 +--- drivers/staging/r8188eu/include/osdep_service.h | 6 ------ 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index 410b5dacfaa7..266bb7db5252 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -1460,7 +1460,6 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) { - u8 timer_cancelled; struct sta_info *psta = NULL; struct wlan_network *pwlan = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1470,7 +1469,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if (pcmd->res != H2C_SUCCESS) _set_timer(&pmlmepriv->assoc_timer, 1); - _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled); + del_timer_sync(&pmlmepriv->assoc_timer); spin_lock_bh(&pmlmepriv->lock); diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 189b48b17326..6533a7babb65 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -676,7 +676,6 @@ exit: void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) { struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - u8 timer_cancelled = 0; spin_lock_bh(&pmlmepriv->lock); @@ -686,16 +685,12 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) pmlmepriv->wps_probe_req_ie = NULL; } - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { - timer_cancelled = 1; - + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); - } spin_unlock_bh(&pmlmepriv->lock); - if (timer_cancelled) - _cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled); + del_timer_sync(&pmlmepriv->scan_to_timer); spin_lock_bh(&pmlmepriv->lock); rtw_set_signal_stat_timer(&adapter->recvpriv); @@ -1017,7 +1012,6 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) { - u8 timer_cancelled; struct sta_info *ptarget_sta = NULL, *pcur_sta = NULL; struct sta_priv *pstapriv = &adapter->stapriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; @@ -1092,8 +1086,8 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) rtw_indicate_connect(adapter); } - /* s5. Cancle assoc_timer */ - _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled); + /* s5. Cancel assoc_timer */ + del_timer_sync(&pmlmepriv->assoc_timer); } else { spin_unlock_bh(&pmlmepriv->scanned_queue.lock); goto ignore_joinbss_callback; diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c index 7b30b9b64b41..50b4fca869a7 100644 --- a/drivers/staging/r8188eu/core/rtw_p2p.c +++ b/drivers/staging/r8188eu/core/rtw_p2p.c @@ -1380,9 +1380,7 @@ u8 process_p2p_group_negotation_confirm(struct wifidirect_info *pwdinfo, u8 *pfr result = attr_content; if (attr_content == P2P_STATUS_SUCCESS) { - u8 bcancelled = 0; - - _cancel_timer(&pwdinfo->restore_p2p_state_timer, &bcancelled); + del_timer_sync(&pwdinfo->restore_p2p_state_timer); /* Commented by Albert 20100911 */ /* Todo: Need to handle the case which both Intents are the same. */ diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index 8ca9f86e3c9b..754691cb2b12 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -59,12 +59,6 @@ static inline void _set_timer(struct timer_list *ptimer,u32 delay_time) mod_timer(ptimer , (jiffies+(delay_time*HZ/1000))); } -static inline void _cancel_timer(struct timer_list *ptimer,u8 *bcancelled) -{ - del_timer_sync(ptimer); - *bcancelled= true;/* true ==1; false==0 */ -} - static inline int rtw_netif_queue_stopped(struct net_device *pnetdev) { return netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) && -- cgit From ac76abcbf1072a5d77f3274799933b25865ae985 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:32 +0100 Subject: staging: r8188eu: call msecs_to_jiffies in _set_timer The _set_timer wrapper function takes a timeout in milliseconds. Call msecs_to_jiffies to convert the timeout to jiffies. Don't do the calculation ourselves. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220115165536.231210-8-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/osdep_service.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index 754691cb2b12..e52e78b2c6b0 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -56,7 +56,7 @@ static inline struct list_head *get_list_head(struct __queue *queue) static inline void _set_timer(struct timer_list *ptimer,u32 delay_time) { - mod_timer(ptimer , (jiffies+(delay_time*HZ/1000))); + mod_timer(ptimer, jiffies + msecs_to_jiffies(delay_time)); } static inline int rtw_netif_queue_stopped(struct net_device *pnetdev) -- cgit From c3e236c8dcf9f01c71ccca026ee03da17c303545 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:33 +0100 Subject: staging: r8188eu: remove rtw_netif_wake_queue wrapper Remove the rtw_netif_wake_queue wrapper function. Call netif_tx_wake_all_queues directly. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220115165536.231210-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/osdep_service.h | 5 ----- drivers/staging/r8188eu/os_dep/os_intfs.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index e52e78b2c6b0..b8f983a1254e 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -67,11 +67,6 @@ static inline int rtw_netif_queue_stopped(struct net_device *pnetdev) netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3)); } -static inline void rtw_netif_wake_queue(struct net_device *pnetdev) -{ - netif_tx_wake_all_queues(pnetdev); -} - static inline void rtw_netif_start_queue(struct net_device *pnetdev) { netif_tx_start_all_queues(pnetdev); diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c index 08d719822062..2e4ad090c77c 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -656,7 +656,7 @@ int _netdev_open(struct net_device *pnetdev) if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_start_queue(pnetdev); else - rtw_netif_wake_queue(pnetdev); + netif_tx_wake_all_queues(pnetdev); netdev_br_init(pnetdev); -- cgit From 19f48a3c670c3a797510fb5b9d514cb8f03c8128 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:34 +0100 Subject: staging: r8188eu: remove rtw_netif_start_queue wrapper Remove the rtw_netif_start_queue wrapper function. Call netif_tx_start_all_queues directly. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220115165536.231210-10-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/osdep_service.h | 5 ----- drivers/staging/r8188eu/os_dep/os_intfs.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index b8f983a1254e..51a22ffe41e2 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -67,11 +67,6 @@ static inline int rtw_netif_queue_stopped(struct net_device *pnetdev) netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3)); } -static inline void rtw_netif_start_queue(struct net_device *pnetdev) -{ - netif_tx_start_all_queues(pnetdev); -} - static inline void rtw_netif_stop_queue(struct net_device *pnetdev) { netif_tx_stop_all_queues(pnetdev); diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c index 2e4ad090c77c..96b49cee3ac4 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -654,7 +654,7 @@ int _netdev_open(struct net_device *pnetdev) rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); if (!rtw_netif_queue_stopped(pnetdev)) - rtw_netif_start_queue(pnetdev); + netif_tx_start_all_queues(pnetdev); else netif_tx_wake_all_queues(pnetdev); -- cgit From 37ba1eba8301aee5e930a0e2f4c38bc23d56014f Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:35 +0100 Subject: staging: r8188eu: remove rtw_netif_stop_queue wrapper Remove the rtw_netif_stop_queue wrapper function. Call netif_tx_stop_all_queues directly. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220115165536.231210-11-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/osdep_service.h | 5 ----- drivers/staging/r8188eu/os_dep/os_intfs.c | 4 ++-- drivers/staging/r8188eu/os_dep/usb_intf.c | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index 51a22ffe41e2..fca8f3d116c2 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -67,11 +67,6 @@ static inline int rtw_netif_queue_stopped(struct net_device *pnetdev) netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3)); } -static inline void rtw_netif_stop_queue(struct net_device *pnetdev) -{ - netif_tx_stop_all_queues(pnetdev); -} - extern int RTW_STATUS_CODE(int error_code); void *rtw_malloc2d(int h, int w, int size); diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c index 96b49cee3ac4..ef4ba0f22c09 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -667,7 +667,7 @@ netdev_open_normal_process: netdev_open_error: padapter->bup = false; netif_carrier_off(pnetdev); - rtw_netif_stop_queue(pnetdev); + netif_tx_stop_all_queues(pnetdev); DBG_88E("-88eu_drv - drv_open fail, bup =%d\n", padapter->bup); return -1; } @@ -769,7 +769,7 @@ int netdev_close(struct net_device *pnetdev) /* s1. */ if (pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) - rtw_netif_stop_queue(pnetdev); + netif_tx_stop_all_queues(pnetdev); } /* s2. */ diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c index 91792dfd3bbe..1b1b8bb165ba 100644 --- a/drivers/staging/r8188eu/os_dep/usb_intf.c +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c @@ -236,7 +236,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) /* s1. */ if (pnetdev) { netif_carrier_off(pnetdev); - rtw_netif_stop_queue(pnetdev); + netif_tx_stop_all_queues(pnetdev); } /* s2. */ -- cgit From f9e97a150078aff563c4221658afebb3a3e584e7 Mon Sep 17 00:00:00 2001 From: Marcelo Aloisio da Silva Date: Wed, 19 Jan 2022 00:49:33 -0300 Subject: staging: r8188eu: remove unnecessary braces in rtw_xmit.c Remove unnecessary braces reported by checkpatch.pl in rtw_xmit.c. Signed-off-by: Marcelo Aloisio da Silva Link: https://lore.kernel.org/r/20220119034933.GA29744@snoopy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_xmit.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index 334644e46000..f3e788e42b18 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -133,9 +133,8 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) if (res == _FAIL) { msleep(10); res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ)); - if (res == _FAIL) { + if (res == _FAIL) goto exit; - } } pxmitbuf->flags = XMIT_VO_QUEUE; @@ -710,15 +709,12 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr struct sta_info *psta; - if (pattrib->psta) { + if (pattrib->psta) psta = pattrib->psta; - } else { - if (is_multicast_ether_addr(pattrib->ra)) { - psta = rtw_get_bcmc_stainfo(padapter); - } else { - psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); - } - } + else if (is_multicast_ether_addr(pattrib->ra)) + psta = rtw_get_bcmc_stainfo(padapter); + else + psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); memset(hdr, 0, WLANHDR_OFFSET); @@ -1470,11 +1466,10 @@ s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe) struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits; int res = _SUCCESS; - if (pattrib->psta) { + if (pattrib->psta) psta = pattrib->psta; - } else { + else psta = rtw_get_stainfo(pstapriv, pattrib->ra); - } if (!psta) { res = _FAIL; -- cgit From f2d8871d00c07c6df3bbbb304e966fb8834819e8 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 22 Jan 2022 18:05:44 +0100 Subject: staging: r8188eu: EntryMaxUndecoratedSmoothedPWDB is set but not used The variable EntryMaxUndecoratedSmoothedPWDB in struct dm_priv is set but not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220122170547.68378-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm.c | 5 ----- drivers/staging/r8188eu/include/rtl8188e_dm.h | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index 8156e4acaa09..7de0f458d788 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -494,11 +494,6 @@ static void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm) } } - if (tmpEntryMaxPWDB != 0) /* If associated entry is found */ - pdmpriv->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; - else - pdmpriv->EntryMaxUndecoratedSmoothedPWDB = 0; - if (tmpEntryMinPWDB != 0xff) /* If associated entry is found */ pdmpriv->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; else diff --git a/drivers/staging/r8188eu/include/rtl8188e_dm.h b/drivers/staging/r8188eu/include/rtl8188e_dm.h index 0b3a9a1a4e5c..d62cdfc2db20 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_dm.h +++ b/drivers/staging/r8188eu/include/rtl8188e_dm.h @@ -12,9 +12,8 @@ enum{ struct dm_priv { u32 InitODMFlag; - /* Upper and Lower Signal threshold for Rate Adaptive*/ + /* Lower Signal threshold for Rate Adaptive */ int EntryMinUndecoratedSmoothedPWDB; - int EntryMaxUndecoratedSmoothedPWDB; int MinUndecoratedPWDBForDM; }; -- cgit From 706125892924718f43ac90fcaa2118cce86e1318 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 22 Jan 2022 18:05:45 +0100 Subject: staging: r8188eu: ODM_RF_TX_PWR_TRACK is always set The ODM_RF_TX_PWR_TRACK flag is set in Init_ODM_ComInfo_88E directly after the driver is probed and it's never cleared. Remove the flag and the one place where it's checked. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220122170547.68378-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm.c | 3 --- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 7 ++----- drivers/staging/r8188eu/include/odm.h | 1 - 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index 7de0f458d788..9b4b75c225a7 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -898,9 +898,6 @@ void ODM_TXPowerTrackingCheck(struct odm_dm_struct *pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; - if (!(pDM_Odm->SupportAbility & ODM_RF_TX_PWR_TRACK)) - return; - if (!pDM_Odm->RFCalibrateInfo.TM_Trigger) { /* at least delay 1 sec */ rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, BIT(17) | BIT(16), 0x03); diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c index adf87c1721ee..2f7294f0486d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -37,8 +37,7 @@ static void Init_ODM_ComInfo_88E(struct adapter *Adapter) ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_RF_ANTENNA_TYPE, hal_data->TRxAntDivType); - pdmpriv->InitODMFlag = ODM_RF_CALIBRATION | - ODM_RF_TX_PWR_TRACK; + pdmpriv->InitODMFlag = ODM_RF_CALIBRATION; ODM_CmnInfoUpdate(dm_odm, ODM_CMNINFO_ABILITY, pdmpriv->InitODMFlag); } @@ -53,9 +52,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) struct dm_priv *pdmpriv = &hal_data->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_BB_RSSI_MONITOR | - ODM_RF_CALIBRATION | - ODM_RF_TX_PWR_TRACK; + pdmpriv->InitODMFlag = ODM_BB_RSSI_MONITOR | ODM_RF_CALIBRATION; if (hal_data->AntDivCfg) pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV; diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 50960e7daf1d..ed6f724841d3 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -153,7 +153,6 @@ enum odm_ability_def { ODM_BB_PWR_TRA = BIT(8), /* RF ODM section BIT 24-31 */ - ODM_RF_TX_PWR_TRACK = BIT(24), ODM_RF_CALIBRATION = BIT(26), }; -- cgit From 4f37285e0a93dc2f9b7181158c9884ea41a09ace Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 22 Jan 2022 18:05:46 +0100 Subject: staging: r8188eu: ODM_RF_CALIBRATION is always set The ODM_RF_CALIBRATION flag is set in Init_ODM_ComInfo_88E directly after the driver is probed and it's never cleared. Remove the flag and the code where it's set or checked. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220122170547.68378-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 5 ----- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 7 +------ drivers/staging/r8188eu/include/odm.h | 3 --- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 21ecc90a558c..5f7a2668cabb 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -893,9 +893,6 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery) rOFDM0_XCTxAFE, rOFDM0_XDTxAFE, rOFDM0_RxIQExtAnta}; - if (!(dm_odm->SupportAbility & ODM_RF_CALIBRATION)) - return; - /* 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) */ if (singletone || carrier_sup) return; @@ -993,8 +990,6 @@ void PHY_LCCalibrate_8188E(struct adapter *adapt) struct hal_data_8188e *pHalData = &adapt->haldata; struct odm_dm_struct *dm_odm = &pHalData->odmpriv; - if (!(dm_odm->SupportAbility & ODM_RF_CALIBRATION)) - return; /* 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) */ if (singletone || carrier_sup) return; diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c index 2f7294f0486d..558aa85f1a9f 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -25,7 +25,6 @@ static void dm_InitGPIOSetting(struct adapter *Adapter) static void Init_ODM_ComInfo_88E(struct adapter *Adapter) { struct hal_data_8188e *hal_data = &Adapter->haldata; - struct dm_priv *pdmpriv = &hal_data->dmpriv; struct odm_dm_struct *dm_odm = &hal_data->odmpriv; /* Init Value */ @@ -36,10 +35,6 @@ static void Init_ODM_ComInfo_88E(struct adapter *Adapter) ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_MP_TEST_CHIP, IS_NORMAL_CHIP(hal_data->VersionID)); ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_RF_ANTENNA_TYPE, hal_data->TRxAntDivType); - - pdmpriv->InitODMFlag = ODM_RF_CALIBRATION; - - ODM_CmnInfoUpdate(dm_odm, ODM_CMNINFO_ABILITY, pdmpriv->InitODMFlag); } static void Update_ODM_ComInfo_88E(struct adapter *Adapter) @@ -52,7 +47,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) struct dm_priv *pdmpriv = &hal_data->dmpriv; int i; - pdmpriv->InitODMFlag = ODM_BB_RSSI_MONITOR | ODM_RF_CALIBRATION; + pdmpriv->InitODMFlag = ODM_BB_RSSI_MONITOR; if (hal_data->AntDivCfg) pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV; diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index ed6f724841d3..63e0b6725bee 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -151,9 +151,6 @@ enum odm_ability_def { ODM_BB_RSSI_MONITOR = BIT(4), ODM_BB_ANT_DIV = BIT(6), ODM_BB_PWR_TRA = BIT(8), - - /* RF ODM section BIT 24-31 */ - ODM_RF_CALIBRATION = BIT(26), }; # define ODM_ITRF_USB 0x2 -- cgit From f0fbfdf6b0ef42f989f7dcbe912d2ce3798c494b Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 22 Jan 2022 18:05:47 +0100 Subject: staging: r8188eu: merge Init_ODM_ComInfo_88E and rtl8188e_init_dm_priv rtl8188e_init_dm_priv is the only caller of Init_ODM_ComInfo_88E. Merge the two functions. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220122170547.68378-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c index 558aa85f1a9f..a05d8687c18d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -22,21 +22,6 @@ static void dm_InitGPIOSetting(struct adapter *Adapter) /* */ /* functions */ /* */ -static void Init_ODM_ComInfo_88E(struct adapter *Adapter) -{ - struct hal_data_8188e *hal_data = &Adapter->haldata; - struct odm_dm_struct *dm_odm = &hal_data->odmpriv; - - /* Init Value */ - memset(dm_odm, 0, sizeof(*dm_odm)); - - dm_odm->Adapter = Adapter; - - ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_MP_TEST_CHIP, IS_NORMAL_CHIP(hal_data->VersionID)); - - ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_RF_ANTENNA_TYPE, hal_data->TRxAntDivType); -} - static void Update_ODM_ComInfo_88E(struct adapter *Adapter) { struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; @@ -102,9 +87,14 @@ void rtl8188e_init_dm_priv(struct adapter *Adapter) { struct hal_data_8188e *hal_data = &Adapter->haldata; struct dm_priv *pdmpriv = &hal_data->dmpriv; + struct odm_dm_struct *dm_odm = &hal_data->odmpriv; memset(pdmpriv, 0, sizeof(struct dm_priv)); - Init_ODM_ComInfo_88E(Adapter); + memset(dm_odm, 0, sizeof(*dm_odm)); + + dm_odm->Adapter = Adapter; + ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_MP_TEST_CHIP, IS_NORMAL_CHIP(hal_data->VersionID)); + ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_RF_ANTENNA_TYPE, hal_data->TRxAntDivType); } /* Add new function to reset the state of antenna diversity before link. */ -- cgit From 6cc2d1a6536788f6334217440a2956c7e73f87f6 Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Sun, 9 Jan 2022 10:27:28 +1300 Subject: staging: pi433: move get version func to where all other functions are As a convention for the pi433 driver, all routines that deals with the rf69 chip are defined in the rf69.c file. There was an exception to the rule in which the uC version verification was being done directly elsewhere. While at it, the Version Register hardcoded value was replaced with a pre-existing constant in the driver. This patch adds rf69_get_version function to rf69.c Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/20220108212728.GA7784@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/pi433_if.c | 4 ++-- drivers/staging/pi433/rf69.c | 5 +++++ drivers/staging/pi433/rf69.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 68c09fa016ed..051c9052aeeb 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -1115,8 +1115,8 @@ static int pi433_probe(struct spi_device *spi) "spi interface setup: mode 0x%2x, %d bits per word, %dhz max speed", spi->mode, spi->bits_per_word, spi->max_speed_hz); - /* Ping the chip by reading the version register */ - retval = spi_w8r8(spi, 0x10); + /* read chip version */ + retval = rf69_get_version(spi); if (retval < 0) return retval; diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index d64df072d8e8..ee8c81d164e1 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -102,6 +102,11 @@ static inline int rf69_read_mod_write(struct spi_device *spi, u8 reg, /*-------------------------------------------------------------------------*/ +int rf69_get_version(struct spi_device *spi) +{ + return rf69_read_reg(spi, REG_VERSION); +} + int rf69_set_mode(struct spi_device *spi, enum mode mode) { static const u8 mode_map[] = { diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h index b648ba5fff89..c25942f142a6 100644 --- a/drivers/staging/pi433/rf69.h +++ b/drivers/staging/pi433/rf69.h @@ -17,6 +17,7 @@ #define FIFO_SIZE 66 /* bytes */ #define FIFO_THRESHOLD 15 /* bytes */ +int rf69_get_version(struct spi_device *spi); int rf69_set_mode(struct spi_device *spi, enum mode mode); int rf69_set_data_mode(struct spi_device *spi, u8 data_mode); int rf69_set_modulation(struct spi_device *spi, enum modulation modulation); -- cgit From 055a2e2ca6d601a21dc95d435d9ea9bf9280921a Mon Sep 17 00:00:00 2001 From: Vihas Mak Date: Sun, 23 Jan 2022 23:47:35 +0530 Subject: staging: r8188eu: handle rtw_init_netdev_name() failure appropriately rtw_init_netdev_name() calls dev_alloc_name() which allocates the name for the device as per the given name format. The name format is specified by the module parameter "ifname". It returns a negative err code if the format is invalid. Handle this error appropriately. Cancel the timers ininitliazed by rtw_init_drv_sw() before calling rtw_free_drv_sw() and then proceed to free the adapter. Also, if register_netdev() fails then goto free_drv_sw instead of goto handle_dualmac. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Mak Link: https://lore.kernel.org/r/20220123181734.10402-1-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/usb_intf.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c index 1b1b8bb165ba..1a67486ff5fb 100644 --- a/drivers/staging/r8188eu/os_dep/usb_intf.c +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c @@ -399,7 +399,11 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, DBG_88E("can't get autopm:\n"); /* alloc dev name after read efuse. */ - rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname); + if (rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname) < 0) { + DBG_88E("rtw_init_netdev_name failed, ifname:%s\n", + padapter->registrypriv.ifname); + goto free_drv_sw; + } rtw_macaddr_cfg(padapter->eeprompriv.mac_addr); rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr, padapter->eeprompriv.mac_addr); @@ -409,7 +413,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, /* step 6. Tell the network stack we exist */ if (register_netdev(pnetdev) != 0) - goto handle_dualmac; + goto free_drv_sw; DBG_88E("bDriverStopped:%d, bSurpriseRemoved:%d, bup:%d, hw_init_completed:%d\n" , padapter->bDriverStopped @@ -420,6 +424,11 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, status = _SUCCESS; +free_drv_sw: + if (status != _SUCCESS) { + rtw_cancel_all_timer(padapter); + rtw_free_drv_sw(padapter); + } handle_dualmac: if (status != _SUCCESS) rtw_handle_dualmac(padapter, 0); -- cgit From a1f39746256c5b301d155cfa90000c91ef00433a Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:06 +0100 Subject: staging: vchiq_core: fix indentation in vchiq_log_dump_mem This align the indentation in the var declaration of vchiq_log_dump_mem to the other code. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-2-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 7fe20d4b7ba2..2cbbbb6e1d83 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3666,10 +3666,10 @@ enum vchiq_status vchiq_send_remote_use_active(struct vchiq_state *state) void vchiq_log_dump_mem(const char *label, u32 addr, const void *void_mem, size_t num_bytes) { - const u8 *mem = void_mem; - size_t offset; - char line_buf[100]; - char *s; + const u8 *mem = void_mem; + size_t offset; + char line_buf[100]; + char *s; while (num_bytes > 0) { s = line_buf; -- cgit From e1a17ce82f1808182338707be5aa5eda6a6144f3 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:07 +0100 Subject: staging: vchiq_debugfs: get the rid of n_log_entries There is no need for this static variable, so use the macro directly. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-3-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c index 8f3d9cb2d562..dc667afd1f8c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c @@ -36,8 +36,6 @@ static struct vchiq_debugfs_log_entry vchiq_debugfs_log_entries[] = { { "arm", &vchiq_arm_log_level }, }; -static int n_log_entries = ARRAY_SIZE(vchiq_debugfs_log_entries); - static int debugfs_log_show(struct seq_file *f, void *offset) { int *levp = f->private; @@ -216,7 +214,7 @@ void vchiq_debugfs_init(void) /* create an entry under /vchiq/log for each log category */ dir = debugfs_create_dir("log", vchiq_dbg_dir); - for (i = 0; i < n_log_entries; i++) + for (i = 0; i < ARRAY_SIZE(vchiq_debugfs_log_entries); i++) debugfs_create_file(vchiq_debugfs_log_entries[i].name, 0644, dir, vchiq_debugfs_log_entries[i].plevel, &debugfs_log_fops); -- cgit From 9c78a73a5fd3aff694ddcaeefdae4ec78a3573be Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:08 +0100 Subject: staging: vchiq_arm: introduce is_adjacent_block The check for an adjacent block is hard to read. So move it into a separate inline function. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-4-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 6759a6261500..974804447935 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -189,6 +189,20 @@ cleanup_pagelistinfo(struct vchiq_pagelist_info *pagelistinfo) pagelistinfo->pagelist, pagelistinfo->dma_addr); } +static inline bool +is_adjacent_block(u32 *addrs, u32 addr, unsigned int k) +{ + u32 tmp; + + if (!k) + return false; + + tmp = (addrs[k - 1] & PAGE_MASK) + + (((addrs[k - 1] & ~PAGE_MASK) + 1) << PAGE_SHIFT); + + return tmp == (addr & PAGE_MASK); +} + /* There is a potential problem with partial cache lines (pages?) * at the ends of the block when reading. If the CPU accessed anything in * the same line (page?) then it may have pulled old data into the cache, @@ -349,10 +363,7 @@ create_pagelist(char *buf, char __user *ubuf, WARN_ON(len == 0); WARN_ON(i && (i != (dma_buffers - 1)) && (len & ~PAGE_MASK)); WARN_ON(i && (addr & ~PAGE_MASK)); - if (k > 0 && - ((addrs[k - 1] & PAGE_MASK) + - (((addrs[k - 1] & ~PAGE_MASK) + 1) << PAGE_SHIFT)) - == (addr & PAGE_MASK)) + if (is_adjacent_block(addrs, addr, k)) addrs[k - 1] += ((len + PAGE_SIZE - 1) >> PAGE_SHIFT); else addrs[k++] = (addr & PAGE_MASK) | -- cgit From 3e68ebd02a87568c0f047eaa712556d6290677fc Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:09 +0100 Subject: staging: vchiq: convert TODOs into unordered list Keeping the order of the TODO items is hard and also unnecessary. So convert it to an unordered list. Suggested-by: Greg Kroah-Hartman Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-5-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/TODO | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/vc04_services/interface/TODO b/drivers/staging/vc04_services/interface/TODO index 241ca004735c..2e4ec5856118 100644 --- a/drivers/staging/vc04_services/interface/TODO +++ b/drivers/staging/vc04_services/interface/TODO @@ -1,4 +1,4 @@ -1) Import drivers using VCHI. +* Import drivers using VCHI. VCHI is just a tool to let drivers talk to the firmware. Here are some of the ones we want: @@ -16,7 +16,7 @@ some of the ones we want: to manage these buffers as dmabufs so that we can zero-copy import camera images into vc4 for rendering/display. -2) Garbage-collect unused code +* Garbage-collect unused code One of the reasons this driver wasn't upstreamed previously was that there's a lot code that got built that's probably unnecessary these @@ -24,7 +24,7 @@ days. Once we have the set of VCHI-using drivers we want in tree, we should be able to do a sweep of the code to see what's left that's unused. -3) Make driver more portable +* Make driver more portable Building this driver with arm/multi_v7_defconfig or arm64/defconfig leads to data corruption during the following command: @@ -33,42 +33,42 @@ leads to data corruption during the following command: This should be fixed. -4) Fix kernel module support +* Fix kernel module support Even the VPU firmware doesn't support a VCHI re-connect, the driver should properly handle a module unload. This also includes that all resources must be freed (kthreads, debugfs entries, ...) and global variables avoided. -5) Cleanup logging mechanism +* Cleanup logging mechanism The driver should probably be using the standard kernel logging mechanisms such as dev_info, dev_dbg, and friends. -6) Documentation +* Documentation A short top-down description of this driver's architecture (function of kthreads, userspace, limitations) could be very helpful for reviewers. -7) Review and comment memory barriers +* Review and comment memory barriers There is a heavy use of memory barriers in this driver, it would be very beneficial to go over all of them and, if correct, comment on their merits. Extra points to whomever confidently reviews the remote_event_*() family of functions. -8) Get rid of custom function return values +* Get rid of custom function return values Most functions use a custom set of return values, we should force proper Linux error numbers. Special care is needed for VCHIQ_RETRY. -9) Reformat core code with more sane indentations +* Reformat core code with more sane indentations The code follows the 80 characters limitation yet tends to go 3 or 4 levels of indentation deep making it very unpleasant to read. This is specially relevant in the character driver ioctl code and in the core thread functions. -10) Reorganize file structure: Move char driver to it's own file and join both +* Reorganize file structure: Move char driver to it's own file and join both platform files The cdev is defined alongside with the platform code in vchiq_arm.c. It would @@ -80,7 +80,7 @@ vchiq-core.ko and vchiq-dev.ko. This would also ease the upstreaming process. The code in vchiq_bcm2835_arm.c should fit in the generic platform file. -11) Get rid of all non essential global structures and create a proper per +* Get rid of all non essential global structures and create a proper per device structure The first thing one generally sees in a probe function is a memory allocation @@ -88,6 +88,6 @@ for all the device specific data. This structure is then passed all over the driver. This is good practice since it makes the driver work regardless of the number of devices probed. -12) Clean up Sparse warnings from __user annotations. See +* Clean up Sparse warnings from __user annotations. See vchiq_irq_queue_bulk_tx_rx(). Ensure that the address of "&waiter->bulk_waiter" is never disclosed to userspace. -- cgit From fcaaed7ca3808c6bef9c334d397f1deda1b8d145 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:10 +0100 Subject: staging: vchiq: drop completed tasks from TODO This removes all already completed tasks from the TODO file. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-6-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/TODO | 29 ---------------------------- 1 file changed, 29 deletions(-) diff --git a/drivers/staging/vc04_services/interface/TODO b/drivers/staging/vc04_services/interface/TODO index 2e4ec5856118..e2d44a4f5f2d 100644 --- a/drivers/staging/vc04_services/interface/TODO +++ b/drivers/staging/vc04_services/interface/TODO @@ -16,23 +16,6 @@ some of the ones we want: to manage these buffers as dmabufs so that we can zero-copy import camera images into vc4 for rendering/display. -* Garbage-collect unused code - -One of the reasons this driver wasn't upstreamed previously was that -there's a lot code that got built that's probably unnecessary these -days. Once we have the set of VCHI-using drivers we want in tree, we -should be able to do a sweep of the code to see what's left that's -unused. - -* Make driver more portable - -Building this driver with arm/multi_v7_defconfig or arm64/defconfig -leads to data corruption during the following command: - - vchiq_test -f 1 - -This should be fixed. - * Fix kernel module support Even the VPU firmware doesn't support a VCHI re-connect, the driver @@ -68,18 +51,6 @@ The code follows the 80 characters limitation yet tends to go 3 or 4 levels of indentation deep making it very unpleasant to read. This is specially relevant in the character driver ioctl code and in the core thread functions. -* Reorganize file structure: Move char driver to it's own file and join both -platform files - -The cdev is defined alongside with the platform code in vchiq_arm.c. It would -be nice to completely decouple it from the actual core code. For instance to be -able to use bcm2835-audio without having /dev/vchiq created. One could argue -it's better for security reasons or general cleanliness. It could even be -interesting to create two different kernel modules, something the likes of -vchiq-core.ko and vchiq-dev.ko. This would also ease the upstreaming process. - -The code in vchiq_bcm2835_arm.c should fit in the generic platform file. - * Get rid of all non essential global structures and create a proper per device structure -- cgit From fd0be0f9aeca8af58db3e69e0c32b0ec4ac33872 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:11 +0100 Subject: staging: vchiq: add message handling to TODO list Recently Arnd Bergmann noticed that the message handling looks broken to him. So add this point on the TODO list. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-7-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/TODO | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/staging/vc04_services/interface/TODO b/drivers/staging/vc04_services/interface/TODO index e2d44a4f5f2d..97085a0b3223 100644 --- a/drivers/staging/vc04_services/interface/TODO +++ b/drivers/staging/vc04_services/interface/TODO @@ -62,3 +62,12 @@ number of devices probed. * Clean up Sparse warnings from __user annotations. See vchiq_irq_queue_bulk_tx_rx(). Ensure that the address of "&waiter->bulk_waiter" is never disclosed to userspace. + +* Fix behavior of message handling + +The polling behavior of vchiq_bulk_transmit(), vchiq_bulk_receive() and +vchiq_queue_kernel_message() looks broken. A possible signal should be +propagated back to user space to let the calling task handle it before +retrying. Hopefully these msleep(1) shouldn't be necessary anymore. + +https://lore.kernel.org/linux-staging/CAK8P3a3HGm1cPo4sW9fOY4E8AN8yAq3tevXxU5m8bmtmsU8WKw@mail.gmail.com/ -- cgit From e831b6955138e0969b2a56e57f920e896eee86ee Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:12 +0100 Subject: staging: vchiq_core: fix type of parameter localport The whole vchiq driver uses unsigned int for "localport" except of find_service_by_port(). So fix this and get the rid of this suspicous cast. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-8-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 +++--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 2cbbbb6e1d83..6fa9fee870d8 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -255,9 +255,9 @@ find_service_by_handle(unsigned int handle) } struct vchiq_service * -find_service_by_port(struct vchiq_state *state, int localport) +find_service_by_port(struct vchiq_state *state, unsigned int localport) { - if ((unsigned int)localport <= VCHIQ_PORT_MAX) { + if (localport <= VCHIQ_PORT_MAX) { struct vchiq_service *service; rcu_read_lock(); @@ -271,7 +271,7 @@ find_service_by_port(struct vchiq_state *state, int localport) rcu_read_unlock(); } vchiq_log_info(vchiq_core_log_level, - "Invalid port %d", localport); + "Invalid port %u", localport); return NULL; } diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index 55abaf02a196..82b7bd7b54b2 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -524,7 +524,7 @@ extern struct vchiq_service * find_service_by_handle(unsigned int handle); extern struct vchiq_service * -find_service_by_port(struct vchiq_state *state, int localport); +find_service_by_port(struct vchiq_state *state, unsigned int localport); extern struct vchiq_service * find_service_for_instance(struct vchiq_instance *instance, unsigned int handle); -- cgit From 7a30a227c51472746defb60a5c1f2ba2aea8e806 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:13 +0100 Subject: staging: vchiq_core: simplify vchiq_add_service_internal Better use kzalloc to properly init vchiq_service with zero. As a result this saves us all the zero assignments. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-9-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 23 +--------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 6fa9fee870d8..a13a0768d28c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2097,16 +2097,6 @@ sync_func(void *v) return 0; } -static void -init_bulk_queue(struct vchiq_bulk_queue *queue) -{ - queue->local_insert = 0; - queue->remote_insert = 0; - queue->process = 0; - queue->remote_notify = 0; - queue->remove = 0; -} - inline const char * get_conn_state_name(enum vchiq_connstate conn_state) { @@ -2371,7 +2361,7 @@ vchiq_add_service_internal(struct vchiq_state *state, if (ret) return NULL; - service = kmalloc(sizeof(*service), GFP_KERNEL); + service = kzalloc(sizeof(*service), GFP_KERNEL); if (!service) return service; @@ -2387,28 +2377,17 @@ vchiq_add_service_internal(struct vchiq_state *state, service->public_fourcc = (srvstate == VCHIQ_SRVSTATE_OPENING) ? VCHIQ_FOURCC_INVALID : params->fourcc; - service->client_id = 0; service->auto_close = 1; - service->sync = 0; - service->closing = 0; - service->trace = 0; atomic_set(&service->poll_flags, 0); service->version = params->version; service->version_min = params->version_min; service->state = state; service->instance = instance; - service->service_use_count = 0; - service->msg_queue_read = 0; - service->msg_queue_write = 0; - init_bulk_queue(&service->bulk_tx); - init_bulk_queue(&service->bulk_rx); init_completion(&service->remove_event); init_completion(&service->bulk_remove_event); init_completion(&service->msg_queue_pop); init_completion(&service->msg_queue_push); mutex_init(&service->bulk_mutex); - memset(&service->stats, 0, sizeof(service->stats)); - memset(&service->msg_queue, 0, sizeof(service->msg_queue)); /* * Although it is perfectly possible to use a spinlock -- cgit From 05f8950fc9c7decb7bf7a160af14eba7ad1a296a Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:14 +0100 Subject: staging: vchiq_core: align return statements in msg_type_str The return statements aren't properly aligned. So fix this by using tabs. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-10-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index a13a0768d28c..e500cef348d6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -205,21 +205,21 @@ release_message_sync(struct vchiq_state *state, struct vchiq_header *header); static const char *msg_type_str(unsigned int msg_type) { switch (msg_type) { - case VCHIQ_MSG_PADDING: return "PADDING"; - case VCHIQ_MSG_CONNECT: return "CONNECT"; - case VCHIQ_MSG_OPEN: return "OPEN"; - case VCHIQ_MSG_OPENACK: return "OPENACK"; - case VCHIQ_MSG_CLOSE: return "CLOSE"; - case VCHIQ_MSG_DATA: return "DATA"; - case VCHIQ_MSG_BULK_RX: return "BULK_RX"; - case VCHIQ_MSG_BULK_TX: return "BULK_TX"; - case VCHIQ_MSG_BULK_RX_DONE: return "BULK_RX_DONE"; - case VCHIQ_MSG_BULK_TX_DONE: return "BULK_TX_DONE"; - case VCHIQ_MSG_PAUSE: return "PAUSE"; - case VCHIQ_MSG_RESUME: return "RESUME"; - case VCHIQ_MSG_REMOTE_USE: return "REMOTE_USE"; - case VCHIQ_MSG_REMOTE_RELEASE: return "REMOTE_RELEASE"; - case VCHIQ_MSG_REMOTE_USE_ACTIVE: return "REMOTE_USE_ACTIVE"; + case VCHIQ_MSG_PADDING: return "PADDING"; + case VCHIQ_MSG_CONNECT: return "CONNECT"; + case VCHIQ_MSG_OPEN: return "OPEN"; + case VCHIQ_MSG_OPENACK: return "OPENACK"; + case VCHIQ_MSG_CLOSE: return "CLOSE"; + case VCHIQ_MSG_DATA: return "DATA"; + case VCHIQ_MSG_BULK_RX: return "BULK_RX"; + case VCHIQ_MSG_BULK_TX: return "BULK_TX"; + case VCHIQ_MSG_BULK_RX_DONE: return "BULK_RX_DONE"; + case VCHIQ_MSG_BULK_TX_DONE: return "BULK_TX_DONE"; + case VCHIQ_MSG_PAUSE: return "PAUSE"; + case VCHIQ_MSG_RESUME: return "RESUME"; + case VCHIQ_MSG_REMOTE_USE: return "REMOTE_USE"; + case VCHIQ_MSG_REMOTE_RELEASE: return "REMOTE_RELEASE"; + case VCHIQ_MSG_REMOTE_USE_ACTIVE: return "REMOTE_USE_ACTIVE"; } return "???"; } -- cgit From 69838a4e0c4a02608fd9604f78d59c81c4149c3b Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:15 +0100 Subject: staging: vchiq_core: drop prefix of vchiq_set_service_state The name of this static function is unnecessary longish. So drop the prefix. This gives us the chance to avoid some multi-line statements or fix some indentations later. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-11-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index e500cef348d6..d861857feb7b 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -225,7 +225,7 @@ static const char *msg_type_str(unsigned int msg_type) } static inline void -vchiq_set_service_state(struct vchiq_service *service, int newstate) +set_service_state(struct vchiq_service *service, int newstate) { vchiq_log_info(vchiq_core_log_level, "%d: srv:%d %s->%s", service->state->id, service->localport, @@ -1122,7 +1122,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, wmb(); if (service && (type == VCHIQ_MSG_CLOSE)) - vchiq_set_service_state(service, VCHIQ_SRVSTATE_CLOSESENT); + set_service_state(service, VCHIQ_SRVSTATE_CLOSESENT); if (!(flags & QMFLAGS_NO_MUTEX_UNLOCK)) mutex_unlock(&state->slot_mutex); @@ -1531,7 +1531,7 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header) } /* The service is now open */ - vchiq_set_service_state(service, service->sync ? VCHIQ_SRVSTATE_OPENSYNC + set_service_state(service, service->sync ? VCHIQ_SRVSTATE_OPENSYNC : VCHIQ_SRVSTATE_OPEN); } @@ -1666,7 +1666,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) service->peer_version); if (service->srvstate == VCHIQ_SRVSTATE_OPENING) { service->remoteport = remoteport; - vchiq_set_service_state(service, VCHIQ_SRVSTATE_OPEN); + set_service_state(service, VCHIQ_SRVSTATE_OPEN); complete(&service->remove_event); } else { vchiq_log_error(vchiq_core_log_level, "OPENACK received in state %s", @@ -2063,7 +2063,7 @@ sync_func(void *v) service->peer_version); if (service->srvstate == VCHIQ_SRVSTATE_OPENING) { service->remoteport = remoteport; - vchiq_set_service_state(service, VCHIQ_SRVSTATE_OPENSYNC); + set_service_state(service, VCHIQ_SRVSTATE_OPENSYNC); service->sync = 1; complete(&service->remove_event); } @@ -2465,7 +2465,7 @@ vchiq_add_service_internal(struct vchiq_state *state, - 1; /* Bring this service online */ - vchiq_set_service_state(service, srvstate); + set_service_state(service, srvstate); vchiq_log_info(vchiq_core_msg_log_level, "%s Service %c%c%c%c SrcPort:%d", (srvstate == VCHIQ_SRVSTATE_OPENING) ? "Open" : "Add", @@ -2621,7 +2621,7 @@ close_service_complete(struct vchiq_service *service, int failstate) } else { newstate = VCHIQ_SRVSTATE_CLOSED; } - vchiq_set_service_state(service, newstate); + set_service_state(service, newstate); break; case VCHIQ_SRVSTATE_LISTENING: break; @@ -2657,7 +2657,7 @@ close_service_complete(struct vchiq_service *service, int failstate) complete(&service->remove_event); } } else { - vchiq_set_service_state(service, failstate); + set_service_state(service, failstate); } return status; @@ -2692,7 +2692,7 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) service->remoteport = VCHIQ_PORT_FREE; if (service->srvstate == VCHIQ_SRVSTATE_CLOSEWAIT) - vchiq_set_service_state(service, VCHIQ_SRVSTATE_LISTENING); + set_service_state(service, VCHIQ_SRVSTATE_LISTENING); } complete(&service->remove_event); } else { @@ -2702,7 +2702,7 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) case VCHIQ_SRVSTATE_OPENING: if (close_recvd) { /* The open was rejected - tell the user */ - vchiq_set_service_state(service, VCHIQ_SRVSTATE_CLOSEWAIT); + set_service_state(service, VCHIQ_SRVSTATE_CLOSEWAIT); complete(&service->remove_event); } else { /* Shutdown mid-open - let the other side know */ @@ -2733,8 +2733,7 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) if (!close_recvd) { /* Change the state while the mutex is still held */ - vchiq_set_service_state(service, - VCHIQ_SRVSTATE_CLOSESENT); + set_service_state(service, VCHIQ_SRVSTATE_CLOSESENT); mutex_unlock(&state->slot_mutex); if (service->sync) mutex_unlock(&state->sync_mutex); @@ -2742,7 +2741,7 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) } /* Change the state while the mutex is still held */ - vchiq_set_service_state(service, VCHIQ_SRVSTATE_CLOSERECVD); + set_service_state(service, VCHIQ_SRVSTATE_CLOSERECVD); mutex_unlock(&state->slot_mutex); if (service->sync) mutex_unlock(&state->sync_mutex); @@ -2767,7 +2766,7 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) case VCHIQ_SRVSTATE_CLOSERECVD: if (!close_recvd && is_server) /* Force into LISTENING mode */ - vchiq_set_service_state(service, VCHIQ_SRVSTATE_LISTENING); + set_service_state(service, VCHIQ_SRVSTATE_LISTENING); status = close_service_complete(service, VCHIQ_SRVSTATE_CLOSERECVD); break; @@ -2816,7 +2815,7 @@ vchiq_free_service_internal(struct vchiq_service *service) return; } - vchiq_set_service_state(service, VCHIQ_SRVSTATE_FREE); + set_service_state(service, VCHIQ_SRVSTATE_FREE); complete(&service->remove_event); @@ -2834,7 +2833,7 @@ vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instanc i = 0; while ((service = next_service_by_instance(state, instance, &i)) != NULL) { if (service->srvstate == VCHIQ_SRVSTATE_HIDDEN) - vchiq_set_service_state(service, VCHIQ_SRVSTATE_LISTENING); + set_service_state(service, VCHIQ_SRVSTATE_LISTENING); vchiq_service_put(service); } -- cgit From 6885fc09b0f0fc7f9bb3ecd5a4a9ab23d6c4287b Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:16 +0100 Subject: staging: vchiq_core: reduce multi-line statements In order to improvement readability try to reduce the multi-line statements. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-12-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index d861857feb7b..fbc44e7ea000 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -872,9 +872,8 @@ copy_message_data(ssize_t (*copy_callback)(void *context, void *dest, size_t off ssize_t callback_result; size_t max_bytes = size - pos; - callback_result = - copy_callback(context, dest + pos, - pos, max_bytes); + callback_result = copy_callback(context, dest + pos, pos, + max_bytes); if (callback_result < 0) return callback_result; @@ -1028,8 +1027,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, if (callback_result < 0) { mutex_unlock(&state->slot_mutex); - VCHIQ_SERVICE_STATS_INC(service, - error_count); + VCHIQ_SERVICE_STATS_INC(service, error_count); return VCHIQ_ERROR; } @@ -1177,8 +1175,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service, if (callback_result < 0) { mutex_unlock(&state->slot_mutex); - VCHIQ_SERVICE_STATS_INC(service, - error_count); + VCHIQ_SERVICE_STATS_INC(service, error_count); return VCHIQ_ERROR; } -- cgit From d9bb2daa4f845aff675dafd8d8ce71a027581472 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:17 +0100 Subject: staging: vchiq_core: fix alignment This fixes some alignment found by checkpatch.pl. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-13-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index fbc44e7ea000..7e901be93a4e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2687,8 +2687,7 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) } else { service->client_id = 0; service->remoteport = VCHIQ_PORT_FREE; - if (service->srvstate == - VCHIQ_SRVSTATE_CLOSEWAIT) + if (service->srvstate == VCHIQ_SRVSTATE_CLOSEWAIT) set_service_state(service, VCHIQ_SRVSTATE_LISTENING); } complete(&service->remove_event); @@ -2893,7 +2892,7 @@ vchiq_close_service(unsigned int handle) status = vchiq_close_service_internal(service, NO_CLOSE_RECVD); WARN_ON(status == VCHIQ_RETRY); } else { - /* Mark the service for termination by the slot handler */ + /* Mark the service for termination by the slot handler */ request_poll(service->state, service, VCHIQ_POLL_TERMINATE); } -- cgit From 5b5a40986b9cd16a9475e4be7ec9cd3c8d5097a0 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:18 +0100 Subject: staging: vchiq_core: avoid ternary operator for set_service_state There is already a check for service->sync, so use this instead of a separate ternary operator to update the service state. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-14-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 7e901be93a4e..612724427b08 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1521,15 +1521,17 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header) if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback, &ack_payload, sizeof(ack_payload), 0) == VCHIQ_RETRY) goto bail_not_ready; + + /* The service is now open */ + set_service_state(service, VCHIQ_SRVSTATE_OPENSYNC); } else { if (queue_message(state, NULL, openack_id, memcpy_copy_callback, &ack_payload, sizeof(ack_payload), 0) == VCHIQ_RETRY) goto bail_not_ready; - } - /* The service is now open */ - set_service_state(service, service->sync ? VCHIQ_SRVSTATE_OPENSYNC - : VCHIQ_SRVSTATE_OPEN); + /* The service is now open */ + set_service_state(service, VCHIQ_SRVSTATE_OPEN); + } } /* Success - the message has been dealt with */ -- cgit From 96225b631cc9ce9e29040a84fd41a44d59849c0c Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:19 +0100 Subject: staging: vchiq_core: use min_t macro Don't try to open code min_t(). Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-15-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 612724427b08..b32cd12f1695 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1035,8 +1035,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, VCHIQ_LOG_INFO)) vchiq_log_dump_mem("Sent", 0, header->data, - min((size_t)16, - (size_t)callback_result)); + min_t(size_t, 16, callback_result)); spin_lock("a_spinlock); quota->message_use_count++; @@ -1184,8 +1183,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service, VCHIQ_LOG_INFO)) vchiq_log_dump_mem("Sent", 0, header->data, - min((size_t)16, - (size_t)callback_result)); + min_t(size_t, 16, callback_result)); VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); @@ -2209,8 +2207,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) state->default_slot_quota = state->slot_queue_available / 2; state->default_message_quota = - min((unsigned short)(state->default_slot_quota * 256), - (unsigned short)~0); + min_t(unsigned short, state->default_slot_quota * 256, ~0); state->previous_data_index = -1; state->data_use_count = 0; -- cgit From 914813cc523cf8b32ca8735cbf3243256e87a5a3 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:20 +0100 Subject: staging: vchiq_arm: make vchiq_get_state return early Make vchiq_get_state return early with NULL and improve the readability. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-16-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 974804447935..6ef8f19fe49a 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1285,14 +1285,18 @@ int vchiq_dump_platform_service_state(void *dump_context, struct vchiq_state * vchiq_get_state(void) { - if (!g_state.remote) + if (!g_state.remote) { pr_err("%s: g_state.remote == NULL\n", __func__); - else if (g_state.remote->initialised != 1) + return NULL; + } + + if (g_state.remote->initialised != 1) { pr_notice("%s: g_state.remote->initialised != 1 (%d)\n", __func__, g_state.remote->initialised); + return NULL; + } - return (g_state.remote && - (g_state.remote->initialised == 1)) ? &g_state : NULL; + return &g_state; } /* -- cgit From aa899e686d442c63d50f4d369cc02dbbf0941cb0 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:21 +0100 Subject: staging: vchiq_arm: Avoid NULL ptr deref in vchiq_dump_platform_instances vchiq_get_state() can return a NULL pointer. So handle this cases and avoid a NULL pointer derefence in vchiq_dump_platform_instances. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-17-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 6ef8f19fe49a..a9b6e4a178cb 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1204,6 +1204,9 @@ int vchiq_dump_platform_instances(void *dump_context) int len; int i; + if (!state) + return -ENOTCONN; + /* * There is no list of instances, so instead scan all services, * marking those that have been dumped. -- cgit From ca225857faf237234d2fffe5d1919467dfadd822 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:22 +0100 Subject: staging: vchiq_core: handle NULL result of find_service_by_handle In case of an invalid handle the function find_servive_by_handle returns NULL. So take care of this and avoid a NULL pointer dereference. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-18-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index b32cd12f1695..8f99272dbd6f 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2292,6 +2292,9 @@ void vchiq_msg_queue_push(unsigned int handle, struct vchiq_header *header) struct vchiq_service *service = find_service_by_handle(handle); int pos; + if (!service) + return; + while (service->msg_queue_write == service->msg_queue_read + VCHIQ_MAX_SLOTS) { if (wait_for_completion_interruptible(&service->msg_queue_pop)) @@ -2312,6 +2315,9 @@ struct vchiq_header *vchiq_msg_hold(unsigned int handle) struct vchiq_header *header; int pos; + if (!service) + return NULL; + if (service->msg_queue_write == service->msg_queue_read) return NULL; -- cgit From e12592158515831e5ff6e80a36a4d05ceaf22908 Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Sun, 23 Jan 2022 21:02:23 +0100 Subject: staging: vchiq_dev: Avoid unnecessary alloc in vchiq_ioc_create_service There is no need to allocate the user service in case there is a VCHIQ connection required, but not available. So simply check the error conditions before doing an expensive memory allocation. Reviewed-by: Nicolas Saenz Julienne Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/1642968143-19281-19-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c index 2325844b0880..b41c2a267355 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c @@ -146,15 +146,14 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance, struct vchiq_service_params_kernel params; int srvstate; + if (args->is_open && !instance->connected) + return -ENOTCONN; + user_service = kmalloc(sizeof(*user_service), GFP_KERNEL); if (!user_service) return -ENOMEM; if (args->is_open) { - if (!instance->connected) { - kfree(user_service); - return -ENOTCONN; - } srvstate = VCHIQ_SRVSTATE_OPENING; } else { srvstate = instance->connected ? -- cgit From d9dc6c1b440f837135af579c3caa4c27b0e0105b Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Wed, 19 Jan 2022 12:04:13 +1300 Subject: staging: pi433: fix validation for min bit rate supported by the device rf69 datasheets establishes that the minimum supported bit rate is 1.2 kbps regardless of modulation. this patch replaces the errouneous validation with the correct value Acked-by: Dan Carpenter Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/20220118230413.GA4859@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/rf69.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index ee8c81d164e1..f4ac17adcd83 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -226,14 +226,12 @@ int rf69_set_modulation_shaping(struct spi_device *spi, int rf69_set_bit_rate(struct spi_device *spi, u16 bit_rate) { int retval; - u32 bit_rate_min; u32 bit_rate_reg; u8 msb; u8 lsb; // check input value - bit_rate_min = F_OSC / 8388608; // 8388608 = 2^23; - if (bit_rate < bit_rate_min) { + if (bit_rate < 1200) { dev_dbg(&spi->dev, "setBitRate: illegal input param"); return -EINVAL; } -- cgit From 14dbdad1f1a142f2c5d5dde6f671c18ac6763e30 Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Wed, 19 Jan 2022 12:05:02 +1300 Subject: staging: pi433: change order in which driver config the rf69 chip There is an explicit dependency between modulation and bit rate configurations. To ensure proper validation of input value for the set_bit_rate routine, we must ensure that modulation has been set before. This patch ensures that set_modulation is always called before set_bit_rate for both RX and TX routines Acked-by: Dan Carpenter Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/20220118230502.GA4897@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/pi433_if.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 051c9052aeeb..523a1bca0c58 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -164,10 +164,10 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg) ret = rf69_set_frequency(dev->spi, rx_cfg->frequency); if (ret < 0) return ret; - ret = rf69_set_bit_rate(dev->spi, rx_cfg->bit_rate); + ret = rf69_set_modulation(dev->spi, rx_cfg->modulation); if (ret < 0) return ret; - ret = rf69_set_modulation(dev->spi, rx_cfg->modulation); + ret = rf69_set_bit_rate(dev->spi, rx_cfg->bit_rate); if (ret < 0) return ret; ret = rf69_set_antenna_impedance(dev->spi, rx_cfg->antenna_impedance); @@ -287,10 +287,10 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg) ret = rf69_set_frequency(dev->spi, tx_cfg->frequency); if (ret < 0) return ret; - ret = rf69_set_bit_rate(dev->spi, tx_cfg->bit_rate); + ret = rf69_set_modulation(dev->spi, tx_cfg->modulation); if (ret < 0) return ret; - ret = rf69_set_modulation(dev->spi, tx_cfg->modulation); + ret = rf69_set_bit_rate(dev->spi, tx_cfg->bit_rate); if (ret < 0) return ret; ret = rf69_set_deviation(dev->spi, tx_cfg->dev_frequency); -- cgit From ca532a56ada46c206ea4a7f87ce34b38c274e57a Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Wed, 19 Jan 2022 12:05:55 +1300 Subject: staging: pi433: validate max bit_rate based on modulation used Max bit rate is dependent on which modulation is used. Previous validation routine only took into consideration min bit rate which can lead a misconfiguration of the rf69 chip causing the packets not to be sent/read. This patch enhances that input check in set_bit_rate to account for modulation values and their respective max bit rate Acked-by: Dan Carpenter Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/20220118230555.GA4961@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/TODO | 2 ++ drivers/staging/pi433/rf69.c | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/staging/pi433/TODO b/drivers/staging/pi433/TODO index 63a40bfcc67e..b9e6c01a02e0 100644 --- a/drivers/staging/pi433/TODO +++ b/drivers/staging/pi433/TODO @@ -3,3 +3,5 @@ * currently the code introduces new IOCTLs. I'm afraid this is a bad idea. -> Replace this with another interface, hints are welcome! * Some missing data (marked with ###) needs to be added in the documentation +* Change (struct pi433_tx_cfg)->bit_rate to be a u32 so that we can support + bit rates up to 300kbps per the spec. diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index f4ac17adcd83..d60514a840c2 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -229,9 +229,17 @@ int rf69_set_bit_rate(struct spi_device *spi, u16 bit_rate) u32 bit_rate_reg; u8 msb; u8 lsb; + enum modulation mod; + + // check if modulation is configured + mod = rf69_get_modulation(spi); + if (mod == UNDEF) { + dev_dbg(&spi->dev, "setBitRate: modulation is undefined"); + return -EINVAL; + } // check input value - if (bit_rate < 1200) { + if (bit_rate < 1200 || (mod == OOK && bit_rate > 32768)) { dev_dbg(&spi->dev, "setBitRate: illegal input param"); return -EINVAL; } -- cgit From 39ddef5681839dc9949fd280ea65869a21fca23f Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 18 Jan 2022 19:13:38 +0100 Subject: staging: fbtft: Deduplicate driver registration macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The two macros FBTFT_REGISTER_DRIVER and FBTFT_REGISTER_SPI_DRIVER contain quite some duplication: Both define an spi driver and an of device table and the differences are quite subtle. So create two new macros and use both twice. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20220118181338.207943-2-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft.h | 93 +++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 57 deletions(-) diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 4cdec34e23d2..ebb7f2738f0a 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -272,21 +272,40 @@ void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...); void fbtft_write_reg16_bus8(struct fbtft_par *par, int len, ...); void fbtft_write_reg16_bus16(struct fbtft_par *par, int len, ...); +#define FBTFT_DT_TABLE(_compatible) \ +static const struct of_device_id dt_ids[] = { \ + { .compatible = _compatible }, \ + {}, \ +}; \ +MODULE_DEVICE_TABLE(of, dt_ids); + +#define FBTFT_SPI_DRIVER(_name, _compatible, _display, _spi_ids) \ + \ +static int fbtft_driver_probe_spi(struct spi_device *spi) \ +{ \ + return fbtft_probe_common(_display, spi, NULL); \ +} \ + \ +static int fbtft_driver_remove_spi(struct spi_device *spi) \ +{ \ + struct fb_info *info = spi_get_drvdata(spi); \ + \ + fbtft_remove_common(&spi->dev, info); \ + return 0; \ +} \ + \ +static struct spi_driver fbtft_driver_spi_driver = { \ + .driver = { \ + .name = _name, \ + .of_match_table = dt_ids, \ + }, \ + .id_table = _spi_ids, \ + .probe = fbtft_driver_probe_spi, \ + .remove = fbtft_driver_remove_spi, \ +}; + #define FBTFT_REGISTER_DRIVER(_name, _compatible, _display) \ \ -static int fbtft_driver_probe_spi(struct spi_device *spi) \ -{ \ - return fbtft_probe_common(_display, spi, NULL); \ -} \ - \ -static int fbtft_driver_remove_spi(struct spi_device *spi) \ -{ \ - struct fb_info *info = spi_get_drvdata(spi); \ - \ - fbtft_remove_common(&spi->dev, info); \ - return 0; \ -} \ - \ static int fbtft_driver_probe_pdev(struct platform_device *pdev) \ { \ return fbtft_probe_common(_display, NULL, pdev); \ @@ -300,22 +319,9 @@ static int fbtft_driver_remove_pdev(struct platform_device *pdev) \ return 0; \ } \ \ -static const struct of_device_id dt_ids[] = { \ - { .compatible = _compatible }, \ - {}, \ -}; \ - \ -MODULE_DEVICE_TABLE(of, dt_ids); \ +FBTFT_DT_TABLE(_compatible) \ \ - \ -static struct spi_driver fbtft_driver_spi_driver = { \ - .driver = { \ - .name = _name, \ - .of_match_table = dt_ids, \ - }, \ - .probe = fbtft_driver_probe_spi, \ - .remove = fbtft_driver_remove_spi, \ -}; \ +FBTFT_SPI_DRIVER(_name, _compatible, _display, NULL) \ \ static struct platform_driver fbtft_driver_platform_driver = { \ .driver = { \ @@ -348,42 +354,15 @@ module_exit(fbtft_driver_module_exit); #define FBTFT_REGISTER_SPI_DRIVER(_name, _comp_vend, _comp_dev, _display) \ \ -static int fbtft_driver_probe_spi(struct spi_device *spi) \ -{ \ - return fbtft_probe_common(_display, spi, NULL); \ -} \ - \ -static int fbtft_driver_remove_spi(struct spi_device *spi) \ -{ \ - struct fb_info *info = spi_get_drvdata(spi); \ - \ - fbtft_remove_common(&spi->dev, info); \ - return 0; \ -} \ - \ -static const struct of_device_id dt_ids[] = { \ - { .compatible = _comp_vend "," _comp_dev }, \ - {}, \ -}; \ - \ -MODULE_DEVICE_TABLE(of, dt_ids); \ +FBTFT_DT_TABLE(_comp_vend "," _comp_dev) \ \ static const struct spi_device_id spi_ids[] = { \ { .name = _comp_dev }, \ {}, \ }; \ - \ MODULE_DEVICE_TABLE(spi, spi_ids); \ \ -static struct spi_driver fbtft_driver_spi_driver = { \ - .driver = { \ - .name = _name, \ - .of_match_table = dt_ids, \ - }, \ - .id_table = spi_ids, \ - .probe = fbtft_driver_probe_spi, \ - .remove = fbtft_driver_remove_spi, \ -}; \ +FBTFT_SPI_DRIVER(_name, _comp_vend "," _comp_dev, _display, spi_ids) \ \ module_spi_driver(fbtft_driver_spi_driver); -- cgit From ce514dadc61a53ea7a2f5bbd67d31c52654e19b8 Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Sat, 15 Jan 2022 11:16:43 +1300 Subject: staging: pi433: enforce tx_cfg to be set before any message can be sent this driver relies on exposing a char device to userspace to tx messages. Every message can be sent using different trasmitter settings such so the tx_cfg must be written before sending any messages. Failing to do so will cause the message to fail silently depending on printk/dynamic_debug settings which makes it hard to troubleshoot. This patch add a control variable that will get initialized once tx_cfg is set for the fd used when interacting with the char device. Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/20220114221643.GA7843@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/pi433_if.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 523a1bca0c58..17ff51f6a9da 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -108,6 +108,9 @@ struct pi433_device { struct pi433_instance { struct pi433_device *device; struct pi433_tx_cfg tx_cfg; + + /* control flags */ + bool tx_cfg_initialized; }; /*-------------------------------------------------------------------------*/ @@ -823,6 +826,16 @@ pi433_write(struct file *filp, const char __user *buf, if (count > MAX_MSG_SIZE) return -EMSGSIZE; + /* + * check if tx_cfg has been initialized otherwise we won't be able to + * config the RF trasmitter correctly due to invalid settings + */ + if (!instance->tx_cfg_initialized) { + dev_notice_once(device->dev, + "write: failed due to unconfigured tx_cfg (see PI433_IOC_WR_TX_CFG)"); + return -EINVAL; + } + /* * write the following sequence into fifo: * - tx_cfg @@ -897,6 +910,7 @@ pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) return -EFAULT; mutex_lock(&device->tx_fifo_lock); memcpy(&instance->tx_cfg, &tx_cfg, sizeof(struct pi433_tx_cfg)); + instance->tx_cfg_initialized = true; mutex_unlock(&device->tx_fifo_lock); break; case PI433_IOC_RD_RX_CFG: @@ -949,8 +963,6 @@ static int pi433_open(struct inode *inode, struct file *filp) /* setup instance data*/ instance->device = device; - instance->tx_cfg.bit_rate = 4711; - // TODO: fill instance->tx_cfg; /* instance data as context */ filp->private_data = instance; -- cgit From 6c73edb5d46abd65b8cd83ddf3b96d89a997cee3 Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Mon, 24 Jan 2022 17:26:36 +1300 Subject: staging: pi433: add missing register contants add missing register constants present in RFM69 and/or RFM69HW so that we don't need to hardcode values when referencing them. this patch adds REG_TESTLNA, REG_TESTAFC constants Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/20220124042636.GA7962@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/rf69_registers.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/pi433/rf69_registers.h b/drivers/staging/pi433/rf69_registers.h index a170c66c3d5b..0d6737738841 100644 --- a/drivers/staging/pi433/rf69_registers.h +++ b/drivers/staging/pi433/rf69_registers.h @@ -89,9 +89,11 @@ #define REG_AESKEY16 0x4D #define REG_TEMP1 0x4E #define REG_TEMP2 0x4F +#define REG_TESTLNA 0x58 #define REG_TESTPA1 0x5A /* only present on RFM69HW */ #define REG_TESTPA2 0x5C /* only present on RFM69HW */ #define REG_TESTDAGC 0x6F +#define REG_TESTAFC 0x71 /******************************************************/ /* RF69/SX1231 bit definition */ -- cgit From 7eeec44d33f6be7caca4fe9ca4e653cf315a36c1 Mon Sep 17 00:00:00 2001 From: Arınç ÜNAL Date: Tue, 25 Jan 2022 18:39:00 +0300 Subject: staging: mt7621-dts: fix formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix formatting on mt7621.dtsi. Reviewed-by: Sergio Paracuellos Signed-off-by: Arınç ÜNAL Link: https://lore.kernel.org/r/20220125153903.1469-2-arinc.unal@arinc9.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dts/mt7621.dtsi | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index 644a65d1a6a1..d120e5872165 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -44,9 +44,9 @@ regulator-max-microvolt = <3300000>; enable-active-high; regulator-always-on; - }; + }; - mmc_fixed_1v8_io: fixedregulator@1 { + mmc_fixed_1v8_io: fixedregulator@1 { compatible = "regulator-fixed"; regulator-name = "mmc_io"; regulator-min-microvolt = <1800000>; @@ -325,17 +325,18 @@ mediatek,ethsys = <&sysc>; - gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "rgmii"; + fixed-link { speed = <1000>; full-duplex; pause; }; }; + gmac1: mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; @@ -343,6 +344,7 @@ phy-mode = "rgmii-rxid"; phy-handle = <&phy_external>; }; + mdio-bus { #address-cells = <1>; #size-cells = <0>; @@ -373,36 +375,43 @@ #address-cells = <1>; #size-cells = <0>; reg = <0>; + port@0 { status = "off"; reg = <0>; label = "lan0"; }; + port@1 { status = "off"; reg = <1>; label = "lan1"; }; + port@2 { status = "off"; reg = <2>; label = "lan2"; }; + port@3 { status = "off"; reg = <3>; label = "lan3"; }; + port@4 { status = "off"; reg = <4>; label = "lan4"; }; + port@6 { reg = <6>; label = "cpu"; ethernet = <&gmac0>; phy-mode = "trgmii"; + fixed-link { speed = <1000>; full-duplex; -- cgit From cb3677bb17a8912953b813fb61fc7109e2972e7e Mon Sep 17 00:00:00 2001 From: Arınç ÜNAL Date: Tue, 25 Jan 2022 18:39:01 +0300 Subject: staging: mt7621-dts: fix switch0@0 warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove reg property from ports node to fix this warning: Warning (unit_address_vs_reg): /ethernet@1e100000/mdio-bus/switch0@0/ports: node has a reg or ranges property, but no unit name Another warning surfaces afterwards. Remove #address-cells and #size-cells from switch0@0 node to fix this warning: Warning (avoid_unnecessary_addr_size): /ethernet@1e100000/mdio-bus/switch0@0: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property Reviewed-by: Sergio Paracuellos Signed-off-by: Arınç ÜNAL Link: https://lore.kernel.org/r/20220125153903.1469-3-arinc.unal@arinc9.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dts/mt7621.dtsi | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index d120e5872165..35f19d6ae4bd 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -360,8 +360,6 @@ switch0: switch0@0 { compatible = "mediatek,mt7621"; - #address-cells = <1>; - #size-cells = <0>; reg = <0>; mediatek,mcm; resets = <&rstctrl 2>; @@ -374,7 +372,6 @@ ports { #address-cells = <1>; #size-cells = <0>; - reg = <0>; port@0 { status = "off"; -- cgit From f4c1760f88a0b960288cc044ed6a21fef16500ef Mon Sep 17 00:00:00 2001 From: Arınç ÜNAL Date: Tue, 25 Jan 2022 18:39:02 +0300 Subject: staging: mt7621-dts: use trgmii on gmac0 and enable flow control on port@6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change phy-mode of gmac0 to trgmii to match the other side, port@6. Flow control needs to be enabled on both sides to work. It is already enabled on gmac0, enable it on port@6 too. Reviewed-by: Sergio Paracuellos Signed-off-by: Arınç ÜNAL Link: https://lore.kernel.org/r/20220125153903.1469-4-arinc.unal@arinc9.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dts/mt7621.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index 35f19d6ae4bd..489754f6ed77 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -328,7 +328,7 @@ gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; - phy-mode = "rgmii"; + phy-mode = "trgmii"; fixed-link { speed = <1000>; @@ -412,6 +412,7 @@ fixed-link { speed = <1000>; full-duplex; + pause; }; }; }; -- cgit From 0a93c0d75809582893e82039143591b9265b520e Mon Sep 17 00:00:00 2001 From: Arınç ÜNAL Date: Tue, 25 Jan 2022 18:39:03 +0300 Subject: staging: mt7621-dts: fix pinctrl properties for ethernet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add pinctrl properties with rgmii1 & mdio pins under ethernet node which was wrongfully put under an external phy node. GMAC1 will start working with this fix. Link: https://lore.kernel.org/netdev/02ecce91-7aad-4392-c9d7-f45ca1b31e0b@arinc9.com/T/ Move GB-PC2 specific phy_external node to its own device tree. Reviewed-by: Sergio Paracuellos Signed-off-by: Arınç ÜNAL Link: https://lore.kernel.org/r/20220125153903.1469-5-arinc.unal@arinc9.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dts/gbpc2.dts | 16 +++++++++++----- drivers/staging/mt7621-dts/mt7621.dtsi | 13 +++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/staging/mt7621-dts/gbpc2.dts b/drivers/staging/mt7621-dts/gbpc2.dts index 6fe603c7711d..03d6bb6735ac 100644 --- a/drivers/staging/mt7621-dts/gbpc2.dts +++ b/drivers/staging/mt7621-dts/gbpc2.dts @@ -13,10 +13,16 @@ function = "gpio"; }; -&gmac1 { - status = "ok"; -}; +ðernet { + gmac1: mac@1 { + status = "ok"; + phy-handle = <&phy_external>; + }; -&phy_external { - status = "ok"; + mdio-bus { + phy_external: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii-rxid"; + }; + }; }; diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index 489754f6ed77..38ab6447756a 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -325,6 +325,9 @@ mediatek,ethsys = <&sysc>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; @@ -342,22 +345,12 @@ reg = <1>; status = "off"; phy-mode = "rgmii-rxid"; - phy-handle = <&phy_external>; }; mdio-bus { #address-cells = <1>; #size-cells = <0>; - phy_external: ethernet-phy@5 { - status = "off"; - reg = <5>; - phy-mode = "rgmii-rxid"; - - pinctrl-names = "default"; - pinctrl-0 = <&rgmii2_pins>; - }; - switch0: switch0@0 { compatible = "mediatek,mt7621"; reg = <0>; -- cgit From 94106f6c21e58900badfeeef5acadf0d6cae7f68 Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Tue, 25 Jan 2022 16:34:43 -0600 Subject: staging: unisys: visorinput: Use struct_size() helper in kzalloc() Make use of the struct_size() helper instead of an open-coded version, in order to avoid any potential type mistakes or integer overflows that, in the worst scenario, could lead to heap overflows. Also, address the following sparse warnings: drivers/staging/unisys/visorinput/visorinput.c:409:27: warning: using sizeof on a flexible structure Link: https://github.com/KSPP/linux/issues/174 Signed-off-by: Gustavo A. R. Silva Link: https://lore.kernel.org/r/20220125223443.GA76937@embeddedor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorinput/visorinput.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index 426deab22d62..dffa71ac3cc5 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -406,7 +406,8 @@ static struct visorinput_devdata *devdata_create(struct visor_device *dev, if (dtype == visorinput_keyboard) /* allocate room for devdata->keycode_table, filled in below */ extra_bytes = KEYCODE_TABLE_BYTES * 2; - devdata = kzalloc(sizeof(*devdata) + extra_bytes, GFP_KERNEL); + devdata = kzalloc(struct_size(devdata, keycode_table, extra_bytes), + GFP_KERNEL); if (!devdata) return NULL; mutex_init(&devdata->lock_visor_dev); -- cgit From f383b0770612838e78986231710c0a3afee4db42 Mon Sep 17 00:00:00 2001 From: Sergio Paracuellos Date: Mon, 10 Jan 2022 12:49:27 +0100 Subject: dt-bindings: reset: add dt binding header for Mediatek MT7621 resets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add dt binding header for resets lines in Mediatek MT7621 SoCs. Acked-by: Rob Herring Tested-by: Arınç ÜNAL Signed-off-by: Sergio Paracuellos Link: https://lore.kernel.org/r/20220110114930.1406665-2-sergio.paracuellos@gmail.com Signed-off-by: Greg Kroah-Hartman --- include/dt-bindings/reset/mt7621-reset.h | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 include/dt-bindings/reset/mt7621-reset.h diff --git a/include/dt-bindings/reset/mt7621-reset.h b/include/dt-bindings/reset/mt7621-reset.h new file mode 100644 index 000000000000..7572c6b41453 --- /dev/null +++ b/include/dt-bindings/reset/mt7621-reset.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright (c) 2021 Sergio Paracuellos + * Author: Sergio Paracuellos + */ + +#ifndef DT_BINDING_MT7621_RESET_H +#define DT_BINDING_MT7621_RESET_H + +#define MT7621_RST_SYS 0 +#define MT7621_RST_MCM 2 +#define MT7621_RST_HSDMA 5 +#define MT7621_RST_FE 6 +#define MT7621_RST_SPDIFTX 7 +#define MT7621_RST_TIMER 8 +#define MT7621_RST_INT 9 +#define MT7621_RST_MC 10 +#define MT7621_RST_PCM 11 +#define MT7621_RST_PIO 13 +#define MT7621_RST_GDMA 14 +#define MT7621_RST_NFI 15 +#define MT7621_RST_I2C 16 +#define MT7621_RST_I2S 17 +#define MT7621_RST_SPI 18 +#define MT7621_RST_UART1 19 +#define MT7621_RST_UART2 20 +#define MT7621_RST_UART3 21 +#define MT7621_RST_ETH 23 +#define MT7621_RST_PCIE0 24 +#define MT7621_RST_PCIE1 25 +#define MT7621_RST_PCIE2 26 +#define MT7621_RST_AUX_STCK 28 +#define MT7621_RST_CRYPTO 29 +#define MT7621_RST_SDXC 30 +#define MT7621_RST_PPE 31 + +#endif /* DT_BINDING_MT7621_RESET_H */ -- cgit From 64b2d6ffff862c0e7278198b4229e42e1abb3bb1 Mon Sep 17 00:00:00 2001 From: Sergio Paracuellos Date: Mon, 10 Jan 2022 12:49:30 +0100 Subject: staging: mt7621-dts: align resets with binding documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Binding documentation for compatible 'mediatek,mt7621-sysc' has been updated to be used as a reset provider. Align reset related bits and system controller node with binding documentation along the dtsi file. Tested-by: Arınç ÜNAL Reviewed-by: Philipp Zabel Signed-off-by: Sergio Paracuellos Link: https://lore.kernel.org/r/20220110114930.1406665-5-sergio.paracuellos@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dts/mt7621.dtsi | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index 38ab6447756a..4ae744b96464 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -2,6 +2,7 @@ #include #include #include +#include / { #address-cells = <1>; @@ -67,6 +68,7 @@ compatible = "mediatek,mt7621-sysc", "syscon"; reg = <0x0 0x100>; #clock-cells = <1>; + #reset-cells = <1>; ralink,memctl = <&memc>; clock-output-names = "xtal", "cpu", "bus", "50m", "125m", "150m", @@ -96,7 +98,7 @@ clocks = <&sysc MT7621_CLK_I2C>; clock-names = "i2c"; - resets = <&rstctrl 16>; + resets = <&sysc MT7621_RST_I2C>; reset-names = "i2c"; #address-cells = <1>; @@ -137,7 +139,7 @@ clocks = <&sysc MT7621_CLK_SPI>; clock-names = "spi"; - resets = <&rstctrl 18>; + resets = <&sysc MT7621_RST_SPI>; reset-names = "spi"; #address-cells = <1>; @@ -234,11 +236,6 @@ }; }; - rstctrl: rstctrl { - compatible = "ralink,rt2880-reset"; - #reset-cells = <1>; - }; - sdhci: sdhci@1e130000 { status = "disabled"; @@ -317,7 +314,7 @@ #address-cells = <1>; #size-cells = <0>; - resets = <&rstctrl 6 &rstctrl 23>; + resets = <&sysc MT7621_RST_FE &sysc MT7621_RST_ETH>; reset-names = "fe", "eth"; interrupt-parent = <&gic>; @@ -355,7 +352,7 @@ compatible = "mediatek,mt7621"; reg = <0>; mediatek,mcm; - resets = <&rstctrl 2>; + resets = <&sysc MT7621_RST_MCM>; reset-names = "mcm"; interrupt-controller; #interrupt-cells = <1>; @@ -448,7 +445,7 @@ #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>; - resets = <&rstctrl 24>; + resets = <&sysc MT7621_RST_PCIE0>; clocks = <&sysc MT7621_CLK_PCIE0>; phys = <&pcie0_phy 1>; phy-names = "pcie-phy0"; @@ -463,7 +460,7 @@ #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>; - resets = <&rstctrl 25>; + resets = <&sysc MT7621_RST_PCIE1>; clocks = <&sysc MT7621_CLK_PCIE1>; phys = <&pcie0_phy 1>; phy-names = "pcie-phy1"; @@ -478,7 +475,7 @@ #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; - resets = <&rstctrl 26>; + resets = <&sysc MT7621_RST_PCIE2>; clocks = <&sysc MT7621_CLK_PCIE2>; phys = <&pcie2_phy 0>; phy-names = "pcie-phy2"; -- cgit From a096a8fb52a2edec0c73fd9d7aa601f40b0783bf Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 28 Jan 2022 12:54:40 +0100 Subject: staging: r8188eu: rx_packet_offset and max_recvbuf_sz are write-only The local variables rx_packet_offset and max_recvbuf_sz in rtw_restructure_ht_ie() are set but never used. Remove them. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220128115445.6606-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme.c | 4 ---- drivers/staging/r8188eu/hal/usb_halinit.c | 6 ------ drivers/staging/r8188eu/include/hal_intf.h | 2 -- 3 files changed, 12 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 6533a7babb65..094885c80a1a 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -1901,7 +1901,6 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct qos_priv *pqospriv = &pmlmepriv->qospriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; - u32 rx_packet_offset, max_recvbuf_sz; phtpriv->ht_option = false; @@ -1926,9 +1925,6 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ IEEE80211_HT_CAP_TX_STBC | IEEE80211_HT_CAP_DSSSCCK40); - GetHalDefVar8188EUsb(padapter, HAL_DEF_RX_PACKET_OFFSET, &rx_packet_offset); - GetHalDefVar8188EUsb(padapter, HAL_DEF_MAX_RECVBUF_SZ, &max_recvbuf_sz); - /* AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k AMPDU_para [4:2]:Min MPDU Start Spacing diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index cc8f8c7d0734..d654d2f01c78 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1625,12 +1625,6 @@ u8 GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable case HAL_DEF_DRVINFO_SZ: *((u32 *)pValue) = DRVINFO_SZ; break; - case HAL_DEF_MAX_RECVBUF_SZ: - *((u32 *)pValue) = MAX_RECVBUF_SZ; - break; - case HAL_DEF_RX_PACKET_OFFSET: - *((u32 *)pValue) = RXDESC_SIZE + DRVINFO_SZ; - break; case HAL_DEF_DBG_DM_FUNC: *((u32 *)pValue) = haldata->odmpriv.SupportAbility; break; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 6728cb506303..726e60fd7273 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -76,8 +76,6 @@ enum hal_def_variable { HAL_DEF_IS_SUPPORT_ANT_DIV, HAL_DEF_CURRENT_ANTENNA, HAL_DEF_DRVINFO_SZ, - HAL_DEF_MAX_RECVBUF_SZ, - HAL_DEF_RX_PACKET_OFFSET, HAL_DEF_DBG_DUMP_RXPKT,/* for dbg */ HAL_DEF_DBG_DM_FUNC,/* for dbg */ HAL_DEF_RA_DECISION_RATE, -- cgit From bd0861f513b1c434c27713ebac02d3322a5d0b46 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 28 Jan 2022 12:54:41 +0100 Subject: staging: r8188eu: remove unused cases from GetHalDefVar8188EUsb() GetHalDefVar8188EUsb() is never called with HAL_DEF_DRVINFO_SZ, HAL_DEF_RA_DECISION_RATE, HAL_DEF_RA_SGI and HAL_DEF_PT_PWR_STATUS. Remove these cases from the function. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220128115445.6606-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 21 --------------------- drivers/staging/r8188eu/include/hal_intf.h | 4 ---- 2 files changed, 25 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index d654d2f01c78..4bb1812f5ae7 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1622,30 +1622,9 @@ u8 GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable case HAL_DEF_CURRENT_ANTENNA: *((u8 *)pValue) = haldata->CurAntenna; break; - case HAL_DEF_DRVINFO_SZ: - *((u32 *)pValue) = DRVINFO_SZ; - break; case HAL_DEF_DBG_DM_FUNC: *((u32 *)pValue) = haldata->odmpriv.SupportAbility; break; - case HAL_DEF_RA_DECISION_RATE: - { - u8 MacID = *((u8 *)pValue); - *((u8 *)pValue) = ODM_RA_GetDecisionRate_8188E(&haldata->odmpriv, MacID); - } - break; - case HAL_DEF_RA_SGI: - { - u8 MacID = *((u8 *)pValue); - *((u8 *)pValue) = ODM_RA_GetShortGI_8188E(&haldata->odmpriv, MacID); - } - break; - case HAL_DEF_PT_PWR_STATUS: - { - u8 MacID = *((u8 *)pValue); - *((u8 *)pValue) = ODM_RA_GetHwPwrStatus_8188E(&haldata->odmpriv, MacID); - } - break; case HW_VAR_MAX_RX_AMPDU_FACTOR: *((u32 *)pValue) = MAX_AMPDU_FACTOR_64K; break; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 726e60fd7273..231badaa9cce 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -75,12 +75,8 @@ enum hal_def_variable { HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, HAL_DEF_IS_SUPPORT_ANT_DIV, HAL_DEF_CURRENT_ANTENNA, - HAL_DEF_DRVINFO_SZ, HAL_DEF_DBG_DUMP_RXPKT,/* for dbg */ HAL_DEF_DBG_DM_FUNC,/* for dbg */ - HAL_DEF_RA_DECISION_RATE, - HAL_DEF_RA_SGI, - HAL_DEF_PT_PWR_STATUS, HW_VAR_MAX_RX_AMPDU_FACTOR, HW_DEF_RA_INFO_DUMP, HAL_DEF_DBG_DUMP_TXPKT, -- cgit From fd5285ba0a184cd7dfad690eacef2b41e2332b5d Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 28 Jan 2022 12:54:42 +0100 Subject: staging: r8188eu: max_rx_ampdu_factor is always MAX_AMPDU_FACTOR_64K The local variable max_rx_ampdu_factor in rtw_restructure_ht_ie() and issue_action_BA() is always set to MAX_AMPDU_FACTOR_64K. Remove the variable from both functions and use MAX_AMPDU_FACTOR_64K directly. The case HW_VAR_MAX_RX_AMPDU_FACTOR in GetHalDefVar8188EUsb() is now unused and can be removed. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220128115445.6606-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme.c | 4 +--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 20 +------------------- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - drivers/staging/r8188eu/include/wifi.h | 7 +------ 5 files changed, 3 insertions(+), 32 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 094885c80a1a..038bddc361c3 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -1894,7 +1894,6 @@ void rtw_joinbss_reset(struct adapter *padapter) unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_len, uint *pout_len) { u32 ielen, out_len; - enum ht_cap_ampdu_factor max_rx_ampdu_factor; unsigned char *p; struct ieee80211_ht_cap ht_capie; unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; @@ -1930,8 +1929,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ AMPDU_para [4:2]:Min MPDU Start Spacing */ - GetHalDefVar8188EUsb(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); - ht_capie.ampdu_params_info = (max_rx_ampdu_factor & 0x03); + ht_capie.ampdu_params_info = (MAX_AMPDU_FACTOR_64K & 0x03); if (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) ht_capie.ampdu_params_info |= (IEEE80211_HT_AMPDU_PARM_DENSITY & (0x07 << 2)); diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index aa5ed6ecc432..d60882983086 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -5747,7 +5747,6 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch u16 BA_timeout_value; __le16 le_tmp; u16 BA_starting_seqctrl = 0; - enum ht_cap_ampdu_factor max_rx_ampdu_factor; struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; u8 *pframe; @@ -5830,24 +5829,7 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch pframe = rtw_set_fixed_ie(pframe, 1, &pmlmeinfo->ADDBA_req.dialog_token, &pattrib->pktlen); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)&status, &pattrib->pktlen); BA_para_set = le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f; - GetHalDefVar8188EUsb(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); - switch (max_rx_ampdu_factor) { - case MAX_AMPDU_FACTOR_64K: - BA_para_set |= 0x1000; /* 64 buffer size */ - break; - case MAX_AMPDU_FACTOR_32K: - BA_para_set |= 0x0800; /* 32 buffer size */ - break; - case MAX_AMPDU_FACTOR_16K: - BA_para_set |= 0x0400; /* 16 buffer size */ - break; - case MAX_AMPDU_FACTOR_8K: - BA_para_set |= 0x0200; /* 8 buffer size */ - break; - default: - BA_para_set |= 0x1000; /* 64 buffer size */ - break; - } + BA_para_set |= 0x1000; /* 64 buffer size */ if (pregpriv->ampdu_amsdu == 0)/* disabled */ BA_para_set = BA_para_set & ~BIT(0); diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 4bb1812f5ae7..87382806774b 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1625,9 +1625,6 @@ u8 GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable case HAL_DEF_DBG_DM_FUNC: *((u32 *)pValue) = haldata->odmpriv.SupportAbility; break; - case HW_VAR_MAX_RX_AMPDU_FACTOR: - *((u32 *)pValue) = MAX_AMPDU_FACTOR_64K; - break; case HW_DEF_RA_INFO_DUMP: { u8 entry_id = *((u8 *)pValue); diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 231badaa9cce..f382b7fefb4a 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -77,7 +77,6 @@ enum hal_def_variable { HAL_DEF_CURRENT_ANTENNA, HAL_DEF_DBG_DUMP_RXPKT,/* for dbg */ HAL_DEF_DBG_DM_FUNC,/* for dbg */ - HW_VAR_MAX_RX_AMPDU_FACTOR, HW_DEF_RA_INFO_DUMP, HAL_DEF_DBG_DUMP_TXPKT, }; diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h index 0b0bd39a257f..e7083d721dae 100644 --- a/drivers/staging/r8188eu/include/wifi.h +++ b/drivers/staging/r8188eu/include/wifi.h @@ -569,12 +569,7 @@ struct ADDBA_request { __le16 BA_starting_seqctrl; } __packed; -enum ht_cap_ampdu_factor { - MAX_AMPDU_FACTOR_8K = 0, - MAX_AMPDU_FACTOR_16K = 1, - MAX_AMPDU_FACTOR_32K = 2, - MAX_AMPDU_FACTOR_64K = 3, -}; +#define MAX_AMPDU_FACTOR_64K 3 /* Spatial Multiplexing Power Save Modes */ #define WLAN_HT_CAP_SM_PS_STATIC 0 -- cgit From 2eb482ab5995d1d3ddcc22fc56376752232a8d0e Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 28 Jan 2022 12:54:43 +0100 Subject: staging: r8188eu: convert GetHalDefVar8188EUsb() to void The return value of GetHalDefVar8188EUsb() is not used. Convert the function to void. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220128115445.6606-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 6 +----- drivers/staging/r8188eu/include/hal_intf.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 87382806774b..7a640fbaaca6 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1600,10 +1600,9 @@ void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } /* Query setting of specified variable. */ -u8 GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue) +void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue) { struct hal_data_8188e *haldata = &Adapter->haldata; - u8 bResult = _SUCCESS; switch (eVariable) { case HAL_DEF_UNDERCORATEDSMOOTHEDPWDB: @@ -1647,11 +1646,8 @@ u8 GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable *((u8 *)pValue) = haldata->bDumpTxPkt; break; default: - bResult = _FAIL; break; } - - return bResult; } /* Change default setting of specified variable. */ diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index f382b7fefb4a..96016e175cb5 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -102,7 +102,7 @@ int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt); u8 SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue); -u8 GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue); +void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue); unsigned int rtl8188eu_inirp_init(struct adapter *Adapter); -- cgit From cab5a00ca8cb0961002d4c1ed3ff5eed7b131545 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 28 Jan 2022 12:54:44 +0100 Subject: staging: r8188eu: convert SetHalDefVar8188EUsb() to void The return value of SetHalDefVar8188EUsb() is not used. Convert the function to void. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220128115445.6606-6-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 6 +----- drivers/staging/r8188eu/include/hal_intf.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 7a640fbaaca6..3aa5289a61f0 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1651,10 +1651,9 @@ void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariab } /* Change default setting of specified variable. */ -u8 SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue) +void SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue) { struct hal_data_8188e *haldata = &Adapter->haldata; - u8 bResult = _SUCCESS; switch (eVariable) { case HAL_DEF_DBG_DM_FUNC: @@ -1692,11 +1691,8 @@ u8 SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable haldata->bDumpTxPkt = *((u8 *)pValue); break; default: - bResult = _FAIL; break; } - - return bResult; } void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level) diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 96016e175cb5..9b4d1650b4b5 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -101,7 +101,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level); int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt); -u8 SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue); +void SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue); void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue); unsigned int rtl8188eu_inirp_init(struct adapter *Adapter); -- cgit From 1245e7b64b1b3a729889ac473e0049b8565a9408 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 28 Jan 2022 12:54:45 +0100 Subject: staging: r8188eu: remove IS_*_CUT macros Remove the IS_*_CUT macros from HalVerDef.h. They are not needed, we can use a switch on chip_vers.CUTVersion directly in dump_chip_info() Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220128115445.6606-7-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/hal_com.c | 24 ++++++++++++++++-------- drivers/staging/r8188eu/include/HalVerDef.h | 18 ------------------ 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/drivers/staging/r8188eu/hal/hal_com.c b/drivers/staging/r8188eu/hal/hal_com.c index ba5d027d765f..7f28fd08f0aa 100644 --- a/drivers/staging/r8188eu/hal/hal_com.c +++ b/drivers/staging/r8188eu/hal/hal_com.c @@ -20,19 +20,27 @@ void dump_chip_info(struct HAL_VERSION chip_vers) "Normal_Chip" : "Test_Chip"); cnt += sprintf((buf + cnt), "%s_", IS_CHIP_VENDOR_TSMC(chip_vers) ? "TSMC" : "UMC"); - if (IS_A_CUT(chip_vers)) + + switch (chip_vers.CUTVersion) { + case A_CUT_VERSION: cnt += sprintf((buf + cnt), "A_CUT_"); - else if (IS_B_CUT(chip_vers)) + break; + case B_CUT_VERSION: cnt += sprintf((buf + cnt), "B_CUT_"); - else if (IS_C_CUT(chip_vers)) + break; + case C_CUT_VERSION: cnt += sprintf((buf + cnt), "C_CUT_"); - else if (IS_D_CUT(chip_vers)) + break; + case D_CUT_VERSION: cnt += sprintf((buf + cnt), "D_CUT_"); - else if (IS_E_CUT(chip_vers)) + break; + case E_CUT_VERSION: cnt += sprintf((buf + cnt), "E_CUT_"); - else - cnt += sprintf((buf + cnt), "UNKNOWN_CUT(%d)_", - chip_vers.CUTVersion); + break; + default: + cnt += sprintf((buf + cnt), "UNKNOWN_CUT(%d)_", chip_vers.CUTVersion); + break; + } cnt += sprintf((buf + cnt), "1T1R_"); diff --git a/drivers/staging/r8188eu/include/HalVerDef.h b/drivers/staging/r8188eu/include/HalVerDef.h index f4816ac765e5..2bc18eabb55d 100644 --- a/drivers/staging/r8188eu/include/HalVerDef.h +++ b/drivers/staging/r8188eu/include/HalVerDef.h @@ -14,8 +14,6 @@ enum HAL_CUT_VERSION { C_CUT_VERSION = 2, D_CUT_VERSION = 3, E_CUT_VERSION = 4, - F_CUT_VERSION = 5, - G_CUT_VERSION = 6, }; enum HAL_VENDOR { @@ -33,27 +31,11 @@ struct HAL_VERSION { /* Get element */ #define GET_CVID_CHIP_TYPE(version) (((version).ChipType)) #define GET_CVID_MANUFACTUER(version) (((version).VendorType)) -#define GET_CVID_CUT_VERSION(version) (((version).CUTVersion)) - -/* Common Macro. -- */ -/* HAL_VERSION VersionID */ /* HAL_CHIP_TYPE_E */ #define IS_NORMAL_CHIP(version) \ ((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false) -/* HAL_CUT_VERSION_E */ -#define IS_A_CUT(version) \ - ((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? true : false) -#define IS_B_CUT(version) \ - ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true : false) -#define IS_C_CUT(version) \ - ((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? true : false) -#define IS_D_CUT(version) \ - ((GET_CVID_CUT_VERSION(version) == D_CUT_VERSION) ? true : false) -#define IS_E_CUT(version) \ - ((GET_CVID_CUT_VERSION(version) == E_CUT_VERSION) ? true : false) - /* HAL_VENDOR_E */ #define IS_CHIP_VENDOR_TSMC(version) \ ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? true : false) -- cgit From 52f11ec9b901ce6dc62705f1a734a1b00bb2735f Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Sun, 30 Jan 2022 18:08:38 +1300 Subject: staging: pi433: remove coding style item from the TODO file After several patches sent by the community along the last couple of years, it's possible to remove the coding style item from the TODO file in the driver's folder. This patch addresses the last code formatting inconsistences and remove the coding style item from the TODO file. Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/YfYdVokxsQ+Adl+T@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/TODO | 1 - drivers/staging/pi433/pi433_if.c | 12 ++++-------- drivers/staging/pi433/rf69.c | 3 ++- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/pi433/TODO b/drivers/staging/pi433/TODO index b9e6c01a02e0..8d0f1b57961a 100644 --- a/drivers/staging/pi433/TODO +++ b/drivers/staging/pi433/TODO @@ -1,4 +1,3 @@ -* coding style does not fully comply with the kernel style guide. * still TODOs, annotated in the code * currently the code introduces new IOCTLs. I'm afraid this is a bad idea. -> Replace this with another interface, hints are welcome! diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 17ff51f6a9da..86ad497417f7 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -362,8 +362,7 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg) /*-------------------------------------------------------------------------*/ -static int -pi433_start_rx(struct pi433_device *dev) +static int pi433_start_rx(struct pi433_device *dev) { int retval; @@ -403,8 +402,7 @@ pi433_start_rx(struct pi433_device *dev) /*-------------------------------------------------------------------------*/ -static int -pi433_receive(void *data) +static int pi433_receive(void *data) { struct pi433_device *dev = data; struct spi_device *spi = dev->spi; @@ -555,8 +553,7 @@ abort: return bytes_total; } -static int -pi433_tx_thread(void *data) +static int pi433_tx_thread(void *data) { struct pi433_device *device = data; struct spi_device *spi = device->spi; @@ -881,8 +878,7 @@ abort: return -EAGAIN; } -static long -pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +static long pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct pi433_instance *instance; struct pi433_device *device; diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index d60514a840c2..c68ad4809e91 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -654,7 +654,8 @@ bool rf69_get_flag(struct spi_device *spi, enum flag flag) return (rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_CRC_OK); case battery_low: return (rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_LOW_BAT); - default: return false; + default: + return false; } } -- cgit From c264c1e48716768f770144eab58001f804ee05bc Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 12:12:17 +0100 Subject: staging: r8188eu: remove c2h_evt_clear() Function c2h_evt_clear() is just a wrapper around rtw_write8(). Remove c2h_evt_clear() and call rtw_write8() directly. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130111219.6390-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_cmd.c | 2 +- drivers/staging/r8188eu/hal/hal_com.c | 7 +------ drivers/staging/r8188eu/include/hal_com.h | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index 266bb7db5252..c7e8602d2097 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -1331,7 +1331,7 @@ static void c2h_wk_callback(struct work_struct *work) while (!rtw_cbuf_empty(evtpriv->c2h_queue)) { if ((c2h_evt = (struct c2h_evt_hdr *)rtw_cbuf_pop(evtpriv->c2h_queue)) != NULL) { /* This C2H event is read, clear it */ - c2h_evt_clear(adapter); + rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE); } else { c2h_evt = kmalloc(16, GFP_KERNEL); if (c2h_evt) { diff --git a/drivers/staging/r8188eu/hal/hal_com.c b/drivers/staging/r8188eu/hal/hal_com.c index 7f28fd08f0aa..f83375a389f8 100644 --- a/drivers/staging/r8188eu/hal/hal_com.c +++ b/drivers/staging/r8188eu/hal/hal_com.c @@ -298,11 +298,6 @@ void hal_init_macaddr(struct adapter *adapter) * BITS [127:120] [119:16] [15:8] [7:4] [3:0] */ -void c2h_evt_clear(struct adapter *adapter) -{ - rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE); -} - s32 c2h_evt_read(struct adapter *adapter, u8 *buf) { s32 ret = _FAIL; @@ -340,7 +335,7 @@ clear_evt: * If this field isn't clear, the FW won't update the next * command message. */ - c2h_evt_clear(adapter); + rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE); exit: return ret; } diff --git a/drivers/staging/r8188eu/include/hal_com.h b/drivers/staging/r8188eu/include/hal_com.h index 95167f0b327f..4417054c0f93 100644 --- a/drivers/staging/r8188eu/include/hal_com.h +++ b/drivers/staging/r8188eu/include/hal_com.h @@ -150,7 +150,6 @@ bool Hal_MappingOutPipe(struct adapter *pAdapter, u8 NumOutPipe); void hal_init_macaddr(struct adapter *adapter); -void c2h_evt_clear(struct adapter *adapter); s32 c2h_evt_read(struct adapter *adapter, u8 *buf); #endif /* __HAL_COMMON_H__ */ -- cgit From 590702353c0793d8143d203017cdd2f1fa635dda Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 12:12:18 +0100 Subject: staging: r8188eu: remove unused parameter from hw_var_set_* Remove the unused parameter 'variable' from hw_var_set_* functions. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130111219.6390-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 3aa5289a61f0..c5282603a42c 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -970,7 +970,7 @@ static void StopTxBeacon(struct adapter *adapt) /* todo: CheckFwRsvdPageContent(Adapter); 2010.06.23. Added by tynli. */ } -static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8 *val) +static void hw_var_set_opmode(struct adapter *Adapter, u8 *val) { u8 val8; u8 mode = *((u8 *)val); @@ -1027,7 +1027,7 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8 *val) } } -static void hw_var_set_macaddr(struct adapter *Adapter, u8 variable, u8 *val) +static void hw_var_set_macaddr(struct adapter *Adapter, u8 *val) { u8 idx = 0; u32 reg_macid; @@ -1038,7 +1038,7 @@ static void hw_var_set_macaddr(struct adapter *Adapter, u8 variable, u8 *val) rtw_write8(Adapter, (reg_macid + idx), val[idx]); } -static void hw_var_set_bssid(struct adapter *Adapter, u8 variable, u8 *val) +static void hw_var_set_bssid(struct adapter *Adapter, u8 *val) { u8 idx = 0; u32 reg_bssid; @@ -1049,7 +1049,7 @@ static void hw_var_set_bssid(struct adapter *Adapter, u8 variable, u8 *val) rtw_write8(Adapter, (reg_bssid + idx), val[idx]); } -static void hw_var_set_bcn_func(struct adapter *Adapter, u8 variable, u8 *val) +static void hw_var_set_bcn_func(struct adapter *Adapter, u8 *val) { u32 bcn_ctrl_reg; @@ -1078,13 +1078,13 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } break; case HW_VAR_SET_OPMODE: - hw_var_set_opmode(Adapter, variable, val); + hw_var_set_opmode(Adapter, val); break; case HW_VAR_MAC_ADDR: - hw_var_set_macaddr(Adapter, variable, val); + hw_var_set_macaddr(Adapter, val); break; case HW_VAR_BSSID: - hw_var_set_bssid(Adapter, variable, val); + hw_var_set_bssid(Adapter, val); break; case HW_VAR_BASIC_RATE: { @@ -1122,7 +1122,7 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } break; case HW_VAR_BCN_FUNC: - hw_var_set_bcn_func(Adapter, variable, val); + hw_var_set_bcn_func(Adapter, val); break; case HW_VAR_CORRECT_TSF: { -- cgit From 81f897a7129c31d4b4345f1b3ec39d8522dd2179 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 12:12:19 +0100 Subject: staging: r8188eu: remove hal_init_macaddr() hal_init_macaddr() is just a wrapper around SetHwReg8188EU() which calls hw_var_set_macaddr(). Remove hal_init_macaddr(), remove the HW_VAR_MAC_ADDR case from SetHwReg8188EU() and call hw_var_set_macaddr() directly. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130111219.6390-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/hal_com.c | 5 ----- drivers/staging/r8188eu/hal/usb_halinit.c | 27 ++++++++++++--------------- drivers/staging/r8188eu/include/hal_com.h | 2 -- drivers/staging/r8188eu/include/hal_intf.h | 1 - 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/drivers/staging/r8188eu/hal/hal_com.c b/drivers/staging/r8188eu/hal/hal_com.c index f83375a389f8..06f2a9083056 100644 --- a/drivers/staging/r8188eu/hal/hal_com.c +++ b/drivers/staging/r8188eu/hal/hal_com.c @@ -287,11 +287,6 @@ bool Hal_MappingOutPipe(struct adapter *adapter, u8 numoutpipe) return result; } -void hal_init_macaddr(struct adapter *adapter) -{ - SetHwReg8188EU(adapter, HW_VAR_MAC_ADDR, adapter->eeprompriv.mac_addr); -} - /* * C2H event format: * Field TRIGGER CONTENT CMD_SEQ CMD_LEN CMD_ID diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index c5282603a42c..90f545f17710 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -567,6 +567,17 @@ static void _InitAntenna_Selection(struct adapter *Adapter) DBG_88E("%s,Cur_ant:(%x)%s\n", __func__, haldata->CurAntenna, (haldata->CurAntenna == Antenna_A) ? "Antenna_A" : "Antenna_B"); } +static void hw_var_set_macaddr(struct adapter *Adapter, u8 *val) +{ + u8 idx = 0; + u32 reg_macid; + + reg_macid = REG_MACID; + + for (idx = 0; idx < 6; idx++) + rtw_write8(Adapter, (reg_macid + idx), val[idx]); +} + u32 rtl8188eu_hal_init(struct adapter *Adapter) { u8 value8 = 0; @@ -673,7 +684,7 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) _InitDriverInfoSize(Adapter, DRVINFO_SZ); _InitInterrupt(Adapter); - hal_init_macaddr(Adapter);/* set mac_address */ + hw_var_set_macaddr(Adapter, Adapter->eeprompriv.mac_addr); _InitNetworkType(Adapter);/* set msr */ _InitWMACSetting(Adapter); _InitAdaptiveCtrl(Adapter); @@ -1027,17 +1038,6 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 *val) } } -static void hw_var_set_macaddr(struct adapter *Adapter, u8 *val) -{ - u8 idx = 0; - u32 reg_macid; - - reg_macid = REG_MACID; - - for (idx = 0; idx < 6; idx++) - rtw_write8(Adapter, (reg_macid + idx), val[idx]); -} - static void hw_var_set_bssid(struct adapter *Adapter, u8 *val) { u8 idx = 0; @@ -1080,9 +1080,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) case HW_VAR_SET_OPMODE: hw_var_set_opmode(Adapter, val); break; - case HW_VAR_MAC_ADDR: - hw_var_set_macaddr(Adapter, val); - break; case HW_VAR_BSSID: hw_var_set_bssid(Adapter, val); break; diff --git a/drivers/staging/r8188eu/include/hal_com.h b/drivers/staging/r8188eu/include/hal_com.h index 4417054c0f93..56ba356b5371 100644 --- a/drivers/staging/r8188eu/include/hal_com.h +++ b/drivers/staging/r8188eu/include/hal_com.h @@ -148,8 +148,6 @@ void HalSetBrateCfg(struct adapter *Adapter, u8 *mBratesOS, u16 *pBrateCfg); bool Hal_MappingOutPipe(struct adapter *pAdapter, u8 NumOutPipe); -void hal_init_macaddr(struct adapter *adapter); - s32 c2h_evt_read(struct adapter *adapter, u8 *buf); #endif /* __HAL_COMMON_H__ */ diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 9b4d1650b4b5..9e66ef68e1e8 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -11,7 +11,6 @@ enum hw_variables { HW_VAR_MEDIA_STATUS, HW_VAR_SET_OPMODE, - HW_VAR_MAC_ADDR, HW_VAR_BSSID, HW_VAR_INIT_RTS_RATE, HW_VAR_BASIC_RATE, -- cgit From 7e41c7db279c2e71c6503cb22f49c4a4b46040d6 Mon Sep 17 00:00:00 2001 From: Muhammad Usama Anjum Date: Fri, 28 Jan 2022 16:19:54 +0500 Subject: staging: rt8188eu: Remove dead code rtStatus is _SUCCESS when the execution reaches this if condition. Remove the dead code. Fixes: 67396d2dfef3 ("staging: r8188eu: merge ODM_ConfigBBWithHeaderFile with its callers") Reviewed-by: Dan Carpenter Acked-by: Martin Kaiser Signed-off-by: Muhammad Usama Anjum Link: https://lore.kernel.org/r/20220128111954.1028121-1-usama.anjum@collabora.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 0b0690dfb947..41a0d7f0d29f 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -504,9 +504,6 @@ static int phy_BB8188E_Config_ParaFile(struct adapter *Adapter) ODM_ReadAndConfig_PHY_REG_PG_8188E(&pHalData->odmpriv); } - if (rtStatus != _SUCCESS) - goto phy_BB8190_Config_ParaFile_Fail; - /* 3. BB AGC table Initialization */ if (HAL_STATUS_FAILURE == ODM_ReadAndConfig_AGC_TAB_1T_8188E(&pHalData->odmpriv)) rtStatus = _FAIL; -- cgit From 42475735ad451b0fdaed384be280d94bb1763b6d Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:34:07 +0530 Subject: staging: r8188eu: remove unneeded variable in rtw_wx_get_essid Remove unneeded return variable that is initialized to 0 and not assigned after. Found using Coccinelle Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/d0208689dffce91c52afbd5938b2704a8b1b554e.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index b9f9698d70cf..3a60e1f81592 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -1383,7 +1383,7 @@ static int rtw_wx_get_essid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { - u32 len, ret = 0; + u32 len; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; @@ -1399,7 +1399,7 @@ static int rtw_wx_get_essid(struct net_device *dev, wrqu->essid.length = len; wrqu->essid.flags = 1; - return ret; + return 0; } static int rtw_wx_set_rate(struct net_device *dev, -- cgit From 0bc14454d3e3e3c21bc7c6992f4d1d7b933f1336 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:34:08 +0530 Subject: staging: r8188eu: remove unneeded variable in rtw_wx_get_enc Remove unneeded return variable that is initialized to 0 and not assigned after. Found using Coccinelle Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/e31a2b15673497cbd70bf62b0093f46952cc7596.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 3a60e1f81592..f99942417a71 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -1717,7 +1717,7 @@ static int rtw_wx_get_enc(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *keybuf) { - uint key, ret = 0; + uint key; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *erq = &wrqu->encoding; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1778,7 +1778,7 @@ static int rtw_wx_get_enc(struct net_device *dev, } - return ret; + return 0; } static int rtw_wx_get_power(struct net_device *dev, -- cgit From c2e5e5f80c4e9aed587dd4e727914976f19c5dca Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:57:55 +0530 Subject: staging: r8188eu: remove unneeded variable in rtw_p2p_get Remove unneeded return variable that is initialized to 0 and not assigned after. Found using Coccinelle Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/6c992e9481c7481aa5931635e162dd7a4400a2e2.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index f99942417a71..bc5c8454ebcf 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3422,8 +3422,6 @@ static int rtw_p2p_get(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); if (padapter->bShowGetP2PState) @@ -3447,7 +3445,7 @@ static int rtw_p2p_get(struct net_device *dev, } else if (!memcmp(wrqu->data.pointer, "op_ch", 5)) { rtw_p2p_get_op_ch(dev, info, wrqu, extra); } - return ret; + return 0; } static int rtw_p2p_get2(struct net_device *dev, -- cgit From ab54b196c98f18b6fa3dfe074c8377d07e08202c Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:57:56 +0530 Subject: staging: r8188eu: remove unneeded variable in rtw_p2p_get_wps_configmethod Remove unneeded return variable that is initialized to 0 and not assigned after. Found using Coccinelle Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/ae35e6f6f603ef83c2bad685ac247273041bd138.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index bc5c8454ebcf..b0f78673d9b7 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2620,7 +2620,6 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 peerMAC[ETH_ALEN] = {0x00}; int jj, kk; @@ -2681,7 +2680,7 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, if (copy_to_user(wrqu->data.pointer, attr_content_str, 6 + 17)) return -EFAULT; - return ret; + return 0; } static int rtw_p2p_get_go_device_address(struct net_device *dev, -- cgit From b1b182507e060fac760716063c09fe008a65ecab Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:57:57 +0530 Subject: staging: r8188eu: remove unneeded variable in rtw_p2p_get_go_device_address Remove unneeded return variable that is initialized to 0 and not assigned after. Found using Coccinelle Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/26a84fbef7e06d518efc29d2cd9e3dd685c96e0d.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index b0f78673d9b7..b093430ff744 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2687,7 +2687,6 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 peerMAC[ETH_ALEN] = {0x00}; int jj, kk; @@ -2763,7 +2762,7 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev, if (copy_to_user(wrqu->data.pointer, go_devadd_str, 10 + 17)) return -EFAULT; - return ret; + return 0; } static int rtw_p2p_get_device_type(struct net_device *dev, -- cgit From 6ae1d6e3803b251afc980b1fe51482c3b54c7d5e Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:57:58 +0530 Subject: staging: r8188eu: remove unneeded variable in rtw_p2p_get_device_type Remove unneeded return variable that is initialized to 0 and not assigned after. Found using Coccinelle Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/83609e3c75a0bde4be612d32d76eaed6a26f72aa.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index b093430ff744..6d72b15541ab 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2769,7 +2769,6 @@ static int rtw_p2p_get_device_type(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 peerMAC[ETH_ALEN] = {0x00}; int jj, kk; @@ -2838,7 +2837,7 @@ static int rtw_p2p_get_device_type(struct net_device *dev, return -EFAULT; } - return ret; + return 0; } static int rtw_p2p_get_device_name(struct net_device *dev, -- cgit From a944d44a14ce4445ce155c5d51e96d539394ad63 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:57:59 +0530 Subject: staging: r8188eu: remove unneeded variable in rtw_p2p_get_device_name Remove unneeded return variable that is initialized to 0 and not assigned after. Found using Coccinelle Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/d94c3029128b9c094bf4e0b2e4574a177aef46e9.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 6d72b15541ab..33fe8e944df4 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2844,7 +2844,6 @@ static int rtw_p2p_get_device_name(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 peerMAC[ETH_ALEN] = {0x00}; int jj, kk; @@ -2903,7 +2902,7 @@ static int rtw_p2p_get_device_name(struct net_device *dev, if (copy_to_user(wrqu->data.pointer, dev_name_str, 5 + ((dev_len > 17) ? dev_len : 17))) return -EFAULT; - return ret; + return 0; } static int rtw_p2p_get_invitation_procedure(struct net_device *dev, -- cgit From 4377ab776373407526b14c23cc9fac3d15b90864 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:00 +0530 Subject: staging: r8188eu: remove unneeded variable in rtw_p2p_get_invitation_procedure Remove unneeded return variable that is initialized to 0 and not assigned after. Found using Coccinelle Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/ccec1f682fbc623381519610284530f940122d0e.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 33fe8e944df4..35f7ba66a7cf 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2909,7 +2909,6 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 peerMAC[ETH_ALEN] = {0x00}; int jj, kk; @@ -2978,7 +2977,7 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, } if (copy_to_user(wrqu->data.pointer, inv_proc_str, 8 + 17)) return -EFAULT; - return ret; + return 0; } static int rtw_p2p_connect(struct net_device *dev, -- cgit From 8fd35553dde48a643395535b2d743c692b208f93 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:01 +0530 Subject: staging: r8188eu: propagate error code in rtw_p2p_get2 rtw_p2p_get2 calls functions that can fail with -EFAULT. Return the error code from the called functions. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/818aad89738b66942bb66568081f1953a9494078.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 35f7ba66a7cf..99c7f9369d2a 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3452,19 +3452,19 @@ static int rtw_p2p_get2(struct net_device *dev, DBG_88E("[%s] extra = %s\n", __func__, (char *)wrqu->data.pointer); if (!memcmp(extra, "wpsCM =", 6)) { wrqu->data.length -= 6; - rtw_p2p_get_wps_configmethod(dev, info, wrqu, &extra[6]); + ret = rtw_p2p_get_wps_configmethod(dev, info, wrqu, &extra[6]); } else if (!memcmp(extra, "devN =", 5)) { wrqu->data.length -= 5; - rtw_p2p_get_device_name(dev, info, wrqu, &extra[5]); + ret = rtw_p2p_get_device_name(dev, info, wrqu, &extra[5]); } else if (!memcmp(extra, "dev_type =", 9)) { wrqu->data.length -= 9; - rtw_p2p_get_device_type(dev, info, wrqu, &extra[9]); + ret = rtw_p2p_get_device_type(dev, info, wrqu, &extra[9]); } else if (!memcmp(extra, "go_devadd =", 10)) { wrqu->data.length -= 10; - rtw_p2p_get_go_device_address(dev, info, wrqu, &extra[10]); + ret = rtw_p2p_get_go_device_address(dev, info, wrqu, &extra[10]); } else if (!memcmp(extra, "InvProc =", 8)) { wrqu->data.length -= 8; - rtw_p2p_get_invitation_procedure(dev, info, wrqu, &extra[8]); + ret = rtw_p2p_get_invitation_procedure(dev, info, wrqu, &extra[8]); } return ret; -- cgit From 94f2746186c2f18c964770856b4ecbe6f4985879 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:02 +0530 Subject: staging: r8188eu: convert rtw_p2p_set_go_nego_ssid to return void rtw_p2p_set_go_nego_ssid always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/90e2b3e4ff99131423c11b8f9206916791f742d9.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 99c7f9369d2a..c761c06cf6e8 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2308,19 +2308,16 @@ exit: return ret; } -static int rtw_p2p_set_go_nego_ssid(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_set_go_nego_ssid(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; DBG_88E("[%s] ssid = %s, len = %zu\n", __func__, extra, strlen(extra)); memcpy(pwdinfo->nego_ssid, extra, strlen(extra)); pwdinfo->nego_ssidlen = strlen(extra); - - return ret; } static int rtw_p2p_set_intent(struct net_device *dev, -- cgit From 712eed5d0978f6f818be8ed702f565c1a1ab6ed1 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:03 +0530 Subject: staging: r8188eu: convert rtw_p2p_setDN to return void rtw_p2p_setDN always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/fe4a9f0176c96ec327342c793de1f55c89d16768.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index c761c06cf6e8..daaf808ca23e 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2453,11 +2453,10 @@ static int rtw_p2p_profilefound(struct net_device *dev, return ret; } -static int rtw_p2p_setDN(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_setDN(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -2465,8 +2464,6 @@ static int rtw_p2p_setDN(struct net_device *dev, memset(pwdinfo->device_name, 0x00, WPS_MAX_DEVICE_NAME_LEN); memcpy(pwdinfo->device_name, extra, wrqu->data.length - 1); pwdinfo->device_name_len = wrqu->data.length - 1; - - return ret; } static int rtw_p2p_get_status(struct net_device *dev, -- cgit From 449dbe9de377fe95bd94373dc0768674a3ac3b79 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:04 +0530 Subject: staging: r8188eu: convert rtw_p2p_get_status to return void rtw_p2p_get_status always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/832c53cc201111449fccb40326084d20f676e722.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index daaf808ca23e..d2db2117abc3 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2466,11 +2466,10 @@ static void rtw_p2p_setDN(struct net_device *dev, pwdinfo->device_name_len = wrqu->data.length - 1; } -static int rtw_p2p_get_status(struct net_device *dev, +static void rtw_p2p_get_status(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -2484,8 +2483,6 @@ static int rtw_p2p_get_status(struct net_device *dev, /* About the "Role" information, we will use the new private IOCTL to get the "Role" information. */ sprintf(extra, "\n\nStatus =%.2d\n", rtw_p2p_state(pwdinfo)); wrqu->data.length = strlen(extra); - - return ret; } /* Commented by Albert 20110520 */ -- cgit From df1847ed07ddaa230e315304e97fd9f456674d29 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:05 +0530 Subject: staging: r8188eu: convert rtw_p2p_get_req_cm to return void rtw_p2p_get_req_cm always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/a5940e6778431a4ce2d2e67543c59aae90464604.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index d2db2117abc3..ba0f42ca36e3 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2490,17 +2490,15 @@ static void rtw_p2p_get_status(struct net_device *dev, /* This config method description will show us which config method the remote P2P device is intended to use */ /* by sending the provisioning discovery request frame. */ -static int rtw_p2p_get_req_cm(struct net_device *dev, +static void rtw_p2p_get_req_cm(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; sprintf(extra, "\n\nCM =%s\n", pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req); wrqu->data.length = strlen(extra); - return ret; } static int rtw_p2p_get_role(struct net_device *dev, -- cgit From 17a543c398d9fc91a125c50e8176331bedb340a0 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:06 +0530 Subject: staging: r8188eu: convert rtw_p2p_get_role to return void rtw_p2p_get_role always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/dcd4bba9910b172031ccc0f138c78e8471e36d91.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index ba0f42ca36e3..343b4ad6ce65 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2501,11 +2501,10 @@ static void rtw_p2p_get_req_cm(struct net_device *dev, wrqu->data.length = strlen(extra); } -static int rtw_p2p_get_role(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_get_role(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -2515,7 +2514,6 @@ static int rtw_p2p_get_role(struct net_device *dev, sprintf(extra, "\n\nRole =%.2d\n", rtw_p2p_role(pwdinfo)); wrqu->data.length = strlen(extra); - return ret; } static int rtw_p2p_get_peer_ifaddr(struct net_device *dev, -- cgit From 057d75dbcef162cf74875676d509cb2a70079968 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:07 +0530 Subject: staging: r8188eu: convert rtw_p2p_get_peer_ifaddr to return void rtw_p2p_get_peer_ifaddr always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/4a51963ce86a5f6bed4c07e545cd64091eeb0a8a.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 343b4ad6ce65..1f89f4fe4d8e 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2516,11 +2516,10 @@ static void rtw_p2p_get_role(struct net_device *dev, wrqu->data.length = strlen(extra); } -static int rtw_p2p_get_peer_ifaddr(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_get_peer_ifaddr(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -2530,7 +2529,6 @@ static int rtw_p2p_get_peer_ifaddr(struct net_device *dev, sprintf(extra, "\nMAC %pM", pwdinfo->p2p_peer_interface_addr); wrqu->data.length = strlen(extra); - return ret; } static int rtw_p2p_get_peer_devaddr(struct net_device *dev, -- cgit From 43a9e572768ce20c8f389ceb5dddc95432de559a Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:08 +0530 Subject: staging: r8188eu: convert rtw_p2p_get_peer_devaddr to return void rtw_p2p_get_peer_devaddr always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/cc077a7d11e4bda521294499c42164db7358b2e1.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 1f89f4fe4d8e..dfd19a649803 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2531,12 +2531,11 @@ static void rtw_p2p_get_peer_ifaddr(struct net_device *dev, wrqu->data.length = strlen(extra); } -static int rtw_p2p_get_peer_devaddr(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_get_peer_devaddr(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -2546,7 +2545,6 @@ static int rtw_p2p_get_peer_devaddr(struct net_device *dev, sprintf(extra, "\n%pM", pwdinfo->rx_prov_disc_info.peerDevAddr); wrqu->data.length = strlen(extra); - return ret; } static int rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev, -- cgit From 6f4dabe2d17575be8e065660c2104250e8efe734 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:09 +0530 Subject: staging: r8188eu: convert rtw_p2p_get_peer_devaddr_by_invitation to return void rtw_p2p_get_peer_devaddr_by_invitation always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/06e2dce5de14c1abe457a40ec9ca597a06095437.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index dfd19a649803..9ee647de5ba7 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2547,12 +2547,12 @@ static void rtw_p2p_get_peer_devaddr(struct net_device *dev, wrqu->data.length = strlen(extra); } -static int rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -2562,7 +2562,6 @@ static int rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev, sprintf(extra, "\nMAC %pM", pwdinfo->p2p_peer_device_addr); wrqu->data.length = strlen(extra); - return ret; } static int rtw_p2p_get_groupid(struct net_device *dev, -- cgit From b63d0921ce50cc9037bbd747a03d68d8cf403dbf Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:10 +0530 Subject: staging: r8188eu: convert rtw_p2p_get_groupid to return void rtw_p2p_get_groupid always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/be08b2d84a7fc836db5aa008d906dee1b282fa54.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 9ee647de5ba7..4c47e9bb7fc3 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2564,12 +2564,11 @@ static void rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev, wrqu->data.length = strlen(extra); } -static int rtw_p2p_get_groupid(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_get_groupid(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -2579,7 +2578,6 @@ static int rtw_p2p_get_groupid(struct net_device *dev, pwdinfo->groupid_info.go_device_addr[4], pwdinfo->groupid_info.go_device_addr[5], pwdinfo->groupid_info.ssid); wrqu->data.length = strlen(extra); - return ret; } static int rtw_p2p_get_op_ch(struct net_device *dev, -- cgit From fa8e9aa24313ed839b3d7c4d24ea03734744630a Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:11 +0530 Subject: staging: r8188eu: convert rtw_p2p_get_op_ch to return void rtw_p2p_get_op_ch always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/c94caa66e738f254b7b1d967b3016975aa0df5d0.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 4c47e9bb7fc3..f533f709ead5 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2580,12 +2580,11 @@ static void rtw_p2p_get_groupid(struct net_device *dev, wrqu->data.length = strlen(extra); } -static int rtw_p2p_get_op_ch(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_get_op_ch(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -2593,7 +2592,6 @@ static int rtw_p2p_get_op_ch(struct net_device *dev, sprintf(extra, "\n\nOp_ch =%.2d\n", pwdinfo->operating_channel); wrqu->data.length = strlen(extra); - return ret; } static int rtw_p2p_get_wps_configmethod(struct net_device *dev, -- cgit From dd103a06418e6a0b85e85ccd36e1b215dc94bbb4 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:12 +0530 Subject: staging: r8188eu: convert rtw_p2p_invite_req to return void rtw_p2p_invite_req always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/059a21d40a5c6cbe621ca969f9d32ea89bc9a977.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index f533f709ead5..6375b3776168 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3037,11 +3037,10 @@ static int rtw_p2p_connect(struct net_device *dev, return ret; } -static int rtw_p2p_invite_req(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_invite_req(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; int jj, kk; @@ -3065,12 +3064,12 @@ static int rtw_p2p_invite_req(struct net_device *dev, if (wrqu->data.length <= 37) { DBG_88E("[%s] Wrong format!\n", __func__); - return ret; + return; } if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { DBG_88E("[%s] WiFi Direct is disable!\n", __func__); - return ret; + return; } else { /* Reset the content of struct tx_invite_req_info */ pinvite_req_info->benable = false; @@ -3143,7 +3142,6 @@ static int rtw_p2p_invite_req(struct net_device *dev, } else { DBG_88E("[%s] NOT Found in the Scanning Queue!\n", __func__); } - return ret; } static int rtw_p2p_set_persistent(struct net_device *dev, -- cgit From e636a1f7b4fa27184888dba64668feebac0d3144 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:13 +0530 Subject: staging: r8188eu: convert rtw_p2p_set_persistent to return void rtw_p2p_set_persistent always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/2f23981bcdf4177327b9a29e88540380ef627aab.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 6375b3776168..4c778cf92680 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3144,11 +3144,10 @@ static void rtw_p2p_invite_req(struct net_device *dev, } } -static int rtw_p2p_set_persistent(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_set_persistent(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -3160,7 +3159,7 @@ static int rtw_p2p_set_persistent(struct net_device *dev, if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { DBG_88E("[%s] WiFi Direct is disable!\n", __func__); - return ret; + return; } else { if (extra[0] == '0') /* Disable the persistent group function. */ pwdinfo->persistent_supported = false; @@ -3170,7 +3169,6 @@ static int rtw_p2p_set_persistent(struct net_device *dev, pwdinfo->persistent_supported = false; } pr_info("[%s] persistent_supported = %d\n", __func__, pwdinfo->persistent_supported); - return ret; } static int rtw_p2p_prov_disc(struct net_device *dev, -- cgit From 7ce2b888efd104f8e92b357943a3a62ff55b86fa Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:14 +0530 Subject: staging: r8188eu: convert rtw_p2p_prov_disc to return void rtw_p2p_prov_disc always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/a6696ce2645a07ddd5b5eca21bcc04b196038e8e.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 4c778cf92680..1af8b2c068b8 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3171,11 +3171,10 @@ static void rtw_p2p_set_persistent(struct net_device *dev, pr_info("[%s] persistent_supported = %d\n", __func__, pwdinfo->persistent_supported); } -static int rtw_p2p_prov_disc(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_prov_disc(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; u8 peerMAC[ETH_ALEN] = {0x00}; @@ -3201,7 +3200,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, if (pwdinfo->p2p_state == P2P_STATE_NONE) { DBG_88E("[%s] WiFi Direct is disable!\n", __func__); - return ret; + return; } else { /* Reset the content of struct tx_provdisc_req_info excluded the wps_config_method_request. */ memset(pwdinfo->tx_prov_disc_info.peerDevAddr, 0x00, ETH_ALEN); @@ -3225,7 +3224,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_LABEL; } else { DBG_88E("[%s] Unknown WPS config methodn", __func__); - return ret; + return; } spin_lock_bh(&pmlmepriv->scanned_queue.lock); @@ -3297,7 +3296,6 @@ static int rtw_p2p_prov_disc(struct net_device *dev, } else { DBG_88E("[%s] NOT Found in the Scanning Queue!\n", __func__); } - return ret; } /* This function is used to inform the driver the user had specified the pin code value or pbc */ -- cgit From 1f6361d771d4ebb5ed17bf9964bc5e05f28b695b Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Sat, 29 Jan 2022 21:58:15 +0530 Subject: staging: r8188eu: convert rtw_p2p_got_wpsinfo to return void rtw_p2p_got_wpsinfo always returns 0 and it's return value is not used. Convert it to return void. Suggested-by: Greg Kroah-Hartman Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/f63e236e3a338789265172990fea049216115105.1643466748.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 1af8b2c068b8..c54ec5602ddf 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3301,11 +3301,10 @@ static void rtw_p2p_prov_disc(struct net_device *dev, /* This function is used to inform the driver the user had specified the pin code value or pbc */ /* to application. */ -static int rtw_p2p_got_wpsinfo(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static void rtw_p2p_got_wpsinfo(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -3326,7 +3325,6 @@ static int rtw_p2p_got_wpsinfo(struct net_device *dev, pwdinfo->ui_got_wps_info = P2P_GOT_WPSINFO_PBC; else pwdinfo->ui_got_wps_info = P2P_NO_WPSINFO; - return ret; } static int rtw_p2p_set(struct net_device *dev, -- cgit From 9957b0e9fc5d4cad70c0f6afe993d7d16add34f3 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:10 +0100 Subject: staging: r8188eu: remove HW_VAR_BEACON_INTERVAL Remove HW_VAR_BEACON_INTERVAL from SetHwReg8188EU() and call rtw_write16() directly. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index d60882983086..4fff240dfcc4 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -7035,7 +7035,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) SetHwReg8188EU(padapter, HW_VAR_BASIC_RATE, cur_network->SupportedRates); /* BCN interval */ - SetHwReg8188EU(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&pmlmeinfo->bcn_interval)); + rtw_write16(padapter, REG_BCN_INTERVAL, pmlmeinfo->bcn_interval); /* udpate capability */ update_capinfo(padapter, pmlmeinfo->capability); diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 90f545f17710..59e0c51e4b12 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1246,9 +1246,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT); } break; - case HW_VAR_BEACON_INTERVAL: - rtw_write16(Adapter, REG_BCN_INTERVAL, *((u16 *)val)); - break; case HW_VAR_SLOT_TIME: { u8 u1bAIFS, aSifsTime; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 9e66ef68e1e8..1e536ee78251 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -20,7 +20,6 @@ enum hw_variables { HW_VAR_MLME_DISCONNECT, HW_VAR_MLME_SITESURVEY, HW_VAR_MLME_JOIN, - HW_VAR_BEACON_INTERVAL, HW_VAR_SLOT_TIME, HW_VAR_RESP_SIFS, HW_VAR_ACK_PREAMBLE, -- cgit From 89ba56a6fae247757888ea405a586a5c160626cd Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:11 +0100 Subject: staging: r8188eu: remove HW_VAR_SEC_CFG Remove HW_VAR_SEC_CFG from SetHwReg8188EU() and call rtw_write8() directly. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 9 +++------ drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 4fff240dfcc4..93462cfcbd4d 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -6382,7 +6382,6 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st void start_create_ibss(struct adapter *padapter) { unsigned short caps; - u8 val8; u8 join_type; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; @@ -6397,8 +6396,7 @@ void start_create_ibss(struct adapter *padapter) caps = rtw_get_capability((struct wlan_bssid_ex *)pnetwork); update_capinfo(padapter, caps); if (caps & cap_IBSS) {/* adhoc master */ - val8 = 0xcf; - SetHwReg8188EU(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); + rtw_write8(padapter, REG_SECCFG, 0xcf); /* switch channel */ /* SelectChannel(padapter, pmlmeext->cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE); */ @@ -6454,7 +6452,7 @@ void start_clnt_join(struct adapter *padapter) val8 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) ? 0xcc : 0xcf; - SetHwReg8188EU(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); + rtw_write8(padapter, REG_SECCFG, val8); /* switch channel */ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); @@ -6470,8 +6468,7 @@ void start_clnt_join(struct adapter *padapter) } else if (caps & cap_IBSS) { /* adhoc client */ Set_MSR(padapter, WIFI_FW_ADHOC_STATE); - val8 = 0xcf; - SetHwReg8188EU(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); + rtw_write8(padapter, REG_SECCFG, 0xcf); /* switch channel */ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 59e0c51e4b12..e4d6e413982a 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1290,9 +1290,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) rtw_write8(Adapter, REG_RRSR + 2, regTmp); } break; - case HW_VAR_SEC_CFG: - rtw_write8(Adapter, REG_SECCFG, *((u8 *)val)); - break; case HW_VAR_DM_FLAG: podmpriv->SupportAbility = *((u8 *)val); break; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 1e536ee78251..b3b38c4957b7 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -23,7 +23,6 @@ enum hw_variables { HW_VAR_SLOT_TIME, HW_VAR_RESP_SIFS, HW_VAR_ACK_PREAMBLE, - HW_VAR_SEC_CFG, HW_VAR_BCN_VALID, HW_VAR_DM_FLAG, HW_VAR_DM_FUNC_OP, -- cgit From 73e2daa8cafc219d2e5886355ab35ce2d7dab3d2 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:12 +0100 Subject: staging: r8188eu: remove HW_VAR_CAM_INVALID_ALL Remove HW_VAR_CAM_INVALID_ALL from SetHwReg8188EU() and call rtw_write32() directly. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 4 ++-- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index d40669c21fc1..34d271b737e9 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -429,7 +429,7 @@ unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval) void invalidate_cam_all(struct adapter *padapter) { - SetHwReg8188EU(padapter, HW_VAR_CAM_INVALID_ALL, NULL); + rtw_write32(padapter, RWCAM, BIT(31) | BIT(30)); } void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key) @@ -492,7 +492,7 @@ void flush_all_cam_entry(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - SetHwReg8188EU(padapter, HW_VAR_CAM_INVALID_ALL, NULL); + rtw_write32(padapter, RWCAM, BIT(31) | BIT(30)); memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info)); } diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index e4d6e413982a..28a0c5b57ae2 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1332,9 +1332,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } } break; - case HW_VAR_CAM_INVALID_ALL: - rtw_write32(Adapter, RWCAM, BIT(31) | BIT(30)); - break; case HW_VAR_CAM_WRITE: { u32 cmd; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index b3b38c4957b7..d712a6e280e7 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -29,7 +29,6 @@ enum hw_variables { HW_VAR_DM_FUNC_SET, HW_VAR_DM_FUNC_CLR, HW_VAR_CAM_EMPTY_ENTRY, - HW_VAR_CAM_INVALID_ALL, HW_VAR_CAM_WRITE, HW_VAR_CAM_READ, HW_VAR_AC_PARAM_VO, -- cgit From 111da5e574d99d2f14b434eddbc61cc7f9b5ab6f Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:13 +0100 Subject: staging: r8188eu: remove HW_VAR_AC_PARAM_VO Remove HW_VAR_AC_PARAM_VO from SetHwReg8188EU() and call rtw_write32() directly. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index 34d271b737e9..a09a4a5d7dc7 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -567,7 +567,7 @@ void WMMOnAssocRsp(struct adapter *padapter) edca[XMIT_VI_QUEUE] = acParm; break; case 0x3: - SetHwReg8188EU(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acParm)); + rtw_write32(padapter, REG_EDCA_VO_PARAM, acParm); acm_mask |= (ACM ? BIT(3) : 0); edca[XMIT_VO_QUEUE] = acParm; break; diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 28a0c5b57ae2..5a9bb6a8a45c 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1342,9 +1342,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) rtw_write32(Adapter, RWCAM, cmd); } break; - case HW_VAR_AC_PARAM_VO: - rtw_write32(Adapter, REG_EDCA_VO_PARAM, ((u32 *)(val))[0]); - break; case HW_VAR_AC_PARAM_VI: rtw_write32(Adapter, REG_EDCA_VI_PARAM, ((u32 *)(val))[0]); break; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index d712a6e280e7..82d67fb68630 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -31,7 +31,6 @@ enum hw_variables { HW_VAR_CAM_EMPTY_ENTRY, HW_VAR_CAM_WRITE, HW_VAR_CAM_READ, - HW_VAR_AC_PARAM_VO, HW_VAR_AC_PARAM_VI, HW_VAR_AC_PARAM_BE, HW_VAR_AC_PARAM_BK, -- cgit From 24873b8859d2f3beb4581b28d8979a71bc323c40 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:14 +0100 Subject: staging: r8188eu: remove HW_VAR_AC_PARAM_VI Remove HW_VAR_AC_PARAM_VI from SetHwReg8188EU() and call rtw_write32() directly. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-6-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index a09a4a5d7dc7..ac1ab5c6b169 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -562,7 +562,7 @@ void WMMOnAssocRsp(struct adapter *padapter) edca[XMIT_BK_QUEUE] = acParm; break; case 0x2: - SetHwReg8188EU(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acParm)); + rtw_write32(padapter, REG_EDCA_VI_PARAM, acParm); acm_mask |= (ACM ? BIT(2) : 0); edca[XMIT_VI_QUEUE] = acParm; break; diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 5a9bb6a8a45c..ef7af9ab368f 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1342,9 +1342,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) rtw_write32(Adapter, RWCAM, cmd); } break; - case HW_VAR_AC_PARAM_VI: - rtw_write32(Adapter, REG_EDCA_VI_PARAM, ((u32 *)(val))[0]); - break; case HW_VAR_AC_PARAM_BE: haldata->AcParam_BE = ((u32 *)(val))[0]; rtw_write32(Adapter, REG_EDCA_BE_PARAM, ((u32 *)(val))[0]); diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 82d67fb68630..d7e46e57c452 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -31,7 +31,6 @@ enum hw_variables { HW_VAR_CAM_EMPTY_ENTRY, HW_VAR_CAM_WRITE, HW_VAR_CAM_READ, - HW_VAR_AC_PARAM_VI, HW_VAR_AC_PARAM_BE, HW_VAR_AC_PARAM_BK, HW_VAR_ACM_CTRL, -- cgit From 39c2b864780ecf3dbb485e8256a2ac7e1565ae1d Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:15 +0100 Subject: staging: r8188eu: remove HW_VAR_AC_PARAM_BK Remove HW_VAR_AC_PARAM_BK from SetHwReg8188EU() and call rtw_write32() directly. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-7-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index ac1ab5c6b169..62a96e59b00d 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -558,7 +558,7 @@ void WMMOnAssocRsp(struct adapter *padapter) edca[XMIT_BE_QUEUE] = acParm; break; case 0x1: - SetHwReg8188EU(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acParm)); + rtw_write32(padapter, REG_EDCA_BK_PARAM, acParm); edca[XMIT_BK_QUEUE] = acParm; break; case 0x2: diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index ef7af9ab368f..54087c3b2664 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1346,9 +1346,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) haldata->AcParam_BE = ((u32 *)(val))[0]; rtw_write32(Adapter, REG_EDCA_BE_PARAM, ((u32 *)(val))[0]); break; - case HW_VAR_AC_PARAM_BK: - rtw_write32(Adapter, REG_EDCA_BK_PARAM, ((u32 *)(val))[0]); - break; case HW_VAR_ACM_CTRL: { u8 acm_ctrl = *((u8 *)val); diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index d7e46e57c452..f41b6d76d73e 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -32,7 +32,6 @@ enum hw_variables { HW_VAR_CAM_WRITE, HW_VAR_CAM_READ, HW_VAR_AC_PARAM_BE, - HW_VAR_AC_PARAM_BK, HW_VAR_ACM_CTRL, HW_VAR_AMPDU_MIN_SPACE, HW_VAR_AMPDU_FACTOR, -- cgit From 0599a490f3a95cb5ac6d98de63de95aaf6c70a1c Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:16 +0100 Subject: staging: r8188eu: remove HW_VAR_MEDIA_STATUS Remove HW_VAR_MEDIA_STATUS from SetHwReg8188EU() and call rtw_read8() and rtw_write8() directly. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-8-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 6 +++++- drivers/staging/r8188eu/hal/usb_halinit.c | 9 --------- drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index 62a96e59b00d..d28929a95108 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -286,7 +286,11 @@ void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable) static void Set_NETYPE0_MSR(struct adapter *padapter, u8 type) { - SetHwReg8188EU(padapter, HW_VAR_MEDIA_STATUS, (u8 *)(&type)); + u8 val8; + + val8 = rtw_read8(padapter, MSR) & 0x0c; + val8 |= type; + rtw_write8(padapter, MSR, val8); } void Set_MSR(struct adapter *padapter, u8 type) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 54087c3b2664..db9a2a963a2a 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1068,15 +1068,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) struct odm_dm_struct *podmpriv = &haldata->odmpriv; switch (variable) { - case HW_VAR_MEDIA_STATUS: - { - u8 val8; - - val8 = rtw_read8(Adapter, MSR) & 0x0c; - val8 |= *((u8 *)val); - rtw_write8(Adapter, MSR, val8); - } - break; case HW_VAR_SET_OPMODE: hw_var_set_opmode(Adapter, val); break; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index f41b6d76d73e..7c04cabc6def 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -9,7 +9,6 @@ #include "Hal8188EPhyCfg.h" enum hw_variables { - HW_VAR_MEDIA_STATUS, HW_VAR_SET_OPMODE, HW_VAR_BSSID, HW_VAR_INIT_RTS_RATE, -- cgit From 9838ee1cc2eae4ee194824836a9ab8636e498652 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:17 +0100 Subject: staging: r8188eu: merge Set_NETYPE0_MSR() and Set_MSR() Set_MSR() just calls Set_NETYPE0_MSR(). Merge the two functions. Keep Set_MSR() and remove Set_NETYPE0_MSR(). Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-9-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index d28929a95108..a8acec776b79 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -284,7 +284,7 @@ void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable) SetHwReg8188EU(padapter, HW_VAR_DM_FUNC_CLR, (u8 *)(&mode)); } -static void Set_NETYPE0_MSR(struct adapter *padapter, u8 type) +void Set_MSR(struct adapter *padapter, u8 type) { u8 val8; @@ -293,11 +293,6 @@ static void Set_NETYPE0_MSR(struct adapter *padapter, u8 type) rtw_write8(padapter, MSR, val8); } -void Set_MSR(struct adapter *padapter, u8 type) -{ - Set_NETYPE0_MSR(padapter, type); -} - inline u8 rtw_get_oper_ch(struct adapter *adapter) { return adapter->mlmeextpriv.oper_channel; -- cgit From b82f0b575aff08f3db99681f8bd23cb11339f003 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:18 +0100 Subject: staging: r8188eu: remove HW_VAR_CAM_WRITE Remove HW_VAR_CAM_WRITE from SetHwReg8188EU() and call rtw_write32() directly. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-10-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 3 ++- drivers/staging/r8188eu/hal/usb_halinit.c | 10 ---------- drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index a8acec776b79..c6288c2d5f33 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -456,7 +456,8 @@ void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key) cam_val[0] = val; cam_val[1] = addr + (unsigned int)j; - SetHwReg8188EU(padapter, HW_VAR_CAM_WRITE, (u8 *)cam_val); + rtw_write32(padapter, WCAMI, cam_val[0]); + rtw_write32(padapter, RWCAM, CAM_POLLINIG | CAM_WRITE | cam_val[1]); } } diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index db9a2a963a2a..b92f56a8f35c 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1323,16 +1323,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } } break; - case HW_VAR_CAM_WRITE: - { - u32 cmd; - u32 *cam_val = (u32 *)val; - rtw_write32(Adapter, WCAMI, cam_val[0]); - - cmd = CAM_POLLINIG | CAM_WRITE | cam_val[1]; - rtw_write32(Adapter, RWCAM, cmd); - } - break; case HW_VAR_AC_PARAM_BE: haldata->AcParam_BE = ((u32 *)(val))[0]; rtw_write32(Adapter, REG_EDCA_BE_PARAM, ((u32 *)(val))[0]); diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 7c04cabc6def..31159265085b 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -28,7 +28,6 @@ enum hw_variables { HW_VAR_DM_FUNC_SET, HW_VAR_DM_FUNC_CLR, HW_VAR_CAM_EMPTY_ENTRY, - HW_VAR_CAM_WRITE, HW_VAR_CAM_READ, HW_VAR_AC_PARAM_BE, HW_VAR_ACM_CTRL, -- cgit From 6e28b38bad7dd62b8bad888728de5e375ed85b98 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:19 +0100 Subject: staging: r8188eu: remove HW_VAR_BCN_FUNC The HW_VAR_BCN_FUNC case in SetHwReg8188EU() just calls hw_var_set_bcn_func(). Remove HW_VAR_BCN_FUNC from SetHwReg8188EU(), remove hw_var_set_bcn_func() and call rtw_write8() directly. Since hw_var_set_bcn_func() was always called with value 0, we only need to keep the else arm of the if statement that checks the value. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-11-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 4 ++-- drivers/staging/r8188eu/hal/usb_halinit.c | 15 --------------- drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 93462cfcbd4d..7fabb5b11aac 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -7626,8 +7626,8 @@ u8 disconnect_hdl(struct adapter *padapter, unsigned char *pbuf) if (((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE)) { /* Stop BCN */ - val8 = 0; - SetHwReg8188EU(padapter, HW_VAR_BCN_FUNC, (u8 *)(&val8)); + val8 = rtw_read8(padapter, REG_BCN_CTRL); + rtw_write8(padapter, REG_BCN_CTRL, val8 & (~(EN_BCN_FUNCTION | EN_TXBCN_RPT))); } /* set MSR to no link state -> infra. mode */ diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index b92f56a8f35c..0fda5172ab3d 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1049,18 +1049,6 @@ static void hw_var_set_bssid(struct adapter *Adapter, u8 *val) rtw_write8(Adapter, (reg_bssid + idx), val[idx]); } -static void hw_var_set_bcn_func(struct adapter *Adapter, u8 *val) -{ - u32 bcn_ctrl_reg; - - bcn_ctrl_reg = REG_BCN_CTRL; - - if (*((u8 *)val)) - rtw_write8(Adapter, bcn_ctrl_reg, (EN_BCN_FUNCTION | EN_TXBCN_RPT)); - else - rtw_write8(Adapter, bcn_ctrl_reg, rtw_read8(Adapter, bcn_ctrl_reg) & (~(EN_BCN_FUNCTION | EN_TXBCN_RPT))); -} - void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) { struct hal_data_8188e *haldata = &Adapter->haldata; @@ -1109,9 +1097,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) rtw_write8(Adapter, REG_INIRTS_RATE_SEL, RateIndex); } break; - case HW_VAR_BCN_FUNC: - hw_var_set_bcn_func(Adapter, val); - break; case HW_VAR_CORRECT_TSF: { u64 tsf; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 31159265085b..ee430359abf7 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -13,7 +13,6 @@ enum hw_variables { HW_VAR_BSSID, HW_VAR_INIT_RTS_RATE, HW_VAR_BASIC_RATE, - HW_VAR_BCN_FUNC, HW_VAR_CORRECT_TSF, HW_VAR_CHECK_BSSID, HW_VAR_MLME_DISCONNECT, -- cgit From 9b80fa7e1fb2865ac2a5448ce6782a66be4eaa3b Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:20 +0100 Subject: staging: r8188eu: remove HW_VAR_CHECK_BSSID The HW_VAR_CHECK_BSSID case in SetHwReg8188EU() is not used. Remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-12-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 13 ------------- drivers/staging/r8188eu/include/hal_intf.h | 1 - 2 files changed, 14 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 0fda5172ab3d..f6a1eb2bba47 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1122,19 +1122,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) ResumeTxBeacon(Adapter); } break; - case HW_VAR_CHECK_BSSID: - if (*((u8 *)val)) { - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID_DATA | RCR_CBSSID_BCN); - } else { - u32 val32; - - val32 = rtw_read32(Adapter, REG_RCR); - - val32 &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); - - rtw_write32(Adapter, REG_RCR, val32); - } - break; case HW_VAR_MLME_DISCONNECT: /* Set RCR to not to receive data frame when NO LINK state */ /* reject all data frames */ diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index ee430359abf7..cd25d5a29a28 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -14,7 +14,6 @@ enum hw_variables { HW_VAR_INIT_RTS_RATE, HW_VAR_BASIC_RATE, HW_VAR_CORRECT_TSF, - HW_VAR_CHECK_BSSID, HW_VAR_MLME_DISCONNECT, HW_VAR_MLME_SITESURVEY, HW_VAR_MLME_JOIN, -- cgit From d0d82cb741d0ad42bb776e17011c98fcdab9fee6 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 30 Jan 2022 20:03:21 +0100 Subject: staging: r8188eu: remove HW_VAR_CAM_EMPTY_ENTRY The HW_VAR_CAM_EMPTY_ENTRY case in SetHwReg8188EU() is not used. Remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220130190321.7172-13-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 23 ----------------------- drivers/staging/r8188eu/include/hal_intf.h | 1 - 2 files changed, 24 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index f6a1eb2bba47..0fdade585d25 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1272,29 +1272,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) case HW_VAR_DM_FUNC_CLR: podmpriv->SupportAbility &= *((u32 *)val); break; - case HW_VAR_CAM_EMPTY_ENTRY: - { - u8 ucIndex = *((u8 *)val); - u8 i; - u32 ulCommand = 0; - u32 ulContent = 0; - u32 ulEncAlgo = CAM_AES; - - for (i = 0; i < CAM_CONTENT_COUNT; i++) { - /* filled id in CAM config 2 byte */ - if (i == 0) - ulContent |= (ucIndex & 0x03) | ((u16)(ulEncAlgo) << 2); - else - ulContent = 0; - /* polling bit, and No Write enable, and address */ - ulCommand = CAM_CONTENT_COUNT * ucIndex + i; - ulCommand = ulCommand | CAM_POLLINIG | CAM_WRITE; - /* write content 0 is equall to mark invalid */ - rtw_write32(Adapter, WCAMI, ulContent); /* delay_ms(40); */ - rtw_write32(Adapter, RWCAM, ulCommand); /* delay_ms(40); */ - } - } - break; case HW_VAR_AC_PARAM_BE: haldata->AcParam_BE = ((u32 *)(val))[0]; rtw_write32(Adapter, REG_EDCA_BE_PARAM, ((u32 *)(val))[0]); diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index cd25d5a29a28..e8731e2668f6 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -25,7 +25,6 @@ enum hw_variables { HW_VAR_DM_FUNC_OP, HW_VAR_DM_FUNC_SET, HW_VAR_DM_FUNC_CLR, - HW_VAR_CAM_EMPTY_ENTRY, HW_VAR_CAM_READ, HW_VAR_AC_PARAM_BE, HW_VAR_ACM_CTRL, -- cgit From b47f6db34c296343a22c9db4ebdcc51d92301dbe Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Wed, 2 Feb 2022 01:09:06 -0600 Subject: staging: r8188eu: Silence out-of-bounds warning in HT_caps_handler() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Silence the following out-of-bounds warning (caught with -Warray-bounds=2): drivers/staging/r8188eu/core/rtw_wlan_util.c: In function ‘HT_caps_handler’: drivers/staging/r8188eu/core/rtw_wlan_util.c:719:54: error: array subscript 2 is above array bounds of ‘u8[1]’ {aka ‘unsigned char[1]’} [-Werror=array-bounds] 719 | pIE->data[i] & 0x3); | ~~~~~~~~~^~~ ./include/linux/minmax.h:32:39: note: in definition of macro ‘__cmp_once’ 32 | typeof(y) unique_y = (y); \ | ^ ./include/linux/minmax.h:45:25: note: in expansion of macro ‘__careful_cmp’ 45 | #define min(x, y) __careful_cmp(x, y, <) | ^~~~~~~~~~~~~ drivers/staging/r8188eu/core/rtw_wlan_util.c:718:41: note: in expansion of macro ‘min’ 718 | max_AMPDU_len = min(pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3, | ^~~ In file included from drivers/staging/r8188eu/core/../include/drv_types.h:16, from drivers/staging/r8188eu/core/rtw_wlan_util.c:7: drivers/staging/r8188eu/core/../include/wlan_bssdef.h:64:13: note: while referencing ‘data’ 64 | u8 data[1]; | ^~~~ by transforming one-element array into a flexible-array member in struct ndis_802_11_var_ie This is part of the ongoing efforts to globally enable -Warray-bounds. Reviewed-by: Dan Carpenter Signed-off-by: Gustavo A. R. Silva Link: https://lore.kernel.org/r/20220202070906.GA274379@embeddedor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/wlan_bssdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/wlan_bssdef.h b/drivers/staging/r8188eu/include/wlan_bssdef.h index 99ca097b8edd..9d1c9e763287 100644 --- a/drivers/staging/r8188eu/include/wlan_bssdef.h +++ b/drivers/staging/r8188eu/include/wlan_bssdef.h @@ -61,7 +61,7 @@ struct ndis_802_11_fixed_ie { struct ndis_802_11_var_ie { u8 ElementID; u8 Length; - u8 data[1]; + u8 data[]; }; /* -- cgit From 999bae66ba9d15f25f74826b847d04679c725821 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 1 Feb 2022 09:42:51 +0100 Subject: staging: r8188eu: ExternalPA is read-only The variable ExternalPA in struct hal_data_8188e is never set. It stays at the default value 0. Remove it and remove related dead code. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220201084259.7497-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 3 --- drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 - 2 files changed, 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c index d10a6cc2d4ab..9b06a23df2ac 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c @@ -99,9 +99,6 @@ rtl8188e_PHY_RF6052SetCckTxPower( TxAGC[idx1] = pPowerlevel[idx1] | (pPowerlevel[idx1] << 8) | (pPowerlevel[idx1] << 16) | (pPowerlevel[idx1] << 24); - /* 2010/10/18 MH For external PA module. We need to limit power index to be less than 0x20. */ - if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA) - TxAGC[idx1] = 0x20; } } else { for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) { diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index a24cdbfa83de..2de7c0464411 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -181,7 +181,6 @@ struct hal_data_8188e { u32 MCSTxPowerLevelOriginalOffset[MAX_PG_GROUP][16]; u8 CrystalCap; - u8 ExternalPA; u32 AcParam_BE; /* Original parameter for BE, use for EDCA turbo. */ -- cgit From 75ba99b4022ead5dc03197d91450d19768967a2f Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 1 Feb 2022 09:42:52 +0100 Subject: staging: r8188eu: remove PGMaxGroup from struct hal_data_8188e the variable PGMaxGroup in struct hal_data_8188e is set to 13 and never changed. We can use the already defined constant MAX_PG_GROUP, which is 13, and remove PGMaxGroup from struct hal_data_8188e. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220201084259.7497-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 1 - drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c index 9b06a23df2ac..ea847ec39e13 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c @@ -200,7 +200,7 @@ static void get_rx_power_val_by_reg(struct adapter *Adapter, u8 Channel, /* increase power diff defined by Realtek for regulatory */ if (pHalData->pwrGroupCnt == 1) chnlGroup = 0; - if (pHalData->pwrGroupCnt >= pHalData->PGMaxGroup) { + if (pHalData->pwrGroupCnt >= MAX_PG_GROUP) { if (Channel < 3) /* Channel 1-2 */ chnlGroup = 0; else if (Channel < 6) /* Channel 3-5 */ diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 0fdade585d25..91b854c7b9a1 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1738,7 +1738,6 @@ void rtl8188eu_init_default_value(struct adapter *adapt) haldata->odmpriv.RFCalibrateInfo.bIQKInitialized = false; haldata->odmpriv.RFCalibrateInfo.TM_Trigger = 0;/* for IQK */ haldata->pwrGroupCnt = 0; - haldata->PGMaxGroup = 13; haldata->odmpriv.RFCalibrateInfo.ThermalValue_HP_index = 0; for (i = 0; i < HP_THERMAL_NUM; i++) haldata->odmpriv.RFCalibrateInfo.ThermalValue_HP[i] = 0; diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 2de7c0464411..661c447a0453 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -150,7 +150,6 @@ struct txpowerinfo24g { struct hal_data_8188e { struct HAL_VERSION VersionID; - u8 PGMaxGroup; /* current WIFI_PHY values */ u32 ReceiveConfig; enum ht_channel_width CurrentChannelBW; -- cgit From 513750ab921f18778daecd1b471ff94c18856586 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 1 Feb 2022 09:42:53 +0100 Subject: staging: r8188eu: remove ReceiveConfig from struct hal_data_8188e The ReceiveConfig variable in struct hal_data_8188e is only used to store a local value. Use a local variable instead and remove ReceiveConfig from struct hal_data_8188e. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220201084259.7497-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 12 +++++------- drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 91b854c7b9a1..2252e8a1d55b 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -324,15 +324,13 @@ static void _InitDriverInfoSize(struct adapter *Adapter, u8 drvInfoSize) static void _InitWMACSetting(struct adapter *Adapter) { - struct hal_data_8188e *haldata = &Adapter->haldata; - - haldata->ReceiveConfig = RCR_AAP | RCR_APM | RCR_AM | RCR_AB | - RCR_CBSSID_DATA | RCR_CBSSID_BCN | - RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL | - RCR_APP_MIC | RCR_APP_PHYSTS; + u32 receive_config = RCR_AAP | RCR_APM | RCR_AM | RCR_AB | + RCR_CBSSID_DATA | RCR_CBSSID_BCN | + RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL | + RCR_APP_MIC | RCR_APP_PHYSTS; /* some REG_RCR will be modified later by phy_ConfigMACWithHeaderFile() */ - rtw_write32(Adapter, REG_RCR, haldata->ReceiveConfig); + rtw_write32(Adapter, REG_RCR, receive_config); /* Accept all multicast address */ rtw_write32(Adapter, REG_MAR, 0xFFFFFFFF); diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 661c447a0453..88246ef65f8a 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -151,7 +151,6 @@ struct txpowerinfo24g { struct hal_data_8188e { struct HAL_VERSION VersionID; /* current WIFI_PHY values */ - u32 ReceiveConfig; enum ht_channel_width CurrentChannelBW; u8 CurrentChannel; u8 nCur40MhzPrimeSC;/* Control channel sub-carrier */ -- cgit From 2687230c07ed15539825457e211454bd71f2b0ab Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 1 Feb 2022 09:42:54 +0100 Subject: staging: r8188eu: BasicRateSet is set but never used The varaible BasicRateSet in struct hal_data_8188e is set but never used. Remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220201084259.7497-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 1 - drivers/staging/r8188eu/include/rtl8188e_hal.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 2252e8a1d55b..e6c253122e9c 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1078,7 +1078,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) /* CCK 5.5M & 11M ACK should be enabled for better performance */ BrateCfg = (BrateCfg | 0xd) & 0x15d; - haldata->BasicRateSet = BrateCfg; BrateCfg |= 0x01; /* default enable 1M ACK rate */ /* Set RRSR rate table. */ diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 88246ef65f8a..7a72b564400d 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -155,8 +155,6 @@ struct hal_data_8188e { u8 CurrentChannel; u8 nCur40MhzPrimeSC;/* Control channel sub-carrier */ - u16 BasicRateSet; - u8 EEPROMRegulatory; u8 EEPROMThermalMeter; -- cgit From b57774ccf573ae878fdcc80d8cf138a30995c2e8 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 1 Feb 2022 09:42:55 +0100 Subject: staging: r8188eu: remove UsbTxAggDescNum from struct hal_data_8188e UsbTxAggDescNum in struct hal_data_8188e is set to 0x6 and never changed. Define this constant and remove UsbTxAggDescNum from the hal_data_8188e structure. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220201084259.7497-6-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 3 +-- drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 - drivers/staging/r8188eu/include/rtl8188e_xmit.h | 2 ++ 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c index 293541db597d..94dafc7c1ad0 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c @@ -518,7 +518,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp if (pbuf < bulkptr) { desc_cnt++; - if (desc_cnt == haldata->UsbTxAggDescNum) + if (desc_cnt == USB_TXAGG_DESC_NUM) break; } else { desc_cnt = 0; diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index e6c253122e9c..f33586a740af 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -54,7 +54,6 @@ void rtl8188eu_interface_configure(struct adapter *adapt) haldata->UsbBulkOutSize = USB_FULL_SPEED_BULK_SIZE;/* 64 bytes */ haldata->UsbTxAggMode = 1; - haldata->UsbTxAggDescNum = 0x6; /* only 4 bits */ haldata->UsbRxAggMode = USB_RX_AGG_DMA;/* USB_RX_AGG_DMA; */ haldata->UsbRxAggBlockCount = 8; /* unit : 512b */ @@ -416,7 +415,7 @@ static void usb_AggSettingTxUpdate(struct adapter *Adapter) if (haldata->UsbTxAggMode) { value32 = rtw_read32(Adapter, REG_TDECTRL); value32 = value32 & ~(BLK_DESC_NUM_MASK << BLK_DESC_NUM_SHIFT); - value32 |= ((haldata->UsbTxAggDescNum & BLK_DESC_NUM_MASK) << BLK_DESC_NUM_SHIFT); + value32 |= ((USB_TXAGG_DESC_NUM & BLK_DESC_NUM_MASK) << BLK_DESC_NUM_SHIFT); rtw_write32(Adapter, REG_TDECTRL, value32); } diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 7a72b564400d..9f4d42c1d24e 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -214,7 +214,6 @@ struct hal_data_8188e { u32 UsbBulkOutSize; u8 UsbTxAggMode; - u8 UsbTxAggDescNum; enum usb_rx_agg_mode UsbRxAggMode; u8 UsbRxAggBlockCount; /* USB Block count. Block size is diff --git a/drivers/staging/r8188eu/include/rtl8188e_xmit.h b/drivers/staging/r8188eu/include/rtl8188e_xmit.h index f1f2ccfc765e..85eb0aad80d6 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_xmit.h +++ b/drivers/staging/r8188eu/include/rtl8188e_xmit.h @@ -93,6 +93,8 @@ enum TXDESC_SC { #define SGI BIT(6) #define USB_TXAGG_NUM_SHT 24 +#define USB_TXAGG_DESC_NUM 0x6 + #define txdesc_set_ccx_sw_88e(txdesc, value) \ do { \ ((struct txdesc_88e *)(txdesc))->sw1 = (((value)>>8) & 0x0f); \ -- cgit From 0da70274551457f25ac2380ff21e066928e4a59e Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 1 Feb 2022 09:42:56 +0100 Subject: staging: r8188eu: remove UsbTxAggMode from struct hal_data_8188e UsbTxAggMode in struct hal_data_r8188e is only used in a single if statement. Remove UsbTxAggMode from the hal_data_8188e structure and adjust the if statement. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220201084259.7497-7-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 17 ++++++----------- drivers/staging/r8188eu/include/rtl8188e_hal.h | 2 -- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index f33586a740af..1c40d5065f51 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -53,8 +53,6 @@ void rtl8188eu_interface_configure(struct adapter *adapt) else haldata->UsbBulkOutSize = USB_FULL_SPEED_BULK_SIZE;/* 64 bytes */ - haldata->UsbTxAggMode = 1; - haldata->UsbRxAggMode = USB_RX_AGG_DMA;/* USB_RX_AGG_DMA; */ haldata->UsbRxAggBlockCount = 8; /* unit : 512b */ haldata->UsbRxAggBlockTimeout = 0x6; @@ -406,20 +404,17 @@ static void _InitRetryFunction(struct adapter *Adapter) *---------------------------------------------------------------------------*/ static void usb_AggSettingTxUpdate(struct adapter *Adapter) { - struct hal_data_8188e *haldata = &Adapter->haldata; u32 value32; if (Adapter->registrypriv.wifi_spec) - haldata->UsbTxAggMode = false; + return; - if (haldata->UsbTxAggMode) { - value32 = rtw_read32(Adapter, REG_TDECTRL); - value32 = value32 & ~(BLK_DESC_NUM_MASK << BLK_DESC_NUM_SHIFT); - value32 |= ((USB_TXAGG_DESC_NUM & BLK_DESC_NUM_MASK) << BLK_DESC_NUM_SHIFT); + value32 = rtw_read32(Adapter, REG_TDECTRL); + value32 = value32 & ~(BLK_DESC_NUM_MASK << BLK_DESC_NUM_SHIFT); + value32 |= ((USB_TXAGG_DESC_NUM & BLK_DESC_NUM_MASK) << BLK_DESC_NUM_SHIFT); - rtw_write32(Adapter, REG_TDECTRL, value32); - } -} /* usb_AggSettingTxUpdate */ + rtw_write32(Adapter, REG_TDECTRL, value32); +} /*----------------------------------------------------------------------------- * Function: usb_AggSettingRxUpdate() diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 9f4d42c1d24e..5dce718c0865 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -213,8 +213,6 @@ struct hal_data_8188e { u32 UsbBulkOutSize; - u8 UsbTxAggMode; - enum usb_rx_agg_mode UsbRxAggMode; u8 UsbRxAggBlockCount; /* USB Block count. Block size is * 512-byte in high speed and 64-byte -- cgit From 0646c218554f30103d603dc33b8f667161da24ee Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 1 Feb 2022 09:42:57 +0100 Subject: staging: r8188eu: remove UsbRxAggMode from struct hal_data_8188e UsbRxAggMode in struct hal_data_8188e is set to USB_RX_AGG_DMA and never changed. Remove UsbRxAggMode from the hal_data_8188e structure and remove related dead code. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220201084259.7497-8-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 46 +++----------------------- drivers/staging/r8188eu/hal/usb_ops_linux.c | 14 ++------ drivers/staging/r8188eu/include/rtl8188e_hal.h | 8 ----- 3 files changed, 7 insertions(+), 61 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 1c40d5065f51..24c11c666534 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -53,7 +53,6 @@ void rtl8188eu_interface_configure(struct adapter *adapt) else haldata->UsbBulkOutSize = USB_FULL_SPEED_BULK_SIZE;/* 64 bytes */ - haldata->UsbRxAggMode = USB_RX_AGG_DMA;/* USB_RX_AGG_DMA; */ haldata->UsbRxAggBlockCount = 8; /* unit : 512b */ haldata->UsbRxAggBlockTimeout = 0x6; haldata->UsbRxAggPageCount = 48; /* uint :128 b 0x0A; 10 = MAX_RX_DMA_BUFFER_SIZE/2/haldata->UsbBulkOutSize */ @@ -443,50 +442,15 @@ usb_AggSettingRxUpdate( valueDMA = rtw_read8(Adapter, REG_TRXDMA_CTRL); valueUSB = rtw_read8(Adapter, REG_USB_SPECIAL_OPTION); - switch (haldata->UsbRxAggMode) { - case USB_RX_AGG_DMA: - valueDMA |= RXDMA_AGG_EN; - valueUSB &= ~USB_AGG_EN; - break; - case USB_RX_AGG_USB: - valueDMA &= ~RXDMA_AGG_EN; - valueUSB |= USB_AGG_EN; - break; - case USB_RX_AGG_MIX: - valueDMA |= RXDMA_AGG_EN; - valueUSB |= USB_AGG_EN; - break; - case USB_RX_AGG_DISABLE: - default: - valueDMA &= ~RXDMA_AGG_EN; - valueUSB &= ~USB_AGG_EN; - break; - } + valueDMA |= RXDMA_AGG_EN; + valueUSB &= ~USB_AGG_EN; rtw_write8(Adapter, REG_TRXDMA_CTRL, valueDMA); rtw_write8(Adapter, REG_USB_SPECIAL_OPTION, valueUSB); - switch (haldata->UsbRxAggMode) { - case USB_RX_AGG_DMA: - rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, haldata->UsbRxAggPageCount); - rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH + 1, haldata->UsbRxAggPageTimeout); - break; - case USB_RX_AGG_USB: - rtw_write8(Adapter, REG_USB_AGG_TH, haldata->UsbRxAggBlockCount); - rtw_write8(Adapter, REG_USB_AGG_TO, haldata->UsbRxAggBlockTimeout); - break; - case USB_RX_AGG_MIX: - rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, haldata->UsbRxAggPageCount); - rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH + 1, (haldata->UsbRxAggPageTimeout & 0x1F));/* 0x280[12:8] */ - rtw_write8(Adapter, REG_USB_AGG_TH, haldata->UsbRxAggBlockCount); - rtw_write8(Adapter, REG_USB_AGG_TO, haldata->UsbRxAggBlockTimeout); - break; - case USB_RX_AGG_DISABLE: - default: - /* TODO: */ - break; - } -} /* usb_AggSettingRxUpdate */ + rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, haldata->UsbRxAggPageCount); + rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH + 1, haldata->UsbRxAggPageTimeout); +} static void InitUsbAggregationSetting(struct adapter *Adapter) { diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 4a0ab4053e90..b7b51af7f2c3 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -295,18 +295,8 @@ static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb) recvframe_put(precvframe, skb_len); - switch (haldata->UsbRxAggMode) { - case USB_RX_AGG_DMA: - case USB_RX_AGG_MIX: - pkt_offset = (u16)_RND128(pkt_offset); - break; - case USB_RX_AGG_USB: - pkt_offset = (u16)_RND4(pkt_offset); - break; - case USB_RX_AGG_DISABLE: - default: - break; - } + pkt_offset = (u16)_RND128(pkt_offset); + if (pattrib->pkt_rpt_type == NORMAL_RX) { /* Normal rx packet */ if (pattrib->physt) update_recvframe_phyinfo_88e(precvframe, (struct phy_stat *)pphy_status); diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 5dce718c0865..98d909b6d217 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -72,13 +72,6 @@ struct rt_firmware_hdr { #define DRIVER_EARLY_INT_TIME 0x05 #define BCN_DMA_ATIME_INT_TIME 0x02 -enum usb_rx_agg_mode { - USB_RX_AGG_DISABLE, - USB_RX_AGG_DMA, - USB_RX_AGG_USB, - USB_RX_AGG_MIX -}; - #define MAX_RX_DMA_BUFFER_SIZE_88E \ 0x2400 /* 9k for 88E nornal chip , MaxRxBuff=10k-max(TxReportSize(64*8), * WOLPattern(16*24)) */ @@ -213,7 +206,6 @@ struct hal_data_8188e { u32 UsbBulkOutSize; - enum usb_rx_agg_mode UsbRxAggMode; u8 UsbRxAggBlockCount; /* USB Block count. Block size is * 512-byte in high speed and 64-byte * in full speed */ -- cgit From eb5e767e568ffecc1a38dbca76fe1b98277553d8 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 1 Feb 2022 09:42:58 +0100 Subject: staging: r8188eu: remove UsbRxAggBlock* from struct hal_data_8188e UsbRxAggBlockCount and UsbRxAggBlockTimeout in struct hal_data_8188e are set but not used. Remove them. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220201084259.7497-9-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 2 -- drivers/staging/r8188eu/include/rtl8188e_hal.h | 4 ---- 2 files changed, 6 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 24c11c666534..1d0d58204c68 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -53,8 +53,6 @@ void rtl8188eu_interface_configure(struct adapter *adapt) else haldata->UsbBulkOutSize = USB_FULL_SPEED_BULK_SIZE;/* 64 bytes */ - haldata->UsbRxAggBlockCount = 8; /* unit : 512b */ - haldata->UsbRxAggBlockTimeout = 0x6; haldata->UsbRxAggPageCount = 48; /* uint :128 b 0x0A; 10 = MAX_RX_DMA_BUFFER_SIZE/2/haldata->UsbBulkOutSize */ haldata->UsbRxAggPageTimeout = 0x4; /* 6, absolute time = 34ms/(2^6) */ diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 98d909b6d217..94678dad37ce 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -206,10 +206,6 @@ struct hal_data_8188e { u32 UsbBulkOutSize; - u8 UsbRxAggBlockCount; /* USB Block count. Block size is - * 512-byte in high speed and 64-byte - * in full speed */ - u8 UsbRxAggBlockTimeout; u8 UsbRxAggPageCount; /* 8192C DMA page count */ u8 UsbRxAggPageTimeout; }; -- cgit From 7ef976e0dc598189232d2d791645a9c4e7e4f7ef Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 1 Feb 2022 09:42:59 +0100 Subject: staging: r8188eu: remove UsbRxAggPage* from struct hal_data_8188e UsbRxAggPageCount and UsbRxAggPageTimeout in struct hal_data_8188e are set and never changed. Define these constants and remove the variables from the hal_data_8188e structure. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220201084259.7497-10-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 10 +++------- drivers/staging/r8188eu/include/rtl8188e_hal.h | 6 +++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 1d0d58204c68..f21b910bd88d 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -53,9 +53,6 @@ void rtl8188eu_interface_configure(struct adapter *adapt) else haldata->UsbBulkOutSize = USB_FULL_SPEED_BULK_SIZE;/* 64 bytes */ - haldata->UsbRxAggPageCount = 48; /* uint :128 b 0x0A; 10 = MAX_RX_DMA_BUFFER_SIZE/2/haldata->UsbBulkOutSize */ - haldata->UsbRxAggPageTimeout = 0x4; /* 6, absolute time = 34ms/(2^6) */ - HalUsbSetQueuePipeMapping8188EUsb(adapt, pdvobjpriv->RtNumOutPipes); } @@ -433,7 +430,6 @@ usb_AggSettingRxUpdate( struct adapter *Adapter ) { - struct hal_data_8188e *haldata = &Adapter->haldata; u8 valueDMA; u8 valueUSB; @@ -446,8 +442,8 @@ usb_AggSettingRxUpdate( rtw_write8(Adapter, REG_TRXDMA_CTRL, valueDMA); rtw_write8(Adapter, REG_USB_SPECIAL_OPTION, valueUSB); - rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, haldata->UsbRxAggPageCount); - rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH + 1, haldata->UsbRxAggPageTimeout); + rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, USB_RXAGG_PAGE_COUNT); + rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH + 1, USB_RXAGG_PAGE_TIMEOUT); } static void InitUsbAggregationSetting(struct adapter *Adapter) @@ -1314,7 +1310,7 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) { u8 threshold = *((u8 *)val); if (threshold == 0) - threshold = haldata->UsbRxAggPageCount; + threshold = USB_RXAGG_PAGE_COUNT; rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, threshold); } break; diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 94678dad37ce..e3c028ff20c7 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -141,6 +141,9 @@ struct txpowerinfo24g { #define EFUSE_PROTECT_BYTES_BANK 16 +#define USB_RXAGG_PAGE_COUNT 48 +#define USB_RXAGG_PAGE_TIMEOUT 0x4 + struct hal_data_8188e { struct HAL_VERSION VersionID; /* current WIFI_PHY values */ @@ -205,9 +208,6 @@ struct hal_data_8188e { u8 bMacPwrCtrlOn; u32 UsbBulkOutSize; - - u8 UsbRxAggPageCount; /* 8192C DMA page count */ - u8 UsbRxAggPageTimeout; }; s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy); -- cgit From c531c785bc49a7e0253041ad9c8a32e3d83e482d Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Wed, 2 Feb 2022 08:50:51 +0100 Subject: staging: r8188eu: move struct rt_firmware_hdr to rtw_fw.h The structure rt_firmware_hdr is firmware related. Move it to the rtw_fw.h header. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220202075051.21266-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtl8188e_hal.h | 35 -------------------------- drivers/staging/r8188eu/include/rtw_fw.h | 35 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index e3c028ff20c7..c323476f5936 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -34,41 +34,6 @@ #define DRVINFO_SZ 4 /* unit is 8bytes */ #define PageNum_128(_Len) (u32)(((_Len)>>7) + ((_Len) & 0x7F ? 1 : 0)) -/* This structure must be careful with byte-ordering */ - -struct rt_firmware_hdr { - /* 8-byte alinment required */ - /* LONG WORD 0 ---- */ - __le16 Signature; /* 92C0: test chip; 92C, - * 88C0: test chip; 88C1: MP A-cut; - * 92C1: MP A-cut */ - u8 Category; /* AP/NIC and USB/PCI */ - u8 Function; /* Reserved for different FW function - * indcation, for further use when - * driver needs to download different - * FW for different conditions */ - __le16 Version; /* FW Version */ - u8 Subversion; /* FW Subversion, default 0x00 */ - u16 Rsvd1; - - /* LONG WORD 1 ---- */ - u8 Month; /* Release time Month field */ - u8 Date; /* Release time Date field */ - u8 Hour; /* Release time Hour field */ - u8 Minute; /* Release time Minute field */ - __le16 RamCodeSize; /* The size of RAM code */ - u8 Foundry; - u8 Rsvd2; - - /* LONG WORD 2 ---- */ - __le32 SvnIdx; /* The SVN entry index */ - u32 Rsvd3; - - /* LONG WORD 3 ---- */ - u32 Rsvd4; - u32 Rsvd5; -}; - #define DRIVER_EARLY_INT_TIME 0x05 #define BCN_DMA_ATIME_INT_TIME 0x02 diff --git a/drivers/staging/r8188eu/include/rtw_fw.h b/drivers/staging/r8188eu/include/rtw_fw.h index 9b7492ef0199..2ee9ae70a468 100644 --- a/drivers/staging/r8188eu/include/rtw_fw.h +++ b/drivers/staging/r8188eu/include/rtw_fw.h @@ -16,6 +16,41 @@ (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x2300 || \ (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88E0) +/* This structure must be careful with byte-ordering */ + +struct rt_firmware_hdr { + /* 8-byte alinment required */ + /* LONG WORD 0 ---- */ + __le16 Signature; /* 92C0: test chip; 92C, + * 88C0: test chip; 88C1: MP A-cut; + * 92C1: MP A-cut */ + u8 Category; /* AP/NIC and USB/PCI */ + u8 Function; /* Reserved for different FW function + * indcation, for further use when + * driver needs to download different + * FW for different conditions */ + __le16 Version; /* FW Version */ + u8 Subversion; /* FW Subversion, default 0x00 */ + u16 Rsvd1; + + /* LONG WORD 1 ---- */ + u8 Month; /* Release time Month field */ + u8 Date; /* Release time Date field */ + u8 Hour; /* Release time Hour field */ + u8 Minute; /* Release time Minute field */ + __le16 RamCodeSize; /* The size of RAM code */ + u8 Foundry; + u8 Rsvd2; + + /* LONG WORD 2 ---- */ + __le32 SvnIdx; /* The SVN entry index */ + u32 Rsvd3; + + /* LONG WORD 3 ---- */ + u32 Rsvd4; + u32 Rsvd5; +}; + int rtl8188e_firmware_download(struct adapter *padapter); void rtw_reset_8051(struct adapter *padapter); -- cgit From 3a797f364fe98a004515deaa6880c9cf75422b59 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Thu, 3 Feb 2022 20:22:01 +0100 Subject: staging: vt6656: Fix crash when WLAN is turned off Stop submitting urbs before calling usb_kill_urb() and usb_free_urb(). Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/20220203192201.GA18509@matrix-ESPRIMO-P710 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/usbpipe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index 7f45734390f6..d505b4b69ba4 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -230,7 +230,9 @@ static void vnt_start_interrupt_urb_complete(struct urb *urb) else vnt_int_process_data(priv); - status = usb_submit_urb(priv->interrupt_urb, GFP_ATOMIC); + if (!test_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags)) + status = usb_submit_urb(priv->interrupt_urb, GFP_ATOMIC); + if (status) dev_dbg(&priv->usb->dev, "Submit int URB failed %d\n", status); } -- cgit From 3993e760881b06e827d967d0cd6ba676d09457a9 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Thu, 3 Feb 2022 21:17:44 +0100 Subject: staging: r8188eu: remove unnecessary error check Remove an unnecessary error check in phy_BB8188E_Config_ParaFile. There's no need to goto phy_BB8190_Config_ParaFile_Fail, this label is in the following line. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220203201745.251826-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 41a0d7f0d29f..accbd08d4fd1 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -508,9 +508,6 @@ static int phy_BB8188E_Config_ParaFile(struct adapter *Adapter) if (HAL_STATUS_FAILURE == ODM_ReadAndConfig_AGC_TAB_1T_8188E(&pHalData->odmpriv)) rtStatus = _FAIL; - if (rtStatus != _SUCCESS) - goto phy_BB8190_Config_ParaFile_Fail; - phy_BB8190_Config_ParaFile_Fail: return rtStatus; -- cgit From 04952a99cb6e6a218c40b8b22e4103962a5c4cac Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Thu, 3 Feb 2022 21:17:45 +0100 Subject: staging: r8188eu: simplify error handling in phy_BB8188E_Config_ParaFile Simplify error handling in phy_BB8188E_Config_ParaFile. Exit immediately when there's an error, do not jump to the end of the function. We do not have anything to clean up before we return. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220203201745.251826-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index accbd08d4fd1..8279768201b7 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -487,16 +487,13 @@ static int phy_BB8188E_Config_ParaFile(struct adapter *Adapter) { struct eeprom_priv *pEEPROM = &Adapter->eeprompriv; struct hal_data_8188e *pHalData = &Adapter->haldata; - int rtStatus = _SUCCESS; /* */ /* 1. Read PHY_REG.TXT BB INIT!! */ /* We will separate as 88C / 92C according to chip version */ /* */ if (HAL_STATUS_FAILURE == ODM_ReadAndConfig_PHY_REG_1T_8188E(&pHalData->odmpriv)) - rtStatus = _FAIL; - if (rtStatus != _SUCCESS) - goto phy_BB8190_Config_ParaFile_Fail; + return _FAIL; /* 2. If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */ if (!pEEPROM->bautoload_fail_flag) { @@ -506,11 +503,9 @@ static int phy_BB8188E_Config_ParaFile(struct adapter *Adapter) /* 3. BB AGC table Initialization */ if (HAL_STATUS_FAILURE == ODM_ReadAndConfig_AGC_TAB_1T_8188E(&pHalData->odmpriv)) - rtStatus = _FAIL; + return _FAIL; -phy_BB8190_Config_ParaFile_Fail: - - return rtStatus; + return _SUCCESS; } int -- cgit From 4ef027d5a367131c56ffc4949466a892733a7d60 Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Fri, 4 Feb 2022 21:04:32 +1300 Subject: staging: pi433: add debugfs interface This adds debugfs interface that can be used for debugging possible hardware/software issues. It currently exposes the following debugfs entries for each SPI device probed: /sys/kernel/debug/pi433//regs ... The 'regs' file contains all rf69 uC registers values that are useful for troubleshooting misconfigurations between 2 devices. It contains one register per line so it should be easy to use normal filtering tools to find the registers of interest if needed. Reviewed-by: Dan Carpenter Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/YfzeEHJcd+qvYGZ8@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/pi433_if.c | 76 ++++++++++++++++++++++++++++++++++++++++ drivers/staging/pi433/rf69.c | 2 +- drivers/staging/pi433/rf69.h | 1 + 3 files changed, 78 insertions(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 86ad497417f7..4fbac3ccef74 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -41,6 +41,8 @@ #ifdef CONFIG_COMPAT #include #endif +#include +#include #include "pi433_if.h" #include "rf69.h" @@ -1098,12 +1100,76 @@ static const struct file_operations pi433_fops = { .llseek = no_llseek, }; +static int pi433_debugfs_regs_show(struct seq_file *m, void *p) +{ + struct pi433_device *dev; + u8 reg_data[114]; + int i; + char *fmt = "0x%02x, 0x%02x\n"; + int ret; + + dev = m->private; + + mutex_lock(&dev->tx_fifo_lock); + mutex_lock(&dev->rx_lock); + + // wait for on-going operations to finish + ret = wait_event_interruptible(dev->rx_wait_queue, !dev->tx_active); + if (ret) + goto out_unlock; + + ret = wait_event_interruptible(dev->tx_wait_queue, !dev->rx_active); + if (ret) + goto out_unlock; + + // skip FIFO register (0x0) otherwise this can affect some of uC ops + for (i = 1; i < 0x50; i++) + reg_data[i] = rf69_read_reg(dev->spi, i); + + reg_data[REG_TESTLNA] = rf69_read_reg(dev->spi, REG_TESTLNA); + reg_data[REG_TESTPA1] = rf69_read_reg(dev->spi, REG_TESTPA1); + reg_data[REG_TESTPA2] = rf69_read_reg(dev->spi, REG_TESTPA2); + reg_data[REG_TESTDAGC] = rf69_read_reg(dev->spi, REG_TESTDAGC); + reg_data[REG_TESTAFC] = rf69_read_reg(dev->spi, REG_TESTAFC); + + seq_puts(m, "# reg, val\n"); + + for (i = 1; i < 0x50; i++) + seq_printf(m, fmt, i, reg_data[i]); + + seq_printf(m, fmt, REG_TESTLNA, reg_data[REG_TESTLNA]); + seq_printf(m, fmt, REG_TESTPA1, reg_data[REG_TESTPA1]); + seq_printf(m, fmt, REG_TESTPA2, reg_data[REG_TESTPA2]); + seq_printf(m, fmt, REG_TESTDAGC, reg_data[REG_TESTDAGC]); + seq_printf(m, fmt, REG_TESTAFC, reg_data[REG_TESTAFC]); + +out_unlock: + mutex_unlock(&dev->rx_lock); + mutex_unlock(&dev->tx_fifo_lock); + + return ret; +} + +static int pi433_debugfs_regs_open(struct inode *inode, struct file *filp) +{ + return single_open(filp, pi433_debugfs_regs_show, inode->i_private); +} + +static const struct file_operations debugfs_fops = { + .llseek = seq_lseek, + .open = pi433_debugfs_regs_open, + .owner = THIS_MODULE, + .read = seq_read, + .release = single_release +}; + /*-------------------------------------------------------------------------*/ static int pi433_probe(struct spi_device *spi) { struct pi433_device *device; int retval; + struct dentry *entry; /* setup spi parameters */ spi->mode = 0x00; @@ -1252,6 +1318,10 @@ static int pi433_probe(struct spi_device *spi) /* spi setup */ spi_set_drvdata(spi, device); + entry = debugfs_create_dir(dev_name(device->dev), + debugfs_lookup(KBUILD_MODNAME, NULL)); + debugfs_create_file("regs", 0400, entry, device, &debugfs_fops); + return 0; del_cdev: @@ -1275,6 +1345,9 @@ RX_failed: static int pi433_remove(struct spi_device *spi) { struct pi433_device *device = spi_get_drvdata(spi); + struct dentry *mod_entry = debugfs_lookup(KBUILD_MODNAME, NULL); + + debugfs_remove(debugfs_lookup(dev_name(device->dev), mod_entry)); /* free GPIOs */ free_gpio(device); @@ -1349,6 +1422,8 @@ static int __init pi433_init(void) return PTR_ERR(pi433_class); } + debugfs_create_dir(KBUILD_MODNAME, NULL); + status = spi_register_driver(&pi433_spi_driver); if (status < 0) { class_destroy(pi433_class); @@ -1366,6 +1441,7 @@ static void __exit pi433_exit(void) spi_unregister_driver(&pi433_spi_driver); class_destroy(pi433_class); unregister_chrdev(MAJOR(pi433_dev), pi433_spi_driver.driver.name); + debugfs_remove_recursive(debugfs_lookup(KBUILD_MODNAME, NULL)); } module_exit(pi433_exit); diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index c68ad4809e91..2ab3bf46e37d 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -24,7 +24,7 @@ /*-------------------------------------------------------------------------*/ -static u8 rf69_read_reg(struct spi_device *spi, u8 addr) +u8 rf69_read_reg(struct spi_device *spi, u8 addr) { int retval; diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h index c25942f142a6..3ff5609ecf2e 100644 --- a/drivers/staging/pi433/rf69.h +++ b/drivers/staging/pi433/rf69.h @@ -17,6 +17,7 @@ #define FIFO_SIZE 66 /* bytes */ #define FIFO_THRESHOLD 15 /* bytes */ +u8 rf69_read_reg(struct spi_device *spi, u8 addr); int rf69_get_version(struct spi_device *spi); int rf69_set_mode(struct spi_device *spi, enum mode mode); int rf69_set_data_mode(struct spi_device *spi, u8 data_mode); -- cgit From 532382fe480d753ab63067b6c4a01b008c29fb41 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Fri, 4 Feb 2022 10:09:38 +0100 Subject: staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E The only caller of phy_LCCalibrate_8188E sets is2t to false. Remove this parameter and resulting dead code. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220204090941.309900-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 5f7a2668cabb..db87eaafb72f 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -821,10 +821,10 @@ static void phy_IQCalibrate_8188E(struct adapter *adapt, s32 result[][8], u8 t) } } -static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t) +static void phy_LCCalibrate_8188E(struct adapter *adapt) { u8 tmpreg; - u32 RF_Amode = 0, RF_Bmode = 0, LC_Cal; + u32 RF_Amode = 0, LC_Cal; /* Check continuous TX and Packet TX */ tmpreg = rtw_read8(adapt, 0xd03); @@ -839,17 +839,9 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t) /* Path-A */ RF_Amode = rtl8188e_PHY_QueryRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits); - /* Path-B */ - if (is2t) - RF_Bmode = rtl8188e_PHY_QueryRFReg(adapt, RF_PATH_B, RF_AC, bMask12Bits); - /* 2. Set RF mode = standby mode */ /* Path-A */ rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits, (RF_Amode & 0x8FFFF) | 0x10000); - - /* Path-B */ - if (is2t) - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_B, RF_AC, bMask12Bits, (RF_Bmode & 0x8FFFF) | 0x10000); } /* 3. Read RF reg18 */ @@ -866,10 +858,6 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t) /* Path-A */ rtw_write8(adapt, 0xd03, tmpreg); rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits, RF_Amode); - - /* Path-B */ - if (is2t) - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_B, RF_AC, bMask12Bits, RF_Bmode); } else { /* Deal with Packet TX case */ rtw_write8(adapt, REG_TXPAUSE, 0x00); @@ -999,5 +987,5 @@ void PHY_LCCalibrate_8188E(struct adapter *adapt) timecount += 50; } - phy_LCCalibrate_8188E(adapt, false); + phy_LCCalibrate_8188E(adapt); } -- cgit From 7728dc33f93e890017e1f6bce7ac5ec67d7c999a Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Fri, 4 Feb 2022 10:09:39 +0100 Subject: staging: r8188eu: remove dead code for tx power tracking The odm_TXPowerTrackingCallback_ThermalMeter_8188E contains code for OFDM paths A and B. It seems that path B is not used, is2t is always false. Remove resulting dead code. Without the path B code, the ele_A and ele_C variables are set but not used. They can be removed. With ele_A and ele_C gone, X and Y are now set but no longer used. Remove them as well. Reported-by: kernel test robot Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220204090941.309900-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 72 +--------------------------- 1 file changed, 2 insertions(+), 70 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index db87eaafb72f..795320e13e55 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -102,12 +102,10 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( u8 ThermalValue = 0, delta, delta_LCK, delta_IQK, offset; u8 ThermalValue_AVG_count = 0; u32 ThermalValue_AVG = 0; - s32 ele_A = 0, ele_D, TempCCk, X, value32; - s32 Y, ele_C = 0; + s32 ele_D, TempCCk; s8 OFDM_index[2], CCK_index = 0; s8 OFDM_index_old[2] = {0, 0}, CCK_index_old = 0; u32 i = 0, j = 0; - bool is2t = false; u8 OFDM_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */ s8 OFDM_index_mapping[2][index_mapping_NUM_88E] = { @@ -139,10 +137,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( ThermalValue = (u8)rtl8188e_PHY_QueryRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, 0xfc00); /* 0x42: RF Reg[15:10] 88E */ - if (is2t) - rf = 2; - else - rf = 1; + rf = 1; if (ThermalValue) { /* Query OFDM path A default setting */ @@ -155,17 +150,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( } } - /* Query OFDM path B default setting */ - if (is2t) { - ele_D = rtl8188e_PHY_QueryBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord) & bMaskOFDM_D; - for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) { /* find the index */ - if (ele_D == (OFDMSwingTable[i] & bMaskOFDM_D)) { - OFDM_index_old[1] = (u8)i; - break; - } - } - } - /* Query CCK default setting From 0xa24 */ TempCCk = dm_odm->RFCalibrateInfo.RegA24; @@ -277,11 +261,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( if (dm_odm->RFCalibrateInfo.TxPowerTrackControl) { dm_odm->RFCalibrateInfo.bDoneTxpower = true; - /* Adujst OFDM Ant_A according to IQK result */ - ele_D = (OFDMSwingTable[(u8)OFDM_index[0]] & 0xFFC00000) >> 22; - X = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][0]; - Y = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][1]; - /* Revse TX power table. */ dm_odm->BbSwingIdxOfdm = (u8)OFDM_index[0]; dm_odm->BbSwingIdxCck = (u8)CCK_index; @@ -295,53 +274,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( dm_odm->BbSwingIdxCckCurrent = dm_odm->BbSwingIdxCck; dm_odm->BbSwingFlagCck = true; } - - if (X != 0) { - if ((X & 0x00000200) != 0) - X = X | 0xFFFFFC00; - ele_A = ((X * ele_D) >> 8) & 0x000003FF; - - /* new element C = element D x Y */ - if ((Y & 0x00000200) != 0) - Y = Y | 0xFFFFFC00; - ele_C = ((Y * ele_D) >> 8) & 0x000003FF; - - /* 2012/04/23 MH According to Luke's suggestion, we can not write BB digital */ - /* to increase TX power. Otherwise, EVM will be bad. */ - } - - if (is2t) { - ele_D = (OFDMSwingTable[(u8)OFDM_index[1]] & 0xFFC00000) >> 22; - - /* new element A = element D x X */ - X = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][4]; - Y = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][5]; - - if (X != 0) { - if ((X & 0x00000200) != 0) /* consider minus */ - X = X | 0xFFFFFC00; - ele_A = ((X * ele_D) >> 8) & 0x000003FF; - - /* new element C = element D x Y */ - if ((Y & 0x00000200) != 0) - Y = Y | 0xFFFFFC00; - ele_C = ((Y * ele_D) >> 8) & 0x00003FF; - - /* wtite new elements A, C, D to regC88 and regC9C, element B is always 0 */ - value32 = (ele_D << 22) | ((ele_C & 0x3F) << 16) | ele_A; - rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord, value32); - - value32 = (ele_C & 0x000003C0) >> 6; - rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XDTxAFE, bMaskH4Bits, value32); - - value32 = ((X * ele_D) >> 7) & 0x01; - rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_ECCAThreshold, BIT(28), value32); - } else { - rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord, OFDMSwingTable[(u8)OFDM_index[1]]); - rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XDTxAFE, bMaskH4Bits, 0x00); - rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_ECCAThreshold, BIT(28), 0x00); - } - } } } -- cgit From 7f2156992a3fadb59bc6cce8b0e654cf6c191abf Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Fri, 4 Feb 2022 10:09:40 +0100 Subject: staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E The only caller of odm_ConfigRFReg_8188E sets RF_PATH to RF_PATH_A. Remove this parameter and use RF_PATH_A inside the function. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220204090941.309900-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_RegConfig8188E.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c b/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c index 5fb5a88314ed..9059f2533b0b 100644 --- a/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c +++ b/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c @@ -4,8 +4,7 @@ #include "../include/drv_types.h" static void odm_ConfigRFReg_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, - u32 Data, enum rf_radio_path RF_PATH, - u32 RegAddr) + u32 Data, u32 RegAddr) { if (Addr == 0xffe) { msleep(50); @@ -20,7 +19,7 @@ static void odm_ConfigRFReg_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, } else if (Addr == 0xf9) { udelay(1); } else { - rtl8188e_PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH, RegAddr, bRFRegOffsetMask, Data); + rtl8188e_PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH_A, RegAddr, bRFRegOffsetMask, Data); /* Add 1us delay between BB/RF register setting. */ udelay(1); } @@ -31,7 +30,7 @@ void odm_ConfigRF_RadioA_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Data u32 content = 0x1000; /* RF_Content: radioa_txt */ u32 maskforPhySet = (u32)(content & 0xE000); - odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, RF_PATH_A, Addr | maskforPhySet); + odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, Addr | maskforPhySet); } void odm_ConfigMAC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u8 Data) -- cgit From 74e69e95f13f91c57c9322c7754a85a0e13e9b90 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Fri, 4 Feb 2022 10:09:41 +0100 Subject: staging: r8188eu: remove constant variable eRFPath In the _PHY_SwChnl8192C function, eRFPath is always zero. Remove the variable and use 0 in the code. Replace (enum rf_radio_path)0 with RF_PATH_A. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220204090941.309900-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 8279768201b7..6e26359bdda7 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -712,7 +712,6 @@ void PHY_SetBWMode8188E(struct adapter *Adapter, enum ht_channel_width Bandwidth static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel) { - u8 eRFPath = 0; u32 param1, param2; struct hal_data_8188e *pHalData = &Adapter->haldata; @@ -725,8 +724,8 @@ static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel) /* s2. RF dependent command - CmdID_RF_WriteReg, param1=RF_CHNLBW, param2=channel */ param1 = RF_CHNLBW; param2 = channel; - pHalData->RfRegChnlVal[eRFPath] = ((pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | param2); - rtl8188e_PHY_SetRFReg(Adapter, (enum rf_radio_path)eRFPath, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[eRFPath]); + pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffffc00) | param2); + rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); } void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel) -- cgit From 7f03a457f5f4cf0000a90611141bde53aa2545d8 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Feb 2022 12:37:34 +0100 Subject: staging: r8188eu: TXPowercount is set but not used TXPowercount in struct odm_rf_cal is set but not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220205113741.379070-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 1 - drivers/staging/r8188eu/hal/odm.c | 1 - drivers/staging/r8188eu/include/odm.h | 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 795320e13e55..f0f26eecb2c0 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -285,7 +285,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( if (dm_odm->RFCalibrateInfo.TxPowerTrackControl) dm_odm->RFCalibrateInfo.ThermalValue = ThermalValue; } - dm_odm->RFCalibrateInfo.TXPowercount = 0; } /* 1 7. IQK */ diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index 9b4b75c225a7..117cdf2e5180 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -506,7 +506,6 @@ static void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm) static void odm_TXPowerTrackingThermalMeterInit(struct odm_dm_struct *pDM_Odm) { pDM_Odm->RFCalibrateInfo.bTXPowerTracking = true; - pDM_Odm->RFCalibrateInfo.TXPowercount = 0; pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = false; pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = true; } diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 63e0b6725bee..046a4b9e0899 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -229,7 +229,6 @@ struct odm_rf_cal { s32 RegEB4; s32 RegEBC; - u8 TXPowercount; bool bTXPowerTrackingInit; bool bTXPowerTracking; u8 TxPowerTrackControl; /* for mp mode, turn off txpwrtracking -- cgit From 2ccc526ec9f96977d1de04a96a1b1b2c29bf41fd Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Feb 2022 12:37:35 +0100 Subject: staging: r8188eu: TXPowerTrackingCallbackCnt is set but not used TXPowerTrackingCallbackCnt in struct odm_rf_cal is set but not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220205113741.379070-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 1 - drivers/staging/r8188eu/include/odm.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index f0f26eecb2c0..2ce777ac041a 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -129,7 +129,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( /* 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E. */ odm_TxPwrTrackSetPwr88E(dm_odm); - dm_odm->RFCalibrateInfo.TXPowerTrackingCallbackCnt++; /* cosa add for debug */ dm_odm->RFCalibrateInfo.bTXPowerTrackingInit = true; /* RFCalibrateInfo.RegA24 will be initialized when ODM HW configuring, but MP configures with para files. */ diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 046a4b9e0899..2844ca96d3ba 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -253,7 +253,6 @@ struct odm_rf_cal { bool bReloadtxpowerindex; u8 bRfPiEnable; - u32 TXPowerTrackingCallbackCnt; /* cosa add for debug */ u8 bCCKinCH14; u8 CCK_index; -- cgit From b1d602da80b11d190e6810cdb158bf5b4f141aa0 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Feb 2022 12:37:36 +0100 Subject: staging: r8188eu: bTXPowerTrackingInit is set but not used bTXPowerTrackingInit in struct odm_rf_cal is set but not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220205113741.379070-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 -- drivers/staging/r8188eu/hal/odm.c | 1 - drivers/staging/r8188eu/include/odm.h | 1 - 3 files changed, 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 2ce777ac041a..c26c87e5cb78 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -129,8 +129,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( /* 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E. */ odm_TxPwrTrackSetPwr88E(dm_odm); - dm_odm->RFCalibrateInfo.bTXPowerTrackingInit = true; - /* RFCalibrateInfo.RegA24 will be initialized when ODM HW configuring, but MP configures with para files. */ dm_odm->RFCalibrateInfo.RegA24 = 0x090e1317; diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index 117cdf2e5180..e3bace2e3713 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -506,7 +506,6 @@ static void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm) static void odm_TXPowerTrackingThermalMeterInit(struct odm_dm_struct *pDM_Odm) { pDM_Odm->RFCalibrateInfo.bTXPowerTracking = true; - pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = false; pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = true; } diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 2844ca96d3ba..47b347fe1da0 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -229,7 +229,6 @@ struct odm_rf_cal { s32 RegEB4; s32 RegEBC; - bool bTXPowerTrackingInit; bool bTXPowerTracking; u8 TxPowerTrackControl; /* for mp mode, turn off txpwrtracking * as default */ -- cgit From 28ba3b7bfaf48559ab59ab70ab34d909820a76ff Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Feb 2022 12:37:37 +0100 Subject: staging: r8188eu: bTXPowerTracking is set but not used bTXPowerTracking in struct odm_rf_cal is set but not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220205113741.379070-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm.c | 1 - drivers/staging/r8188eu/include/odm.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index e3bace2e3713..a759c2fe5d66 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -505,7 +505,6 @@ static void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm) static void odm_TXPowerTrackingThermalMeterInit(struct odm_dm_struct *pDM_Odm) { - pDM_Odm->RFCalibrateInfo.bTXPowerTracking = true; pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = true; } diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 47b347fe1da0..f7f85ca05bd3 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -229,7 +229,6 @@ struct odm_rf_cal { s32 RegEB4; s32 RegEBC; - bool bTXPowerTracking; u8 TxPowerTrackControl; /* for mp mode, turn off txpwrtracking * as default */ u8 TM_Trigger; -- cgit From 246c4680a94ec0844053d4f7cfe2aa923e063a2c Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Feb 2022 12:37:38 +0100 Subject: staging: r8188eu: remove constant rf variable The rf variable in odm_TXPowerTrackingCallback_ThermalMeter_8188E is always 1. The for loops that use rf will be executed only once. We can remove the variable and the loops. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220205113741.379070-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index c26c87e5cb78..5df8371a44fb 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -107,7 +107,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( s8 OFDM_index_old[2] = {0, 0}, CCK_index_old = 0; u32 i = 0, j = 0; - u8 OFDM_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */ + u8 OFDM_min_index = 6; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */ s8 OFDM_index_mapping[2][index_mapping_NUM_88E] = { {0, 0, 2, 3, 4, 4, /* 2.4G, decrease power */ 5, 6, 7, 7, 8, 9, @@ -134,8 +134,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( ThermalValue = (u8)rtl8188e_PHY_QueryRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, 0xfc00); /* 0x42: RF Reg[15:10] 88E */ - rf = 1; - if (ThermalValue) { /* Query OFDM path A default setting */ ele_D = rtl8188e_PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, bMaskDWord) & bMaskOFDM_D; @@ -171,8 +169,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( dm_odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue; dm_odm->RFCalibrateInfo.ThermalValue_IQK = ThermalValue; - for (i = 0; i < rf; i++) - dm_odm->RFCalibrateInfo.OFDM_index[i] = OFDM_index_old[i]; + dm_odm->RFCalibrateInfo.OFDM_index[0] = OFDM_index_old[0]; dm_odm->RFCalibrateInfo.CCK_index = CCK_index_old; } @@ -237,16 +234,13 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( } if (offset >= index_mapping_NUM_88E) offset = index_mapping_NUM_88E - 1; - for (i = 0; i < rf; i++) - OFDM_index[i] = dm_odm->RFCalibrateInfo.OFDM_index[i] + OFDM_index_mapping[j][offset]; + OFDM_index[0] = dm_odm->RFCalibrateInfo.OFDM_index[0] + OFDM_index_mapping[j][offset]; CCK_index = dm_odm->RFCalibrateInfo.CCK_index + OFDM_index_mapping[j][offset]; - for (i = 0; i < rf; i++) { - if (OFDM_index[i] > OFDM_TABLE_SIZE_92D - 1) - OFDM_index[i] = OFDM_TABLE_SIZE_92D - 1; - else if (OFDM_index[i] < OFDM_min_index) - OFDM_index[i] = OFDM_min_index; - } + if (OFDM_index[0] > OFDM_TABLE_SIZE_92D - 1) + OFDM_index[0] = OFDM_TABLE_SIZE_92D - 1; + else if (OFDM_index[0] < OFDM_min_index) + OFDM_index[0] = OFDM_min_index; if (CCK_index > CCK_TABLE_SIZE - 1) CCK_index = CCK_TABLE_SIZE - 1; -- cgit From 2096151fbe67bb09600d22c8bca1ebedfdd293a7 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Feb 2022 12:37:39 +0100 Subject: staging: r8188eu: RfRegChnlVal[1] is set but not used RfRegChnlVal[1] in hal_data_8188e is set but not used. This driver needs only one RfRegChnlVal setting. Replace the array with a single u32. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220205113741.379070-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 4 ++-- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 8 ++++---- drivers/staging/r8188eu/hal/usb_halinit.c | 3 +-- drivers/staging/r8188eu/include/rtl8188e_hal.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 6e26359bdda7..cd82452238e0 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -724,8 +724,8 @@ static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel) /* s2. RF dependent command - CmdID_RF_WriteReg, param1=RF_CHNLBW, param2=channel */ param1 = RF_CHNLBW; param2 = channel; - pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffffc00) | param2); - rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); + pHalData->RfRegChnlVal = ((pHalData->RfRegChnlVal & 0xfffffc00) | param2); + rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal); } void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c index ea847ec39e13..2d5d04b384d1 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c @@ -50,12 +50,12 @@ void rtl8188e_PHY_RF6052SetBandwidth(struct adapter *Adapter, switch (Bandwidth) { case HT_CHANNEL_WIDTH_20: - pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT(10) | BIT(11)); - rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); + pHalData->RfRegChnlVal = ((pHalData->RfRegChnlVal & 0xfffff3ff) | BIT(10) | BIT(11)); + rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal); break; case HT_CHANNEL_WIDTH_40: - pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT(10)); - rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); + pHalData->RfRegChnlVal = ((pHalData->RfRegChnlVal & 0xfffff3ff) | BIT(10)); + rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal); break; default: break; diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index f21b910bd88d..e8bc4a115a2b 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -668,8 +668,7 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) rtw_write16(Adapter, REG_PKT_BE_BK_LIFE_TIME, 0x0400); /* unit: 256us. 256ms */ /* Keep RfRegChnlVal for later use. */ - haldata->RfRegChnlVal[0] = rtl8188e_PHY_QueryRFReg(Adapter, (enum rf_radio_path)0, RF_CHNLBW, bRFRegOffsetMask); - haldata->RfRegChnlVal[1] = rtl8188e_PHY_QueryRFReg(Adapter, (enum rf_radio_path)1, RF_CHNLBW, bRFRegOffsetMask); + haldata->RfRegChnlVal = rtl8188e_PHY_QueryRFReg(Adapter, (enum rf_radio_path)0, RF_CHNLBW, bRFRegOffsetMask); _BBTurnOnBlock(Adapter); diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index c323476f5936..c6472d13e069 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -143,7 +143,7 @@ struct hal_data_8188e { struct bb_reg_def PHYRegDef[2]; /* Radio A/B */ - u32 RfRegChnlVal[2]; + u32 RfRegChnlVal; /* for host message to fw */ u8 LastHMEBoxNum; -- cgit From 49132583d26089e37de8c33dd0321b1d1f17be19 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Feb 2022 12:37:40 +0100 Subject: staging: r8188eu: use a define for the radio path Replace (enum rf_radio_path)0 with RF_PATH_A. This should make it easier to see which path is selected. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220205113741.379070-8-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index e8bc4a115a2b..0c0b7e819518 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -668,7 +668,7 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) rtw_write16(Adapter, REG_PKT_BE_BK_LIFE_TIME, 0x0400); /* unit: 256us. 256ms */ /* Keep RfRegChnlVal for later use. */ - haldata->RfRegChnlVal = rtl8188e_PHY_QueryRFReg(Adapter, (enum rf_radio_path)0, RF_CHNLBW, bRFRegOffsetMask); + haldata->RfRegChnlVal = rtl8188e_PHY_QueryRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask); _BBTurnOnBlock(Adapter); -- cgit From 3b011b097c386e2a2861256f8f253fce4fbf94c5 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Feb 2022 12:37:41 +0100 Subject: staging: r8188eu: limit rf register writes to path a The r8188eu driver uses only RF_PATH_A. At the moment, the only exception are private ioctls. It does not make sense if these ioctls set registers that are not used anywhere else in the driver. This patch limits the private ioctl 0x0C, i.e. the rtw_wx_write_rf function, to RF_PATH_A. For any other setting, we return an error saying the parameter is invalid. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220205113741.379070-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index c54ec5602ddf..c41d75666568 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2083,6 +2083,9 @@ static int rtw_wx_write_rf(struct net_device *dev, u32 path, addr, data32; path = *(u32 *)extra; + if (path != RF_PATH_A) + return -EINVAL; + addr = *((u32 *)extra + 1); data32 = *((u32 *)extra + 2); rtl8188e_PHY_SetRFReg(padapter, path, addr, 0xFFFFF, data32); -- cgit From bfa4b4e6912f4cc0059ef960e2586a6558a62005 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 6 Feb 2022 15:44:07 +0100 Subject: staging: r8188eu: remove UsbBulkOutSize from struct hal_data_8188e UsbBulkOutSize in struct hal_data_8188e is only used to set a local variable in rtl8188eu_xmitframe_complete(). Set the local variable directly and remove UsbBulkOutSize from the hal_data_8188e structure. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220206144407.8397-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 9 +++++++-- drivers/staging/r8188eu/hal/usb_halinit.c | 8 +------- drivers/staging/r8188eu/include/rtl8188e_hal.h | 2 -- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c index 94dafc7c1ad0..205a392a0ad3 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c @@ -382,7 +382,7 @@ static u32 xmitframe_need_length(struct xmit_frame *pxmitframe) s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) { - struct hal_data_8188e *haldata = &adapt->haldata; + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapt); struct xmit_frame *pxmitframe = NULL; struct xmit_frame *pfirstframe = NULL; @@ -396,13 +396,18 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp u32 pbuf_tail; /* last pkt tail */ u32 len; /* packet length, except TXDESC_SIZE and PKT_OFFSET */ - u32 bulksize = haldata->UsbBulkOutSize; + u32 bulksize; u8 desc_cnt; u32 bulkptr; /* dump frame variable */ u32 ff_hwaddr; + if (pdvobjpriv->ishighspeed) + bulksize = USB_HIGH_SPEED_BULK_SIZE; + else + bulksize = USB_FULL_SPEED_BULK_SIZE; + /* check xmitbuffer is ok */ if (!pxmitbuf) { pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv); diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 0c0b7e819518..3b3cb03d3989 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -45,13 +45,7 @@ static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumOutPi void rtl8188eu_interface_configure(struct adapter *adapt) { - struct hal_data_8188e *haldata = &adapt->haldata; - struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapt); - - if (pdvobjpriv->ishighspeed) - haldata->UsbBulkOutSize = USB_HIGH_SPEED_BULK_SIZE;/* 512 bytes */ - else - haldata->UsbBulkOutSize = USB_FULL_SPEED_BULK_SIZE;/* 64 bytes */ + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapt); HalUsbSetQueuePipeMapping8188EUsb(adapt, pdvobjpriv->RtNumOutPipes); } diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index c6472d13e069..5b27bae97e91 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -171,8 +171,6 @@ struct hal_data_8188e { /* Auto FSM to Turn On, include clock, isolation, power control * for MAC only */ u8 bMacPwrCtrlOn; - - u32 UsbBulkOutSize; }; s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy); -- cgit From c2e6b577784d3b1ce91115a71423c94bb2333248 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:17:56 +0100 Subject: staging: r8188eu: only OFDM_index_old[0] is used The odm_TXPowerTrackingCallback_ThermalMeter_8188E function uses only OFDM_index_old[0]. Use a single variable instead of an array. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 5df8371a44fb..08db24614ed1 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -104,7 +104,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( u32 ThermalValue_AVG = 0; s32 ele_D, TempCCk; s8 OFDM_index[2], CCK_index = 0; - s8 OFDM_index_old[2] = {0, 0}, CCK_index_old = 0; + s8 OFDM_index_old = 0, CCK_index_old = 0; u32 i = 0, j = 0; u8 OFDM_min_index = 6; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */ @@ -139,7 +139,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( ele_D = rtl8188e_PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, bMaskDWord) & bMaskOFDM_D; for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) { /* find the index */ if (ele_D == (OFDMSwingTable[i] & bMaskOFDM_D)) { - OFDM_index_old[0] = (u8)i; + OFDM_index_old = (u8)i; dm_odm->BbSwingIdxOfdmBase = (u8)i; break; } @@ -169,7 +169,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( dm_odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue; dm_odm->RFCalibrateInfo.ThermalValue_IQK = ThermalValue; - dm_odm->RFCalibrateInfo.OFDM_index[0] = OFDM_index_old[0]; + dm_odm->RFCalibrateInfo.OFDM_index[0] = OFDM_index_old; dm_odm->RFCalibrateInfo.CCK_index = CCK_index_old; } -- cgit From 18cb09cb254321f631dcdf5db63a8693a57b3273 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:17:57 +0100 Subject: staging: r8188eu: only OFDM_index[0] is used Replace the OFDM_index array in struct odm_rf_cal with a single variable. Only its first component is used. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 4 ++-- drivers/staging/r8188eu/include/odm.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 08db24614ed1..8b3bc41b7e27 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -169,7 +169,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( dm_odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue; dm_odm->RFCalibrateInfo.ThermalValue_IQK = ThermalValue; - dm_odm->RFCalibrateInfo.OFDM_index[0] = OFDM_index_old; + dm_odm->RFCalibrateInfo.OFDM_index = OFDM_index_old; dm_odm->RFCalibrateInfo.CCK_index = CCK_index_old; } @@ -234,7 +234,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( } if (offset >= index_mapping_NUM_88E) offset = index_mapping_NUM_88E - 1; - OFDM_index[0] = dm_odm->RFCalibrateInfo.OFDM_index[0] + OFDM_index_mapping[j][offset]; + OFDM_index[0] = dm_odm->RFCalibrateInfo.OFDM_index + OFDM_index_mapping[j][offset]; CCK_index = dm_odm->RFCalibrateInfo.CCK_index + OFDM_index_mapping[j][offset]; if (OFDM_index[0] > OFDM_TABLE_SIZE_92D - 1) diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index f7f85ca05bd3..698d61d5fc40 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -254,7 +254,7 @@ struct odm_rf_cal { u8 bCCKinCH14; u8 CCK_index; - u8 OFDM_index[2]; + u8 OFDM_index; bool bDoneTxpower; u8 ThermalValue_HP[HP_THERMAL_NUM]; -- cgit From 8a1cf651d602f01aba62f3935b17bb09f5db37d3 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:17:58 +0100 Subject: staging: r8188eu: replace local OFDM_index with single variable Replace the local OFDM_index array in the odm_TXPowerTrackingCallback_ThermalMeter_8188E function with a single variable. Only its first component is used. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 8b3bc41b7e27..27cac9775a90 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -103,7 +103,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( u8 ThermalValue_AVG_count = 0; u32 ThermalValue_AVG = 0; s32 ele_D, TempCCk; - s8 OFDM_index[2], CCK_index = 0; + s8 OFDM_index, CCK_index = 0; s8 OFDM_index_old = 0, CCK_index_old = 0; u32 i = 0, j = 0; @@ -234,13 +234,13 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( } if (offset >= index_mapping_NUM_88E) offset = index_mapping_NUM_88E - 1; - OFDM_index[0] = dm_odm->RFCalibrateInfo.OFDM_index + OFDM_index_mapping[j][offset]; + OFDM_index = dm_odm->RFCalibrateInfo.OFDM_index + OFDM_index_mapping[j][offset]; CCK_index = dm_odm->RFCalibrateInfo.CCK_index + OFDM_index_mapping[j][offset]; - if (OFDM_index[0] > OFDM_TABLE_SIZE_92D - 1) - OFDM_index[0] = OFDM_TABLE_SIZE_92D - 1; - else if (OFDM_index[0] < OFDM_min_index) - OFDM_index[0] = OFDM_min_index; + if (OFDM_index > OFDM_TABLE_SIZE_92D - 1) + OFDM_index = OFDM_TABLE_SIZE_92D - 1; + else if (OFDM_index < OFDM_min_index) + OFDM_index = OFDM_min_index; if (CCK_index > CCK_TABLE_SIZE - 1) CCK_index = CCK_TABLE_SIZE - 1; @@ -253,7 +253,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( dm_odm->RFCalibrateInfo.bDoneTxpower = true; /* Revse TX power table. */ - dm_odm->BbSwingIdxOfdm = (u8)OFDM_index[0]; + dm_odm->BbSwingIdxOfdm = (u8)OFDM_index; dm_odm->BbSwingIdxCck = (u8)CCK_index; if (dm_odm->BbSwingIdxOfdmCurrent != dm_odm->BbSwingIdxOfdm) { -- cgit From fa6ffa4a7587288065a9239f69690223a818df94 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:17:59 +0100 Subject: staging: r8188eu: remove debug code to bypass LC calibration Remove a check before the LC calibration that is always false. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 27cac9775a90..0c2dbef59197 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -895,15 +895,10 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery) void PHY_LCCalibrate_8188E(struct adapter *adapt) { - bool singletone = false, carrier_sup = false; u32 timeout = 2000, timecount = 0; struct hal_data_8188e *pHalData = &adapt->haldata; struct odm_dm_struct *dm_odm = &pHalData->odmpriv; - /* 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) */ - if (singletone || carrier_sup) - return; - while (*dm_odm->pbScanInProcess && timecount < timeout) { mdelay(50); timecount += 50; -- cgit From 521e63c5d9a508fab4c3038c2fc8d821a6f1ae72 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:18:00 +0100 Subject: staging: r8188eu: remove debug code to bypass IQ calibration Remove a check before the IQ calibration that is always false. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 0c2dbef59197..8edae488d998 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -795,7 +795,6 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery) bool pathaok; s32 RegE94, RegE9C, RegEA4, RegEB4, RegEBC; bool is12simular, is13simular, is23simular; - bool singletone = false, carrier_sup = false; u32 IQK_BB_REG_92C[IQK_BB_REG_NUM] = { rOFDM0_XARxIQImbalance, rOFDM0_XBRxIQImbalance, rOFDM0_ECCAThreshold, rOFDM0_AGCRSSITable, @@ -803,10 +802,6 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery) rOFDM0_XCTxAFE, rOFDM0_XDTxAFE, rOFDM0_RxIQExtAnta}; - /* 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) */ - if (singletone || carrier_sup) - return; - if (recovery) { reload_adda_reg(adapt, IQK_BB_REG_92C, dm_odm->RFCalibrateInfo.IQK_BB_backup_recover, 9); return; -- cgit From fc91b5bf8cf00bc9d0f52d0617f0870454419e6b Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:18:01 +0100 Subject: staging: r8188eu: move local definitions into rtw_fw.h Move some defines and the definition of struct rt_firmware_hdr from rtw_fw.h to rtw_fw.c. These definitions are used only by the fw layer. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_fw.c | 45 ++++++++++++++++++++++++++++++++ drivers/staging/r8188eu/include/rtw_fw.h | 45 -------------------------------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188eu/core/rtw_fw.c index fa29d47bf165..f591b091b8af 100644 --- a/drivers/staging/r8188eu/core/rtw_fw.c +++ b/drivers/staging/r8188eu/core/rtw_fw.c @@ -4,6 +4,51 @@ #include #include "../include/rtw_fw.h" +#define MAX_REG_BOLCK_SIZE 196 +#define FW_8188E_START_ADDRESS 0x1000 +#define MAX_PAGE_SIZE 4096 + +#define IS_FW_HEADER_EXIST(_fwhdr) \ + ((le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x92C0 || \ + (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88C0 || \ + (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x2300 || \ + (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88E0) + +/* This structure must be careful with byte-ordering */ + +struct rt_firmware_hdr { + /* 8-byte alinment required */ + /* LONG WORD 0 ---- */ + __le16 Signature; /* 92C0: test chip; 92C, + * 88C0: test chip; 88C1: MP A-cut; + * 92C1: MP A-cut */ + u8 Category; /* AP/NIC and USB/PCI */ + u8 Function; /* Reserved for different FW function + * indcation, for further use when + * driver needs to download different + * FW for different conditions */ + __le16 Version; /* FW Version */ + u8 Subversion; /* FW Subversion, default 0x00 */ + u16 Rsvd1; + + /* LONG WORD 1 ---- */ + u8 Month; /* Release time Month field */ + u8 Date; /* Release time Date field */ + u8 Hour; /* Release time Hour field */ + u8 Minute; /* Release time Minute field */ + __le16 RamCodeSize; /* The size of RAM code */ + u8 Foundry; + u8 Rsvd2; + + /* LONG WORD 2 ---- */ + __le32 SvnIdx; /* The SVN entry index */ + u32 Rsvd3; + + /* LONG WORD 3 ---- */ + u32 Rsvd4; + u32 Rsvd5; +}; + static void fw_download_enable(struct adapter *padapter, bool enable) { u8 tmp; diff --git a/drivers/staging/r8188eu/include/rtw_fw.h b/drivers/staging/r8188eu/include/rtw_fw.h index 2ee9ae70a468..c4b1a8370b4a 100644 --- a/drivers/staging/r8188eu/include/rtw_fw.h +++ b/drivers/staging/r8188eu/include/rtw_fw.h @@ -6,51 +6,6 @@ #include "drv_types.h" -#define MAX_REG_BOLCK_SIZE 196 -#define FW_8188E_START_ADDRESS 0x1000 -#define MAX_PAGE_SIZE 4096 - -#define IS_FW_HEADER_EXIST(_fwhdr) \ - ((le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x92C0 || \ - (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88C0 || \ - (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x2300 || \ - (le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88E0) - -/* This structure must be careful with byte-ordering */ - -struct rt_firmware_hdr { - /* 8-byte alinment required */ - /* LONG WORD 0 ---- */ - __le16 Signature; /* 92C0: test chip; 92C, - * 88C0: test chip; 88C1: MP A-cut; - * 92C1: MP A-cut */ - u8 Category; /* AP/NIC and USB/PCI */ - u8 Function; /* Reserved for different FW function - * indcation, for further use when - * driver needs to download different - * FW for different conditions */ - __le16 Version; /* FW Version */ - u8 Subversion; /* FW Subversion, default 0x00 */ - u16 Rsvd1; - - /* LONG WORD 1 ---- */ - u8 Month; /* Release time Month field */ - u8 Date; /* Release time Date field */ - u8 Hour; /* Release time Hour field */ - u8 Minute; /* Release time Minute field */ - __le16 RamCodeSize; /* The size of RAM code */ - u8 Foundry; - u8 Rsvd2; - - /* LONG WORD 2 ---- */ - __le32 SvnIdx; /* The SVN entry index */ - u32 Rsvd3; - - /* LONG WORD 3 ---- */ - u32 Rsvd4; - u32 Rsvd5; -}; - int rtl8188e_firmware_download(struct adapter *padapter); void rtw_reset_8051(struct adapter *padapter); -- cgit From e3b1450dfc386df3e31b52a1569461eb1e70c16f Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:18:02 +0100 Subject: staging: r8188eu: remove unused enum _IFACE_TYPE enum _IFACE_TYPE is not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-8-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/drv_types.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 388822dd325d..91e25a2b5947 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -159,12 +159,6 @@ static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj) return &dvobj->pusbintf->dev; }; -enum _IFACE_TYPE { - IFACE_PORT0, /* mapping to port0 for C/D series chips */ - IFACE_PORT1, /* mapping to port1 for C/D series chip */ - MAX_IFACE_PORT, -}; - enum _ADAPTER_TYPE { PRIMARY_ADAPTER, SECONDARY_ADAPTER, -- cgit From 3c4b62e3819c552c03a269d18126f0603bc62e85 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:18:03 +0100 Subject: staging: r8188eu: remove unused enum _ADAPTER_TYPE enum _ADAPTER_TYPE is not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/drv_types.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 91e25a2b5947..a07bcf0b6358 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -159,12 +159,6 @@ static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj) return &dvobj->pusbintf->dev; }; -enum _ADAPTER_TYPE { - PRIMARY_ADAPTER, - SECONDARY_ADAPTER, - MAX_ADAPTER, -}; - enum driver_state { DRIVER_NORMAL = 0, DRIVER_DISAPPEAR = 1, -- cgit From de424be4e976a43d89c04f2fbc6530ea3bf28df8 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:18:04 +0100 Subject: staging: r8188eu: remove the global DriverState DriverState in struct adapter is never set. It remains 0 (DRIVER_NORMAL) all the time, DriverState != DRIVER_DISAPPEAR is always true. Both DriverState and the check can be removed. enum driver_state contains the possible values of DriverState. This enum can be removed as well. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-10-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/drv_types.h | 8 -------- drivers/staging/r8188eu/os_dep/usb_intf.c | 8 +++----- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index a07bcf0b6358..1260cacbae64 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -159,15 +159,7 @@ static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj) return &dvobj->pusbintf->dev; }; -enum driver_state { - DRIVER_NORMAL = 0, - DRIVER_DISAPPEAR = 1, - DRIVER_REPLACE_DONGLE = 2, -}; - struct adapter { - int DriverState;/* for disable driver using module, use dongle toi - * replace module. */ int pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */ int bDongle;/* build-in module or external dongle */ diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c index 1a67486ff5fb..b20d0eca12fa 100644 --- a/drivers/staging/r8188eu/os_dep/usb_intf.c +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c @@ -454,11 +454,9 @@ static void rtw_usb_if1_deinit(struct adapter *if1) free_mlme_ap_info(if1); - if (if1->DriverState != DRIVER_DISAPPEAR) { - if (pnetdev) { - /* will call netdev_close() */ - unregister_netdev(pnetdev); - } + if (pnetdev) { + /* will call netdev_close() */ + unregister_netdev(pnetdev); } rtw_cancel_all_timer(if1); -- cgit From e5b45a53efc89bb3ecaf10002f79d931018dbac7 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:18:05 +0100 Subject: staging: r8188eu: remove unused struct adapter components Remove a number of unused components from struct adapter. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-11-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/drv_types.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 1260cacbae64..4553cfda0aa4 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -161,7 +161,6 @@ static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj) struct adapter { int pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */ - int bDongle;/* build-in module or external dongle */ struct dvobj_priv *dvobj; struct mlme_priv mlmepriv; @@ -186,20 +185,11 @@ struct adapter { s32 bSurpriseRemoved; s32 bCardDisableWOHSM; - u32 IsrContent; - u32 ImrContent; - u8 EepromAddressSize; u8 hw_init_completed; - u8 bDriverIsGoingToUnload; - u8 init_adpt_in_progress; - u8 bHaltInProgress; s8 signal_strength; void *cmdThread; - void *evtThread; - void *xmitThread; - void *recvThread; void (*intf_start)(struct adapter *adapter); void (*intf_stop)(struct adapter *adapter); struct net_device *pnetdev; @@ -219,7 +209,6 @@ struct adapter { int net_closed; u8 bFWReady; - u8 bBTFWReady; u8 bReadPortCancel; u8 bWritePortCancel; u8 bRxRSSIDisplay; -- cgit From 72d8054a5b59ada208d8b659ce8092c2f10d8c2f Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:18:06 +0100 Subject: staging: r8188eu: in_cta_test is always 0 in_cta_test in struct adapter is never set, so it's always 0. Remove in_cta_test and related dead code. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-12-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 16 ++-------------- drivers/staging/r8188eu/include/drv_types.h | 2 -- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 3b3cb03d3989..659e0f26db29 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1105,13 +1105,7 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) { rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID_BCN); } else { - if (Adapter->in_cta_test) { - u32 v = rtw_read32(Adapter, REG_RCR); - v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN);/* RCR_ADF */ - rtw_write32(Adapter, REG_RCR, v); - } else { - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID_BCN); - } + rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID_BCN); } } break; @@ -1125,13 +1119,7 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) /* enable to rx data frame.Accept all data frame */ rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF); - if (Adapter->in_cta_test) { - u32 v = rtw_read32(Adapter, REG_RCR); - v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN);/* RCR_ADF */ - rtw_write32(Adapter, REG_RCR, v); - } else { - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID_DATA | RCR_CBSSID_BCN); - } + rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID_DATA | RCR_CBSSID_BCN); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) RetryLimit = 48; diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 4553cfda0aa4..3d5eb37a4c51 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -232,8 +232,6 @@ struct adapter { unsigned char br_mac[ETH_ALEN]; unsigned char br_ip[4]; struct br_ext_info ethBrExtInfo; - - unsigned char in_cta_test; }; #define adapter_to_dvobj(adapter) (adapter->dvobj) -- cgit From 2a02c1adf86e4406be8cb3c0bbcb34d045d78be7 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:18:07 +0100 Subject: staging: r8188eu: irq_alloc is not used irq_alloc in struct dvobj_priv is not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-13-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/drv_types.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 3d5eb37a4c51..b02940accc4e 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -133,8 +133,6 @@ struct dvobj_priv { int RtOutPipe[3]; u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */ - u8 irq_alloc; - struct rt_firmware firmware; /*-------- below is for USB INTERFACE --------*/ -- cgit From f59d7c0b60dec63c9a09d5a39146bd01655ef3ef Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:18:08 +0100 Subject: staging: r8188eu: not_indic_disco is unused not_indic_disco in struct mlme_priv is not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-14-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_mlme.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/rtw_mlme.h b/drivers/staging/r8188eu/include/rtw_mlme.h index 77169c15080a..30ee46ccdb21 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme.h +++ b/drivers/staging/r8188eu/include/rtw_mlme.h @@ -316,7 +316,6 @@ struct mlme_priv { u8 *nic_hdl; - u8 not_indic_disco; struct list_head *pscanned; struct __queue free_bss_pool; struct __queue scanned_queue; -- cgit From c781d8db2c577aef116db0449597c717a83b1515 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 17:18:09 +0100 Subject: staging: r8188eu: remove unused struct hostapd_priv struct hostapd_priv contains only a pointer to struct adapter. Remove this struct and the unused phostapdpriv pointer in struct adapter. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206161809.423031-15-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/drv_types.h | 1 - drivers/staging/r8188eu/include/rtw_mlme.h | 4 ---- 2 files changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index b02940accc4e..987dae613d8b 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -174,7 +174,6 @@ struct adapter { struct pwrctrl_priv pwrctrlpriv; struct eeprom_priv eeprompriv; struct led_priv ledpriv; - struct hostapd_priv *phostapdpriv; struct wifidirect_info wdinfo; struct hal_data_8188e haldata; diff --git a/drivers/staging/r8188eu/include/rtw_mlme.h b/drivers/staging/r8188eu/include/rtw_mlme.h index 30ee46ccdb21..ed2a50bad66e 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme.h +++ b/drivers/staging/r8188eu/include/rtw_mlme.h @@ -416,10 +416,6 @@ struct mlme_priv { u8 update_bcn; }; -struct hostapd_priv { - struct adapter *padapter; -}; - int hostapd_mode_init(struct adapter *padapter); void hostapd_mode_unload(struct adapter *padapter); -- cgit From a548aea7ff6bdbdc00bb238707113b71b4c74f3a Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 18:59:21 +0100 Subject: staging: r8188eu: usb_vendor_req_mutex is not used usb_vendor_req_mutex in struct dvobj_priv is not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206175925.461426-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/drv_types.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 987dae613d8b..7e6385109cbc 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -141,7 +141,6 @@ struct dvobj_priv { u8 RtNumOutPipes; int RegUsbSS; struct semaphore usb_suspend_sema; - struct mutex usb_vendor_req_mutex; struct usb_interface *pusbintf; struct usb_device *pusbdev; -- cgit From ac510bbe168dfe2d52b1e18f4c4668328899b928 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 18:59:22 +0100 Subject: staging: r8188eu: dvobj_priv's signal_strength is not used signal_strength is struct dvobj_priv is not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206175925.461426-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/drv_types.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 7e6385109cbc..79ff0b25914c 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -146,7 +146,6 @@ struct dvobj_priv { struct usb_device *pusbdev; atomic_t continual_urb_error; - u8 signal_strength; }; static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj) -- cgit From 0266c945a8ffd86ca9c5dcb24688dcfd338269ed Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 18:59:23 +0100 Subject: staging: r8188eu: RegUsbSS is not used RegUsbSS in struct dvobj_priv is not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206175925.461426-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/drv_types.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 79ff0b25914c..e3acac56ce6e 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -139,7 +139,6 @@ struct dvobj_priv { u8 ishighspeed; u8 RtNumOutPipes; - int RegUsbSS; struct semaphore usb_suspend_sema; struct usb_interface *pusbintf; -- cgit From 1091a8737b9ea32960d73bedb4d30c34aace5f9a Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 6 Feb 2022 18:59:24 +0100 Subject: staging: r8188eu: usb_suspend_sema is initialised but not used usb_suspend_sema from struct dvobj_priv is initialised but never used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220206175925.461426-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/drv_types.h | 1 - drivers/staging/r8188eu/os_dep/usb_intf.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index e3acac56ce6e..618a6529192b 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -139,7 +139,6 @@ struct dvobj_priv { u8 ishighspeed; u8 RtNumOutPipes; - struct semaphore usb_suspend_sema; struct usb_interface *pusbintf; struct usb_device *pusbdev; diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c index b20d0eca12fa..10c33e2ae3bc 100644 --- a/drivers/staging/r8188eu/os_dep/usb_intf.c +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c @@ -126,7 +126,6 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) } /* 3 misc */ - sema_init(&pdvobjpriv->usb_suspend_sema, 0); rtw_reset_continual_urb_error(pdvobjpriv); usb_get_dev(pusbd); -- cgit From 20198dd98cb5eb32e87f9370d20717b460c75d4a Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Fri, 4 Feb 2022 17:29:44 -0600 Subject: staging: gdm724x: Replace one-element array with flexible-array member MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. This helps with the ongoing efforts to globally enable -Warray-bounds and get us closer to being able to tighten the FORTIFY_SOURCE routines on memcpy(). This issue was found with the help of Coccinelle and audited and fixed, manually. [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays Link: https://github.com/KSPP/linux/issues/79 Reviewed-by: Dan Carpenter Signed-off-by: Gustavo A. R. Silva Link: https://lore.kernel.org/r/20220204232944.GA454945@embeddedor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/hci_packet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gdm724x/hci_packet.h b/drivers/staging/gdm724x/hci_packet.h index faecdfbc664f..3bb01e94f3b5 100644 --- a/drivers/staging/gdm724x/hci_packet.h +++ b/drivers/staging/gdm724x/hci_packet.h @@ -34,7 +34,7 @@ struct hci_packet { struct tlv { u8 type; u8 len; - u8 *data[1]; + u8 *data[]; } __packed; struct sdu_header { -- cgit From 4948dbb78d53a69a5637b9651f5e4a573ad9bca3 Mon Sep 17 00:00:00 2001 From: Leonardo Araujo Date: Mon, 7 Feb 2022 01:42:30 -0300 Subject: Staging: unisys: visorhba: alignment should match open parenthesis Fixed a coding style issue. Signed-off-by: Leonardo Araujo Link: https://lore.kernel.org/r/20220207044230.19918-1-leonardo.aa88@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorhba/visorhba_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 8eee131e834d..48aa18f8b984 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -192,7 +192,7 @@ static struct uiscmdrsp *get_scsipending_cmdrsp(struct visorhba_devdata *ddata, * @result: The location to place the result of the event handle into */ static int setup_scsitaskmgmt_handles(struct xarray *xa, struct uiscmdrsp *cmdrsp, - wait_queue_head_t *event, int *result) + wait_queue_head_t *event, int *result) { int ret; u32 id; -- cgit From 171561849655ee8f0e2c25513fbe0c27026e4777 Mon Sep 17 00:00:00 2001 From: Leonardo Araujo Date: Mon, 7 Feb 2022 20:42:10 -0300 Subject: Staging: r8188eu: core: 'associcated' may be misspelled - perhaps 'associated'? This patch fixes the following checkpatch.pl warning: CHECK: 'associcated' may be misspelled - perhaps 'associated'? Signed-off-by: Leonardo Araujo Link: https://lore.kernel.org/r/20220207234210.26097-1-leonardo.aa88@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_ap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c index 1486ec613458..19d12dd9788e 100644 --- a/drivers/staging/r8188eu/core/rtw_ap.c +++ b/drivers/staging/r8188eu/core/rtw_ap.c @@ -785,7 +785,7 @@ static int rtw_ht_operation_update(struct adapter *padapter) void associated_clients_update(struct adapter *padapter, u8 updated) { - /* update associcated stations cap. */ + /* update associated stations cap. */ if (updated) { struct list_head *phead, *plist; struct sta_info *psta = NULL; @@ -939,7 +939,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true); } - /* update associcated stations cap. */ + /* update associated stations cap. */ associated_clients_update(padapter, beacon_updated); netdev_dbg(padapter->pnetdev, "updated = %d\n", beacon_updated); @@ -1003,7 +1003,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta) update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true); } - /* update associcated stations cap. */ + /* update associated stations cap. */ netdev_dbg(padapter->pnetdev, "updated = %d\n", beacon_updated); -- cgit From 9e223aa451a136ab148c5c362ef16d186c815b40 Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Sun, 6 Feb 2022 18:55:09 +1300 Subject: staging: pi433: remove register debug dev_dbg stmts using DEBUG_VALUES Which the recent addition of the debugfs dentry (regs), users can now obtain rf69 register values without having to tweak constants (DEBUG_VALUES) and recompile the pi433 module source code in order to see those values. This patch removes code blocks made obsolete by debugfs regs file. Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/Yf9ivRB5qpmA5rY2@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/rf69.c | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index 2ab3bf46e37d..bf26aef69daa 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -8,8 +8,6 @@ /* enable prosa debug info */ #undef DEBUG -/* enable print of values on reg access */ -#undef DEBUG_VALUES /* enable print of values on fifo access */ #undef DEBUG_FIFO_ACCESS @@ -26,48 +24,17 @@ u8 rf69_read_reg(struct spi_device *spi, u8 addr) { - int retval; - - retval = spi_w8r8(spi, addr); - -#ifdef DEBUG_VALUES - if (retval < 0) - /* - * should never happen, since we already checked, - * that module is connected. Therefore no error - * handling, just an optional error message... - */ - dev_dbg(&spi->dev, "read 0x%x FAILED\n", addr); - else - dev_dbg(&spi->dev, "read 0x%x from reg 0x%x\n", retval, addr); -#endif - - return retval; + return spi_w8r8(spi, addr); } static int rf69_write_reg(struct spi_device *spi, u8 addr, u8 value) { - int retval; char buffer[2]; buffer[0] = addr | WRITE_BIT; buffer[1] = value; - retval = spi_write(spi, &buffer, 2); - -#ifdef DEBUG_VALUES - if (retval < 0) - /* - * should never happen, since we already checked, - * that module is connected. Therefore no error - * handling, just an optional error message... - */ - dev_dbg(&spi->dev, "write 0x%x to 0x%x FAILED\n", value, addr); - else - dev_dbg(&spi->dev, "wrote 0x%x to reg 0x%x\n", value, addr); -#endif - - return retval; + return spi_write(spi, &buffer, ARRAY_SIZE(buffer)); } /*-------------------------------------------------------------------------*/ -- cgit From 1b6a6147374eb37f652cd0a4e5b121ef8077c4d3 Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Mon, 7 Feb 2022 10:06:36 +1300 Subject: staging: pi433: standardize use of line escape chars in dev_dbg stmts In this driver there are strings ending with of both '\n' and '' (without '\n') when using dev_dbg function. While it doesn't affect drivers functionality, it would be good to keep it consistent across the driver's source code. This patch add '\n' characters where it's missing to make it consistent with the other dev_dbg instances. Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/YgA4XHU4uf6YkOk5@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/pi433_if.c | 54 ++++++++++++++++++++-------------------- drivers/staging/pi433/rf69.c | 51 ++++++++++++++++++------------------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 4fbac3ccef74..069255f023c8 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -414,7 +414,7 @@ static int pi433_receive(void *data) dev->interrupt_rx_allowed = false; /* wait for any tx to finish */ - dev_dbg(dev->dev, "rx: going to wait for any tx to finish"); + dev_dbg(dev->dev, "rx: going to wait for any tx to finish\n"); retval = wait_event_interruptible(dev->rx_wait_queue, !dev->tx_active); if (retval) { /* wait was interrupted */ @@ -440,7 +440,7 @@ static int pi433_receive(void *data) wake_up_interruptible(&dev->tx_wait_queue); /* wait for RSSI level to become high */ - dev_dbg(dev->dev, "rx: going to wait for high RSSI level"); + dev_dbg(dev->dev, "rx: going to wait for high RSSI level\n"); retval = wait_event_interruptible(dev->rx_wait_queue, rf69_get_flag(dev->spi, rssi_exceeded_threshold)); @@ -467,11 +467,11 @@ static int pi433_receive(void *data) goto abort; } bytes_total = dev->rx_cfg.fixed_message_length; - dev_dbg(dev->dev, "rx: msg len set to %d by fixed length", + dev_dbg(dev->dev, "rx: msg len set to %d by fixed length\n", bytes_total); } else { bytes_total = dev->rx_buffer_size; - dev_dbg(dev->dev, "rx: msg len set to %d as requested by read", + dev_dbg(dev->dev, "rx: msg len set to %d as requested by read\n", bytes_total); } @@ -488,7 +488,7 @@ static int pi433_receive(void *data) goto abort; } dev->free_in_fifo++; - dev_dbg(dev->dev, "rx: msg len reset to %d due to length byte", + dev_dbg(dev->dev, "rx: msg len reset to %d due to length byte\n", bytes_total); } @@ -505,7 +505,7 @@ static int pi433_receive(void *data) rf69_read_fifo(spi, &dummy, 1); dev->free_in_fifo++; - dev_dbg(dev->dev, "rx: address byte stripped off"); + dev_dbg(dev->dev, "rx: address byte stripped off\n"); } /* get payload */ @@ -567,7 +567,7 @@ static int pi433_tx_thread(void *data) while (1) { /* wait for fifo to be populated or for request to terminate*/ - dev_dbg(device->dev, "thread: going to wait for new messages"); + dev_dbg(device->dev, "thread: going to wait for new messages\n"); wait_event_interruptible(device->tx_wait_queue, (!kfifo_is_empty(&device->tx_fifo) || kthread_should_stop())); @@ -583,7 +583,7 @@ static int pi433_tx_thread(void *data) retval = kfifo_out(&device->tx_fifo, &tx_cfg, sizeof(tx_cfg)); if (retval != sizeof(tx_cfg)) { dev_dbg(device->dev, - "reading tx_cfg from fifo failed: got %d byte(s), expected %d", + "reading tx_cfg from fifo failed: got %d byte(s), expected %d\n", retval, (unsigned int)sizeof(tx_cfg)); continue; } @@ -591,7 +591,7 @@ static int pi433_tx_thread(void *data) retval = kfifo_out(&device->tx_fifo, &size, sizeof(size_t)); if (retval != sizeof(size_t)) { dev_dbg(device->dev, - "reading msg size from fifo failed: got %d, expected %d", + "reading msg size from fifo failed: got %d, expected %d\n", retval, (unsigned int)sizeof(size_t)); continue; } @@ -628,7 +628,7 @@ static int pi433_tx_thread(void *data) retval = kfifo_out(&device->tx_fifo, &device->buffer[position], sizeof(device->buffer) - position); dev_dbg(device->dev, - "read %d message byte(s) from fifo queue.", retval); + "read %d message byte(s) from fifo queue.\n", retval); /* * if rx is active, we need to interrupt the waiting for @@ -733,7 +733,7 @@ static int pi433_tx_thread(void *data) /* we are done. Wait for packet to get sent */ dev_dbg(device->dev, - "thread: wait for packet to get sent/fifo to be empty"); + "thread: wait for packet to get sent/fifo to be empty\n"); wait_event_interruptible(device->fifo_wait_queue, device->free_in_fifo == FIFO_SIZE || kthread_should_stop()); @@ -741,7 +741,7 @@ static int pi433_tx_thread(void *data) return 0; /* STOP_TRANSMISSION */ - dev_dbg(device->dev, "thread: Packet sent. Set mode to stby."); + dev_dbg(device->dev, "thread: Packet sent. Set mode to stby.\n"); retval = rf69_set_mode(spi, standby); if (retval < 0) goto abort; @@ -831,7 +831,7 @@ pi433_write(struct file *filp, const char __user *buf, */ if (!instance->tx_cfg_initialized) { dev_notice_once(device->dev, - "write: failed due to unconfigured tx_cfg (see PI433_IOC_WR_TX_CFG)"); + "write: failed due to unconfigured tx_cfg (see PI433_IOC_WR_TX_CFG)\n"); return -EINVAL; } @@ -846,7 +846,7 @@ pi433_write(struct file *filp, const char __user *buf, required = sizeof(instance->tx_cfg) + sizeof(size_t) + count; available = kfifo_avail(&device->tx_fifo); if (required > available) { - dev_dbg(device->dev, "write to fifo failed: %d bytes required but %d available", + dev_dbg(device->dev, "write to fifo failed: %d bytes required but %d available\n", required, available); mutex_unlock(&device->tx_fifo_lock); return -EAGAIN; @@ -869,13 +869,13 @@ pi433_write(struct file *filp, const char __user *buf, /* start transfer */ wake_up_interruptible(&device->tx_wait_queue); - dev_dbg(device->dev, "write: generated new msg with %d bytes.", copied); + dev_dbg(device->dev, "write: generated new msg with %d bytes.\n", copied); return copied; abort: dev_warn(device->dev, - "write to fifo failed, non recoverable: 0x%x", retval); + "write to fifo failed, non recoverable: 0x%x\n", retval); mutex_unlock(&device->tx_fifo_lock); return -EAGAIN; } @@ -1000,12 +1000,12 @@ static int setup_gpio(struct pi433_device *device) if (device->gpiod[i] == ERR_PTR(-ENOENT)) { dev_dbg(&device->spi->dev, - "Could not find entry for %s. Ignoring.", name); + "Could not find entry for %s. Ignoring.\n", name); continue; } if (device->gpiod[i] == ERR_PTR(-EBUSY)) - dev_dbg(&device->spi->dev, "%s is busy.", name); + dev_dbg(&device->spi->dev, "%s is busy.\n", name); if (IS_ERR(device->gpiod[i])) { retval = PTR_ERR(device->gpiod[i]); @@ -1038,7 +1038,7 @@ static int setup_gpio(struct pi433_device *device) if (retval) return retval; - dev_dbg(&device->spi->dev, "%s successfully configured", name); + dev_dbg(&device->spi->dev, "%s successfully configured\n", name); } return 0; @@ -1186,7 +1186,7 @@ static int pi433_probe(struct spi_device *spi) } dev_dbg(&spi->dev, - "spi interface setup: mode 0x%2x, %d bits per word, %dhz max speed", + "spi interface setup: mode 0x%2x, %d bits per word, %dhz max speed\n", spi->mode, spi->bits_per_word, spi->max_speed_hz); /* read chip version */ @@ -1196,10 +1196,10 @@ static int pi433_probe(struct spi_device *spi) switch (retval) { case 0x24: - dev_dbg(&spi->dev, "found pi433 (ver. 0x%x)", retval); + dev_dbg(&spi->dev, "found pi433 (ver. 0x%x)\n", retval); break; default: - dev_dbg(&spi->dev, "unknown chip version: 0x%x", retval); + dev_dbg(&spi->dev, "unknown chip version: 0x%x\n", retval); return -ENODEV; } @@ -1236,7 +1236,7 @@ static int pi433_probe(struct spi_device *spi) /* setup GPIO (including irq_handler) for the different DIOs */ retval = setup_gpio(device); if (retval) { - dev_dbg(&spi->dev, "setup of GPIOs failed"); + dev_dbg(&spi->dev, "setup of GPIOs failed\n"); goto GPIO_failed; } @@ -1266,7 +1266,7 @@ static int pi433_probe(struct spi_device *spi) /* determ minor number */ retval = pi433_get_minor(device); if (retval) { - dev_dbg(&spi->dev, "get of minor number failed"); + dev_dbg(&spi->dev, "get of minor number failed\n"); goto minor_failed; } @@ -1295,7 +1295,7 @@ static int pi433_probe(struct spi_device *spi) "pi433.%d_tx_task", device->minor); if (IS_ERR(device->tx_task_struct)) { - dev_dbg(device->dev, "start of send thread failed"); + dev_dbg(device->dev, "start of send thread failed\n"); retval = PTR_ERR(device->tx_task_struct); goto send_thread_failed; } @@ -1303,7 +1303,7 @@ static int pi433_probe(struct spi_device *spi) /* create cdev */ device->cdev = cdev_alloc(); if (!device->cdev) { - dev_dbg(device->dev, "allocation of cdev failed"); + dev_dbg(device->dev, "allocation of cdev failed\n"); retval = -ENOMEM; goto cdev_failed; } @@ -1311,7 +1311,7 @@ static int pi433_probe(struct spi_device *spi) cdev_init(device->cdev, &pi433_fops); retval = cdev_add(device->cdev, device->devt, 1); if (retval) { - dev_dbg(device->dev, "register of cdev failed"); + dev_dbg(device->dev, "register of cdev failed\n"); goto del_cdev; } diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index bf26aef69daa..a8def70808d6 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -85,7 +85,7 @@ int rf69_set_mode(struct spi_device *spi, enum mode mode) }; if (unlikely(mode >= ARRAY_SIZE(mode_map))) { - dev_dbg(&spi->dev, "set: illegal mode %u", mode); + dev_dbg(&spi->dev, "set: illegal mode %u\n", mode); return -EINVAL; } @@ -115,7 +115,7 @@ int rf69_set_modulation(struct spi_device *spi, enum modulation modulation) }; if (unlikely(modulation >= ARRAY_SIZE(modulation_map))) { - dev_dbg(&spi->dev, "set: illegal modulation %u", modulation); + dev_dbg(&spi->dev, "set: illegal modulation %u\n", modulation); return -EINVAL; } @@ -163,7 +163,7 @@ int rf69_set_modulation_shaping(struct spi_device *spi, MASK_DATAMODUL_MODULATION_SHAPE, DATAMODUL_MODULATION_SHAPE_0_3); default: - dev_dbg(&spi->dev, "set: illegal mod shaping for FSK %u", mod_shaping); + dev_dbg(&spi->dev, "set: illegal mod shaping for FSK %u\n", mod_shaping); return -EINVAL; } case OOK: @@ -181,11 +181,11 @@ int rf69_set_modulation_shaping(struct spi_device *spi, MASK_DATAMODUL_MODULATION_SHAPE, DATAMODUL_MODULATION_SHAPE_2BR); default: - dev_dbg(&spi->dev, "set: illegal mod shaping for OOK %u", mod_shaping); + dev_dbg(&spi->dev, "set: illegal mod shaping for OOK %u\n", mod_shaping); return -EINVAL; } default: - dev_dbg(&spi->dev, "set: modulation undefined"); + dev_dbg(&spi->dev, "set: modulation undefined\n"); return -EINVAL; } } @@ -201,13 +201,13 @@ int rf69_set_bit_rate(struct spi_device *spi, u16 bit_rate) // check if modulation is configured mod = rf69_get_modulation(spi); if (mod == UNDEF) { - dev_dbg(&spi->dev, "setBitRate: modulation is undefined"); + dev_dbg(&spi->dev, "setBitRate: modulation is undefined\n"); return -EINVAL; } // check input value if (bit_rate < 1200 || (mod == OOK && bit_rate > 32768)) { - dev_dbg(&spi->dev, "setBitRate: illegal input param"); + dev_dbg(&spi->dev, "setBitRate: illegal input param\n"); return -EINVAL; } @@ -251,7 +251,7 @@ int rf69_set_deviation(struct spi_device *spi, u32 deviation) */ if (deviation < 600 || (deviation + (bit_rate / 2)) > 500000) { dev_dbg(&spi->dev, - "set_deviation: illegal input param: %u", deviation); + "set_deviation: illegal input param: %u\n", deviation); return -EINVAL; } @@ -268,7 +268,7 @@ int rf69_set_deviation(struct spi_device *spi, u32 deviation) // check msb if (msb & ~FDEVMASB_MASK) { - dev_dbg(&spi->dev, "set_deviation: err in calc of msb"); + dev_dbg(&spi->dev, "set_deviation: err in calc of msb\n"); return -EINVAL; } @@ -301,7 +301,7 @@ int rf69_set_frequency(struct spi_device *spi, u32 frequency) // check input value f_max = div_u64(f_step * 8388608, factor); if (frequency > f_max) { - dev_dbg(&spi->dev, "setFrequency: illegal input param"); + dev_dbg(&spi->dev, "setFrequency: illegal input param\n"); return -EINVAL; } @@ -382,7 +382,7 @@ int rf69_set_output_power_level(struct spi_device *spi, u8 power_level) return rf69_read_mod_write(spi, REG_PALEVEL, MASK_PALEVEL_OUTPUT_POWER, power_level); failed: - dev_dbg(&spi->dev, "set: illegal power level %u", power_level); + dev_dbg(&spi->dev, "set: illegal power level %u\n", power_level); return -EINVAL; } @@ -407,7 +407,7 @@ int rf69_set_pa_ramp(struct spi_device *spi, enum pa_ramp pa_ramp) }; if (unlikely(pa_ramp >= ARRAY_SIZE(pa_ramp_map))) { - dev_dbg(&spi->dev, "set: illegal pa_ramp %u", pa_ramp); + dev_dbg(&spi->dev, "set: illegal pa_ramp %u\n", pa_ramp); return -EINVAL; } @@ -423,7 +423,7 @@ int rf69_set_antenna_impedance(struct spi_device *spi, case two_hundred_ohm: return rf69_set_bit(spi, REG_LNA, MASK_LNA_ZIN); default: - dev_dbg(&spi->dev, "set: illegal antenna impedance %u", antenna_impedance); + dev_dbg(&spi->dev, "set: illegal antenna impedance %u\n", antenna_impedance); return -EINVAL; } } @@ -441,7 +441,7 @@ int rf69_set_lna_gain(struct spi_device *spi, enum lna_gain lna_gain) }; if (unlikely(lna_gain >= ARRAY_SIZE(lna_gain_map))) { - dev_dbg(&spi->dev, "set: illegal lna gain %u", lna_gain); + dev_dbg(&spi->dev, "set: illegal lna gain %u\n", lna_gain); return -EINVAL; } @@ -456,14 +456,14 @@ static int rf69_set_bandwidth_intern(struct spi_device *spi, u8 reg, // check value for mantisse and exponent if (exponent > 7) { - dev_dbg(&spi->dev, "set: illegal bandwidth exponent %u", exponent); + dev_dbg(&spi->dev, "set: illegal bandwidth exponent %u\n", exponent); return -EINVAL; } if (mantisse != mantisse16 && mantisse != mantisse20 && mantisse != mantisse24) { - dev_dbg(&spi->dev, "set: illegal bandwidth mantisse %u", mantisse); + dev_dbg(&spi->dev, "set: illegal bandwidth mantisse %u\n", mantisse); return -EINVAL; } @@ -521,7 +521,8 @@ int rf69_set_ook_threshold_dec(struct spi_device *spi, }; if (unlikely(threshold_decrement >= ARRAY_SIZE(td_map))) { - dev_dbg(&spi->dev, "set: illegal OOK threshold decrement %u", threshold_decrement); + dev_dbg(&spi->dev, "set: illegal OOK threshold decrement %u\n", + threshold_decrement); return -EINVAL; } @@ -568,7 +569,7 @@ int rf69_set_dio_mapping(struct spi_device *spi, u8 dio_number, u8 value) dio_addr = REG_DIOMAPPING2; break; default: - dev_dbg(&spi->dev, "set: illegal dio number %u", dio_number); + dev_dbg(&spi->dev, "set: illegal dio number %u\n", dio_number); return -EINVAL; } @@ -672,7 +673,7 @@ int rf69_set_fifo_fill_condition(struct spi_device *spi, return rf69_clear_bit(spi, REG_SYNC_CONFIG, MASK_SYNC_CONFIG_FIFO_FILL_CONDITION); default: - dev_dbg(&spi->dev, "set: illegal fifo fill condition %u", fifo_fill_condition); + dev_dbg(&spi->dev, "set: illegal fifo fill condition %u\n", fifo_fill_condition); return -EINVAL; } } @@ -681,7 +682,7 @@ int rf69_set_sync_size(struct spi_device *spi, u8 sync_size) { // check input value if (sync_size > 0x07) { - dev_dbg(&spi->dev, "set: illegal sync size %u", sync_size); + dev_dbg(&spi->dev, "set: illegal sync size %u\n", sync_size); return -EINVAL; } @@ -718,7 +719,7 @@ int rf69_set_packet_format(struct spi_device *spi, return rf69_clear_bit(spi, REG_PACKETCONFIG1, MASK_PACKETCONFIG1_PACKET_FORMAT_VARIABLE); default: - dev_dbg(&spi->dev, "set: illegal packet format %u", packet_format); + dev_dbg(&spi->dev, "set: illegal packet format %u\n", packet_format); return -EINVAL; } } @@ -744,7 +745,7 @@ int rf69_set_address_filtering(struct spi_device *spi, }; if (unlikely(address_filtering >= ARRAY_SIZE(af_map))) { - dev_dbg(&spi->dev, "set: illegal address filtering %u", address_filtering); + dev_dbg(&spi->dev, "set: illegal address filtering %u\n", address_filtering); return -EINVAL; } @@ -779,7 +780,7 @@ int rf69_set_tx_start_condition(struct spi_device *spi, return rf69_set_bit(spi, REG_FIFO_THRESH, MASK_FIFO_THRESH_TXSTART); default: - dev_dbg(&spi->dev, "set: illegal tx start condition %u", tx_start_condition); + dev_dbg(&spi->dev, "set: illegal tx start condition %u\n", tx_start_condition); return -EINVAL; } } @@ -790,7 +791,7 @@ int rf69_set_fifo_threshold(struct spi_device *spi, u8 threshold) /* check input value */ if (threshold & 0x80) { - dev_dbg(&spi->dev, "set: illegal fifo threshold %u", threshold); + dev_dbg(&spi->dev, "set: illegal fifo threshold %u\n", threshold); return -EINVAL; } @@ -817,7 +818,7 @@ int rf69_set_dagc(struct spi_device *spi, enum dagc dagc) }; if (unlikely(dagc >= ARRAY_SIZE(dagc_map))) { - dev_dbg(&spi->dev, "set: illegal dagc %u", dagc); + dev_dbg(&spi->dev, "set: illegal dagc %u\n", dagc); return -EINVAL; } -- cgit From a2882e5ea3497b7cb6318ddeaf539b6a2da8d61e Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Mon, 7 Feb 2022 17:45:12 +1300 Subject: staging: pi433: remove need to recompile code to debug fifo content Debugging content present in the FIFO register is tricky as when we read the FIFO register that changes the content of fifo struct which reduces number of possible ways of debugging it. Rf69 uC has the possibility of triggering certain IRQs depending on how many items are in the FIFO queue, so being able to know what's in there is an important way to troubleshoot certain problems. This patch removes the requirement of having to compile pi433 driver with DEBUG_FIFO_ACCESS set and let that be driven by printk verbositity level and/or dynamic debug config instead. Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/YgCj2P59AbFFmnbA@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/rf69.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index a8def70808d6..901f8db3e3ce 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -6,11 +6,6 @@ * Marcus Wolf */ -/* enable prosa debug info */ -#undef DEBUG -/* enable print of values on fifo access */ -#undef DEBUG_FIFO_ACCESS - #include #include @@ -829,9 +824,7 @@ int rf69_set_dagc(struct spi_device *spi, enum dagc dagc) int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) { -#ifdef DEBUG_FIFO_ACCESS int i; -#endif struct spi_transfer transfer; u8 local_buffer[FIFO_SIZE + 1]; int retval; @@ -851,10 +844,9 @@ int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) retval = spi_sync_transfer(spi, &transfer, 1); -#ifdef DEBUG_FIFO_ACCESS + /* print content read from fifo for debugging purposes */ for (i = 0; i < size; i++) dev_dbg(&spi->dev, "%d - 0x%x\n", i, local_buffer[i + 1]); -#endif memcpy(buffer, &local_buffer[1], size); @@ -863,9 +855,7 @@ int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) { -#ifdef DEBUG_FIFO_ACCESS int i; -#endif u8 local_buffer[FIFO_SIZE + 1]; if (size > FIFO_SIZE) { @@ -877,10 +867,9 @@ int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) local_buffer[0] = REG_FIFO | WRITE_BIT; memcpy(&local_buffer[1], buffer, size); -#ifdef DEBUG_FIFO_ACCESS + /* print content written from fifo for debugging purposes */ for (i = 0; i < size; i++) dev_dbg(&spi->dev, "0x%x\n", buffer[i]); -#endif return spi_write(spi, local_buffer, size + 1); } -- cgit From 1b9a8d755f2be2ef96d46b2724311a255ceccedf Mon Sep 17 00:00:00 2001 From: Ayan Choudhary Date: Mon, 7 Feb 2022 05:39:21 -0800 Subject: Staging: nvec: Fix ending in '(' error This patch fixes the checkpatch.pl warning: CHECK: Lines should not end with a '(' 386: FILE: drivers/staging/nvec/nvec.c:386: + err = wait_for_completion_interruptible_timeout( Signed-off-by: Ayan Choudhary Link: https://lore.kernel.org/r/20220207133921.4287-1-ayanchoudhary1025@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 990d15c31a13..b3f114cb00dc 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -383,8 +383,8 @@ static void nvec_request_master(struct work_struct *work) msg = list_first_entry(&nvec->tx_data, struct nvec_msg, node); spin_unlock_irqrestore(&nvec->tx_lock, flags); nvec_gpio_set_value(nvec, 0); - err = wait_for_completion_interruptible_timeout( - &nvec->ec_transfer, msecs_to_jiffies(5000)); + err = wait_for_completion_interruptible_timeout(&nvec->ec_transfer, + msecs_to_jiffies(5000)); if (err == 0) { dev_warn(nvec->dev, "timeout waiting for ec transfer\n"); -- cgit From f2c461536226eb0852a241e72b9125685d6741b4 Mon Sep 17 00:00:00 2001 From: Tong Zhang Date: Fri, 4 Feb 2022 11:08:35 -0800 Subject: staging: drop fpgaboot driver The gs_fpgaboot driver is totally broken since 2014 and no one even noticed the driver is not probing. Given the quality of the driver and its current state it makes sense to drop it. Signed-off-by: Tong Zhang Link: https://lore.kernel.org/r/20220204190847.3809405-1-ztong0001@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/gs_fpgaboot/Kconfig | 8 - drivers/staging/gs_fpgaboot/Makefile | 3 - drivers/staging/gs_fpgaboot/README | 70 ------ drivers/staging/gs_fpgaboot/TODO | 7 - drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 394 ------------------------------ drivers/staging/gs_fpgaboot/gs_fpgaboot.h | 41 ---- drivers/staging/gs_fpgaboot/io.c | 105 -------- drivers/staging/gs_fpgaboot/io.h | 73 ------ 10 files changed, 704 deletions(-) delete mode 100644 drivers/staging/gs_fpgaboot/Kconfig delete mode 100644 drivers/staging/gs_fpgaboot/Makefile delete mode 100644 drivers/staging/gs_fpgaboot/README delete mode 100644 drivers/staging/gs_fpgaboot/TODO delete mode 100644 drivers/staging/gs_fpgaboot/gs_fpgaboot.c delete mode 100644 drivers/staging/gs_fpgaboot/gs_fpgaboot.h delete mode 100644 drivers/staging/gs_fpgaboot/io.c delete mode 100644 drivers/staging/gs_fpgaboot/io.h diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 8d41fdd40657..d1ce500c0319 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -66,8 +66,6 @@ source "drivers/staging/gdm724x/Kconfig" source "drivers/staging/fwserial/Kconfig" -source "drivers/staging/gs_fpgaboot/Kconfig" - source "drivers/staging/unisys/Kconfig" source "drivers/staging/clocking-wizard/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 02b01949b94e..82e912a7586f 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -23,7 +23,6 @@ obj-$(CONFIG_ANDROID) += android/ obj-$(CONFIG_STAGING_BOARD) += board/ obj-$(CONFIG_LTE_GDM724X) += gdm724x/ obj-$(CONFIG_FIREWIRE_SERIAL) += fwserial/ -obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/ obj-$(CONFIG_UNISYSSPAR) += unisys/ obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/ obj-$(CONFIG_FB_TFT) += fbtft/ diff --git a/drivers/staging/gs_fpgaboot/Kconfig b/drivers/staging/gs_fpgaboot/Kconfig deleted file mode 100644 index 968a153c4ab6..000000000000 --- a/drivers/staging/gs_fpgaboot/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# "xilinx FPGA firmware download, fpgaboot" -# -config GS_FPGABOOT - tristate "Xilinx FPGA firmware download module" - help - Xilinx FPGA firmware download module diff --git a/drivers/staging/gs_fpgaboot/Makefile b/drivers/staging/gs_fpgaboot/Makefile deleted file mode 100644 index 33e238be63d6..000000000000 --- a/drivers/staging/gs_fpgaboot/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -gs_fpga-y += gs_fpgaboot.o io.o -obj-$(CONFIG_GS_FPGABOOT) += gs_fpga.o diff --git a/drivers/staging/gs_fpgaboot/README b/drivers/staging/gs_fpgaboot/README deleted file mode 100644 index ec1235a21bcc..000000000000 --- a/drivers/staging/gs_fpgaboot/README +++ /dev/null @@ -1,70 +0,0 @@ -============================================================================== -Linux Driver Source for Xilinx FPGA firmware download -============================================================================== - - -TABLE OF CONTENTS. - -1. SUMMARY -2. BACKGROUND -3. DESIGN -4. HOW TO USE -5. REFERENCE - -1. SUMMARY - - - Download Xilinx FPGA firmware - - This module downloads Xilinx FPGA firmware using gpio pins. - -2. BACKGROUND - - An FPGA (Field Programmable Gate Array) is a programmable hardware that is - used in various applications. Hardware design needs to programmed through - a dedicated device or CPU assisted way (serial or parallel). - This driver provides a way to download FPGA firmware. - -3. DESIGN - - - load Xilinx FPGA bitstream format[1] firmware image file using - kernel firmware framework, request_firmware() - - program the Xilinx FPGA using SelectMAP (parallel) mode [2] - - FPGA prgram is done by gpio based bit-banging, as an example - - platform independent file: gs_fpgaboot.c - - platform dependent file: io.c - -4. HOW TO USE - - $ insmod gs_fpga.ko file="xlinx_fpga_top_bitstream.bit" - $ rmmod gs_fpga - -5. USE CASE (from a mailing list discussion with Greg) - - a. As an FPGA development support tool, - During FPGA firmware development, you need to download a new FPGA - image frequently. - You would do that with a dedicated JTAG, which usually a limited - resource in the lab. - However, if you use my driver, you don't have to have a dedicated JTAG. - This is a real gain :) - - b. For the FPGA that runs without config after the download, which - doesn't talk to any of Linux interfaces (such as PCIE). - - We download FPGA firmware from user triggered or some other way, and that's it. - Since that FPGA runs on its own, it doesn't require a linux driver - after the download. - - c. For the FPGA that requires config after the download, which talk to - any of linux interfaces (such as PCIE) - - Then, this type of FPGA config can be put into device tree and have a - separate driver (pcie or others), then THAT driver calls my driver to - download FPGA firmware during the Linux boot, the take over the device - through the interface. - -6. REFERENCE - - 1. Xilinx APP NOTE XAPP583: - https://www.xilinx.com/support/documentation/application_notes/xapp583-fpga-configuration.pdf - 2. bitstream file info: - http://home.earthlink.net/~davesullins/software/bitinfo.html diff --git a/drivers/staging/gs_fpgaboot/TODO b/drivers/staging/gs_fpgaboot/TODO deleted file mode 100644 index 2d9fb17d606d..000000000000 --- a/drivers/staging/gs_fpgaboot/TODO +++ /dev/null @@ -1,7 +0,0 @@ -TODO: - - get bus width input instead of hardcoded bus width - - get it reviewed - -Please send any patches for this driver to Insop Song -and Greg Kroah-Hartman . -And please CC to "Staging subsystem" mail list too. diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c deleted file mode 100644 index 3e154562c64d..000000000000 --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c +++ /dev/null @@ -1,394 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "gs_fpgaboot.h" -#include "io.h" - -#define DEVICE_NAME "device" -#define CLASS_NAME "fpgaboot" - -static u8 bits_magic[] = { - 0x0, 0x9, 0xf, 0xf0, 0xf, 0xf0, - 0xf, 0xf0, 0xf, 0xf0, 0x0, 0x0, 0x1}; - -/* fake device for request_firmware */ -static struct platform_device *firmware_pdev; - -static char *file = "xlinx_fpga_firmware.bit"; -module_param(file, charp, 0444); -MODULE_PARM_DESC(file, "Xilinx FPGA firmware file."); - -static void read_bitstream(u8 *bitdata, u8 *buf, int *offset, int rdsize) -{ - memcpy(buf, bitdata + *offset, rdsize); - *offset += rdsize; -} - -static int readinfo_bitstream(u8 *bitdata, u8 *buf, int size, int *offset) -{ - u8 tbuf[2]; - u16 len; - - /* read section char */ - read_bitstream(bitdata, tbuf, offset, 1); - - /* read length */ - read_bitstream(bitdata, tbuf, offset, 2); - - len = get_unaligned_be16(tbuf); - if (len >= size) { - pr_err("error: readinfo buffer too small\n"); - return -EINVAL; - } - - read_bitstream(bitdata, buf, offset, len); - buf[len] = '\0'; - - return 0; -} - -/* - * read bitdata length - */ -static int readlength_bitstream(u8 *bitdata, int *lendata, int *offset) -{ - u8 tbuf[4]; - - /* read section char */ - read_bitstream(bitdata, tbuf, offset, 1); - - /* make sure it is section 'e' */ - if (tbuf[0] != 'e') { - pr_err("error: length section is not 'e', but %c\n", tbuf[0]); - return -EINVAL; - } - - /* read 4bytes length */ - read_bitstream(bitdata, tbuf, offset, 4); - - *lendata = get_unaligned_be32(tbuf); - - return 0; -} - -/* - * read first 13 bytes to check bitstream magic number - */ -static int readmagic_bitstream(u8 *bitdata, int *offset) -{ - u8 buf[13]; - int r; - - read_bitstream(bitdata, buf, offset, 13); - r = memcmp(buf, bits_magic, 13); - if (r) { - pr_err("error: corrupted header\n"); - return -EINVAL; - } - pr_info("bitstream file magic number Ok\n"); - - *offset = 13; /* magic length */ - - return 0; -} - -/* - * NOTE: supports only bitstream format - */ -static enum fmt_image get_imageformat(void) -{ - return f_bit; -} - -static void gs_print_header(struct fpgaimage *fimage) -{ - pr_info("file: %s\n", fimage->filename); - pr_info("part: %s\n", fimage->part); - pr_info("date: %s\n", fimage->date); - pr_info("time: %s\n", fimage->time); - pr_info("lendata: %d\n", fimage->lendata); -} - -static int gs_read_bitstream(struct fpgaimage *fimage) -{ - u8 *bitdata; - int offset; - int err; - - offset = 0; - bitdata = (u8 *)fimage->fw_entry->data; - - err = readmagic_bitstream(bitdata, &offset); - if (err) - return err; - - err = readinfo_bitstream(bitdata, fimage->filename, MAX_STR, &offset); - if (err) - return err; - err = readinfo_bitstream(bitdata, fimage->part, MAX_STR, &offset); - if (err) - return err; - err = readinfo_bitstream(bitdata, fimage->date, MAX_STR, &offset); - if (err) - return err; - err = readinfo_bitstream(bitdata, fimage->time, MAX_STR, &offset); - if (err) - return err; - - err = readlength_bitstream(bitdata, &fimage->lendata, &offset); - if (err) - return err; - - fimage->fpgadata = bitdata + offset; - - return 0; -} - -static int gs_read_image(struct fpgaimage *fimage) -{ - int img_fmt; - int err; - - img_fmt = get_imageformat(); - - switch (img_fmt) { - case f_bit: - pr_info("image is bitstream format\n"); - err = gs_read_bitstream(fimage); - if (err) - return err; - break; - default: - pr_err("unsupported fpga image format\n"); - return -EINVAL; - } - - gs_print_header(fimage); - - return 0; -} - -static int gs_load_image(struct fpgaimage *fimage, char *fw_file) -{ - int err; - - pr_info("load fpgaimage %s\n", fw_file); - - err = request_firmware(&fimage->fw_entry, fw_file, &firmware_pdev->dev); - if (err != 0) { - pr_err("firmware %s is missing, cannot continue.\n", fw_file); - return err; - } - - return 0; -} - -static int gs_download_image(struct fpgaimage *fimage, enum wbus bus_bytes) -{ - u8 *bitdata; - int size, i, cnt; - - cnt = 0; - bitdata = (u8 *)fimage->fpgadata; - size = fimage->lendata; - -#ifdef DEBUG_FPGA - print_hex_dump_bytes("bitfile sample: ", DUMP_PREFIX_OFFSET, - bitdata, 0x100); -#endif /* DEBUG_FPGA */ - if (!xl_supported_prog_bus_width(bus_bytes)) { - pr_err("unsupported program bus width %d\n", - bus_bytes); - return -EINVAL; - } - - /* Bring csi_b, rdwr_b Low and program_b High */ - xl_program_b(1); - xl_rdwr_b(0); - xl_csi_b(0); - - /* Configuration reset */ - xl_program_b(0); - msleep(20); - xl_program_b(1); - - /* Wait for Device Initialization */ - while (xl_get_init_b() == 0) - ; - - pr_info("device init done\n"); - - for (i = 0; i < size; i += bus_bytes) - xl_shift_bytes_out(bus_bytes, bitdata + i); - - pr_info("program done\n"); - - /* Check INIT_B */ - if (xl_get_init_b() == 0) { - pr_err("init_b 0\n"); - return -EIO; - } - - while (xl_get_done_b() == 0) { - if (cnt++ > MAX_WAIT_DONE) { - pr_err("init_B %d\n", xl_get_init_b()); - break; - } - } - - if (cnt > MAX_WAIT_DONE) { - pr_err("fpga download fail\n"); - return -EIO; - } - - pr_info("download fpgaimage\n"); - - /* Compensate for Special Startup Conditions */ - xl_shift_cclk(8); - - return 0; -} - -static int gs_release_image(struct fpgaimage *fimage) -{ - release_firmware(fimage->fw_entry); - pr_info("release fpgaimage\n"); - - return 0; -} - -/* - * NOTE: supports systemmap parallel programming - */ -static int gs_set_download_method(struct fpgaimage *fimage) -{ - pr_info("set program method\n"); - - fimage->dmethod = m_systemmap; - - pr_info("systemmap program method\n"); - - return 0; -} - -static int init_driver(void) -{ - firmware_pdev = platform_device_register_simple("fpgaboot", -1, - NULL, 0); - return PTR_ERR_OR_ZERO(firmware_pdev); -} - -static int gs_fpgaboot(void) -{ - int err; - struct fpgaimage *fimage; - - fimage = kmalloc(sizeof(*fimage), GFP_KERNEL); - if (!fimage) - return -ENOMEM; - - err = gs_load_image(fimage, file); - if (err) { - pr_err("gs_load_image error\n"); - goto err_out1; - } - - err = gs_read_image(fimage); - if (err) { - pr_err("gs_read_image error\n"); - goto err_out2; - } - - err = gs_set_download_method(fimage); - if (err) { - pr_err("gs_set_download_method error\n"); - goto err_out2; - } - - err = gs_download_image(fimage, bus_2byte); - if (err) { - pr_err("gs_download_image error\n"); - goto err_out2; - } - - err = gs_release_image(fimage); - if (err) { - pr_err("gs_release_image error\n"); - goto err_out1; - } - - kfree(fimage); - return 0; - -err_out2: - err = gs_release_image(fimage); - if (err) - pr_err("gs_release_image error\n"); -err_out1: - kfree(fimage); - - return err; -} - -static int __init gs_fpgaboot_init(void) -{ - int err; - - pr_info("FPGA DOWNLOAD --->\n"); - - pr_info("FPGA image file name: %s\n", file); - - err = init_driver(); - if (err) { - pr_err("FPGA DRIVER INIT FAIL!!\n"); - return err; - } - - err = xl_init_io(); - if (err) { - pr_err("GPIO INIT FAIL!!\n"); - goto errout; - } - - err = gs_fpgaboot(); - if (err) { - pr_err("FPGA DOWNLOAD FAIL!!\n"); - goto errout; - } - - pr_info("FPGA DOWNLOAD DONE <---\n"); - - return 0; - -errout: - platform_device_unregister(firmware_pdev); - - return err; -} - -static void __exit gs_fpgaboot_exit(void) -{ - platform_device_unregister(firmware_pdev); - pr_info("FPGA image download module removed\n"); -} - -module_init(gs_fpgaboot_init); -module_exit(gs_fpgaboot_exit); - -MODULE_AUTHOR("Insop Song"); -MODULE_DESCRIPTION("Xlinix FPGA firmware download"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.h b/drivers/staging/gs_fpgaboot/gs_fpgaboot.h deleted file mode 100644 index 5cf12c14cca4..000000000000 --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.h +++ /dev/null @@ -1,41 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ - -#include - -#define MAX_STR 256 - -enum fmt_image { - f_bit, /* only bitstream is supported */ - f_rbt, - f_bin, - f_mcs, - f_hex, -}; - -enum mdownload { - m_systemmap, /* only system map is supported */ - m_serial, - m_jtag, -}; - -/* - * xilinx fpgaimage information - * NOTE: use MAX_STR instead of dynamic alloc for simplicity - */ -struct fpgaimage { - enum fmt_image fmt_img; - enum mdownload dmethod; - - const struct firmware *fw_entry; - - /* - * the following can be read from bitstream, - * but other image format should have as well - */ - char filename[MAX_STR]; - char part[MAX_STR]; - char date[MAX_STR]; - char time[MAX_STR]; - int lendata; - u8 *fpgadata; -}; diff --git a/drivers/staging/gs_fpgaboot/io.c b/drivers/staging/gs_fpgaboot/io.c deleted file mode 100644 index 80903ec36b76..000000000000 --- a/drivers/staging/gs_fpgaboot/io.c +++ /dev/null @@ -1,105 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "io.h" - -static inline void byte0_out(unsigned char data); -static inline void byte1_out(unsigned char data); -static inline void xl_cclk_b(int32_t i); - -/* Assert and Deassert CCLK */ -void xl_shift_cclk(int count) -{ - int i; - - for (i = 0; i < count; i++) { - xl_cclk_b(1); - xl_cclk_b(0); - } -} - -int xl_supported_prog_bus_width(enum wbus bus_bytes) -{ - switch (bus_bytes) { - case bus_1byte: - break; - case bus_2byte: - break; - default: - pr_err("unsupported program bus width %d\n", bus_bytes); - return 0; - } - - return 1; -} - -/* Serialize byte and clock each bit on target's DIN and CCLK pins */ -void xl_shift_bytes_out(enum wbus bus_byte, unsigned char *pdata) -{ - /* - * supports 1 and 2 bytes programming mode - */ - if (likely(bus_byte == bus_2byte)) - byte0_out(pdata[0]); - - byte1_out(pdata[1]); - xl_shift_cclk(1); -} - -/* - * generic bit swap for xilinx SYSTEMMAP FPGA programming - */ -void xl_program_b(int32_t i) -{ -} - -void xl_rdwr_b(int32_t i) -{ -} - -void xl_csi_b(int32_t i) -{ -} - -int xl_get_init_b(void) -{ - return -1; -} - -int xl_get_done_b(void) -{ - return -1; -} - -static inline void byte0_out(unsigned char data) -{ -} - -static inline void byte1_out(unsigned char data) -{ -} - -static inline void xl_cclk_b(int32_t i) -{ -} - -/* - * configurable per device type for different I/O config - */ -int xl_init_io(void) -{ - return -1; -} diff --git a/drivers/staging/gs_fpgaboot/io.h b/drivers/staging/gs_fpgaboot/io.h deleted file mode 100644 index 9bd86a92e90f..000000000000 --- a/drivers/staging/gs_fpgaboot/io.h +++ /dev/null @@ -1,73 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ - -#define GPDIR 0 -#define GPCFG 4 /* open drain or not */ -#define GPDAT 8 - -/* - * gpio port and pin definitions - * NOTE: port number starts from 0 - */ -#define XL_INITN_PORT 1 -#define XL_INITN_PIN 14 -#define XL_RDWRN_PORT 1 -#define XL_RDWRN_PIN 13 -#define XL_CCLK_PORT 1 -#define XL_CCLK_PIN 10 -#define XL_PROGN_PORT 1 -#define XL_PROGN_PIN 25 -#define XL_CSIN_PORT 1 -#define XL_CSIN_PIN 26 -#define XL_DONE_PORT 1 -#define XL_DONE_PIN 27 - -/* - * gpio mapping - * - XL_config_D0 – gpio1_31 - Xl_config_d1 – gpio1_30 - Xl_config_d2 – gpio1_29 - Xl_config_d3 – gpio1_28 - Xl_config_d4 – gpio1_27 - Xl_config_d5 – gpio1_26 - Xl_config_d6 – gpio1_25 - Xl_config_d7 – gpio1_24 - Xl_config_d8 – gpio1_23 - Xl_config_d9 – gpio1_22 - Xl_config_d10 – gpio1_21 - Xl_config_d11 – gpio1_20 - Xl_config_d12 – gpio1_19 - Xl_config_d13 – gpio1_18 - Xl_config_d14 – gpio1_16 - Xl_config_d15 – gpio1_14 -* -*/ - -/* - * program bus width in bytes - */ -enum wbus { - bus_1byte = 1, - bus_2byte = 2, -}; - -#define MAX_WAIT_DONE 10000 - -struct gpiobus { - int ngpio; - void __iomem *r[4]; -}; - -int xl_supported_prog_bus_width(enum wbus bus_bytes); - -void xl_program_b(int32_t i); -void xl_rdwr_b(int32_t i); -void xl_csi_b(int32_t i); - -int xl_get_init_b(void); -int xl_get_done_b(void); - -void xl_shift_cclk(int count); -void xl_shift_bytes_out(enum wbus bus_byte, unsigned char *pdata); - -int xl_init_io(void); -- cgit From dcbecb497908a127dd9fd361d8cdc68f46d8cff6 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 11 Feb 2022 17:26:58 +0100 Subject: staging: wfx: allow new PDS format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The device needs data about the antenna configuration. This information in provided by PDS (Platform Data Set, this is the wording used in WF200 documentation) files. Until now, the driver had to parse the PDS file before to send it. This solution was not acceptable for the vanilla kernel. We have slightly changed the PDS format so it is now an array of Type-Length-Value. This patch allows to support new format and keep compatibility with legacy format. Signed-off-by: Jérôme Pouiller probe: allow new PDS format Link: https://lore.kernel.org/r/20220211162659.528333-2-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/main.c | 74 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 8be9100847a7..a0f5e09c3c3f 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -33,7 +33,8 @@ #include "hif_tx_mib.h" #include "hif_api_cmd.h" -#define WFX_PDS_MAX_SIZE 1500 +#define WFX_PDS_TLV_TYPE 0x4450 // "PD" (Platform Data) in ascii little-endian +#define WFX_PDS_MAX_CHUNK_SIZE 1500 MODULE_DESCRIPTION("Silicon Labs 802.11 Wireless LAN driver for WF200"); MODULE_AUTHOR("Jérôme Pouiller "); @@ -162,29 +163,18 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) return false; } -/* The device needs data about the antenna configuration. This information in provided by PDS - * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware - * integrators, the full process to create PDS files is described here: - * https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md - * - * So this function aims to send PDS to the device. However, the PDS file is often bigger than Rx - * buffers of the chip, so it has to be sent in multiple parts. +/* In legacy format, the PDS file is often bigger than Rx buffers of the chip, so it has to be sent + * in multiple parts. * * In add, the PDS data cannot be split anywhere. The PDS files contains tree structures. Braces are * used to enter/leave a level of the tree (in a JSON fashion). PDS files can only been split * between root nodes. */ -int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) +int wfx_send_pds_legacy(struct wfx_dev *wdev, u8 *buf, size_t len) { int ret; - int start, brace_level, i; + int start = 0, brace_level = 0, i; - start = 0; - brace_level = 0; - if (buf[0] != '{') { - dev_err(wdev->dev, "valid PDS start with '{'. Did you forget to compress it?\n"); - return -EINVAL; - } for (i = 1; i < len - 1; i++) { if (buf[i] == '{') brace_level++; @@ -192,7 +182,7 @@ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) brace_level--; if (buf[i] == '}' && !brace_level) { i++; - if (i - start + 1 > WFX_PDS_MAX_SIZE) + if (i - start + 1 > WFX_PDS_MAX_CHUNK_SIZE) return -EFBIG; buf[start] = '{'; buf[i] = 0; @@ -222,6 +212,56 @@ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) return 0; } +/* The device needs data about the antenna configuration. This information in provided by PDS + * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware + * integrators, the full process to create PDS files is described here: + * https://github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md + * + * The PDS file is an array of Time-Length-Value structs. + */ + int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) +{ + int ret, chunk_type, chunk_len, chunk_num = 0; + + if (*buf == '{') + return wfx_send_pds_legacy(wdev, buf, len); + while (len > 0) { + chunk_type = get_unaligned_le16(buf + 0); + chunk_len = get_unaligned_le16(buf + 2); + if (chunk_len > len) { + dev_err(wdev->dev, "PDS:%d: corrupted file\n", chunk_num); + return -EINVAL; + } + if (chunk_type != WFX_PDS_TLV_TYPE) { + dev_info(wdev->dev, "PDS:%d: skip unknown data\n", chunk_num); + goto next; + } + if (chunk_len > WFX_PDS_MAX_CHUNK_SIZE) + dev_warn(wdev->dev, "PDS:%d: unexpectly large chunk\n", chunk_num); + if (buf[4] != '{' || buf[chunk_len - 1] != '}') + dev_warn(wdev->dev, "PDS:%d: unexpected content\n", chunk_num); + + ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4); + if (ret > 0) { + dev_err(wdev->dev, "PDS:%d: invalid data (unsupported options?)\n", chunk_num); + return -EINVAL; + } + if (ret == -ETIMEDOUT) { + dev_err(wdev->dev, "PDS:%d: chip didn't reply (corrupted file?)\n", chunk_num); + return ret; + } + if (ret) { + dev_err(wdev->dev, "PDS:%d: chip returned an unknown error\n", chunk_num); + return -EIO; + } +next: + chunk_num++; + len -= chunk_len; + buf += chunk_len; + } + return 0; +} + static int wfx_send_pdata_pds(struct wfx_dev *wdev) { int ret = 0; -- cgit From 2f8189beb4c84f7b259f37aead729d0aa9b2d2fb Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 11 Feb 2022 17:26:59 +0100 Subject: staging: wfx: remove support for legacy PDS format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't want to support legacy PDS format. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220211162659.528333-3-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/main.c | 55 ++++------------------------------------------ 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index a0f5e09c3c3f..0ddc67b56589 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -163,55 +163,6 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) return false; } -/* In legacy format, the PDS file is often bigger than Rx buffers of the chip, so it has to be sent - * in multiple parts. - * - * In add, the PDS data cannot be split anywhere. The PDS files contains tree structures. Braces are - * used to enter/leave a level of the tree (in a JSON fashion). PDS files can only been split - * between root nodes. - */ -int wfx_send_pds_legacy(struct wfx_dev *wdev, u8 *buf, size_t len) -{ - int ret; - int start = 0, brace_level = 0, i; - - for (i = 1; i < len - 1; i++) { - if (buf[i] == '{') - brace_level++; - if (buf[i] == '}') - brace_level--; - if (buf[i] == '}' && !brace_level) { - i++; - if (i - start + 1 > WFX_PDS_MAX_CHUNK_SIZE) - return -EFBIG; - buf[start] = '{'; - buf[i] = 0; - dev_dbg(wdev->dev, "send PDS '%s}'\n", buf + start); - buf[i] = '}'; - ret = wfx_hif_configuration(wdev, buf + start, - i - start + 1); - if (ret > 0) { - dev_err(wdev->dev, "PDS bytes %d to %d: invalid data (unsupported options?)\n", - start, i); - return -EINVAL; - } - if (ret == -ETIMEDOUT) { - dev_err(wdev->dev, "PDS bytes %d to %d: chip didn't reply (corrupted file?)\n", - start, i); - return ret; - } - if (ret) { - dev_err(wdev->dev, "PDS bytes %d to %d: chip returned an unknown error\n", - start, i); - return -EIO; - } - buf[i] = ','; - start = i; - } - } - return 0; -} - /* The device needs data about the antenna configuration. This information in provided by PDS * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware * integrators, the full process to create PDS files is described here: @@ -223,8 +174,10 @@ int wfx_send_pds_legacy(struct wfx_dev *wdev, u8 *buf, size_t len) { int ret, chunk_type, chunk_len, chunk_num = 0; - if (*buf == '{') - return wfx_send_pds_legacy(wdev, buf, len); + if (*buf == '{') { + dev_err(wdev->dev, "PDS: malformed file (legacy format?)\n"); + return -EINVAL; + } while (len > 0) { chunk_type = get_unaligned_le16(buf + 0); chunk_len = get_unaligned_le16(buf + 2); -- cgit From d6ef48e595823ef0ba37d78725350ceeeda0cb0a Mon Sep 17 00:00:00 2001 From: Cai Huoqing Date: Wed, 9 Feb 2022 11:27:13 +0800 Subject: staging: most: video: Make use of the helper macro LIST_HEAD() Replace "struct list_head head = LIST_HEAD_INIT(head)" with "LIST_HEAD(head)" to simplify the code. Signed-off-by: Cai Huoqing Link: https://lore.kernel.org/r/20220209032715.38437-1-cai.huoqing@linux.dev Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/video/video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c index b7858e47145f..ffa97ef21ea5 100644 --- a/drivers/staging/most/video/video.c +++ b/drivers/staging/most/video/video.c @@ -52,7 +52,7 @@ struct comp_fh { u32 offs; }; -static struct list_head video_devices = LIST_HEAD_INIT(video_devices); +static LIST_HEAD(video_devices); static DEFINE_SPINLOCK(list_lock); static inline bool data_ready(struct most_video_dev *mdev) -- cgit From b7b3c35e8791ca77dec16f35a6c6a84b5922ecc2 Mon Sep 17 00:00:00 2001 From: Cai Huoqing Date: Wed, 9 Feb 2022 11:26:43 +0800 Subject: staging: most: net: Make use of the helper macro LIST_HEAD() Replace "struct list_head head = LIST_HEAD_INIT(head)" with "LIST_HEAD(head)" to simplify the code. Signed-off-by: Cai Huoqing Link: https://lore.kernel.org/r/20220209032645.38305-1-cai.huoqing@linux.dev Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c index 47039f0d262f..1d1fe8bff7ee 100644 --- a/drivers/staging/most/net/net.c +++ b/drivers/staging/most/net/net.c @@ -67,7 +67,7 @@ struct net_dev_context { struct list_head list; }; -static struct list_head net_devices = LIST_HEAD_INIT(net_devices); +static LIST_HEAD(net_devices); static DEFINE_MUTEX(probe_disc_mt); /* ch->linked = true, most_nd_open */ static DEFINE_SPINLOCK(list_lock); /* list_head, ch->linked = false, dev_hold */ static struct most_component comp; -- cgit From f89019d43bd1cdbdd3675692be9f1e6eb5be48e8 Mon Sep 17 00:00:00 2001 From: "Minghao Chi (CGEL ZTE)" Date: Thu, 10 Feb 2022 06:04:11 +0000 Subject: staging/ks7010: Remove redundant 'flush_workqueue()' calls 'destroy_workqueue()' already drains the queue before destroying it, so there is no need to flush it explicitly. Remove the redundant 'flush_workqueue()' calls. Reported-by: Zeal Robot Signed-off-by: Minghao Chi (CGEL ZTE) Link: https://lore.kernel.org/r/20220210060411.1607928-1-chi.minghao@zte.com.cn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks7010_sdio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 98d759e7cc95..9fb118e77a1f 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -1102,10 +1102,8 @@ static void ks7010_sdio_remove(struct sdio_func *func) if (ret) /* memory allocation failure */ goto err_free_card; - if (priv->wq) { - flush_workqueue(priv->wq); + if (priv->wq) destroy_workqueue(priv->wq); - } hostif_exit(priv); -- cgit From 3b335cf1f67d770797abc99b6323be2f6c1cb04e Mon Sep 17 00:00:00 2001 From: "Minghao Chi (CGEL ZTE)" Date: Thu, 10 Feb 2022 06:02:05 +0000 Subject: staging: greybus: Remove redundant 'flush_workqueue()' calls 'destroy_workqueue()' already drains the queue before destroying it, so there is no need to flush it explicitly. Remove the redundant 'flush_workqueue()' calls. Reported-by: Zeal Robot Reviewed-by: Rui Miguel Silva Signed-off-by: Minghao Chi (CGEL ZTE) Link: https://lore.kernel.org/r/20220210060205.1607792-1-chi.minghao@zte.com.cn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/sdio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c index 37bf04c22dbc..25bee5335c70 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -858,7 +858,6 @@ static void gb_sdio_remove(struct gbphy_device *gbphy_dev) gb_connection_set_data(connection, NULL); mutex_unlock(&host->lock); - flush_workqueue(host->mrq_workqueue); destroy_workqueue(host->mrq_workqueue); gb_connection_disable_rx(connection); mmc_remove_host(mmc); -- cgit From 5d2ed511b4a220332eb17725757dda433e9d35c4 Mon Sep 17 00:00:00 2001 From: Jiapeng Chong Date: Fri, 11 Feb 2022 16:03:22 +0800 Subject: staging: r8188eu: remove useless if else Eliminate the follow coccicheck warning: ./drivers/staging/r8188eu/hal/usb_halinit.c:1105:3-5: WARNING: possible condition with no effect (if == else). Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong Link: https://lore.kernel.org/r/20220211080322.80388-1-jiapeng.chong@linux.alibaba.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 659e0f26db29..9bcbc275f043 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1102,11 +1102,7 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) /* enable update TSF */ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL) & (~BIT(4))); } - if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) { - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID_BCN); - } else { - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID_BCN); - } + rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR) | RCR_CBSSID_BCN); } break; case HW_VAR_MLME_JOIN: -- cgit From 478b09fa2c00cbc40d25bc061befdf11f04a27ad Mon Sep 17 00:00:00 2001 From: Sergio Paracuellos Date: Thu, 10 Feb 2022 10:48:58 +0100 Subject: dt-bindings: clock: mediatek,mt7621-sysc: add '#reset-cells' property Make system controller a reset provider for all the peripherals in the MT7621 SoC adding '#reset-cells' property. Acked-by: Rob Herring Acked-by: Stephen Boyd Signed-off-by: Sergio Paracuellos Link: https://lore.kernel.org/r/20220210094859.927868-2-sergio.paracuellos@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../devicetree/bindings/clock/mediatek,mt7621-sysc.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml b/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml index 915f84efd763..0c0b0ae5e2ac 100644 --- a/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml +++ b/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml @@ -22,6 +22,11 @@ description: | The clocks are provided inside a system controller node. + This node is also a reset provider for all the peripherals. + + Reset related bits are defined in: + [2]: . + properties: compatible: items: @@ -37,6 +42,12 @@ properties: clocks. const: 1 + "#reset-cells": + description: + The first cell indicates the reset bit within the register, see + [2] for available resets. + const: 1 + ralink,memctl: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -61,6 +72,7 @@ examples: compatible = "mediatek,mt7621-sysc", "syscon"; reg = <0x0 0x100>; #clock-cells = <1>; + #reset-cells = <1>; ralink,memctl = <&memc>; clock-output-names = "xtal", "cpu", "bus", "50m", "125m", "150m", -- cgit From 38a8553b0a22ed54f014d8402fedd268b529175c Mon Sep 17 00:00:00 2001 From: Sergio Paracuellos Date: Thu, 10 Feb 2022 10:48:59 +0100 Subject: clk: ralink: make system controller node a reset provider MT7621 system controller node is already providing the clocks for the whole system but must also serve as a reset provider. Hence, add reset controller related code to the clock driver itself. To get resets properly ready for the rest of the world we need to move platform driver initialization process to 'arch_initcall'. CC: Philipp Zabel Reviewed-by: Philipp Zabel Acked-by: Stephen Boyd Signed-off-by: Sergio Paracuellos Link: https://lore.kernel.org/r/20220210094859.927868-3-sergio.paracuellos@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/clk/ralink/clk-mt7621.c | 92 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/drivers/clk/ralink/clk-mt7621.c b/drivers/clk/ralink/clk-mt7621.c index a2c045390f00..99256659dd96 100644 --- a/drivers/clk/ralink/clk-mt7621.c +++ b/drivers/clk/ralink/clk-mt7621.c @@ -11,14 +11,17 @@ #include #include #include +#include #include #include +#include /* Configuration registers */ #define SYSC_REG_SYSTEM_CONFIG0 0x10 #define SYSC_REG_SYSTEM_CONFIG1 0x14 #define SYSC_REG_CLKCFG0 0x2c #define SYSC_REG_CLKCFG1 0x30 +#define SYSC_REG_RESET_CTRL 0x34 #define SYSC_REG_CUR_CLK_STS 0x44 #define MEMC_REG_CPU_PLL 0x648 @@ -398,6 +401,82 @@ free_clk_priv: } CLK_OF_DECLARE_DRIVER(mt7621_clk, "mediatek,mt7621-sysc", mt7621_clk_init); +struct mt7621_rst { + struct reset_controller_dev rcdev; + struct regmap *sysc; +}; + +static struct mt7621_rst *to_mt7621_rst(struct reset_controller_dev *dev) +{ + return container_of(dev, struct mt7621_rst, rcdev); +} + +static int mt7621_assert_device(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct mt7621_rst *data = to_mt7621_rst(rcdev); + struct regmap *sysc = data->sysc; + + return regmap_update_bits(sysc, SYSC_REG_RESET_CTRL, BIT(id), BIT(id)); +} + +static int mt7621_deassert_device(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct mt7621_rst *data = to_mt7621_rst(rcdev); + struct regmap *sysc = data->sysc; + + return regmap_update_bits(sysc, SYSC_REG_RESET_CTRL, BIT(id), 0); +} + +static int mt7621_reset_device(struct reset_controller_dev *rcdev, + unsigned long id) +{ + int ret; + + ret = mt7621_assert_device(rcdev, id); + if (ret < 0) + return ret; + + return mt7621_deassert_device(rcdev, id); +} + +static int mt7621_rst_xlate(struct reset_controller_dev *rcdev, + const struct of_phandle_args *reset_spec) +{ + unsigned long id = reset_spec->args[0]; + + if (id == MT7621_RST_SYS || id >= rcdev->nr_resets) + return -EINVAL; + + return id; +} + +static const struct reset_control_ops reset_ops = { + .reset = mt7621_reset_device, + .assert = mt7621_assert_device, + .deassert = mt7621_deassert_device +}; + +static int mt7621_reset_init(struct device *dev, struct regmap *sysc) +{ + struct mt7621_rst *rst_data; + + rst_data = devm_kzalloc(dev, sizeof(*rst_data), GFP_KERNEL); + if (!rst_data) + return -ENOMEM; + + rst_data->sysc = sysc; + rst_data->rcdev.ops = &reset_ops; + rst_data->rcdev.owner = THIS_MODULE; + rst_data->rcdev.nr_resets = 32; + rst_data->rcdev.of_reset_n_cells = 1; + rst_data->rcdev.of_xlate = mt7621_rst_xlate; + rst_data->rcdev.of_node = dev_of_node(dev); + + return devm_reset_controller_register(dev, &rst_data->rcdev); +} + static int mt7621_clk_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -424,6 +503,12 @@ static int mt7621_clk_probe(struct platform_device *pdev) return ret; } + ret = mt7621_reset_init(dev, priv->sysc); + if (ret) { + dev_err(dev, "Could not init reset controller\n"); + return ret; + } + count = ARRAY_SIZE(mt7621_clks_base) + ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates); clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, count), @@ -485,4 +570,9 @@ static struct platform_driver mt7621_clk_driver = { .of_match_table = mt7621_clk_of_match, }, }; -builtin_platform_driver(mt7621_clk_driver); + +static int __init mt7621_clk_reset_init(void) +{ + return platform_driver_register(&mt7621_clk_driver); +} +arch_initcall(mt7621_clk_reset_init); -- cgit From 13456b9b43d43610eadc34f33406365cb3cc8d07 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 10 Feb 2022 00:37:53 +0530 Subject: staging: r8188eu: keep the success path and error path separate Keep the success path and error path separate in rtw_usb_if1_init() and drop the "status" variable. Also, remove do-nothing gotos. Reviewed-by: Pavel Skripkin Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220209190752.7232-1-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/usb_intf.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c index 10c33e2ae3bc..668e79a3c70e 100644 --- a/drivers/staging/r8188eu/os_dep/usb_intf.c +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c @@ -336,13 +336,13 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, { struct adapter *padapter = NULL; struct net_device *pnetdev = NULL; - int status = _FAIL; struct io_priv *piopriv; struct intf_hdl *pintf; padapter = vzalloc(sizeof(*padapter)); if (!padapter) - goto exit; + return NULL; + padapter->dvobj = dvobj; dvobj->if1 = padapter; @@ -421,26 +421,20 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, , padapter->hw_init_completed ); - status = _SUCCESS; + return padapter; free_drv_sw: - if (status != _SUCCESS) { - rtw_cancel_all_timer(padapter); - rtw_free_drv_sw(padapter); - } + rtw_cancel_all_timer(padapter); + rtw_free_drv_sw(padapter); handle_dualmac: - if (status != _SUCCESS) - rtw_handle_dualmac(padapter, 0); + rtw_handle_dualmac(padapter, 0); free_adapter: - if (status != _SUCCESS) { - if (pnetdev) - rtw_free_netdev(pnetdev); - else if (padapter) - vfree(padapter); - padapter = NULL; - } -exit: - return padapter; + if (pnetdev) + rtw_free_netdev(pnetdev); + else if (padapter) + vfree(padapter); + + return NULL; } static void rtw_usb_if1_deinit(struct adapter *if1) -- cgit From 90e0372af7b869971ddce12aea0553c2dcbf3450 Mon Sep 17 00:00:00 2001 From: "Fabio M. De Francesco" Date: Tue, 8 Feb 2022 19:04:25 +0100 Subject: staging: r8188eu: Use sizeof dereferenced pointer in kzalloc() checkpatch.pl emits the following warning: CHECK: Prefer kzalloc(sizeof(*pcmd)...) over kzalloc(sizeof(struct cmd_obj)...) + pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); CHECK: Prefer kzalloc(sizeof(*psetkeyparm)...) over kzalloc(sizeof(struct setkey_parm)...) + psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_KERNEL). According to the above "CHECK[S]", use the preferred style in the two kzalloc() of rtw_set_key(). Signed-off-by: Fabio M. De Francesco Link: https://lore.kernel.org/r/20220208180426.27455-2-fmdefrancesco@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 038bddc361c3..f5b2df72e0f4 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -1600,12 +1600,12 @@ int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, in struct mlme_priv *pmlmepriv = &adapter->mlmepriv; int res = _SUCCESS; - pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); + pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL); if (!pcmd) { res = _FAIL; /* try again */ goto exit; } - psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_KERNEL); + psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_KERNEL); if (!psetkeyparm) { kfree(pcmd); res = _FAIL; -- cgit From d92b70b372941374d4acd1d5c75a4742be0f2c22 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Wed, 9 Feb 2022 08:36:17 +0100 Subject: staging: r8188eu: remove unused enum Remove an unused enum from rtl8188e_hal_init.c. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220209073618.29725-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index b3ae358d1143..8fe74e21992e 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -336,14 +336,6 @@ exit: return ret; } -/* */ -/* Efuse related code */ -/* */ -enum{ - VOLTAGE_V25 = 0x03, - LDOE25_SHIFT = 28, - }; - void rtl8188e_EfusePowerSwitch(struct adapter *pAdapter, u8 PwrState) { u16 tmpV16; -- cgit From 167390093b9f2265c14aae4147b659adac5968cd Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Wed, 9 Feb 2022 08:36:18 +0100 Subject: staging: r8188eu: clean up enum hw_variables Remove unused constants from enum hw_variables. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220209073618.29725-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/hal_intf.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index e8731e2668f6..8e204d61cc53 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -11,7 +11,6 @@ enum hw_variables { HW_VAR_SET_OPMODE, HW_VAR_BSSID, - HW_VAR_INIT_RTS_RATE, HW_VAR_BASIC_RATE, HW_VAR_CORRECT_TSF, HW_VAR_MLME_DISCONNECT, @@ -25,7 +24,6 @@ enum hw_variables { HW_VAR_DM_FUNC_OP, HW_VAR_DM_FUNC_SET, HW_VAR_DM_FUNC_CLR, - HW_VAR_CAM_READ, HW_VAR_AC_PARAM_BE, HW_VAR_ACM_CTRL, HW_VAR_AMPDU_MIN_SPACE, @@ -35,24 +33,9 @@ enum hw_variables { HW_VAR_H2C_FW_JOINBSSRPT, HW_VAR_FWLPS_RF_ON, HW_VAR_H2C_FW_P2P_PS_OFFLOAD, - HW_VAR_TDLS_WRCR, - HW_VAR_TDLS_INIT_CH_SEN, - HW_VAR_TDLS_RS_RCR, - HW_VAR_TDLS_DONE_CH_SEN, HW_VAR_INITIAL_GAIN, - HW_VAR_BT_SET_COEXIST, - HW_VAR_BT_ISSUE_DELBA, - HW_VAR_ANTENNA_DIVERSITY_LINK, HW_VAR_ANTENNA_DIVERSITY_SELECT, - HW_VAR_SWITCH_EPHY_WoWLAN, - HW_VAR_EFUSE_USAGE, - HW_VAR_EFUSE_BT_USAGE, - HW_VAR_EFUSE_BT_BYTES, HW_VAR_FIFO_CLEARN_UP, - /* The valid upper nav range for the HW updating, if the true value is - * larger than the upper range, the HW won't update it. */ - /* Unit in microsecond. 0 means disable this function. */ - HW_VAR_NAV_UPPER, HW_VAR_RPT_TIMER_SETTING, HW_VAR_TX_RPT_MAX_MACID, HW_VAR_H2C_MEDIA_STATUS_RPT, -- cgit From 83e5f11b8f238259bd6b47022888c573a461b971 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Wed, 9 Feb 2022 20:28:42 +0100 Subject: staging: r8188eu: remove ishighspeed from dvobj_priv There's no need to store the usb device speed in struct dvobj_priv. We can read the speed from struct usb_device. dvobj_priv has a pointer to the usb_device. Reorder one if-statement to make the code clearer. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220209192842.99399-1-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_iol.c | 4 +++- drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 6 +++--- drivers/staging/r8188eu/include/drv_types.h | 1 - drivers/staging/r8188eu/include/usb_ops.h | 2 +- drivers/staging/r8188eu/os_dep/usb_intf.c | 8 -------- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_iol.c b/drivers/staging/r8188eu/core/rtw_iol.c index 923da2a9f6ae..f5f03160759c 100644 --- a/drivers/staging/r8188eu/core/rtw_iol.c +++ b/drivers/staging/r8188eu/core/rtw_iol.c @@ -68,8 +68,10 @@ bool rtw_IOL_applied(struct adapter *adapter) if (1 == adapter->registrypriv.fw_iol) return true; - if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed)) + if ((2 == adapter->registrypriv.fw_iol) && + (adapter_to_dvobj(adapter)->pusbdev->speed != USB_SPEED_HIGH)) return true; + return false; } diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c index 205a392a0ad3..f2555c97b0c4 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c @@ -403,7 +403,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp /* dump frame variable */ u32 ff_hwaddr; - if (pdvobjpriv->ishighspeed) + if (pdvobjpriv->pusbdev->speed == USB_SPEED_HIGH) bulksize = USB_HIGH_SPEED_BULK_SIZE; else bulksize = USB_FULL_SPEED_BULK_SIZE; diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 9bcbc275f043..a2a8166ac3f9 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -99,10 +99,10 @@ static void _InitInterrupt(struct adapter *Adapter) /* 1; Use bulk endpoint to upload interrupt pkt, */ usb_opt = rtw_read8(Adapter, REG_USB_SPECIAL_OPTION); - if (!adapter_to_dvobj(Adapter)->ishighspeed) - usb_opt = usb_opt & (~INT_BULK_SEL); - else + if (adapter_to_dvobj(Adapter)->pusbdev->speed == USB_SPEED_HIGH) usb_opt = usb_opt | (INT_BULK_SEL); + else + usb_opt = usb_opt & (~INT_BULK_SEL); rtw_write8(Adapter, REG_USB_SPECIAL_OPTION, usb_opt); } diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 618a6529192b..894e70a0d506 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -137,7 +137,6 @@ struct dvobj_priv { /*-------- below is for USB INTERFACE --------*/ - u8 ishighspeed; u8 RtNumOutPipes; struct usb_interface *pusbintf; diff --git a/drivers/staging/r8188eu/include/usb_ops.h b/drivers/staging/r8188eu/include/usb_ops.h index 0a1155bbc7b8..62e4706c0497 100644 --- a/drivers/staging/r8188eu/include/usb_ops.h +++ b/drivers/staging/r8188eu/include/usb_ops.h @@ -55,7 +55,7 @@ static inline u8 rtw_usb_bulk_size_boundary(struct adapter *padapter, u8 rst = true; struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); - if (pdvobjpriv->ishighspeed) + if (pdvobjpriv->pusbdev->speed == USB_SPEED_HIGH) rst = (0 == (buf_len) % USB_HIGH_SPEED_BULK_SIZE) ? true : false; else diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c index 668e79a3c70e..ae3750a3f056 100644 --- a/drivers/staging/r8188eu/os_dep/usb_intf.c +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c @@ -117,14 +117,6 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) if (rt_num_in_pipes != 1) goto err; - if (pusbd->speed == USB_SPEED_HIGH) { - pdvobjpriv->ishighspeed = true; - DBG_88E("USB_SPEED_HIGH\n"); - } else { - pdvobjpriv->ishighspeed = false; - DBG_88E("NON USB_SPEED_HIGH\n"); - } - /* 3 misc */ rtw_reset_continual_urb_error(pdvobjpriv); -- cgit From 6c36bcbfcef7c04691ed3dc881f836a0f358e574 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Thu, 10 Feb 2022 11:16:22 +0100 Subject: staging: r8188eu: remove unused structs from ieee80211.h There are lots of unused structures in the ieee80211.h header. Remove them. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220210101623.13758-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/ieee80211.h | 200 ---------------------------- 1 file changed, 200 deletions(-) diff --git a/drivers/staging/r8188eu/include/ieee80211.h b/drivers/staging/r8188eu/include/ieee80211.h index 3a23d5299314..f3b20215ca94 100644 --- a/drivers/staging/r8188eu/include/ieee80211.h +++ b/drivers/staging/r8188eu/include/ieee80211.h @@ -182,28 +182,6 @@ struct ieee_param { } u; }; -struct ieee_param_ex { - u32 cmd; - u8 sta_addr[ETH_ALEN]; - u8 data[0]; -}; - -struct sta_data { - u16 aid; - u16 capability; - int flags; - u32 sta_set; - u8 tx_supp_rates[16]; - u32 tx_supp_rates_len; - struct ieee80211_ht_cap ht_cap; - u64 rx_pkts; - u64 rx_bytes; - u64 rx_drops; - u64 tx_pkts; - u64 tx_bytes; - u64 tx_drops; -}; - #define IEEE80211_DATA_LEN 2304 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 6.2.1.1.2. @@ -219,14 +197,6 @@ struct sta_data { /* this is stolen from ipw2200 driver */ #define IEEE_IBSS_MAC_HASH_SIZE 31 -struct ieee_ibss_seq { - u8 mac[ETH_ALEN]; - u16 seq_num; - u16 frag_num; - unsigned long packet_time; - struct list_head list; -}; - struct rtw_ieee80211_hdr { __le16 frame_ctl; __le16 duration_id; @@ -246,17 +216,6 @@ struct rtw_ieee80211_hdr_3addr { u16 seq_ctl; } __packed; -struct rtw_ieee80211_hdr_qos { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - u16 seq_ctl; - u8 addr4[ETH_ALEN]; - u16 qc; -} __packed; - struct rtw_ieee80211_hdr_3addr_qos { __le16 frame_ctl; __le16 duration_id; @@ -267,14 +226,6 @@ struct rtw_ieee80211_hdr_3addr_qos { u16 qc; } __packed; -struct eapol { - u8 snap[6]; - u16 ethertype; - u8 version; - u8 type; - u16 length; -} __packed; - enum eap_type { EAP_PACKET = 0, EAPOL_START, @@ -557,83 +508,12 @@ struct ieee80211_snap_hdr { #define IEEE80211_NUM_CCK_RATES 4 #define IEEE80211_OFDM_SHIFT_MASK_A 4 -/* NOTE: This data is for statistical purposes; not all hardware provides this - * information for frames received. Not setting these will not cause - * any adverse affects. */ -struct ieee80211_rx_stats { - /* u32 mac_time[2]; */ - s8 rssi; - u8 signal; - u8 noise; - u8 received_channel; - u16 rate; /* in 100 kbps */ - /* u8 control; */ - u8 mask; - u8 freq; - u16 len; -}; - /* IEEE 802.11 requires that STA supports concurrent reception of at least * three fragmented frames. This define can be increased to support more * concurrent frames, but it should be noted that each entry can consume about * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ #define IEEE80211_FRAG_CACHE_LEN 4 -struct ieee80211_frag_entry { - u32 first_frag_time; - uint seq; - uint last_frag; - uint qos; /* jackson */ - uint tid; /* jackson */ - struct sk_buff *skb; - u8 src_addr[ETH_ALEN]; - u8 dst_addr[ETH_ALEN]; -}; - -struct ieee80211_stats { - uint tx_unicast_frames; - uint tx_multicast_frames; - uint tx_fragments; - uint tx_unicast_octets; - uint tx_multicast_octets; - uint tx_deferred_transmissions; - uint tx_single_retry_frames; - uint tx_multiple_retry_frames; - uint tx_retry_limit_exceeded; - uint tx_discards; - uint rx_unicast_frames; - uint rx_multicast_frames; - uint rx_fragments; - uint rx_unicast_octets; - uint rx_multicast_octets; - uint rx_fcs_errors; - uint rx_discards_no_buffer; - uint tx_discards_wrong_sa; - uint rx_discards_undecryptable; - uint rx_message_in_msg_fragments; - uint rx_message_in_bad_msg_fragments; -}; - -struct ieee80211_softmac_stats { - uint rx_ass_ok; - uint rx_ass_err; - uint rx_probe_rq; - uint tx_probe_rs; - uint tx_beacons; - uint rx_auth_rq; - uint rx_auth_rs_ok; - uint rx_auth_rs_err; - uint tx_auth_rq; - uint no_auth_rs; - uint no_ass_rs; - uint tx_ass_rq; - uint rx_ass_rq; - uint tx_probe_rq; - uint reassoc; - uint swtxstop; - uint swtxawake; -}; - #define SEC_KEY_1 (1<<0) #define SEC_KEY_2 (1<<1) #define SEC_KEY_3 (1<<2) @@ -653,18 +533,6 @@ struct ieee80211_softmac_stats { #define WEP_KEYS 4 #define WEP_KEY_LEN 13 -struct ieee80211_security { - u16 active_key:2, - enabled:1, - auth_mode:2, - auth_algo:4, - unicast_uses_group:1; - u8 key_sizes[WEP_KEYS]; - u8 keys[WEP_KEYS][WEP_KEY_LEN]; - u8 level; - u16 flags; -} __packed; - /* 802.11 data frame from AP @@ -680,15 +548,6 @@ Total: 28-2340 bytes */ -struct ieee80211_header_data { - u16 frame_ctl; - u16 duration_id; - u8 addr1[6]; - u8 addr2[6]; - u8 addr3[6]; - u16 seq_ctrl; -}; - #define BEACON_PROBE_SSID_ID_POSITION 12 /* Management Frame Information Element Types */ @@ -705,17 +564,6 @@ struct ieee80211_header_data { #define MFIE_TYPE_RATES_EX 50 #define MFIE_TYPE_GENERIC 221 -struct ieee80211_info_element_hdr { - u8 id; - u8 len; -} __packed; - -struct ieee80211_info_element { - u8 id; - u8 len; - u8 data[0]; -} __packed; - /* * These are the data types that can make up management packets * @@ -736,49 +584,6 @@ struct ieee80211_info_element { #define IEEE80211_DEFAULT_TX_ESSID "Penguin" #define IEEE80211_DEFAULT_BASIC_RATE 10 -struct ieee80211_authentication { - struct ieee80211_header_data header; - u16 algorithm; - u16 transaction; - u16 status; - /* struct ieee80211_info_element_hdr info_element; */ -} __packed; - -struct ieee80211_probe_response { - struct ieee80211_header_data header; - u32 time_stamp[2]; - u16 beacon_interval; - u16 capability; - struct ieee80211_info_element info_element; -} __packed; - -struct ieee80211_probe_request { - struct ieee80211_header_data header; -} __packed; - -struct ieee80211_assoc_request_frame { - struct rtw_ieee80211_hdr_3addr header; - u16 capability; - u16 listen_interval; - struct ieee80211_info_element_hdr info_element; -} __packed; - -struct ieee80211_assoc_response_frame { - struct rtw_ieee80211_hdr_3addr header; - u16 capability; - u16 status; - u16 aid; -} __packed; - -struct ieee80211_txb { - u8 nr_frags; - u8 encrypted; - u16 reserved; - u16 frag_size; - u16 payload_size; - struct sk_buff *fragments[0]; -}; - /* SWEEP TABLE ENTRIES NUMBER*/ #define MAX_SWEEP_TAB_ENTRIES 42 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 @@ -876,11 +681,6 @@ static inline int is_broadcast_mac_addr(const u8 *addr) #define CFG_IEEE80211_RESERVE_FCS (1<<0) #define CFG_IEEE80211_COMPUTE_FCS (1<<1) -struct tx_pending { - int frag; - struct ieee80211_txb *txb; -}; - #define MAXTID 16 #define IEEE_A (1<<0) -- cgit From d08282a9423a09310efe61873b029e352fe335cc Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Thu, 10 Feb 2022 11:16:23 +0100 Subject: staging: r8188eu: remove unused enums from ieee80211.h There are some unused enums in the ieee80211.h header. Remove them. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220210101623.13758-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/ieee80211.h | 66 ----------------------------- 1 file changed, 66 deletions(-) diff --git a/drivers/staging/r8188eu/include/ieee80211.h b/drivers/staging/r8188eu/include/ieee80211.h index f3b20215ca94..1793b99feb9f 100644 --- a/drivers/staging/r8188eu/include/ieee80211.h +++ b/drivers/staging/r8188eu/include/ieee80211.h @@ -226,14 +226,6 @@ struct rtw_ieee80211_hdr_3addr_qos { u16 qc; } __packed; -enum eap_type { - EAP_PACKET = 0, - EAPOL_START, - EAPOL_LOGOFF, - EAPOL_KEY, - EAPOL_ENCAP_ASF_ALERT -}; - #define IEEE80211_3ADDR_LEN 24 #define IEEE80211_4ADDR_LEN 30 #define IEEE80211_FCS_LEN 4 @@ -626,44 +618,6 @@ join_res: > 0: TID */ -enum ieee80211_state { - /* the card is not linked at all */ - IEEE80211_NOLINK = 0, - - /* IEEE80211_ASSOCIATING* are for BSS client mode - * the driver shall not perform RX filtering unless - * the state is LINKED. - * The driver shall just check for the state LINKED and - * defaults to NOLINK for ALL the other states (including - * LINKED_SCANNING) - */ - - /* the association procedure will start (wq scheduling)*/ - IEEE80211_ASSOCIATING, - IEEE80211_ASSOCIATING_RETRY, - - /* the association procedure is sending AUTH request*/ - IEEE80211_ASSOCIATING_AUTHENTICATING, - - /* the association procedure has successfully authentcated - * and is sending association request - */ - IEEE80211_ASSOCIATING_AUTHENTICATED, - - /* the link is ok. the card associated to a BSS or linked - * to a ibss cell or acting as an AP and creating the bss - */ - IEEE80211_LINKED, - - /* same as LINKED, but the driver shall apply RX filter - * rules as we are in NO_LINK mode. As the card is still - * logically linked, but it is doing a syncro site survey - * then it will be back to LINKED state. - */ - IEEE80211_LINKED_SCANNING, - -}; - #define DEFAULT_MAX_SCAN_AGE (15 * HZ) #define DEFAULT_FTS 2346 @@ -741,26 +695,6 @@ enum rtw_ieee80211_back_actioncode { RTW_WLAN_ACTION_DELBA = 2, }; -/* HT features action code */ -enum rtw_ieee80211_ht_actioncode { - RTW_WLAN_ACTION_NOTIFY_CH_WIDTH = 0, - RTW_WLAN_ACTION_SM_PS = 1, - RTW_WLAN_ACTION_PSPM = 2, - RTW_WLAN_ACTION_PCO_PHASE = 3, - RTW_WLAN_ACTION_MIMO_CSI_MX = 4, - RTW_WLAN_ACTION_MIMO_NONCP_BF = 5, - RTW_WLAN_ACTION_MIMP_CP_BF = 6, - RTW_WLAN_ACTION_ASEL_INDICATES_FB = 7, - RTW_WLAN_ACTION_HI_INFO_EXCHG = 8, -}; - -/* BACK (block-ack) parties */ -enum rtw_ieee80211_back_parties { - RTW_WLAN_BACK_RECIPIENT = 0, - RTW_WLAN_BACK_INITIATOR = 1, - RTW_WLAN_BACK_TIMER = 2, -}; - #define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs) * 00:50:F2 */ #define WME_OUI_TYPE 2 -- cgit From d709b5ae9a44f00a5feb010fc215be9dcf472e64 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 12 Feb 2022 17:17:28 +0100 Subject: staging: r8188eu: set path a explicitly We've already limited the rtw_wx_write_rf function to RF_PATH_A in commit 3b011b097c38 ("staging: r8188eu: limit rf register writes to path a"). Set RF_PATH_A explicitly when we call rtl8188e_PHY_SetRFReg. This will make it easier later to verify that all callers of rtl8188e_PHY_SetRFReg use path a. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220212161737.381841-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index c41d75666568..8c49df724461 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2088,7 +2088,7 @@ static int rtw_wx_write_rf(struct net_device *dev, addr = *((u32 *)extra + 1); data32 = *((u32 *)extra + 2); - rtl8188e_PHY_SetRFReg(padapter, path, addr, 0xFFFFF, data32); + rtl8188e_PHY_SetRFReg(padapter, RF_PATH_A, addr, 0xFFFFF, data32); return 0; } -- cgit From e31e782a361af7cda6169220b4e9a4ae814eecfe Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 12 Feb 2022 17:17:29 +0100 Subject: staging: r8188eu: write only path a registers in rtw_dbg_port Commit 3b011b097c38 ("staging: r8188eu: limit rf register writes to path a") limited the rtw_wx_write_rf function to write only rf registers for path a. The private ioctl 0x0B invokes the rtw_dbg_port function. This ioctl can also be used for writing rf registers. We should limit these register writes to rf path a as well. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220212161737.381841-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 8c49df724461..9d3488c28048 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3621,7 +3621,11 @@ static int rtw_dbg_port(struct net_device *dev, DBG_88E("read RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", minor_cmd, arg, rtl8188e_PHY_QueryRFReg(padapter, minor_cmd, arg, 0xffffffff)); break; case 0x75:/* write_rf */ - rtl8188e_PHY_SetRFReg(padapter, minor_cmd, arg, 0xffffffff, extra_arg); + if (minor_cmd != RF_PATH_A) { + ret = -EINVAL; + break; + } + rtl8188e_PHY_SetRFReg(padapter, RF_PATH_A, arg, 0xffffffff, extra_arg); DBG_88E("write RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", minor_cmd, arg, rtl8188e_PHY_QueryRFReg(padapter, minor_cmd, arg, 0xffffffff)); break; -- cgit From e7fd55f6c180b4083471b91bc7840c5fa980749e Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 12 Feb 2022 17:17:30 +0100 Subject: staging: r8188eu: remove path parameter from rtl8188e_PHY_SetRFReg All callers of rtl8188e_PHY_SetRFReg set the eRFPath parameter to RF_PATH_A. Remove the parameter and use RF_PATH_A directly. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220212161737.381841-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 28 ++++++++++++------------ drivers/staging/r8188eu/hal/odm.c | 2 +- drivers/staging/r8188eu/hal/odm_RegConfig8188E.c | 2 +- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 8 +++---- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 4 ++-- drivers/staging/r8188eu/include/Hal8188EPhyCfg.h | 3 +-- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 ++-- 7 files changed, 24 insertions(+), 27 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 8edae488d998..c7aed5ed5fa5 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -327,14 +327,14 @@ phy_PathA_RxIQK(struct adapter *adapt) /* 1 Get TXIMR setting */ /* modify RXIQK mode table */ rtl8188e_PHY_SetBBReg(adapt, rFPGA0_IQK, bMaskDWord, 0x00000000); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf117B); + rtl8188e_PHY_SetRFReg(adapt, RF_WE_LUT, bRFRegOffsetMask, 0x800a0); + rtl8188e_PHY_SetRFReg(adapt, RF_RCK_OS, bRFRegOffsetMask, 0x30000); + rtl8188e_PHY_SetRFReg(adapt, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f); + rtl8188e_PHY_SetRFReg(adapt, RF_TXPA_G2, bRFRegOffsetMask, 0xf117B); /* PA,PAD off */ - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x980); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, 0x56, bRFRegOffsetMask, 0x51000); + rtl8188e_PHY_SetRFReg(adapt, 0xdf, bRFRegOffsetMask, 0x980); + rtl8188e_PHY_SetRFReg(adapt, 0x56, bRFRegOffsetMask, 0x51000); rtl8188e_PHY_SetBBReg(adapt, rFPGA0_IQK, bMaskDWord, 0x80800000); @@ -376,10 +376,10 @@ phy_PathA_RxIQK(struct adapter *adapt) /* 1 RX IQK */ /* modify RXIQK mode table */ rtl8188e_PHY_SetBBReg(adapt, rFPGA0_IQK, bMaskDWord, 0x00000000); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf7ffa); + rtl8188e_PHY_SetRFReg(adapt, RF_WE_LUT, bRFRegOffsetMask, 0x800a0); + rtl8188e_PHY_SetRFReg(adapt, RF_RCK_OS, bRFRegOffsetMask, 0x30000); + rtl8188e_PHY_SetRFReg(adapt, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f); + rtl8188e_PHY_SetRFReg(adapt, RF_TXPA_G2, bRFRegOffsetMask, 0xf7ffa); rtl8188e_PHY_SetBBReg(adapt, rFPGA0_IQK, bMaskDWord, 0x80800000); /* IQK setting */ @@ -410,7 +410,7 @@ phy_PathA_RxIQK(struct adapter *adapt) /* reload RF 0xdf */ rtl8188e_PHY_SetBBReg(adapt, rFPGA0_IQK, bMaskDWord, 0x00000000); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180); + rtl8188e_PHY_SetRFReg(adapt, 0xdf, bRFRegOffsetMask, 0x180); if (!(regeac & BIT(27)) && /* if Tx is OK, check whether Rx is OK */ (((regEA4 & 0x03FF0000) >> 16) != 0x132) && @@ -763,14 +763,14 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt) /* 2. Set RF mode = standby mode */ /* Path-A */ - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits, (RF_Amode & 0x8FFFF) | 0x10000); + rtl8188e_PHY_SetRFReg(adapt, RF_AC, bMask12Bits, (RF_Amode & 0x8FFFF) | 0x10000); } /* 3. Read RF reg18 */ LC_Cal = rtl8188e_PHY_QueryRFReg(adapt, RF_PATH_A, RF_CHNLBW, bMask12Bits); /* 4. Set LC calibration begin bit15 */ - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_CHNLBW, bMask12Bits, LC_Cal | 0x08000); + rtl8188e_PHY_SetRFReg(adapt, RF_CHNLBW, bMask12Bits, LC_Cal | 0x08000); msleep(100); @@ -779,7 +779,7 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt) /* Deal with continuous TX case */ /* Path-A */ rtw_write8(adapt, 0xd03, tmpreg); - rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits, RF_Amode); + rtl8188e_PHY_SetRFReg(adapt, RF_AC, bMask12Bits, RF_Amode); } else { /* Deal with Packet TX case */ rtw_write8(adapt, REG_TXPAUSE, 0x00); diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index a759c2fe5d66..b4be706545ff 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -896,7 +896,7 @@ void ODM_TXPowerTrackingCheck(struct odm_dm_struct *pDM_Odm) struct adapter *Adapter = pDM_Odm->Adapter; if (!pDM_Odm->RFCalibrateInfo.TM_Trigger) { /* at least delay 1 sec */ - rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, BIT(17) | BIT(16), 0x03); + rtl8188e_PHY_SetRFReg(Adapter, RF_T_METER_88E, BIT(17) | BIT(16), 0x03); pDM_Odm->RFCalibrateInfo.TM_Trigger = 1; return; diff --git a/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c b/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c index 9059f2533b0b..0fa17a99f9e9 100644 --- a/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c +++ b/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c @@ -19,7 +19,7 @@ static void odm_ConfigRFReg_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, } else if (Addr == 0xf9) { udelay(1); } else { - rtl8188e_PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH_A, RegAddr, bRFRegOffsetMask, Data); + rtl8188e_PHY_SetRFReg(pDM_Odm->Adapter, RegAddr, bRFRegOffsetMask, Data); /* Add 1us delay between BB/RF register setting. */ udelay(1); } diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index cd82452238e0..628cec40db5f 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -282,7 +282,6 @@ u32 rtl8188e_PHY_QueryRFReg(struct adapter *Adapter, enum rf_radio_path eRFPath, * * Input: * struct adapter *Adapter, -* enum rf_radio_path eRFPath, Radio path of A/B/C/D * u32 RegAddr, The target address to be modified * u32 BitMask The target bit position in the target address * to be modified @@ -296,7 +295,6 @@ u32 rtl8188e_PHY_QueryRFReg(struct adapter *Adapter, enum rf_radio_path eRFPath, void rtl8188e_PHY_SetRFReg( struct adapter *Adapter, - enum rf_radio_path eRFPath, u32 RegAddr, u32 BitMask, u32 Data @@ -306,12 +304,12 @@ rtl8188e_PHY_SetRFReg( /* RF data is 12 bits only */ if (BitMask != bRFRegOffsetMask) { - Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr); + Original_Value = phy_RFSerialRead(Adapter, RF_PATH_A, RegAddr); BitShift = phy_CalculateBitShift(BitMask); Data = ((Original_Value & (~BitMask)) | (Data << BitShift)); } - phy_RFSerialWrite(Adapter, eRFPath, RegAddr, Data); + phy_RFSerialWrite(Adapter, RF_PATH_A, RegAddr, Data); } /* */ @@ -725,7 +723,7 @@ static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel) param1 = RF_CHNLBW; param2 = channel; pHalData->RfRegChnlVal = ((pHalData->RfRegChnlVal & 0xfffffc00) | param2); - rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal); + rtl8188e_PHY_SetRFReg(Adapter, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal); } void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c index 2d5d04b384d1..4a7a877e4017 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c @@ -51,11 +51,11 @@ void rtl8188e_PHY_RF6052SetBandwidth(struct adapter *Adapter, switch (Bandwidth) { case HT_CHANNEL_WIDTH_20: pHalData->RfRegChnlVal = ((pHalData->RfRegChnlVal & 0xfffff3ff) | BIT(10) | BIT(11)); - rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal); + rtl8188e_PHY_SetRFReg(Adapter, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal); break; case HT_CHANNEL_WIDTH_40: pHalData->RfRegChnlVal = ((pHalData->RfRegChnlVal & 0xfffff3ff) | BIT(10)); - rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal); + rtl8188e_PHY_SetRFReg(Adapter, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal); break; default: break; diff --git a/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h b/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h index 2517a08bc95a..e0dff772534d 100644 --- a/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h +++ b/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h @@ -75,8 +75,7 @@ void rtl8188e_PHY_SetBBReg(struct adapter *Adapter, u32 RegAddr, u32 mask, u32 data); u32 rtl8188e_PHY_QueryRFReg(struct adapter *adapter, enum rf_radio_path rfpath, u32 regaddr, u32 mask); -void rtl8188e_PHY_SetRFReg(struct adapter *adapter, enum rf_radio_path rfpath, - u32 regaddr, u32 mask, u32 data); +void rtl8188e_PHY_SetRFReg(struct adapter *adapter, u32 regaddr, u32 mask, u32 data); /* Initialization related function */ /* MAC/BB/RF HAL config */ diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 9d3488c28048..548ed6f965f8 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2088,7 +2088,7 @@ static int rtw_wx_write_rf(struct net_device *dev, addr = *((u32 *)extra + 1); data32 = *((u32 *)extra + 2); - rtl8188e_PHY_SetRFReg(padapter, RF_PATH_A, addr, 0xFFFFF, data32); + rtl8188e_PHY_SetRFReg(padapter, addr, 0xFFFFF, data32); return 0; } @@ -3625,7 +3625,7 @@ static int rtw_dbg_port(struct net_device *dev, ret = -EINVAL; break; } - rtl8188e_PHY_SetRFReg(padapter, RF_PATH_A, arg, 0xffffffff, extra_arg); + rtl8188e_PHY_SetRFReg(padapter, arg, 0xffffffff, extra_arg); DBG_88E("write RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", minor_cmd, arg, rtl8188e_PHY_QueryRFReg(padapter, minor_cmd, arg, 0xffffffff)); break; -- cgit From 138a2ff3cceaa9089f7cb5f25207f7175b8391a2 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 12 Feb 2022 17:17:31 +0100 Subject: staging: r8188eu: remove path parameter from phy_RFSerialWrite The only caller of phy_RFSerialWrite sets the eRFPath parameter to RF_PATH_A. Remove the parameter and use RF_PATH_A directly. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220212161737.381841-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 628cec40db5f..9e02855c47b2 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -217,14 +217,13 @@ phy_RFSerialRead( static void phy_RFSerialWrite( struct adapter *Adapter, - enum rf_radio_path eRFPath, u32 Offset, u32 Data ) { u32 DataAndAddr = 0; struct hal_data_8188e *pHalData = &Adapter->haldata; - struct bb_reg_def *pPhyReg = &pHalData->PHYRegDef[eRFPath]; + struct bb_reg_def *pPhyReg = &pHalData->PHYRegDef[RF_PATH_A]; u32 NewOffset; /* 2009/06/17 MH We can not execute IO for power save or other accident mode. */ @@ -309,7 +308,7 @@ rtl8188e_PHY_SetRFReg( Data = ((Original_Value & (~BitMask)) | (Data << BitShift)); } - phy_RFSerialWrite(Adapter, RF_PATH_A, RegAddr, Data); + phy_RFSerialWrite(Adapter, RegAddr, Data); } /* */ -- cgit From aa7776609583ba8d3cbf44a7c46c8bd0cbb75689 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 12 Feb 2022 17:17:32 +0100 Subject: staging: r8188eu: clarify that bb_reg_dump uses only path a The path variable is always 0 in bb_reg_dump. Remove the path variable and replace the constant 0 with RF_PATH_A to make it clearer that path a is used. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220212161737.381841-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 548ed6f965f8..e815ae223f53 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3538,13 +3538,13 @@ static void bb_reg_dump(struct adapter *padapter) static void rf_reg_dump(struct adapter *padapter) { - int i, j = 1, path = 0; + int i, j = 1; u32 value; pr_info("\n ======= RF REG =======\n"); - pr_info("\nRF_Path(%x)\n", path); + pr_info("\nRF_Path(%x)\n", RF_PATH_A); for (i = 0; i < 0x100; i++) { - value = rtl8188e_PHY_QueryRFReg(padapter, path, i, 0xffffffff); + value = rtl8188e_PHY_QueryRFReg(padapter, RF_PATH_A, i, 0xffffffff); if (j % 4 == 1) pr_info("0x%02x ", i); pr_info(" 0x%08x ", value); -- cgit From 67a825083163331bbc48569dca41aa7f53a26625 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 12 Feb 2022 17:17:33 +0100 Subject: staging: r8188eu: limit rtw_wx_read_rf to path a Commit 3b011b097c38 ("staging: r8188eu: limit rf register writes to path a") limits rf register writes by private ioctls to RF_PATH_A. Apart from private ioctls, the rest of the driver uses only path a. This patch limits rf register reads by the private ioctl 0x0D, which calls rtw_wx_read_rf, to path a. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220212161737.381841-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index e815ae223f53..30fdc8afcffe 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2063,8 +2063,11 @@ static int rtw_wx_read_rf(struct net_device *dev, u32 path, addr, data32; path = *(u32 *)extra; + if (path != RF_PATH_A) + return -EINVAL; + addr = *((u32 *)extra + 1); - data32 = rtl8188e_PHY_QueryRFReg(padapter, path, addr, 0xFFFFF); + data32 = rtl8188e_PHY_QueryRFReg(padapter, RF_PATH_A, addr, 0xFFFFF); /* * IMPORTANT!! * Only when wireless private ioctl is at odd order, @@ -3626,7 +3629,7 @@ static int rtw_dbg_port(struct net_device *dev, break; } rtl8188e_PHY_SetRFReg(padapter, arg, 0xffffffff, extra_arg); - DBG_88E("write RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", minor_cmd, arg, rtl8188e_PHY_QueryRFReg(padapter, minor_cmd, arg, 0xffffffff)); + DBG_88E("write RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", RF_PATH_A, arg, rtl8188e_PHY_QueryRFReg(padapter, RF_PATH_A, arg, 0xffffffff)); break; case 0x76: -- cgit From 8460ddc21c6f42d01b75ef37a5a0814d14f18ff1 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 12 Feb 2022 17:17:34 +0100 Subject: staging: r8188eu: limit rtw_dbg_port to path a Rf registers can be read by rtw_wx_read_rf or via the private ioctl 0x0B. The latter calls rtw_dbg_port. Limit rf register reads to path a in rtw_debug_port. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220212161737.381841-8-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 30fdc8afcffe..4b3134aef917 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -3621,7 +3621,11 @@ static int rtw_dbg_port(struct net_device *dev, DBG_88E("write_bbreg(0x%x) = 0x%x\n", arg, rtl8188e_PHY_QueryBBReg(padapter, arg, 0xffffffff)); break; case 0x74:/* read_rf */ - DBG_88E("read RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", minor_cmd, arg, rtl8188e_PHY_QueryRFReg(padapter, minor_cmd, arg, 0xffffffff)); + if (minor_cmd != RF_PATH_A) { + ret = -EINVAL; + break; + } + DBG_88E("read RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", RF_PATH_A, arg, rtl8188e_PHY_QueryRFReg(padapter, RF_PATH_A, arg, 0xffffffff)); break; case 0x75:/* write_rf */ if (minor_cmd != RF_PATH_A) { -- cgit From c45049ad5270d9e664401a6c9fab794667b3cbe2 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 12 Feb 2022 17:17:35 +0100 Subject: staging: r8188eu: remove path parameter from rtl8188e_PHY_QueryRFReg All callers of rtl8188e_PHY_QueryRFReg set the eRFPath parameter to RF_PATH_A. Remove the parameter and use RF_PATH_A directly. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220212161737.381841-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 6 +++--- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 6 ++---- drivers/staging/r8188eu/hal/usb_halinit.c | 2 +- drivers/staging/r8188eu/include/Hal8188EPhyCfg.h | 3 +-- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 ++++---- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index c7aed5ed5fa5..0fcf094ae594 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -132,7 +132,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( /* RFCalibrateInfo.RegA24 will be initialized when ODM HW configuring, but MP configures with para files. */ dm_odm->RFCalibrateInfo.RegA24 = 0x090e1317; - ThermalValue = (u8)rtl8188e_PHY_QueryRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, 0xfc00); /* 0x42: RF Reg[15:10] 88E */ + ThermalValue = (u8)rtl8188e_PHY_QueryRFReg(Adapter, RF_T_METER_88E, 0xfc00); /* 0x42: RF Reg[15:10] 88E */ if (ThermalValue) { /* Query OFDM path A default setting */ @@ -759,7 +759,7 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt) if ((tmpreg & 0x70) != 0) { /* 1. Read original RF mode */ /* Path-A */ - RF_Amode = rtl8188e_PHY_QueryRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits); + RF_Amode = rtl8188e_PHY_QueryRFReg(adapt, RF_AC, bMask12Bits); /* 2. Set RF mode = standby mode */ /* Path-A */ @@ -767,7 +767,7 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt) } /* 3. Read RF reg18 */ - LC_Cal = rtl8188e_PHY_QueryRFReg(adapt, RF_PATH_A, RF_CHNLBW, bMask12Bits); + LC_Cal = rtl8188e_PHY_QueryRFReg(adapt, RF_CHNLBW, bMask12Bits); /* 4. Set LC calibration begin bit15 */ rtl8188e_PHY_SetRFReg(adapt, RF_CHNLBW, bMask12Bits, LC_Cal | 0x08000); diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 9e02855c47b2..2dcd1df58aaa 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -253,7 +253,6 @@ phy_RFSerialWrite( * * Input: * struct adapter *Adapter, -* enum rf_radio_path eRFPath, Radio path of A/B/C/D * u32 RegAddr, The target address to be read * u32 BitMask The target bit position in the target address * to be read @@ -262,12 +261,11 @@ phy_RFSerialWrite( * Return: u32 Readback value * Note: This function is equal to "GetRFRegSetting" in PHY programming guide */ -u32 rtl8188e_PHY_QueryRFReg(struct adapter *Adapter, enum rf_radio_path eRFPath, - u32 RegAddr, u32 BitMask) +u32 rtl8188e_PHY_QueryRFReg(struct adapter *Adapter, u32 RegAddr, u32 BitMask) { u32 Original_Value, Readback_Value, BitShift; - Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr); + Original_Value = phy_RFSerialRead(Adapter, RF_PATH_A, RegAddr); BitShift = phy_CalculateBitShift(BitMask); Readback_Value = (Original_Value & BitMask) >> BitShift; diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index a2a8166ac3f9..e2013745d41c 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -662,7 +662,7 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) rtw_write16(Adapter, REG_PKT_BE_BK_LIFE_TIME, 0x0400); /* unit: 256us. 256ms */ /* Keep RfRegChnlVal for later use. */ - haldata->RfRegChnlVal = rtl8188e_PHY_QueryRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask); + haldata->RfRegChnlVal = rtl8188e_PHY_QueryRFReg(Adapter, RF_CHNLBW, bRFRegOffsetMask); _BBTurnOnBlock(Adapter); diff --git a/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h b/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h index e0dff772534d..9e6f2361b090 100644 --- a/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h +++ b/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h @@ -73,8 +73,7 @@ struct bb_reg_def { u32 rtl8188e_PHY_QueryBBReg(struct adapter *adapter, u32 regaddr, u32 mask); void rtl8188e_PHY_SetBBReg(struct adapter *Adapter, u32 RegAddr, u32 mask, u32 data); -u32 rtl8188e_PHY_QueryRFReg(struct adapter *adapter, enum rf_radio_path rfpath, - u32 regaddr, u32 mask); +u32 rtl8188e_PHY_QueryRFReg(struct adapter *adapter, u32 regaddr, u32 mask); void rtl8188e_PHY_SetRFReg(struct adapter *adapter, u32 regaddr, u32 mask, u32 data); /* Initialization related function */ diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 4b3134aef917..f6a683cda614 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2067,7 +2067,7 @@ static int rtw_wx_read_rf(struct net_device *dev, return -EINVAL; addr = *((u32 *)extra + 1); - data32 = rtl8188e_PHY_QueryRFReg(padapter, RF_PATH_A, addr, 0xFFFFF); + data32 = rtl8188e_PHY_QueryRFReg(padapter, addr, 0xFFFFF); /* * IMPORTANT!! * Only when wireless private ioctl is at odd order, @@ -3547,7 +3547,7 @@ static void rf_reg_dump(struct adapter *padapter) pr_info("\n ======= RF REG =======\n"); pr_info("\nRF_Path(%x)\n", RF_PATH_A); for (i = 0; i < 0x100; i++) { - value = rtl8188e_PHY_QueryRFReg(padapter, RF_PATH_A, i, 0xffffffff); + value = rtl8188e_PHY_QueryRFReg(padapter, i, 0xffffffff); if (j % 4 == 1) pr_info("0x%02x ", i); pr_info(" 0x%08x ", value); @@ -3625,7 +3625,7 @@ static int rtw_dbg_port(struct net_device *dev, ret = -EINVAL; break; } - DBG_88E("read RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", RF_PATH_A, arg, rtl8188e_PHY_QueryRFReg(padapter, RF_PATH_A, arg, 0xffffffff)); + DBG_88E("read RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", RF_PATH_A, arg, rtl8188e_PHY_QueryRFReg(padapter, arg, 0xffffffff)); break; case 0x75:/* write_rf */ if (minor_cmd != RF_PATH_A) { @@ -3633,7 +3633,7 @@ static int rtw_dbg_port(struct net_device *dev, break; } rtl8188e_PHY_SetRFReg(padapter, arg, 0xffffffff, extra_arg); - DBG_88E("write RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", RF_PATH_A, arg, rtl8188e_PHY_QueryRFReg(padapter, RF_PATH_A, arg, 0xffffffff)); + DBG_88E("write RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", RF_PATH_A, arg, rtl8188e_PHY_QueryRFReg(padapter, arg, 0xffffffff)); break; case 0x76: -- cgit From aa3dfd4613533a1603b096bccb6e62deee515071 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 12 Feb 2022 17:17:36 +0100 Subject: staging: r8188eu: remove path parameter from phy_RFSerialRead All callers of phy_RFSerialRead set the eRFPath parameter to RF_PATH_A. Remove the parameter and use RF_PATH_A directly. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220212161737.381841-10-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 2dcd1df58aaa..e2e4443b7414 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -104,7 +104,6 @@ void rtl8188e_PHY_SetBBReg(struct adapter *Adapter, u32 RegAddr, u32 BitMask, u3 * * Input: * struct adapter *Adapter, -* enum rf_radio_path eRFPath, Radio path of A/B/C/D * u32 Offset, The target address to be read * * Output: None @@ -119,13 +118,12 @@ void rtl8188e_PHY_SetBBReg(struct adapter *Adapter, u32 RegAddr, u32 BitMask, u3 static u32 phy_RFSerialRead( struct adapter *Adapter, - enum rf_radio_path eRFPath, u32 Offset ) { u32 retValue = 0; struct hal_data_8188e *pHalData = &Adapter->haldata; - struct bb_reg_def *pPhyReg = &pHalData->PHYRegDef[eRFPath]; + struct bb_reg_def *pPhyReg = &pHalData->PHYRegDef[RF_PATH_A]; u32 NewOffset; u32 tmplong, tmplong2; u8 RfPiEnable = 0; @@ -143,10 +141,7 @@ phy_RFSerialRead( /* For RF A/B write 0x824/82c(does not work in the future) */ /* We must use 0x824 for RF A and B to execute read trigger */ tmplong = rtl8188e_PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord); - if (eRFPath == RF_PATH_A) - tmplong2 = tmplong; - else - tmplong2 = rtl8188e_PHY_QueryBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord); + tmplong2 = tmplong; tmplong2 = (tmplong2 & (~bLSSIReadAddress)) | (NewOffset << 23) | bLSSIReadEdge; /* T65 RF */ @@ -158,10 +153,7 @@ phy_RFSerialRead( udelay(10);/* PlatformStallExecution(10); */ - if (eRFPath == RF_PATH_A) - RfPiEnable = (u8)rtl8188e_PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter1, BIT(8)); - else if (eRFPath == RF_PATH_B) - RfPiEnable = (u8)rtl8188e_PHY_QueryBBReg(Adapter, rFPGA0_XB_HSSIParameter1, BIT(8)); + RfPiEnable = (u8)rtl8188e_PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter1, BIT(8)); if (RfPiEnable) { /* Read from BBreg8b8, 12 bits for 8190, 20bits for T65 RF */ retValue = rtl8188e_PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBackPi, bLSSIReadBackData); @@ -265,7 +257,7 @@ u32 rtl8188e_PHY_QueryRFReg(struct adapter *Adapter, u32 RegAddr, u32 BitMask) { u32 Original_Value, Readback_Value, BitShift; - Original_Value = phy_RFSerialRead(Adapter, RF_PATH_A, RegAddr); + Original_Value = phy_RFSerialRead(Adapter, RegAddr); BitShift = phy_CalculateBitShift(BitMask); Readback_Value = (Original_Value & BitMask) >> BitShift; @@ -301,7 +293,7 @@ rtl8188e_PHY_SetRFReg( /* RF data is 12 bits only */ if (BitMask != bRFRegOffsetMask) { - Original_Value = phy_RFSerialRead(Adapter, RF_PATH_A, RegAddr); + Original_Value = phy_RFSerialRead(Adapter, RegAddr); BitShift = phy_CalculateBitShift(BitMask); Data = ((Original_Value & (~BitMask)) | (Data << BitShift)); } -- cgit From 841b3f2fb6c685121f5f7b5f58c08a8f35569a63 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 12 Feb 2022 17:17:37 +0100 Subject: staging: r8188eu: we only need one struct bb_reg_def for path a The r8188eu driver does no longer access rf path b registers via PHYRegDef. Change the PHYRegDef array in struct hal_data_8188e to a single variable that holds the register addresses for rf path a. Remove the initialisation of path b register addresses. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220212161737.381841-11-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 58 +++++++++----------------- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 2 +- drivers/staging/r8188eu/include/rtl8188e_hal.h | 2 +- 3 files changed, 22 insertions(+), 40 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index e2e4443b7414..b0e5b9f6a005 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -123,7 +123,7 @@ phy_RFSerialRead( { u32 retValue = 0; struct hal_data_8188e *pHalData = &Adapter->haldata; - struct bb_reg_def *pPhyReg = &pHalData->PHYRegDef[RF_PATH_A]; + struct bb_reg_def *pPhyReg = &pHalData->PHYRegDef; u32 NewOffset; u32 tmplong, tmplong2; u8 RfPiEnable = 0; @@ -215,7 +215,7 @@ phy_RFSerialWrite( { u32 DataAndAddr = 0; struct hal_data_8188e *pHalData = &Adapter->haldata; - struct bb_reg_def *pPhyReg = &pHalData->PHYRegDef[RF_PATH_A]; + struct bb_reg_def *pPhyReg = &pHalData->PHYRegDef; u32 NewOffset; /* 2009/06/17 MH We can not execute IO for power save or other accident mode. */ @@ -358,76 +358,58 @@ phy_InitBBRFRegisterDefinition( struct hal_data_8188e *pHalData = &Adapter->haldata; /* RF Interface Sowrtware Control */ - pHalData->PHYRegDef[RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; /* 16 LSBs if read 32-bit from 0x870 */ - pHalData->PHYRegDef[RF_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW; /* 16 MSBs if read 32-bit from 0x870 (16-bit for 0x872) */ + pHalData->PHYRegDef.rfintfs = rFPGA0_XAB_RFInterfaceSW; /* 16 LSBs if read 32-bit from 0x870 */ /* RF Interface Readback Value */ - pHalData->PHYRegDef[RF_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB; /* 16 LSBs if read 32-bit from 0x8E0 */ - pHalData->PHYRegDef[RF_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB;/* 16 MSBs if read 32-bit from 0x8E0 (16-bit for 0x8E2) */ + pHalData->PHYRegDef.rfintfi = rFPGA0_XAB_RFInterfaceRB; /* 16 LSBs if read 32-bit from 0x8E0 */ /* RF Interface Output (and Enable) */ - pHalData->PHYRegDef[RF_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE; /* 16 LSBs if read 32-bit from 0x860 */ - pHalData->PHYRegDef[RF_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE; /* 16 LSBs if read 32-bit from 0x864 */ + pHalData->PHYRegDef.rfintfo = rFPGA0_XA_RFInterfaceOE; /* 16 LSBs if read 32-bit from 0x860 */ /* RF Interface (Output and) Enable */ - pHalData->PHYRegDef[RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE; /* 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862) */ - pHalData->PHYRegDef[RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE; /* 16 MSBs if read 32-bit from 0x864 (16-bit for 0x866) */ + pHalData->PHYRegDef.rfintfe = rFPGA0_XA_RFInterfaceOE; /* 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862) */ /* Addr of LSSI. Wirte RF register by driver */ - pHalData->PHYRegDef[RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; /* LSSI Parameter */ - pHalData->PHYRegDef[RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter; + pHalData->PHYRegDef.rf3wireOffset = rFPGA0_XA_LSSIParameter; /* LSSI Parameter */ /* RF parameter */ - pHalData->PHYRegDef[RF_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter; /* BB Band Select */ - pHalData->PHYRegDef[RF_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter; + pHalData->PHYRegDef.rfLSSI_Select = rFPGA0_XAB_RFParameter; /* BB Band Select */ /* Tx AGC Gain Stage (same for all path. Should we remove this?) */ - pHalData->PHYRegDef[RF_PATH_A].rfTxGainStage = rFPGA0_TxGainStage; /* Tx gain stage */ - pHalData->PHYRegDef[RF_PATH_B].rfTxGainStage = rFPGA0_TxGainStage; /* Tx gain stage */ + pHalData->PHYRegDef.rfTxGainStage = rFPGA0_TxGainStage; /* Tx gain stage */ /* Tranceiver A~D HSSI Parameter-1 */ - pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1; /* wire control parameter1 */ - pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1; /* wire control parameter1 */ + pHalData->PHYRegDef.rfHSSIPara1 = rFPGA0_XA_HSSIParameter1; /* wire control parameter1 */ /* Tranceiver A~D HSSI Parameter-2 */ - pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; /* wire control parameter2 */ - pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; /* wire control parameter2 */ + pHalData->PHYRegDef.rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; /* wire control parameter2 */ /* RF switch Control */ - pHalData->PHYRegDef[RF_PATH_A].rfSwitchControl = rFPGA0_XAB_SwitchControl; /* TR/Ant switch control */ - pHalData->PHYRegDef[RF_PATH_B].rfSwitchControl = rFPGA0_XAB_SwitchControl; + pHalData->PHYRegDef.rfSwitchControl = rFPGA0_XAB_SwitchControl; /* TR/Ant switch control */ /* AGC control 1 */ - pHalData->PHYRegDef[RF_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1; - pHalData->PHYRegDef[RF_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1; + pHalData->PHYRegDef.rfAGCControl1 = rOFDM0_XAAGCCore1; /* AGC control 2 */ - pHalData->PHYRegDef[RF_PATH_A].rfAGCControl2 = rOFDM0_XAAGCCore2; - pHalData->PHYRegDef[RF_PATH_B].rfAGCControl2 = rOFDM0_XBAGCCore2; + pHalData->PHYRegDef.rfAGCControl2 = rOFDM0_XAAGCCore2; /* RX AFE control 1 */ - pHalData->PHYRegDef[RF_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance; - pHalData->PHYRegDef[RF_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance; + pHalData->PHYRegDef.rfRxIQImbalance = rOFDM0_XARxIQImbalance; /* RX AFE control 1 */ - pHalData->PHYRegDef[RF_PATH_A].rfRxAFE = rOFDM0_XARxAFE; - pHalData->PHYRegDef[RF_PATH_B].rfRxAFE = rOFDM0_XBRxAFE; + pHalData->PHYRegDef.rfRxAFE = rOFDM0_XARxAFE; /* Tx AFE control 1 */ - pHalData->PHYRegDef[RF_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance; - pHalData->PHYRegDef[RF_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance; + pHalData->PHYRegDef.rfTxIQImbalance = rOFDM0_XATxIQImbalance; /* Tx AFE control 2 */ - pHalData->PHYRegDef[RF_PATH_A].rfTxAFE = rOFDM0_XATxAFE; - pHalData->PHYRegDef[RF_PATH_B].rfTxAFE = rOFDM0_XBTxAFE; + pHalData->PHYRegDef.rfTxAFE = rOFDM0_XATxAFE; /* Tranceiver LSSI Readback SI mode */ - pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; - pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; + pHalData->PHYRegDef.rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; /* Tranceiver LSSI Readback PI mode */ - pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback; - pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBackPi = TransceiverB_HSPI_Readback; + pHalData->PHYRegDef.rfLSSIReadBackPi = TransceiverA_HSPI_Readback; } void storePwrIndexDiffRateOffset(struct adapter *Adapter, u32 RegAddr, u32 BitMask, u32 Data) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c index 4a7a877e4017..d043b7bc4142 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c @@ -375,7 +375,7 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) /* Initialize RF */ - pPhyReg = &pHalData->PHYRegDef[0]; + pPhyReg = &pHalData->PHYRegDef; /*----Store original RFENV control type----*/ u4RegValue = rtl8188e_PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV); diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 5b27bae97e91..44321a53a345 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -141,7 +141,7 @@ struct hal_data_8188e { u32 AcParam_BE; /* Original parameter for BE, use for EDCA turbo. */ - struct bb_reg_def PHYRegDef[2]; /* Radio A/B */ + struct bb_reg_def PHYRegDef; u32 RfRegChnlVal; -- cgit From 25e4f5220efead592c83200241e098e757d37e1f Mon Sep 17 00:00:00 2001 From: Arınç ÜNAL Date: Tue, 15 Feb 2022 11:17:24 +0300 Subject: staging: mt7621-dts: fix pinctrl-0 items to be size-1 items on ethernet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix pinctrl-0 items under the ethernet node to be size-1 items. Current notation would be used on specifications with non-zero cells. Fixes: 0a93c0d75809 ("staging: mt7621-dts: fix pinctrl properties for ethernet") Reported-by: Sander Vanheule Signed-off-by: Arınç ÜNAL Link: https://lore.kernel.org/r/20220215081725.3463-1-arinc.unal@arinc9.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dts/mt7621.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index 4ae744b96464..4da20da243e6 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -323,7 +323,7 @@ mediatek,ethsys = <&sysc>; pinctrl-names = "default"; - pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>, <&rgmii2_pins>; gmac0: mac@0 { compatible = "mediatek,eth-mac"; -- cgit From 56f1124a94699e18fde9421cfabed2312e7fc28e Mon Sep 17 00:00:00 2001 From: Arınç ÜNAL Date: Tue, 15 Feb 2022 11:17:25 +0300 Subject: staging: mt7621-dts: do not use rgmii2_pins for ethernet on GB-PC1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GB-PC1 uses some of the rgmii2 pins (22 - 33) as GPIO. Therefore, the rgmii2 bus cannot be used on this device. Overwrite pinctrl-0 property under the ethernet node without rgmii2_pins on the GB-PC1 devicetree. Tested-by: Sergio Paracuellos Signed-off-by: Arınç ÜNAL Link: https://lore.kernel.org/r/20220215081725.3463-2-arinc.unal@arinc9.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dts/gbpc1.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/mt7621-dts/gbpc1.dts b/drivers/staging/mt7621-dts/gbpc1.dts index e38a083811e5..1b5175e6ccf3 100644 --- a/drivers/staging/mt7621-dts/gbpc1.dts +++ b/drivers/staging/mt7621-dts/gbpc1.dts @@ -114,6 +114,10 @@ }; }; +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + &switch0 { ports { port@0 { -- cgit From 3027d37d93a7d55d47ef39887d5af5469617c894 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Sun, 13 Feb 2022 23:04:26 +0530 Subject: staging: r8188eu: mark _rtw_free_sta_priv as void _rtw_free_sta_priv() always returns _SUCCESS and it's return value isn't checked either. So it makes sense to mark it as void instead of u32. Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220213173424.39935-1-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_sta_mgt.c | 4 +--- drivers/staging/r8188eu/include/sta_info.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c index de5406a5870c..79b49a13fe61 100644 --- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c @@ -117,7 +117,7 @@ inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info)); } -u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) +void _rtw_free_sta_priv(struct sta_priv *pstapriv) { struct list_head *phead, *plist; struct sta_info *psta = NULL; @@ -147,8 +147,6 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) vfree(pstapriv->pallocated_stainfo_buf); } - - return _SUCCESS; } struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) diff --git a/drivers/staging/r8188eu/include/sta_info.h b/drivers/staging/r8188eu/include/sta_info.h index 24b1254310b2..23f6a85bf017 100644 --- a/drivers/staging/r8188eu/include/sta_info.h +++ b/drivers/staging/r8188eu/include/sta_info.h @@ -344,7 +344,7 @@ static inline u32 wifi_mac_hash(u8 *mac) } extern u32 _rtw_init_sta_priv(struct sta_priv *pstapriv); -extern u32 _rtw_free_sta_priv(struct sta_priv *pstapriv); +extern void _rtw_free_sta_priv(struct sta_priv *pstapriv); #define stainfo_offset_valid(offset) (offset < NUM_STA && offset >= 0) int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta); -- cgit From 2ea2394e01f82c8c327113af9f2c4548437ba41a Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Wed, 9 Feb 2022 22:05:59 +0530 Subject: staging: r8188eu: remove unused struct zero_bulkout_context struct zero_bulkout_context is not used. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/05b72a7b045a829de6f706295d17c9f0d5fa5e2f.1644422181.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/usb_ops_linux.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c index 3977a717d30a..d75933c73946 100644 --- a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c +++ b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c @@ -20,13 +20,6 @@ unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr) return pipe; } -struct zero_bulkout_context { - void *pbuf; - void *purb; - void *pirp; - void *padapter; -}; - void rtw_read_port_cancel(struct adapter *padapter) { int i; -- cgit From 50ad6a0ffc64283784dbced98879cfec3cf09ce8 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Wed, 9 Feb 2022 22:06:00 +0530 Subject: staging: r8188eu: remove empty function rtw_get_encrypt_decrypt_from_registrypriv The definition of function rtw_get_encrypt_decrypt_from_registrypriv is empty. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/3d84df54e73b49464d2a0732b44acdb71687b3b1.1644422181.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme.c | 7 ------- drivers/staging/r8188eu/include/rtw_mlme.h | 2 -- 2 files changed, 9 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index f5b2df72e0f4..47baef64bdc4 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -1020,8 +1020,6 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) struct wlan_network *pcur_wlan = NULL, *ptarget_wlan = NULL; unsigned int the_same_macaddr = false; - rtw_get_encrypt_decrypt_from_registrypriv(adapter); - the_same_macaddr = !memcmp(pnetwork->network.MacAddress, cur_network->network.MacAddress, ETH_ALEN); pnetwork->network.Length = get_wlan_bssid_ex_sz(&pnetwork->network); @@ -1857,11 +1855,6 @@ void rtw_update_registrypriv_dev_network(struct adapter *adapter) } -void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter) -{ - -} - /* the function is at passive_level */ void rtw_joinbss_reset(struct adapter *padapter) { diff --git a/drivers/staging/r8188eu/include/rtw_mlme.h b/drivers/staging/r8188eu/include/rtw_mlme.h index ed2a50bad66e..1e16fa615b94 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme.h +++ b/drivers/staging/r8188eu/include/rtw_mlme.h @@ -549,8 +549,6 @@ void rtw_init_registrypriv_dev_network(struct adapter *adapter); void rtw_update_registrypriv_dev_network(struct adapter *adapter); -void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter); - void _rtw_join_timeout_handler(struct adapter *adapter); void rtw_scan_timeout_handler(struct adapter *adapter); -- cgit From ff3b7942529bdcd8326c4acaecb91875075c24b3 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Wed, 9 Feb 2022 22:06:01 +0530 Subject: staging: r8188eu: remove empty function rtw_mfree_mlme_priv_lock The definition of function rtw_mfree_mlme_priv_lock is empty. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/8b6d750b049f875370996258aedaf89cf0f198d4.1644422181.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 47baef64bdc4..557f6b96e99c 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -85,10 +85,6 @@ exit: return res; } -static void rtw_mfree_mlme_priv_lock(struct mlme_priv *pmlmepriv) -{ -} - static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen) { kfree(*ppie); @@ -118,8 +114,6 @@ void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv) rtw_free_mlme_priv_ie_data(pmlmepriv); if (pmlmepriv) { - rtw_mfree_mlme_priv_lock(pmlmepriv); - vfree(pmlmepriv->free_bss_buf); } -- cgit From 932fa93090eab0fff4bbdce6537ecc08768c1453 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Wed, 9 Feb 2022 22:06:02 +0530 Subject: staging: r8188eu: remove empty function _InitOperationMode The definition of function _InitOperationMode is empty. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/07083cbb8b09957d2fcf9e5b70e0fd832ce53f35.1644422181.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index e2013745d41c..3b8869455166 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -449,10 +449,6 @@ static void InitUsbAggregationSetting(struct adapter *Adapter) usb_AggSettingRxUpdate(Adapter); } -static void _InitOperationMode(struct adapter *Adapter) -{ -} - static void _InitBeaconParameters(struct adapter *Adapter) { struct hal_data_8188e *haldata = &Adapter->haldata; @@ -635,7 +631,6 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) _InitEDCA(Adapter); _InitRetryFunction(Adapter); InitUsbAggregationSetting(Adapter); - _InitOperationMode(Adapter);/* todo */ _InitBeaconParameters(Adapter); /* */ -- cgit From dbb2423ba70005e4a11ed2059d3367426418fa87 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Wed, 9 Feb 2022 22:06:03 +0530 Subject: staging: r8188eu: remove empty function __nat25_db_print The definition of function __nat25_db_print is empty. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/98d201e029dba9acf707ed020b5a5604029ca710.1644422181.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_br_ext.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c index 4951f835feaf..088145118b41 100644 --- a/drivers/staging/r8188eu/core/rtw_br_ext.c +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c @@ -319,10 +319,6 @@ static void __nat25_db_network_insert(struct adapter *priv, spin_unlock_bh(&priv->br_ext_lock); } -static void __nat25_db_print(struct adapter *priv) -{ -} - /* * NAT2.5 interface */ @@ -422,8 +418,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) __nat25_generate_ipv4_network_addr(networkAddr, &tmp); /* record source IP address and , source mac address into db */ __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); - - __nat25_db_print(priv); return 0; default: return -1; @@ -454,7 +448,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) sender = (unsigned int *)arp_ptr; __nat25_generate_ipv4_network_addr(networkAddr, sender); __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); - __nat25_db_print(priv); return 0; default: return -1; @@ -535,8 +528,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); - __nat25_db_print(priv); - if (!priv->ethBrExtInfo.addPPPoETag && priv->pppoe_connection_in_progress && !memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN)) @@ -597,7 +588,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) if (memcmp(&iph->saddr, "\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0", 16)) { __nat25_generate_ipv6_network_addr(networkAddr, (unsigned int *)&iph->saddr); __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); - __nat25_db_print(priv); if (iph->nexthdr == IPPROTO_ICMPV6 && skb->len > (ETH_HLEN + sizeof(*iph) + 4)) { -- cgit From b3896a36810eb1d562da665502d0551dd339fc4c Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Wed, 9 Feb 2022 22:06:04 +0530 Subject: staging: r8188eu: remove unused argument in __nat25_has_expired The argument priv is not used in function __nat25_has_expired. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/eceb38329e108c1e440eb973492a5a1c17bd7927.1644422181.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_br_ext.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c index 088145118b41..5c40babcd45c 100644 --- a/drivers/staging/r8188eu/core/rtw_br_ext.c +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c @@ -105,8 +105,7 @@ static int skb_pull_and_merge(struct sk_buff *skb, unsigned char *src, int len) return 0; } -static int __nat25_has_expired(struct adapter *priv, - struct nat25_network_db_entry *fdb) +static int __nat25_has_expired(struct nat25_network_db_entry *fdb) { if (time_before_eq(fdb->ageing_timer, jiffies - NAT25_AGEING_TIME * HZ)) return 1; @@ -363,7 +362,7 @@ void nat25_db_expire(struct adapter *priv) struct nat25_network_db_entry *g; g = f->next_hash; - if (__nat25_has_expired(priv, f)) { + if (__nat25_has_expired(f)) { if (atomic_dec_and_test(&f->use_count)) { if (priv->scdb_entry == f) { memset(priv->scdb_mac, 0, ETH_ALEN); -- cgit From 87d544b6f4cb7b3040f1a2dd6c2ed95a61f86c0f Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Wed, 9 Feb 2022 22:06:05 +0530 Subject: staging: r8188eu: remove unused argument in on_action_public_default The function argument action is not used in on_action_public_default. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/01c8fd82c21ae96773c9099a2cee3c3fd29c1054.1644422181.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 7fabb5b11aac..27bfb43f306e 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -4044,7 +4044,7 @@ static unsigned int on_action_public_vendor(struct recv_frame *precv_frame) return ret; } -static unsigned int on_action_public_default(struct recv_frame *precv_frame, u8 action) +static unsigned int on_action_public_default(struct recv_frame *precv_frame) { unsigned int ret = _FAIL; u8 *pframe = precv_frame->rx_data; @@ -4083,7 +4083,7 @@ unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precv ret = on_action_public_vendor(precv_frame); break; default: - ret = on_action_public_default(precv_frame, action); + ret = on_action_public_default(precv_frame); break; } -- cgit From 14b33d8c8a814ec096e1258865b8ccd825d5b627 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Wed, 9 Feb 2022 22:06:06 +0530 Subject: staging: r8188eu: remove unused argument in chk_ap_is_alive The function argument padapter is not used in chk_ap_is_alive. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/17af206986d64f34e85acdf67b138edb4ccc0312.1644422181.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 27bfb43f306e..ceca6751cdee 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -7157,7 +7157,7 @@ static void _linked_rx_signal_strength_display(struct adapter *padapter) "UndecoratedSmoothedPWDB:%d\n", UndecoratedSmoothedPWDB); } -static u8 chk_ap_is_alive(struct adapter *padapter, struct sta_info *psta) +static u8 chk_ap_is_alive(struct sta_info *psta) { u8 ret = false; @@ -7221,7 +7221,7 @@ void linked_status_chk(struct adapter *padapter) bool is_p2p_enable = false; is_p2p_enable = !rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE); - if (!chk_ap_is_alive(padapter, psta)) + if (!chk_ap_is_alive(psta)) rx_chk = _FAIL; if (pxmitpriv->last_tx_pkts == pxmitpriv->tx_pkts) -- cgit From 66c123d8b43bfafe13c12bd9f03e3fcde3f6a606 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Wed, 9 Feb 2022 22:06:07 +0530 Subject: staging: r8188eu: remove unused macros in sta_info.h Some of the sta_* and STA_* macros are not used. Remove those unused macros. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/c2453078b2d46119d167f2d0e4690cc87fc4b77e.1644422181.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/sta_info.h | 46 ------------------------------ 1 file changed, 46 deletions(-) diff --git a/drivers/staging/r8188eu/include/sta_info.h b/drivers/staging/r8188eu/include/sta_info.h index 23f6a85bf017..b7e6b1f319a2 100644 --- a/drivers/staging/r8188eu/include/sta_info.h +++ b/drivers/staging/r8188eu/include/sta_info.h @@ -210,53 +210,24 @@ struct sta_info { + sta->sta_stats.rx_ctrl_pkts \ + sta->sta_stats.rx_data_pkts) -#define sta_last_rx_pkts(sta) \ - (sta->sta_stats.last_rx_mgnt_pkts \ - + sta->sta_stats.last_rx_ctrl_pkts \ - + sta->sta_stats.last_rx_data_pkts) - #define sta_rx_data_pkts(sta) \ (sta->sta_stats.rx_data_pkts) #define sta_last_rx_data_pkts(sta) \ (sta->sta_stats.last_rx_data_pkts) -#define sta_rx_mgnt_pkts(sta) \ - (sta->sta_stats.rx_mgnt_pkts) - -#define sta_last_rx_mgnt_pkts(sta) \ - (sta->sta_stats.last_rx_mgnt_pkts) - #define sta_rx_beacon_pkts(sta) \ (sta->sta_stats.rx_beacon_pkts) #define sta_last_rx_beacon_pkts(sta) \ (sta->sta_stats.last_rx_beacon_pkts) -#define sta_rx_probereq_pkts(sta) \ - (sta->sta_stats.rx_probereq_pkts) - -#define sta_last_rx_probereq_pkts(sta) \ - (sta->sta_stats.last_rx_probereq_pkts) - #define sta_rx_probersp_pkts(sta) \ (sta->sta_stats.rx_probersp_pkts) #define sta_last_rx_probersp_pkts(sta) \ (sta->sta_stats.last_rx_probersp_pkts) -#define sta_rx_probersp_bm_pkts(sta) \ - (sta->sta_stats.rx_probersp_bm_pkts) - -#define sta_last_rx_probersp_bm_pkts(sta) \ - (sta->sta_stats.last_rx_probersp_bm_pkts) - -#define sta_rx_probersp_uo_pkts(sta) \ - (sta->sta_stats.rx_probersp_uo_pkts) - -#define sta_last_rx_probersp_uo_pkts(sta) \ - (sta->sta_stats.last_rx_probersp_uo_pkts) - #define sta_update_last_rx_pkts(sta) \ do { \ sta->sta_stats.last_rx_mgnt_pkts = sta->sta_stats.rx_mgnt_pkts; \ @@ -269,23 +240,6 @@ do { \ sta->sta_stats.last_rx_data_pkts = sta->sta_stats.rx_data_pkts; \ } while (0) -#define STA_RX_PKTS_ARG(sta) \ - sta->sta_stats.rx_mgnt_pkts \ - , sta->sta_stats.rx_ctrl_pkts \ - , sta->sta_stats.rx_data_pkts - -#define STA_LAST_RX_PKTS_ARG(sta) \ - sta->sta_stats.last_rx_mgnt_pkts \ - , sta->sta_stats.last_rx_ctrl_pkts \ - , sta->sta_stats.last_rx_data_pkts - -#define STA_RX_PKTS_DIFF_ARG(sta) \ - sta->sta_stats.rx_mgnt_pkts - sta->sta_stats.last_rx_mgnt_pkts \ - , sta->sta_stats.rx_ctrl_pkts - sta->sta_stats.last_rx_ctrl_pkts \ - , sta->sta_stats.rx_data_pkts - sta->sta_stats.last_rx_data_pkts - -#define STA_PKTS_FMT "(m:%llu, c:%llu, d:%llu)" - struct sta_priv { u8 *pallocated_stainfo_buf; u8 *pstainfo_buf; -- cgit From e9685834b1db754cbd07e31ad1a091f5d366dacf Mon Sep 17 00:00:00 2001 From: Marcelo Aloisio da Silva Date: Mon, 14 Feb 2022 23:39:26 -0300 Subject: staging: r8188eu: remove unconditional if statement Remove if condition that is always true. It is useless and makes the code less readable. Signed-off-by: Marcelo Aloisio da Silva Link: https://lore.kernel.org/r/20220215023926.GA52339@snoopy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_ap.c | 124 +++++++++++++++++----------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c index 19d12dd9788e..5e22b1baf9a5 100644 --- a/drivers/staging/r8188eu/core/rtw_ap.c +++ b/drivers/staging/r8188eu/core/rtw_ap.c @@ -55,85 +55,85 @@ static void update_BCNTIM(struct adapter *padapter) struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network; unsigned char *pie = pnetwork_mlmeext->IEs; + u8 *p, *dst_ie, *premainder_ie = NULL; + u8 *pbackup_remainder_ie = NULL; + __le16 tim_bitmap_le; + uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; /* update TIM IE */ - if (true) { - u8 *p, *dst_ie, *premainder_ie = NULL; - u8 *pbackup_remainder_ie = NULL; - __le16 tim_bitmap_le; - uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - - tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap); - - p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_); - if (p && tim_ielen > 0) { - tim_ielen += 2; - premainder_ie = p + tim_ielen; - tim_ie_offset = (int)(p - pie); - remainder_ielen = pnetwork_mlmeext->IELength - tim_ie_offset - tim_ielen; - /* append TIM IE from dst_ie offset */ - dst_ie = p; - } else { - tim_ielen = 0; - /* calculate head_len */ - offset = _FIXED_IE_LENGTH_; - offset += pnetwork_mlmeext->Ssid.SsidLength + 2; + p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, + pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_); + if (p && tim_ielen > 0) { + tim_ielen += 2; + premainder_ie = p + tim_ielen; + tim_ie_offset = (int)(p - pie); + remainder_ielen = pnetwork_mlmeext->IELength - tim_ie_offset - tim_ielen; + /* append TIM IE from dst_ie offset */ + dst_ie = p; + } else { + tim_ielen = 0; - /* get supported rates len */ - p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_)); - if (p) - offset += tmp_len + 2; + /* calculate head_len */ + offset = _FIXED_IE_LENGTH_; + offset += pnetwork_mlmeext->Ssid.SsidLength + 2; - /* DS Parameter Set IE, len = 3 */ - offset += 3; + /* get supported rates len */ + p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, + &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_)); + if (p) + offset += tmp_len + 2; - premainder_ie = pie + offset; + /* DS Parameter Set IE, len = 3 */ + offset += 3; - remainder_ielen = pnetwork_mlmeext->IELength - offset - tim_ielen; + premainder_ie = pie + offset; - /* append TIM IE from offset */ - dst_ie = pie + offset; - } + remainder_ielen = pnetwork_mlmeext->IELength - offset - tim_ielen; - if (remainder_ielen > 0) { - pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_ATOMIC); - if (pbackup_remainder_ie && premainder_ie) - memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); - } - *dst_ie++ = _TIM_IE_; + /* append TIM IE from offset */ + dst_ie = pie + offset; + } - if ((pstapriv->tim_bitmap & 0xff00) && (pstapriv->tim_bitmap & 0x00fc)) - tim_ielen = 5; - else - tim_ielen = 4; + if (remainder_ielen > 0) { + pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_ATOMIC); + if (pbackup_remainder_ie && premainder_ie) + memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); + } + *dst_ie++ = _TIM_IE_; - *dst_ie++ = tim_ielen; + if ((pstapriv->tim_bitmap & 0xff00) && (pstapriv->tim_bitmap & 0x00fc)) + tim_ielen = 5; + else + tim_ielen = 4; - *dst_ie++ = 0;/* DTIM count */ - *dst_ie++ = 1;/* DTIM period */ + *dst_ie++ = tim_ielen; - if (pstapriv->tim_bitmap & BIT(0))/* for bc/mc frames */ - *dst_ie++ = BIT(0);/* bitmap ctrl */ - else - *dst_ie++ = 0; + *dst_ie++ = 0;/* DTIM count */ + *dst_ie++ = 1;/* DTIM period */ - if (tim_ielen == 4) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; - } else if (tim_ielen == 5) { - memcpy(dst_ie, &tim_bitmap_le, 2); - dst_ie += 2; - } + if (pstapriv->tim_bitmap & BIT(0))/* for bc/mc frames */ + *dst_ie++ = BIT(0);/* bitmap ctrl */ + else + *dst_ie++ = 0; - /* copy remainder IE */ - if (pbackup_remainder_ie) { - memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); + tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap); - kfree(pbackup_remainder_ie); - } - offset = (uint)(dst_ie - pie); - pnetwork_mlmeext->IELength = offset + remainder_ielen; + if (tim_ielen == 4) { + *dst_ie++ = *(u8 *)&tim_bitmap_le; + } else if (tim_ielen == 5) { + memcpy(dst_ie, &tim_bitmap_le, 2); + dst_ie += 2; + } + + /* copy remainder IE */ + if (pbackup_remainder_ie) { + memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); + + kfree(pbackup_remainder_ie); } + offset = (uint)(dst_ie - pie); + pnetwork_mlmeext->IELength = offset + remainder_ielen; set_tx_beacon_cmd(padapter); } -- cgit From d746f5bcb0ce64ce742b1daae72b735ffd4abc5d Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Wed, 16 Feb 2022 20:40:36 +0100 Subject: staging: r8188eu: remove unused enum Remove an unused enum from usb_halinit.c. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220216194038.6762-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 3b8869455166..ca2833d3e7dc 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -484,11 +484,6 @@ static void _BBTurnOnBlock(struct adapter *Adapter) rtl8188e_PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bOFDMEn, 0x1); } -enum { - Antenna_Lfet = 1, - Antenna_Right = 2, -}; - static void _InitAntenna_Selection(struct adapter *Adapter) { struct hal_data_8188e *haldata = &Adapter->haldata; -- cgit From d5890d9264d59aec855046fe1b102814f248123d Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Wed, 16 Feb 2022 20:40:37 +0100 Subject: staging: r8188eu: bCCKinCH14 is read-only The variable bCCKinCH14 in struct odm_rf_cal is never set. It stays at its default value 0. Remove bCCKinCH14 from struct odm_rf_cal and remove related dead code. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220216194038.6762-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 16 ++++--------- drivers/staging/r8188eu/hal/odm.c | 36 ---------------------------- drivers/staging/r8188eu/include/odm.h | 2 -- 3 files changed, 4 insertions(+), 50 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 0fcf094ae594..523d4fedb3cc 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -149,18 +149,10 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( TempCCk = dm_odm->RFCalibrateInfo.RegA24; for (i = 0; i < CCK_TABLE_SIZE; i++) { - if (dm_odm->RFCalibrateInfo.bCCKinCH14) { - if (memcmp((void *)&TempCCk, (void *)&CCKSwingTable_Ch14[i][2], 4)) { - CCK_index_old = (u8)i; - dm_odm->BbSwingIdxCckBase = (u8)i; - break; - } - } else { - if (memcmp((void *)&TempCCk, (void *)&CCKSwingTable_Ch1_Ch13[i][2], 4)) { - CCK_index_old = (u8)i; - dm_odm->BbSwingIdxCckBase = (u8)i; - break; - } + if (memcmp((void *)&TempCCk, (void *)&CCKSwingTable_Ch1_Ch13[i][2], 4)) { + CCK_index_old = (u8)i; + dm_odm->BbSwingIdxCckBase = (u8)i; + break; } } diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index b4be706545ff..24a884bcea3b 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -101,42 +101,6 @@ u8 CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8] = { {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01} /* 32, -16.0dB */ }; -u8 CCKSwingTable_Ch14[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, /* 0, +0dB */ - {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, /* 1, -0.5dB */ - {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, /* 2, -1.0dB */ - {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, /* 3, -1.5dB */ - {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, /* 4, -2.0dB */ - {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, /* 5, -2.5dB */ - {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, /* 6, -3.0dB */ - {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, /* 7, -3.5dB */ - {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, /* 8, -4.0dB */ - {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, /* 9, -4.5dB */ - {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, /* 10, -5.0dB */ - {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 11, -5.5dB */ - {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 12, -6.0dB */ - {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, /* 13, -6.5dB */ - {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, /* 14, -7.0dB */ - {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 15, -7.5dB */ - {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 16, -8.0dB */ - {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 17, -8.5dB */ - {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 18, -9.0dB */ - {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 19, -9.5dB */ - {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 20, -10.0dB */ - {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 21, -10.5dB */ - {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 22, -11.0dB */ - {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 23, -11.5dB */ - {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 24, -12.0dB */ - {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 25, -12.5dB */ - {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 26, -13.0dB */ - {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 27, -13.5dB */ - {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 28, -14.0dB */ - {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 29, -14.5dB */ - {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 30, -15.0dB */ - {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 31, -15.5dB */ - {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} /* 32, -16.0dB */ -}; - #define RxDefaultAnt1 0x65a9 #define RxDefaultAnt2 0x569a diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 698d61d5fc40..f17c707f2cde 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -252,7 +252,6 @@ struct odm_rf_cal { bool bReloadtxpowerindex; u8 bRfPiEnable; - u8 bCCKinCH14; u8 CCK_index; u8 OFDM_index; bool bDoneTxpower; @@ -449,7 +448,6 @@ enum dm_swas { extern u32 OFDMSwingTable[OFDM_TABLE_SIZE_92D]; extern u8 CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8]; -extern u8 CCKSwingTable_Ch14 [CCK_TABLE_SIZE][8]; /* check Sta pointer valid or not */ #define IS_STA_VALID(pSta) (pSta) -- cgit From 5df60184a2b1d9414455f55fd33a9dac2f803e93 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Wed, 16 Feb 2022 20:40:38 +0100 Subject: staging: r8188eu: rename CCKSwingTable_Ch1_Ch13 After removing CCKSwingTable_Ch14 there is only one table left and we can rename CCKSwingTable_Ch1_Ch13 to simply cck_swing_table. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220216194038.6762-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +- drivers/staging/r8188eu/hal/odm.c | 2 +- drivers/staging/r8188eu/include/odm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c index 523d4fedb3cc..b944c8071a3b 100644 --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c @@ -149,7 +149,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( TempCCk = dm_odm->RFCalibrateInfo.RegA24; for (i = 0; i < CCK_TABLE_SIZE; i++) { - if (memcmp((void *)&TempCCk, (void *)&CCKSwingTable_Ch1_Ch13[i][2], 4)) { + if (memcmp((void *)&TempCCk, (void *)&cck_swing_table[i][2], 4)) { CCK_index_old = (u8)i; dm_odm->BbSwingIdxCckBase = (u8)i; break; diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index 24a884bcea3b..e0824eefd83a 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -65,7 +65,7 @@ u32 OFDMSwingTable[OFDM_TABLE_SIZE_92D] = { 0x0b40002d,/* 42, -15.0dB */ }; -u8 CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8] = { +u8 cck_swing_table[CCK_TABLE_SIZE][8] = { {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, /* 0, +0dB */ {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, /* 1, -0.5dB */ {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, /* 2, -1.0dB */ diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index f17c707f2cde..9fb09e0a0df9 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -447,7 +447,7 @@ enum dm_swas { #define CCK_TABLE_SIZE 33 extern u32 OFDMSwingTable[OFDM_TABLE_SIZE_92D]; -extern u8 CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8]; +extern u8 cck_swing_table[CCK_TABLE_SIZE][8]; /* check Sta pointer valid or not */ #define IS_STA_VALID(pSta) (pSta) -- cgit From 5f86ecba8e8ed4d8e6896b8940b5796a86200408 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Wed, 16 Feb 2022 10:31:11 +0100 Subject: staging: wfx: WF200 has no official SDIO IDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some may think that SDIO_VENDOR_ID_SILABS / SDIO_DEVICE_ID_SILABS_WF200 are official SDIO IDs. However, it is not the case, the values used by WF200 are not official (BTW, the driver rely on the DT rather than on the SDIO IDs to probe the device). To avoid any confusion, remove the definitions SDIO_*_ID_SILABS* and use raw values. Reviewed-by: Pali Rohár Reviewed-by: Ulf Hansson Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220216093112.92469-2-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bus_sdio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index bc3df85a05b6..312d2d391a24 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -257,10 +257,9 @@ static void wfx_sdio_remove(struct sdio_func *func) sdio_release_host(func); } -#define SDIO_VENDOR_ID_SILABS 0x0000 -#define SDIO_DEVICE_ID_SILABS_WF200 0x1000 static const struct sdio_device_id wfx_sdio_ids[] = { - { SDIO_DEVICE(SDIO_VENDOR_ID_SILABS, SDIO_DEVICE_ID_SILABS_WF200) }, + /* WF200 does not have official VID/PID */ + { SDIO_DEVICE(0x0000, 0x1000) }, { }, }; MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids); -- cgit From 96e0cbca1cb96e9d3deac3051aa816e13082f3fd Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Wed, 16 Feb 2022 10:31:12 +0100 Subject: staging: wfx: apply the necessary SDIO quirks for the Silabs WF200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until now, the SDIO quirks are applied directly from the driver. However, it is better to apply the quirks before driver probing. So, this patch relocate the quirks in the MMC framework. Note that the WF200 has no valid SDIO VID/PID. Therefore, we match DT rather than on the SDIO VID/PID. Reviewed-by: Pali Rohár Reviewed-by: Ulf Hansson Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220216093112.92469-3-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/quirks.h | 5 +++++ drivers/staging/wfx/bus_sdio.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h index 20f568727277..f879dc63d936 100644 --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h @@ -149,6 +149,11 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = { static const struct mmc_fixup __maybe_unused sdio_card_init_methods[] = { SDIO_FIXUP_COMPATIBLE("ti,wl1251", wl1251_quirk, 0), + SDIO_FIXUP_COMPATIBLE("silabs,wf200", add_quirk, + MMC_QUIRK_BROKEN_BYTE_MODE_512 | + MMC_QUIRK_LENIENT_FN0 | + MMC_QUIRK_BLKSZ_FOR_BYTE_MODE), + END_FIXUP }; diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 312d2d391a24..51a0d58a9070 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -216,9 +216,6 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i bus->func = func; bus->of_irq = irq_of_parse_and_map(np, 0); sdio_set_drvdata(func, bus); - func->card->quirks |= MMC_QUIRK_LENIENT_FN0 | - MMC_QUIRK_BLKSZ_FOR_BYTE_MODE | - MMC_QUIRK_BROKEN_BYTE_MODE_512; sdio_claim_host(func); ret = sdio_enable_func(func); -- cgit From 2da0d487781b2b27c1e114976257f455eb25def4 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Thu, 17 Feb 2022 11:32:48 +0100 Subject: staging: wfx: fix DT bindings location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, the DT bindings the wfx driver cannot be processed by make dt_binding_check. We need to place it somewhere into Documentation/devicetree/bindings/. After that change, we are able to get warnings from dt_binding_check and fix them. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220217103248.183770-1-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- .../bindings/staging/net/wireless/silabs,wfx.yaml | 137 +++++++++++++++++++++ MAINTAINERS | 1 + .../bindings/net/wireless/silabs,wfx.yaml | 130 ------------------- 3 files changed, 138 insertions(+), 130 deletions(-) create mode 100644 Documentation/devicetree/bindings/staging/net/wireless/silabs,wfx.yaml delete mode 100644 drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml diff --git a/Documentation/devicetree/bindings/staging/net/wireless/silabs,wfx.yaml b/Documentation/devicetree/bindings/staging/net/wireless/silabs,wfx.yaml new file mode 100644 index 000000000000..105725a127ab --- /dev/null +++ b/Documentation/devicetree/bindings/staging/net/wireless/silabs,wfx.yaml @@ -0,0 +1,137 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (c) 2020, Silicon Laboratories, Inc. +%YAML 1.2 +--- + +$id: http://devicetree.org/schemas/staging/net/wireless/silabs,wfx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Silicon Labs WFxxx devicetree bindings + +maintainers: + - Jérôme Pouiller + +description: > + Support for the Wifi chip WFxxx from Silicon Labs. Currently, the only device + from the WFxxx series is the WF200 described here: + https://www.silabs.com/documents/public/data-sheets/wf200-datasheet.pdf + + The WF200 can be connected via SPI or via SDIO. + + For SDIO: + + Declaring the WFxxx chip in device tree is mandatory (usually, the VID/PID is + sufficient for the SDIO devices). + + It is recommended to declare a mmc-pwrseq on SDIO host above WFx. Without + it, you may encounter issues during reboot. The mmc-pwrseq should be + compatible with mmc-pwrseq-simple. Please consult + Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml for more + information. + + For SPI: + + In add of the properties below, please consult + Documentation/devicetree/bindings/spi/spi-controller.yaml for optional SPI + related properties. + +properties: + compatible: + items: + - enum: + - silabs,brd4001a # WGM160P Evaluation Board + - silabs,brd8022a # WF200 Evaluation Board + - silabs,brd8023a # WFM200 Evaluation Board + - const: silabs,wf200 # Chip alone without antenna + + reg: + description: + When used on SDIO bus, must be set to 1. When used on SPI bus, it is + the chip select address of the device as defined in the SPI devices + bindings. + maxItems: 1 + + spi-max-frequency: true + + interrupts: + description: The interrupt line. Should be IRQ_TYPE_EDGE_RISING. When SPI is + used, this property is required. When SDIO is used, the "in-band" + interrupt provided by the SDIO bus is used unless an interrupt is defined + in the Device Tree. + maxItems: 1 + + reset-gpios: + description: (SPI only) Phandle of gpio that will be used to reset chip + during probe. Without this property, you may encounter issues with warm + boot. + + For SDIO, the reset gpio should declared using a mmc-pwrseq. + maxItems: 1 + + wakeup-gpios: + description: Phandle of gpio that will be used to wake-up chip. Without this + property, driver will disable most of power saving features. + maxItems: 1 + + silabs,antenna-config-file: + $ref: /schemas/types.yaml#/definitions/string + description: Use an alternative file for antenna configuration (aka + "Platform Data Set" in Silabs jargon). Default depends of "compatible" + string. For "silabs,wf200", the default is 'wf200.pds'. + + local-mac-address: true + + mac-address: true + +additionalProperties: false + +required: + - compatible + - reg + +examples: + - | + #include + #include + + spi { + #address-cells = <1>; + #size-cells = <0>; + + wifi@0 { + compatible = "silabs,brd8022a", "silabs,wf200"; + pinctrl-names = "default"; + pinctrl-0 = <&wfx_irq &wfx_gpios>; + reg = <0>; + interrupts-extended = <&gpio 16 IRQ_TYPE_EDGE_RISING>; + wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + spi-max-frequency = <42000000>; + }; + }; + + - | + #include + #include + + wfx_pwrseq: wfx_pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + pinctrl-0 = <&wfx_reset>; + reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + mmc { + mmc-pwrseq = <&wfx_pwrseq>; + #address-cells = <1>; + #size-cells = <0>; + + wifi@1 { + compatible = "silabs,brd8022a", "silabs,wf200"; + pinctrl-names = "default"; + pinctrl-0 = <&wfx_wakeup>; + reg = <1>; + wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index fca970a46e77..65227f6aabd0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17652,6 +17652,7 @@ F: drivers/platform/x86/touchscreen_dmi.c SILICON LABS WIRELESS DRIVERS (for WFxxx series) M: Jérôme Pouiller S: Supported +F: Documentation/devicetree/bindings/staging/net/wireless/silabs,wfx.yaml F: drivers/staging/wfx/ SILICON MOTION SM712 FRAME BUFFER DRIVER diff --git a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml deleted file mode 100644 index c49496357180..000000000000 --- a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml +++ /dev/null @@ -1,130 +0,0 @@ -# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -# Copyright (c) 2020, Silicon Laboratories, Inc. -%YAML 1.2 ---- - -$id: http://devicetree.org/schemas/net/wireless/silabs,wfx.yaml# -$schema: http://devicetree.org/meta-schemas/core.yaml# - -title: Silicon Labs WFxxx devicetree bindings - -maintainers: - - Jérôme Pouiller - -description: - The WFxxx chip series can be connected via SPI or via SDIO. - - For SDIO':' - - The driver is able to detect a WFxxx chip on SDIO bus by matching its Vendor - ID and Product ID. However, driver will only provide limited features in - this case. Thus declaring WFxxx chip in device tree is recommended (and may - become mandatory in the future). - - In addition, it is recommended to declare a mmc-pwrseq on SDIO host above - WFx. Without it, you may encounter issues with warm boot. The mmc-pwrseq - should be compatible with mmc-pwrseq-simple. Please consult - Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml for more - information. - - For SPI':' - - In add of the properties below, please consult - Documentation/devicetree/bindings/spi/spi-controller.yaml for optional SPI - related properties. - - Note that in add of the properties below, the WFx driver also supports - `mac-address` and `local-mac-address` as described in - Documentation/devicetree/bindings/net/ethernet.txt - -properties: - compatible: - items: - - enum: - - silabs,brd4001a # WGM160P Evaluation Board - - silabs,brd8022a # WF200 Evaluation Board - - silabs,brd8023a # WFM200 Evaluation Board - - const: silabs,wf200 # Chip alone without antenna - reg: - description: - When used on SDIO bus, must be set to 1. When used on SPI bus, it is - the chip select address of the device as defined in the SPI devices - bindings. - maxItems: 1 - spi-max-frequency: - description: (SPI only) Maximum SPI clocking speed of device in Hz. - maxItems: 1 - interrupts: - description: The interrupt line. Triggers IRQ_TYPE_LEVEL_HIGH and - IRQ_TYPE_EDGE_RISING are both supported by the chip and the driver. When - SPI is used, this property is required. When SDIO is used, the "in-band" - interrupt provided by the SDIO bus is used unless an interrupt is defined - in the Device Tree. - maxItems: 1 - reset-gpios: - description: (SPI only) Phandle of gpio that will be used to reset chip - during probe. Without this property, you may encounter issues with warm - boot. - - For SDIO, the reset gpio should declared using a mmc-pwrseq. - maxItems: 1 - wakeup-gpios: - description: Phandle of gpio that will be used to wake-up chip. Without this - property, driver will disable most of power saving features. - maxItems: 1 - silabs,antenna-config-file: - $ref: /schemas/types.yaml#/definitions/string - description: Use an alternative file for antenna configuration (aka - "Platform Data Set" in Silabs jargon). Default depends of "compatible" - string. For "silabs,wf200", the default is 'wf200.pds'. - -required: - - compatible - - reg - -examples: - - | - #include - #include - - spi0 { - #address-cells = <1>; - #size-cells = <0>; - - wfx@0 { - compatible = "silabs,brd8022a", "silabs,wf200"; - pinctrl-names = "default"; - pinctrl-0 = <&wfx_irq &wfx_gpios>; - reg = <0>; - interrupts-extended = <&gpio 16 IRQ_TYPE_EDGE_RISING>; - wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; - reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - spi-max-frequency = <42000000>; - }; - }; - - - | - #include - #include - - wfx_pwrseq: wfx_pwrseq { - compatible = "mmc-pwrseq-simple"; - pinctrl-names = "default"; - pinctrl-0 = <&wfx_reset>; - reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - mmc0 { - mmc-pwrseq = <&wfx_pwrseq>; - #address-cells = <1>; - #size-cells = <0>; - - mmc@1 { - compatible = "silabs,brd8022a", "silabs,wf200"; - pinctrl-names = "default"; - pinctrl-0 = <&wfx_wakeup>; - reg = <1>; - wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; - }; - }; -... -- cgit From 88daa27a2834edc5a40b7259976d98230983633e Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 17 Feb 2022 10:47:47 +0000 Subject: staging: wfx: Fix spelling mistake "unexpectly" -> "unexpectedly" There is a spelling mistake in a dev_warn message. Fix it. Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20220217104747.15424-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 0ddc67b56589..d832a22850c7 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -190,7 +190,7 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) goto next; } if (chunk_len > WFX_PDS_MAX_CHUNK_SIZE) - dev_warn(wdev->dev, "PDS:%d: unexpectly large chunk\n", chunk_num); + dev_warn(wdev->dev, "PDS:%d: unexpectedly large chunk\n", chunk_num); if (buf[4] != '{' || buf[chunk_len - 1] != '}') dev_warn(wdev->dev, "PDS:%d: unexpected content\n", chunk_num); -- cgit From fa0d50f2ee91cb3538eab04d64c7940c9ee3013d Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Wed, 16 Feb 2022 09:16:55 +0100 Subject: staging: r8188eu: evt_allocated_buf is not used evt_allocated_buf in struct evt_priv is not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220216081657.622467-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_cmd.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8188eu/include/rtw_cmd.h index 60cecdd4ee0e..6ca141b04344 100644 --- a/drivers/staging/r8188eu/include/rtw_cmd.h +++ b/drivers/staging/r8188eu/include/rtw_cmd.h @@ -55,7 +55,6 @@ struct evt_priv { #define C2H_QUEUE_MAX_LEN 10 atomic_t event_seq; u8 *evt_buf; /* shall be non-paged, and 4 bytes aligned */ - u8 *evt_allocated_buf; u32 evt_done_cnt; }; -- cgit From 0077e86a5bfeae07454cdce2f93a806e01bd5f49 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Wed, 16 Feb 2022 09:16:56 +0100 Subject: staging: r8188eu: evt_done_cnt is set but not used evt_done_cnt in struct evt_priv is set but not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220216081657.622467-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_cmd.c | 1 - drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 -- drivers/staging/r8188eu/include/rtw_cmd.h | 1 - 3 files changed, 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index c7e8602d2097..ae7d620bc4a0 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -65,7 +65,6 @@ static int _rtw_init_evt_priv(struct evt_priv *pevtpriv) /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ atomic_set(&pevtpriv->event_seq, 0); - pevtpriv->evt_done_cnt = 0; INIT_WORK(&pevtpriv->c2h_wk, c2h_wk_callback); pevtpriv->c2h_wk_alive = false; diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index ceca6751cdee..5e1f3a197dcb 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -7967,8 +7967,6 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) if (peventbuf) { event_callback = wlanevents[evt_code].event_callback; event_callback(padapter, (u8 *)peventbuf); - - pevt_priv->evt_done_cnt++; } _abort_event_: diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8188eu/include/rtw_cmd.h index 6ca141b04344..39273f9775cb 100644 --- a/drivers/staging/r8188eu/include/rtw_cmd.h +++ b/drivers/staging/r8188eu/include/rtw_cmd.h @@ -55,7 +55,6 @@ struct evt_priv { #define C2H_QUEUE_MAX_LEN 10 atomic_t event_seq; u8 *evt_buf; /* shall be non-paged, and 4 bytes aligned */ - u32 evt_done_cnt; }; #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \ -- cgit From f24bd333b4c665b5ca7a48af3be0262bac0185e5 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Wed, 16 Feb 2022 09:16:57 +0100 Subject: staging: r8188eu: struct usb_suspend_parm is not used struct usb_suspend_parm is not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220216081657.622467-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_cmd.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8188eu/include/rtw_cmd.h index 39273f9775cb..54643927054f 100644 --- a/drivers/staging/r8188eu/include/rtw_cmd.h +++ b/drivers/staging/r8188eu/include/rtw_cmd.h @@ -122,18 +122,6 @@ enum RFINTFS { HWPI, }; -/* -Caller Mode: Infra, Ad-HoC(C) - -Notes: To enter USB suspend mode - -Command Mode - -*/ -struct usb_suspend_parm { - u32 action;/* 1: sleep, 0:resume */ -}; - /* Caller Mode: Infra, Ad-HoC -- cgit From 973aeaee50181efec8835821761e563ec938cd6e Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:06:55 +0000 Subject: staging: r8188eu: remove previously converted DBG_88E_LEVEL calls Remove all netdev_dbg and dev_dbg calls that were previously converted from DBG_88E_LEVEL. After some thought, it makes more sense to just entirely strip all of these calls, so that debugging code in the driver can be more consistent and useful going forwards. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-2-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_fw.c | 1 - drivers/staging/r8188eu/core/rtw_ioctl_set.c | 5 ----- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 28 ---------------------------- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 8 -------- drivers/staging/r8188eu/core/rtw_xmit.c | 1 - drivers/staging/r8188eu/os_dep/ioctl_linux.c | 2 -- 6 files changed, 45 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188eu/core/rtw_fw.c index f591b091b8af..ce0e4e3b21f9 100644 --- a/drivers/staging/r8188eu/core/rtw_fw.c +++ b/drivers/staging/r8188eu/core/rtw_fw.c @@ -243,7 +243,6 @@ static int load_firmware(struct rt_firmware *rtfw, struct device *device) goto exit; } rtfw->size = fw->size; - dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", rtfw->size); exit: release_firmware(fw); diff --git a/drivers/staging/r8188eu/core/rtw_ioctl_set.c b/drivers/staging/r8188eu/core/rtw_ioctl_set.c index c95ca471ae55..e7f35370b69c 100644 --- a/drivers/staging/r8188eu/core/rtw_ioctl_set.c +++ b/drivers/staging/r8188eu/core/rtw_ioctl_set.c @@ -110,8 +110,6 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid) u32 cur_time = 0; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - netdev_dbg(padapter->pnetdev, "set bssid:%pM\n", bssid); - if ((bssid[0] == 0x00 && bssid[1] == 0x00 && bssid[2] == 0x00 && bssid[3] == 0x00 && bssid[4] == 0x00 && bssid[5] == 0x00) || (bssid[0] == 0xFF && bssid[1] == 0xFF && bssid[2] == 0xFF && @@ -186,9 +184,6 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *pnetwork = &pmlmepriv->cur_network; - netdev_dbg(padapter->pnetdev, "set ssid [%s] fw_state=0x%08x\n", - ssid->Ssid, get_fwstate(pmlmepriv)); - if (!padapter->hw_init_completed) { status = _FAIL; goto exit; diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 5e1f3a197dcb..329b27bfc09b 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -649,8 +649,6 @@ unsigned int OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame) if (psta) { ret = rtw_check_bcn_info(padapter, pframe, len); if (!ret) { - netdev_dbg(padapter->pnetdev, - "ap has changed, disconnect now\n"); receive_disconnect(padapter, pmlmeinfo->network.MacAddress, 0); return _SUCCESS; @@ -932,7 +930,6 @@ unsigned int OnAuthClient(struct adapter *padapter, struct recv_frame *precv_fra } if (go2asoc) { - netdev_dbg(padapter->pnetdev, "auth success, start assoc\n"); start_clnt_assoc(padapter); return _SUCCESS; } @@ -1507,10 +1504,6 @@ unsigned int OnDeAuth(struct adapter *padapter, struct recv_frame *precv_frame) struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; - netdev_dbg(padapter->pnetdev, - "ap recv deauth reason code(%d) sta:%pM\n", - reason, GetAddr2Ptr(pframe)); - psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); if (psta) { u8 updated = 0; @@ -1545,10 +1538,6 @@ unsigned int OnDeAuth(struct adapter *padapter, struct recv_frame *precv_frame) } } - netdev_dbg(padapter->pnetdev, - "sta recv deauth reason code(%d) sta:%pM, ignore = %d\n", - reason, GetAddr3Ptr(pframe), ignore_received_deauth); - if (!ignore_received_deauth) receive_disconnect(padapter, GetAddr3Ptr(pframe), reason); } @@ -1582,10 +1571,6 @@ unsigned int OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; - netdev_dbg(padapter->pnetdev, - "ap recv disassoc reason code(%d) sta:%pM\n", - reason, GetAddr2Ptr(pframe)); - psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); if (psta) { u8 updated = 0; @@ -1603,10 +1588,6 @@ unsigned int OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame return _SUCCESS; } else { - netdev_dbg(padapter->pnetdev, - "ap recv disassoc reason code(%d) sta:%pM\n", - reason, GetAddr3Ptr(pframe)); - receive_disconnect(padapter, GetAddr3Ptr(pframe), reason); } pmlmepriv->LinkDetectInfo.bBusyTraffic = false; @@ -6506,7 +6487,6 @@ void start_clnt_auth(struct adapter *padapter) /* For the Win8 P2P connection, it will be hard to have a successful connection if this Wi-Fi doesn't connect to it. */ issue_deauth(padapter, (&pmlmeinfo->network)->MacAddress, WLAN_REASON_DEAUTH_LEAVING); - netdev_dbg(padapter->pnetdev, "start auth\n"); issue_auth(padapter, NULL, 0); set_link_timer(pmlmeext, REAUTH_TO); @@ -7266,8 +7246,6 @@ void linked_status_chk(struct adapter *padapter) if (rx_chk == _FAIL) { pmlmeext->retry++; if (pmlmeext->retry > rx_chk_limit) { - netdev_dbg(padapter->pnetdev, - "disconnect or roaming\n"); receive_disconnect(padapter, pmlmeinfo->network.MacAddress, WLAN_REASON_EXPIRATION_CHK); return; @@ -7793,9 +7771,6 @@ u8 setkey_hdl(struct adapter *padapter, u8 *pbuf) /* write cam */ ctrl = BIT(15) | ((pparm->algorithm) << 2) | pparm->keyid; - netdev_dbg(padapter->pnetdev, - "set group key to hw: alg:%d(WEP40-1 WEP104-5 TKIP-2 AES-4) keyid:%d\n", - pparm->algorithm, pparm->keyid); write_cam(padapter, pparm->keyid, ctrl, null_sta, pparm->key); return H2C_SUCCESS; @@ -7824,9 +7799,6 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) cam_id = 4; - netdev_dbg(padapter->pnetdev, - "set pairwise key to hw: alg:%d(WEP40-1 WEP104-5 TKIP-2 AES-4) camid:%d\n", - pparm->algorithm, cam_id); if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) { struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c index 46e44aee587f..ff35685eaa12 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -15,12 +15,6 @@ void ips_enter(struct adapter *padapter) if (pxmit_priv->free_xmitbuf_cnt != NR_XMITBUFF || pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) { - netdev_dbg(padapter->pnetdev, - "There are some pkts to transmit\n"); - netdev_dbg(padapter->pnetdev, - "free_xmitbuf_cnt: %d, free_xmit_extbuf_cnt: %d\n", - pxmit_priv->free_xmitbuf_cnt, - pxmit_priv->free_xmit_extbuf_cnt); return; } @@ -35,7 +29,6 @@ void ips_enter(struct adapter *padapter) DBG_88E("==>ips_enter cnts:%d\n", pwrpriv->ips_enter_cnts); if (rf_off == pwrpriv->change_rfpwrstate) { pwrpriv->bpower_saving = true; - netdev_dbg(padapter->pnetdev, "nolinked power save enter\n"); if (pwrpriv->ips_mode == IPS_LEVEL_2) pwrpriv->bkeepfwalive = true; @@ -68,7 +61,6 @@ int ips_leave(struct adapter *padapter) if (result == _SUCCESS) { pwrpriv->rf_pwrstate = rf_on; } - netdev_dbg(padapter->pnetdev, "nolinked power save leave\n"); if ((_WEP40_ == psecuritypriv->dot11PrivacyAlgrthm) || (_WEP104_ == psecuritypriv->dot11PrivacyAlgrthm)) { DBG_88E("==>%s, channel(%d), processing(%x)\n", __func__, padapter->mlmeextpriv.cur_channel, pwrpriv->bips_processing); diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index f3e788e42b18..30714fee1921 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -460,7 +460,6 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p } } } else if (0x888e == pattrib->ether_type) { - netdev_dbg(padapter->pnetdev, "send eapol packet\n"); } if ((pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1)) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index f6a683cda614..3bb2714a6a54 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -58,7 +58,6 @@ void rtw_indicate_wx_assoc_event(struct adapter *padapter) memcpy(wrqu.ap_addr.sa_data, pmlmepriv->cur_network.network.MacAddress, ETH_ALEN); - netdev_dbg(padapter->pnetdev, "assoc success\n"); wireless_send_event(padapter->pnetdev, SIOCGIWAP, &wrqu, NULL); } @@ -71,7 +70,6 @@ void rtw_indicate_wx_disassoc_event(struct adapter *padapter) wrqu.ap_addr.sa_family = ARPHRD_ETHER; memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - netdev_dbg(padapter->pnetdev, "indicate disassoc\n"); wireless_send_event(padapter->pnetdev, SIOCGIWAP, &wrqu, NULL); } -- cgit From 1663e5f86355a8b32a32f71c66747e1b05e0b381 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:06:56 +0000 Subject: staging: r8188eu: remove smaller sets of converted DBG_88E calls Remove all the smaller sets of dev_dbg/netdev_dbg/pr_debug calls that were previously converted from DBG_88E. After some thought, it makes more sense to just entirely strip all of these calls, so that debugging code in the driver can be more consistent and useful going forwards. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-3-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_ap.c | 65 -------------------------- drivers/staging/r8188eu/core/rtw_cmd.c | 8 ---- drivers/staging/r8188eu/core/rtw_ieee80211.c | 19 -------- drivers/staging/r8188eu/core/rtw_ioctl_set.c | 5 -- drivers/staging/r8188eu/core/rtw_iol.c | 6 --- drivers/staging/r8188eu/core/rtw_mlme.c | 57 +--------------------- drivers/staging/r8188eu/core/rtw_security.c | 12 ----- drivers/staging/r8188eu/core/rtw_sta_mgt.c | 4 +- drivers/staging/r8188eu/core/rtw_xmit.c | 17 +------ drivers/staging/r8188eu/os_dep/usb_ops_linux.c | 12 ----- drivers/staging/r8188eu/os_dep/xmit_linux.c | 3 -- 11 files changed, 4 insertions(+), 204 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c index 5e22b1baf9a5..505517dbbf8c 100644 --- a/drivers/staging/r8188eu/core/rtw_ap.c +++ b/drivers/staging/r8188eu/core/rtw_ap.c @@ -179,10 +179,6 @@ void expire_timeout_chk(struct adapter *padapter) list_del_init(&psta->auth_list); pstapriv->auth_list_cnt--; - netdev_dbg(padapter->pnetdev, - "auth expire %6ph\n", - psta->hwaddr); - spin_unlock_bh(&pstapriv->auth_list_lock); spin_lock_bh(&pstapriv->sta_hash_lock); @@ -250,19 +246,11 @@ void expire_timeout_chk(struct adapter *padapter) list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; - netdev_dbg(padapter->pnetdev, - "asoc expire %pM, state = 0x%x\n", - (psta->hwaddr), psta->state); updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING); } else { /* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */ if (psta->sleepq_len > (NR_XMITFRAME / pstapriv->asoc_list_cnt) && padapter->xmitpriv.free_xmitframe_cnt < (NR_XMITFRAME / pstapriv->asoc_list_cnt / 2)) { - netdev_dbg(padapter->pnetdev, - "sta:%pM, sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", - (psta->hwaddr), psta->sleepq_len, - padapter->xmitpriv.free_xmitframe_cnt, - pstapriv->asoc_list_cnt); wakeup_sta_to_xmit(padapter, psta); } } @@ -292,25 +280,16 @@ void expire_timeout_chk(struct adapter *padapter) psta->keep_alive_trycnt++; if (ret == _SUCCESS) { - netdev_dbg(padapter->pnetdev, - "asoc check, sta(%pM) is alive\n", - (psta->hwaddr)); psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; continue; } else if (psta->keep_alive_trycnt <= 3) { - netdev_dbg(padapter->pnetdev, - "ack check for asoc expire, keep_alive_trycnt =%d\n", - psta->keep_alive_trycnt); psta->expire_to = 1; continue; } psta->keep_alive_trycnt = 0; - netdev_dbg(padapter->pnetdev, - "asoc expire %pM, state = 0x%x\n", - (psta->hwaddr), psta->state); spin_lock_bh(&pstapriv->asoc_list_lock); list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; @@ -390,10 +369,6 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) tx_ra_bitmap |= ((raid << 28) & 0xf0000000); - netdev_dbg(padapter->pnetdev, - "mac_id:%d, raid:%d, bitmap = 0x%x, arg = 0x%x\n", - psta->mac_id, raid, tx_ra_bitmap, arg); - /* bitmap[0:27] = tx_rate_bitmap */ /* bitmap[28:31]= Rate Adaptive id */ /* arg[0:4] = macid */ @@ -408,9 +383,6 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) psta->init_rate = init_rate; } else { - netdev_dbg(padapter->pnetdev, - "station aid %d exceed the max number\n", - psta->aid); } } @@ -468,9 +440,6 @@ void update_bmc_sta(struct adapter *padapter) arg = psta->mac_id & 0x1f; arg |= BIT(7); tx_ra_bitmap |= ((raid << 28) & 0xf0000000); - netdev_dbg(padapter->pnetdev, - "mask = 0x%x, arg = 0x%x\n", - tx_ra_bitmap, arg); /* bitmap[0:27] = tx_rate_bitmap */ /* bitmap[28:31]= Rate Adaptive id */ @@ -489,7 +458,6 @@ void update_bmc_sta(struct adapter *padapter) spin_unlock_bh(&psta->lock); } else { - netdev_dbg(padapter->pnetdev, "add_RATid_bmc_sta error!\n"); } } @@ -575,8 +543,6 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter) unsigned char *p, *ie = pnetwork->IEs; u32 len = 0; - netdev_dbg(padapter->pnetdev, "ERP_enable = %d\n", pmlmeinfo->ERP_enable); - if (!pmlmeinfo->ERP_enable) return; @@ -659,8 +625,6 @@ static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui) update_bcn_wps_ie(padapter); else if (!memcmp(P2P_OUI, oui, 4)) update_bcn_p2p_ie(padapter); - else - netdev_dbg(padapter->pnetdev, "unknown/unused OUI type!\n"); } void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) @@ -723,10 +687,6 @@ static int rtw_ht_operation_update(struct adapter *padapter) if (pmlmepriv->htpriv.ht_option) return 0; - netdev_dbg(padapter->pnetdev, - "current operation mode = 0x%X\n", - pmlmepriv->ht_op_mode); - if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) && pmlmepriv->num_sta_ht_no_gf) { pmlmepriv->ht_op_mode |= @@ -776,10 +736,6 @@ static int rtw_ht_operation_update(struct adapter *padapter) op_mode_changes++; } - netdev_dbg(padapter->pnetdev, - "new operation mode = 0x%X changes = %d\n", - pmlmepriv->ht_op_mode, op_mode_changes); - return op_mode_changes; } @@ -894,10 +850,6 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) if (psta->flags & WLAN_STA_HT) { u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info); - netdev_dbg(padapter->pnetdev, - "HT: STA %pM HT Capabilities Info: 0x%04x\n", - (psta->hwaddr), ht_capab); - if (psta->no_ht_set) { psta->no_ht_set = 0; pmlmepriv->num_sta_no_ht--; @@ -908,9 +860,6 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) psta->no_ht_gf_set = 1; pmlmepriv->num_sta_ht_no_gf++; } - netdev_dbg(padapter->pnetdev, - "STA %pM - no greenfield, num of non-gf stations %d\n", - (psta->hwaddr), pmlmepriv->num_sta_ht_no_gf); } if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH_20_40) == 0) { @@ -918,9 +867,6 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) psta->ht_20mhz_set = 1; pmlmepriv->num_sta_ht_20mhz++; } - netdev_dbg(padapter->pnetdev, - "STA %pM - 20 MHz HT, num of 20MHz HT STAs %d\n", - (psta->hwaddr), pmlmepriv->num_sta_ht_20mhz); } } else { if (!psta->no_ht_set) { @@ -928,9 +874,6 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) pmlmepriv->num_sta_no_ht++; } if (pmlmepriv->htpriv.ht_option) { - netdev_dbg(padapter->pnetdev, - "STA %pM - no HT, num of non-HT stations %d\n", - (psta->hwaddr), pmlmepriv->num_sta_no_ht); } } @@ -941,8 +884,6 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) /* update associated stations cap. */ associated_clients_update(padapter, beacon_updated); - - netdev_dbg(padapter->pnetdev, "updated = %d\n", beacon_updated); } u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta) @@ -1005,8 +946,6 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta) /* update associated stations cap. */ - netdev_dbg(padapter->pnetdev, "updated = %d\n", beacon_updated); - return beacon_updated; } @@ -1201,10 +1140,6 @@ void stop_ap_mode(struct adapter *padapter) } spin_unlock_bh(&pacl_node_q->lock); - netdev_dbg(padapter->pnetdev, - "free acl_node_queue, num = %d\n", - pacl_list->num); - rtw_sta_flush(padapter); /* free_assoc_sta_resources */ diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index ae7d620bc4a0..5d49428f0431 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -252,9 +252,6 @@ int rtw_cmd_thread(void *context) _next: if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { - netdev_dbg(padapter->pnetdev, - "DriverStopped(%d) SurpriseRemoved(%d) break\n", - padapter->bDriverStopped, padapter->bSurpriseRemoved); break; } @@ -573,8 +570,6 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) else padapter->pwrctrlpriv.smart_ps = padapter->registrypriv.smart_ps; - netdev_dbg(padapter->pnetdev, "smart_ps = %d\n", padapter->pwrctrlpriv.smart_ps); - pcmd->cmdsz = get_wlan_bssid_ex_sz(psecnetwork);/* get cmdsz before endian conversion */ INIT_LIST_HEAD(&pcmd->list); @@ -943,9 +938,6 @@ static void rtl8188e_sreset_xmit_status_check(struct adapter *padapter) txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS); if (txdma_status != 0x00) { - netdev_dbg(padapter->pnetdev, - "REG_TXDMA_STATUS: 0x%08x\n", - txdma_status); rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status); } /* total xmit irp = 4 */ diff --git a/drivers/staging/r8188eu/core/rtw_ieee80211.c b/drivers/staging/r8188eu/core/rtw_ieee80211.c index 25445f3ab4a3..c8998cb276be 100644 --- a/drivers/staging/r8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/r8188eu/core/rtw_ieee80211.c @@ -655,8 +655,6 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, * sub-type. */ if (elen < 4) { if (show_errors) { - pr_debug("short vendor specific information element ignored (len=%lu)\n", - (unsigned long)elen); } return -1; } @@ -675,8 +673,6 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, break; case WME_OUI_TYPE: /* this is a Wi-Fi WME info. element */ if (elen < 5) { - pr_debug("short WME information element ignored (len=%lu)\n", - (unsigned long)elen); return -1; } switch (pos[4]) { @@ -690,8 +686,6 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, elems->wme_tspec_len = elen; break; default: - pr_debug("unknown WME information element ignored (subtype=%d len=%lu)\n", - pos[4], (unsigned long)elen); return -1; } break; @@ -701,8 +695,6 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, elems->wps_ie_len = elen; break; default: - pr_debug("Unknown Microsoft information element ignored (type=%d len=%lu)\n", - pos[3], (unsigned long)elen); return -1; } break; @@ -714,14 +706,10 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, elems->vendor_ht_cap_len = elen; break; default: - pr_debug("Unknown Broadcom information element ignored (type=%d len=%lu)\n", - pos[3], (unsigned long)elen); return -1; } break; default: - pr_debug("unknown vendor specific information element ignored (vendor OUI %02x:%02x:%02x len=%lu)\n", - pos[0], pos[1], pos[2], (unsigned long)elen); return -1; } return 0; @@ -754,8 +742,6 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len, if (elen > left) { if (show_errors) { - pr_debug("IEEE 802.11 element parse failed (id=%d elen=%d left=%lu)\n", - id, elen, (unsigned long)left); } return ParseFailed; } @@ -841,8 +827,6 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len, unknown++; if (!show_errors) break; - pr_debug("IEEE 802.11 element parse ignored unknown element (id=%d elen=%d)\n", - id, elen); break; } left -= elen; @@ -892,10 +876,7 @@ void rtw_macaddr_cfg(u8 *mac_addr) if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) { eth_random_addr(mac_addr); - pr_debug("MAC Address from efuse error, assign random one !!!\n"); } - - pr_debug("MAC Address = %pM\n", mac_addr); } /** diff --git a/drivers/staging/r8188eu/core/rtw_ioctl_set.c b/drivers/staging/r8188eu/core/rtw_ioctl_set.c index e7f35370b69c..4b78e42d180d 100644 --- a/drivers/staging/r8188eu/core/rtw_ioctl_set.c +++ b/drivers/staging/r8188eu/core/rtw_ioctl_set.c @@ -120,8 +120,6 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid) spin_lock_bh(&pmlmepriv->lock); - netdev_dbg(padapter->pnetdev, "Set BSSID under fw_state = 0x%08x\n", - get_fwstate(pmlmepriv)); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) goto handle_tkip_countermeasure; else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) @@ -191,8 +189,6 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) spin_lock_bh(&pmlmepriv->lock); - netdev_dbg(padapter->pnetdev, "Set SSID under fw_state = 0x%08x\n", - get_fwstate(pmlmepriv)); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { goto handle_tkip_countermeasure; } else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { @@ -359,7 +355,6 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s res = true; } else { if (rtw_is_scan_deny(padapter)) { - netdev_dbg(padapter->pnetdev, "scan deny\n"); indicate_wx_scan_complete_event(padapter); return _SUCCESS; } diff --git a/drivers/staging/r8188eu/core/rtw_iol.c b/drivers/staging/r8188eu/core/rtw_iol.c index f5f03160759c..5f73413a4511 100644 --- a/drivers/staging/r8188eu/core/rtw_iol.c +++ b/drivers/staging/r8188eu/core/rtw_iol.c @@ -12,15 +12,11 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter) xmit_frame = rtw_alloc_xmitframe(pxmitpriv); if (!xmit_frame) { - netdev_dbg(adapter->pnetdev, - "rtw_alloc_xmitframe return null\n"); return NULL; } xmitbuf = rtw_alloc_xmitbuf(pxmitpriv); if (!xmitbuf) { - netdev_dbg(adapter->pnetdev, - "rtw_alloc_xmitbuf return null\n"); rtw_free_xmitframe(pxmitpriv, xmit_frame); return NULL; } @@ -51,8 +47,6 @@ int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len /* check if the io_buf can accommodate new cmds */ if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) { - pr_debug("%u is larger than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", - ori_len + cmd_len + 8, MAX_XMITBUF_SZ); return _FAIL; } diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 557f6b96e99c..d7494d820756 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -611,9 +611,6 @@ static int rtw_is_desired_network(struct adapter *adapter, struct wlan_network * } if ((desired_encmode != Ndis802_11EncryptionDisabled) && (privacy == 0)) { - netdev_dbg(adapter->pnetdev, - "desired_encmode: %d, privacy: %d\n", - desired_encmode, privacy); bselected = false; } @@ -725,9 +722,6 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); rtw_indicate_connect(adapter); } else { - netdev_dbg(adapter->pnetdev, - "try_to_join, but select scanning queue fail, to_roaming:%d\n", - pmlmepriv->to_roaming); if (rtw_to_roaming(adapter) != 0) { if (--pmlmepriv->to_roaming == 0 || _SUCCESS != rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) { @@ -1225,10 +1219,6 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) else mac_id = pstadel->mac_id; - netdev_dbg(adapter->pnetdev, - "(mac_id=%d)=%pM\n", - mac_id, pstadel->macaddr); - if (mac_id >= 0) { u16 media_status; media_status = (mac_id << 8) | 0; /* MACID|OPMODE:0 means disconnect */ @@ -1318,8 +1308,6 @@ void _rtw_join_timeout_handler (struct adapter *adapter) struct mlme_priv *pmlmepriv = &adapter->mlmepriv; int do_join_r; - netdev_dbg(adapter->pnetdev, "fw_state=%x\n", get_fwstate(pmlmepriv)); - if (adapter->bDriverStopped || adapter->bSurpriseRemoved) return; @@ -1329,19 +1317,12 @@ void _rtw_join_timeout_handler (struct adapter *adapter) while (1) { pmlmepriv->to_roaming--; if (rtw_to_roaming(adapter) != 0) { /* try another */ - netdev_dbg(adapter->pnetdev, - "try another roaming\n"); do_join_r = rtw_do_join(adapter); if (_SUCCESS != do_join_r) { - netdev_dbg(adapter->pnetdev, - "roaming do_join return %d\n", - do_join_r); continue; } break; } else { - netdev_dbg(adapter->pnetdev, - "We've tried roaming but failed\n"); rtw_indicate_disconnect(adapter); break; } @@ -1362,7 +1343,6 @@ void rtw_scan_timeout_handler (struct adapter *adapter) { struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - netdev_dbg(adapter->pnetdev, "fw_state=%x\n", get_fwstate(pmlmepriv)); spin_lock_bh(&pmlmepriv->lock); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); spin_unlock_bh(&pmlmepriv->lock); @@ -1467,15 +1447,6 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv updated = true; } if (updated) { - netdev_dbg(adapter->pnetdev, - "[by_bssid:%u][assoc_ssid:%s]new candidate: %s(%pM rssi:%d\n", - pmlmepriv->assoc_by_bssid, - pmlmepriv->assoc_ssid.Ssid, - (*candidate)->network.Ssid.Ssid, - (*candidate)->network.MacAddress, - (int)(*candidate)->network.Rssi); - netdev_dbg(adapter->pnetdev, - "[to_roaming:%u]\n", rtw_to_roaming(adapter)); } exit: @@ -1513,21 +1484,13 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) rtw_check_join_candidate(pmlmepriv, &candidate, pnetwork); } if (!candidate) { - netdev_dbg(adapter->pnetdev, - "return _FAIL(candidate==NULL)\n"); ret = _FAIL; goto exit; } else { - netdev_dbg(adapter->pnetdev, "candidate: %s(%pM ch:%u)\n", - candidate->network.Ssid.Ssid, candidate->network.MacAddress, - candidate->network.Configuration.DSConfig); } /* check for situation of _FW_LINKED */ if (check_fwstate(pmlmepriv, _FW_LINKED)) { - netdev_dbg(adapter->pnetdev, - "_FW_LINKED while ask_for_joinbss!!!\n"); - rtw_disassoc_cmd(adapter, 0, true); rtw_indicate_disconnect(adapter); rtw_free_assoc_resources(adapter, 0); @@ -1537,9 +1500,6 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) if (supp_ant_div) { u8 cur_ant; GetHalDefVar8188EUsb(adapter, HAL_DEF_CURRENT_ANTENNA, &cur_ant); - netdev_dbg(adapter->pnetdev, "Opt_Ant_(%s), cur_Ant(%s)\n", - (candidate->network.PhyInfo.Optimum_antenna == 2) ? "A" : "B", - (cur_ant == 2) ? "A" : "B"); } ret = rtw_joinbss_cmd(adapter, candidate); @@ -1611,10 +1571,6 @@ int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, in psetkeyparm->keyid = (u8)keyid;/* 0~3 */ psetkeyparm->set_tx = set_tx; pmlmepriv->key_mask |= BIT(psetkeyparm->keyid); - netdev_dbg(adapter->pnetdev, - "algorithm(%x), keyid(%x), key_mask(%x)\n", - psetkeyparm->algorithm, psetkeyparm->keyid, - pmlmepriv->key_mask); switch (psetkeyparm->algorithm) { case _WEP40_: @@ -2005,7 +1961,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) /* Config SM Power Save setting */ pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2; if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) - netdev_dbg(padapter->pnetdev, "WLAN_HT_CAP_SM_PS_STATIC\n"); + ; /* Config current HT Protection mode. */ pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; @@ -2040,7 +1996,6 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr issued |= (phtpriv->candidate_tid_bitmap >> priority) & 0x1; if (0 == issued) { - netdev_dbg(padapter->pnetdev, "p=%d\n", priority); psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority); rtw_addbareq_cmd(padapter, (u8)priority, pattrib->ra); } @@ -2068,11 +2023,6 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) pnetwork = &pmlmepriv->cur_network; if (0 < rtw_to_roaming(padapter)) { - netdev_dbg(padapter->pnetdev, - "roaming from %s(%pM length:%d\n", - pnetwork->network.Ssid.Ssid, - pnetwork->network.MacAddress, - pnetwork->network.Ssid.SsidLength); memcpy(&pmlmepriv->assoc_ssid, &pnetwork->network.Ssid, sizeof(struct ndis_802_11_ssid)); pmlmepriv->assoc_by_bssid = false; @@ -2082,16 +2032,11 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) if (_SUCCESS == do_join_r) { break; } else { - netdev_dbg(padapter->pnetdev, - "roaming do_join return %d\n", - do_join_r); pmlmepriv->to_roaming--; if (0 < pmlmepriv->to_roaming) { continue; } else { - netdev_dbg(padapter->pnetdev, - "-to roaming fail, indicate_disconnect\n"); rtw_indicate_disconnect(padapter); break; } diff --git a/drivers/staging/r8188eu/core/rtw_security.c b/drivers/staging/r8188eu/core/rtw_security.c index 4e93c720c1b6..fdd2dbf65eb7 100644 --- a/drivers/staging/r8188eu/core/rtw_security.c +++ b/drivers/staging/r8188eu/core/rtw_security.c @@ -545,8 +545,6 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, struct recv_frame *precvframe) if (is_multicast_ether_addr(prxattrib->ra)) { if (!psecuritypriv->binstallGrpkey) { res = _FAIL; - netdev_dbg(padapter->pnetdev, - "rx bc/mc packets, but didn't install group key!\n"); goto exit; } prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey; @@ -1330,10 +1328,6 @@ static int aes_decipher(struct adapter *padapter, u8 *key, uint hdrlen, /* compare the mic */ for (i = 0; i < 8; i++) { if (pframe[hdrlen + 8 + plen - 8 + i] != message[hdrlen + 8 + plen - 8 + i]) { - netdev_dbg(padapter->pnetdev, - "mic check error mic[%d]: pframe(%x)!=message(%x)\n", - i, pframe[hdrlen + 8 + plen - 8 + i], - message[hdrlen + 8 + plen - 8 + i]); res = _FAIL; } } @@ -1361,16 +1355,10 @@ u32 rtw_aes_decrypt(struct adapter *padapter, struct recv_frame *precvframe) /* in concurrent we should use sw descrypt in group key, so we remove this message */ if (!psecuritypriv->binstallGrpkey) { res = _FAIL; - netdev_dbg(padapter->pnetdev, - "rx bc/mc packets, but didn't install group key!\n"); goto exit; } prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey; if (psecuritypriv->dot118021XGrpKeyid != prxattrib->key_index) { - netdev_dbg(padapter->pnetdev, - "not match packet_index=%d, install_index=%d\n", - prxattrib->key_index, - psecuritypriv->dot118021XGrpKeyid); res = _FAIL; goto exit; } diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c index 79b49a13fe61..1fb9b6cc7eda 100644 --- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c @@ -104,7 +104,7 @@ inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta) int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info); if (!stainfo_offset_valid(offset)) - pr_debug("invalid offset(%d), out of range!!!", offset); + ; return offset; } @@ -112,7 +112,7 @@ inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta) inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset) { if (!stainfo_offset_valid(offset)) - pr_debug("invalid offset(%d), out of range!!!", offset); + ; return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info)); } diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index 30714fee1921..7d616a409c0c 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -371,7 +371,6 @@ u8 qos_acm(u8 acm_mask, u8 priority) change_priority = 5; break; default: - pr_debug("invalid pattrib->priority: %d!!!\n", priority); break; } @@ -889,7 +888,6 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct return _FAIL; if (!pxmitframe->buf_addr) { - netdev_dbg(padapter->pnetdev, "buf_addr == NULL\n"); return _FAIL; } @@ -900,8 +898,6 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct mem_start = pbuf_start + hw_hdr_offset; if (rtw_make_wlanhdr(padapter, mem_start, pattrib) == _FAIL) { - netdev_dbg(padapter->pnetdev, - "rtw_make_wlanhdr fail; drop pkt\n"); res = _FAIL; goto exit; } @@ -998,8 +994,6 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct } if (xmitframe_addmic(padapter, pxmitframe) == _FAIL) { - netdev_dbg(padapter->pnetdev, - "xmitframe_addmic(padapter, pxmitframe) == _FAIL\n"); res = _FAIL; goto exit; } @@ -1130,7 +1124,6 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv) /* pxmitbuf->ext_tag = true; */ if (pxmitbuf->sctx) { - pr_debug("pxmitbuf->sctx is not NULL\n"); rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC); } } @@ -1185,7 +1178,6 @@ struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv) pxmitpriv->free_xmitbuf_cnt--; pxmitbuf->priv_data = NULL; if (pxmitbuf->sctx) { - pr_debug("pxmitbuf->sctx is not NULL\n"); rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC); } } @@ -1203,7 +1195,6 @@ s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) return _FAIL; if (pxmitbuf->sctx) { - pr_debug("pxmitbuf->sctx is not NULL\n"); rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_FREE); } @@ -1472,7 +1463,6 @@ s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe) if (!psta) { res = _FAIL; - netdev_dbg(padapter->pnetdev, "psta == NULL\n"); goto exit; } @@ -1718,8 +1708,6 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) pxmitframe = rtw_alloc_xmitframe(pxmitpriv); if (!pxmitframe) { - netdev_dbg(padapter->pnetdev, - "DBG_TX_DROP_FRAME no more pxmitframe\n"); return -1; } @@ -2144,7 +2132,6 @@ int rtw_sctx_wait(struct submit_ctx *sctx) if (!wait_for_completion_timeout(&sctx->done, expire)) { /* timeout, do something?? */ status = RTW_SCTX_DONE_TIMEOUT; - pr_debug("timeout\n"); } else { status = sctx->status; } @@ -2174,7 +2161,7 @@ void rtw_sctx_done_err(struct submit_ctx **sctx, int status) { if (*sctx) { if (rtw_sctx_chk_waring_status(status)) - pr_debug("status:%d\n", status); + ; (*sctx)->status = status; complete(&((*sctx)->done)); *sctx = NULL; @@ -2198,6 +2185,4 @@ void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status) if (pxmitpriv->ack_tx) rtw_sctx_done_err(&pack_tx_ops, status); - else - pr_debug("ack_tx not set\n"); } diff --git a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c index d75933c73946..82e680abcd61 100644 --- a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c +++ b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c @@ -63,32 +63,21 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) if (padapter->bSurpriseRemoved || padapter->bDriverStopped || padapter->bWritePortCancel) { - netdev_dbg(padapter->pnetdev, - "TX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", - padapter->bDriverStopped, padapter->bSurpriseRemoved); - netdev_dbg(padapter->pnetdev, - "TX Warning! bWritePortCancel(%d) pxmitbuf->ext_tag(%x)\n", - padapter->bReadPortCancel, pxmitbuf->ext_tag); - goto check_completion; } if (purb->status) { - netdev_dbg(padapter->pnetdev, "status(%d)\n", purb->status); if (purb->status == -EINPROGRESS) { goto check_completion; } else if (purb->status == -ENOENT) { - netdev_dbg(padapter->pnetdev, "-ENOENT\n"); goto check_completion; } else if (purb->status == -ECONNRESET) { - netdev_dbg(padapter->pnetdev, "-ECONNRESET\n"); goto check_completion; } else if (purb->status == -ESHUTDOWN) { padapter->bDriverStopped = true; goto check_completion; } else if ((purb->status != -EPIPE) && (purb->status != -EPROTO)) { padapter->bSurpriseRemoved = true; - netdev_dbg(padapter->pnetdev, "bSurpriseRemoved = true\n"); goto check_completion; } @@ -167,7 +156,6 @@ u32 rtw_write_port(struct adapter *padapter, u32 addr, u32 cnt, u8 *wmem) status = usb_submit_urb(purb, GFP_ATOMIC); if (status) { rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR); - netdev_dbg(padapter->pnetdev, "usb_write_port, status = %d\n", status); switch (status) { case -ENODEV: diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c index 7287897b3f65..6032831364c4 100644 --- a/drivers/staging/r8188eu/os_dep/xmit_linux.c +++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c @@ -79,7 +79,6 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb for (i = 0; i < 8; i++) { pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); if (!pxmitbuf->pxmit_urb[i]) { - netdev_dbg(padapter->pnetdev, "pxmitbuf->pxmit_urb[i]==NULL"); return _FAIL; } } @@ -188,14 +187,12 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) memcpy(newskb->data, psta->hwaddr, 6); res = rtw_xmit(padapter, &newskb); if (res < 0) { - netdev_dbg(padapter->pnetdev, "rtw_xmit() return error!\n"); pxmitpriv->tx_drop++; dev_kfree_skb_any(newskb); } else { pxmitpriv->tx_pkts++; } } else { - netdev_dbg(padapter->pnetdev, "skb_copy() failed!\n"); pxmitpriv->tx_drop++; spin_unlock_bh(&pstapriv->asoc_list_lock); -- cgit From dbc96a32e406c5627b8fc0bdb201ae884deafba3 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:06:57 +0000 Subject: staging: r8188eu: remove converted DBG_88E calls from core/rtw_mlme_ext.c Remove all the netdev_dbg/pr_debug calls that were previously converted from DBG_88E inside core/rtw_mlme_ext.c. Due to the sheer number of lines, this patch is separated out for ease of review. After some thought, it makes more sense to just entirely strip all of these calls, so that debugging code in the driver can be more consistent and useful going forwards. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-4-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 283 ++-------------------------- 1 file changed, 14 insertions(+), 269 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 329b27bfc09b..6c07a03dfa84 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -315,9 +315,6 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_c memset(channel_set, 0, sizeof(struct rt_channel_info) * MAX_CHANNEL_NUM); if (ChannelPlan >= RT_CHANNEL_DOMAIN_MAX && ChannelPlan != RT_CHANNEL_DOMAIN_REALTEK_DEFINE) { - netdev_dbg(padapter->pnetdev, - "ChannelPlan ID %x error !!!!!\n", - ChannelPlan); return chanset_size; } @@ -438,9 +435,6 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) if (GetRetry(pframe)) { if (precv_frame->attrib.seq_num == psta->RxMgmtFrameSeqNum) { /* drop the duplicate management frame */ - netdev_dbg(padapter->pnetdev, - "Drop duplicate management frame with seq_num=%d.\n", - precv_frame->attrib.seq_num); return; } } @@ -577,8 +571,6 @@ unsigned int OnProbeRsp(struct adapter *padapter, struct recv_frame *precv_frame return _SUCCESS; } else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) { if (pwdinfo->nego_req_info.benable) { - netdev_dbg(padapter->pnetdev, - "P2P State is GONEGO ING!\n"); if (!memcmp(pwdinfo->nego_req_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN)) { pwdinfo->nego_req_info.benable = false; issue_p2p_GO_request(padapter, pwdinfo->nego_req_info.peerDevAddr); @@ -586,8 +578,6 @@ unsigned int OnProbeRsp(struct adapter *padapter, struct recv_frame *precv_frame } } else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_INVITE_REQ)) { if (pwdinfo->invitereq_info.benable) { - netdev_dbg(padapter->pnetdev, - "P2P_STATE_TX_INVITE_REQ!\n"); if (!memcmp(pwdinfo->invitereq_info.peer_macaddr, GetAddr2Ptr(pframe), ETH_ALEN)) { pwdinfo->invitereq_info.benable = false; issue_p2p_invitation_request(padapter, pwdinfo->invitereq_info.peer_macaddr); @@ -717,17 +707,12 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) seq = le16_to_cpu(*(__le16 *)((size_t)pframe + WLAN_HDR_A3_LEN + 2)); algorithm = le16_to_cpu(*(__le16 *)((size_t)pframe + WLAN_HDR_A3_LEN)); - netdev_dbg(padapter->pnetdev, "auth alg=%x, seq=%X\n", algorithm, seq); - if (auth_mode == 2 && psecuritypriv->dot11PrivacyAlgrthm != _WEP40_ && psecuritypriv->dot11PrivacyAlgrthm != _WEP104_) auth_mode = 0; if ((algorithm > 0 && auth_mode == 0) || /* rx a shared-key auth but shared not enabled */ (algorithm == 0 && auth_mode == 1)) { /* rx a open-system auth but shared-key is enabled */ - netdev_dbg(padapter->pnetdev, - "auth rejected due to bad alg [alg=%d, auth_mib=%d] %02X%02X%02X%02X%02X%02X\n", - algorithm, auth_mode, sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); status = _STATS_NO_SUPP_ALG_; @@ -742,12 +727,8 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) pstat = rtw_get_stainfo(pstapriv, sa); if (!pstat) { /* allocate a new one */ - netdev_dbg(padapter->pnetdev, - "going to alloc stainfo for sa=%pM\n", sa); pstat = rtw_alloc_stainfo(pstapriv, sa); if (!pstat) { - netdev_dbg(padapter->pnetdev, - "Exceed the upper limit of supported clients...\n"); status = _STATS_UNABLE_HANDLE_STA_; goto auth_fail; } @@ -778,9 +759,6 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) pstat->expire_to = pstapriv->auth_to; if ((pstat->auth_seq + 1) != seq) { - netdev_dbg(padapter->pnetdev, - "(1)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", - seq, pstat->auth_seq + 1); status = _STATS_OUT_OF_AUTH_SEQ_; goto auth_fail; } @@ -792,9 +770,6 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) pstat->expire_to = pstapriv->assoc_to; pstat->authalg = algorithm; } else { - netdev_dbg(padapter->pnetdev, - "(2)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", - seq, pstat->auth_seq + 1); status = _STATS_OUT_OF_AUTH_SEQ_; goto auth_fail; } @@ -808,14 +783,11 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) pstat->auth_seq = 2; } else if (seq == 3) { /* checking for challenging txt... */ - netdev_dbg(padapter->pnetdev, "checking for challenging txt...\n"); p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_, _CHLGETXT_IE_, (int *)&ie_len, len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ - 4); if (!p || ie_len <= 0) { - netdev_dbg(padapter->pnetdev, - "auth rejected because challenge failure!(1)\n"); status = _STATS_CHALLENGE_FAIL_; goto auth_fail; } @@ -826,15 +798,10 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame) /* challenging txt is correct... */ pstat->expire_to = pstapriv->assoc_to; } else { - netdev_dbg(padapter->pnetdev, - "auth rejected because challenge failure!\n"); status = _STATS_CHALLENGE_FAIL_; goto auth_fail; } } else { - netdev_dbg(padapter->pnetdev, - "(3)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", - seq, pstat->auth_seq + 1); status = _STATS_OUT_OF_AUTH_SEQ_; goto auth_fail; } @@ -887,8 +854,6 @@ unsigned int OnAuthClient(struct adapter *padapter, struct recv_frame *precv_fra status = le16_to_cpu(*(__le16 *)((size_t)pframe + WLAN_HDR_A3_LEN + offset + 4)); if (status != 0) { - netdev_dbg(padapter->pnetdev, - "clnt auth fail, status: %d\n", status); if (status == 13) { /* pmlmeinfo->auth_algo == dot11AuthAlgrthm_Auto) */ if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) pmlmeinfo->auth_algo = dot11AuthAlgrthm_Open; @@ -942,7 +907,7 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame u16 capab_info; struct rtw_ieee802_11_elems elems; struct sta_info *pstat; - unsigned char reassoc, *p, *pos, *wpa_ie; + unsigned char *p, *pos, *wpa_ie; unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01}; int i, ie_len, wpa_ie_len, left; unsigned char supportRate[16]; @@ -967,17 +932,12 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame frame_type = GetFrameSubType(pframe); if (frame_type == WIFI_ASSOCREQ) { - reassoc = 0; ie_offset = _ASOCREQ_IE_OFFSET_; } else { /* WIFI_REASSOCREQ */ - reassoc = 1; ie_offset = _REASOCREQ_IE_OFFSET_; } if (pkt_len < IEEE80211_3ADDR_LEN + ie_offset) { - netdev_dbg(padapter->pnetdev, - "handle_assoc(reassoc=%d) - too short payload (len=%lu)\n", - reassoc, (unsigned long)pkt_len); return _FAIL; } @@ -1009,9 +969,6 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame /* now parse all ieee802_11 ie to point to elems */ if (rtw_ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed || !elems.ssid) { - netdev_dbg(padapter->pnetdev, - "STA %pM sent invalid association request\n", - pstat->hwaddr); status = _STATS_FAILURE_; goto OnAssocReqFail; } @@ -1040,8 +997,6 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame /* check if the supported rate is ok */ p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _SUPPORTEDRATES_IE_, &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset); if (!p) { - netdev_dbg(padapter->pnetdev, - "Rx a sta assoc-req which supported rate is empty!\n"); /* use our own rate set as statoin used */ /* memcpy(supportRate, AP_BSSRATE, AP_BSSRATE_LEN); */ /* supportRateNum = AP_BSSRATE_LEN; */ @@ -1131,15 +1086,11 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS); if (!wpa_ie) { if (elems.wps_ie) { - netdev_dbg(padapter->pnetdev, - "STA included WPS IE in (Re)Association Request - assume WPS is used\n"); pstat->flags |= WLAN_STA_WPS; /* wpabuf_free(sta->wps_ie); */ /* sta->wps_ie = wpabuf_alloc_copy(elems.wps_ie + 4, */ /* elems.wps_ie_len - 4); */ } else { - netdev_dbg(padapter->pnetdev, - "STA did not include WPA/RSN IE in (Re)Association Request - possible WPS use\n"); pstat->flags |= WLAN_STA_MAYBE_WPS; } @@ -1152,8 +1103,6 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame rtw_get_wps_attr_content(pmlmepriv->wps_beacon_ie, pmlmepriv->wps_beacon_ie_len, WPS_ATTR_SELECTED_REGISTRAR, &selected_registrar, NULL); if (!selected_registrar) { - netdev_dbg(padapter->pnetdev, - "selected_registrar is false , or AP is not ready to do WPS\n"); status = _STATS_UNABLE_HANDLE_STA_; @@ -1165,9 +1114,6 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame int copy_len; if (psecuritypriv->wpa_psk == 0) { - netdev_dbg(padapter->pnetdev, - "STA %pM: WPA/RSN IE in association request, but AP don't support WPA/RSN\n", - pstat->hwaddr); status = WLAN_STATUS_INVALID_IE; @@ -1175,8 +1121,6 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame } if (elems.wps_ie) { - netdev_dbg(padapter->pnetdev, - "STA included WPS IE in (Re)Association Request - WPS is used\n"); pstat->flags |= WLAN_STA_WPS; copy_len = 0; } else { @@ -1261,9 +1205,6 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame if ((pstat->flags & WLAN_STA_HT) && ((pstat->wpa2_pairwise_cipher & WPA_CIPHER_TKIP) || (pstat->wpa_pairwise_cipher & WPA_CIPHER_TKIP))) { - netdev_dbg(padapter->pnetdev, - "HT: %pM tried to use TKIP with HT association\n", - pstat->hwaddr); /* status = WLAN_STATUS_CIPHER_REJECTED_PER_POLICY; */ /* goto OnAssocReqFail; */ @@ -1308,7 +1249,6 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame /* get a unique AID */ if (pstat->aid > 0) { - netdev_dbg(padapter->pnetdev, "old AID %d\n", pstat->aid); } else { for (pstat->aid = 1; pstat->aid <= NUM_STA; pstat->aid++) if (!pstapriv->sta_aid[pstat->aid - 1]) @@ -1318,16 +1258,11 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame if (pstat->aid > pstapriv->max_num_sta) { pstat->aid = 0; - netdev_dbg(padapter->pnetdev, - "no room for more AIDs\n"); - status = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; goto OnAssocReqFail; } else { pstapriv->sta_aid[pstat->aid - 1] = pstat; - netdev_dbg(padapter->pnetdev, - "allocate new AID=(%d)\n", pstat->aid); } } @@ -1362,8 +1297,6 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame issue_asocrsp(padapter, status, pstat, WIFI_REASSOCRSP); /* 2 - report to upper layer */ - netdev_dbg(padapter->pnetdev, - "indicate_sta_join_event to upper layer - hostapd\n"); rtw_indicate_sta_assoc_event(padapter, pstat); /* 3-(1) report sta add event */ @@ -1417,8 +1350,6 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame /* status */ status = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + 2)); if (status > 0) { - netdev_dbg(padapter->pnetdev, - "assoc reject, status code: %d\n", status); pmlmeinfo->state = WIFI_FW_NULL_STATE; res = -4; goto report_assoc_result; @@ -1498,8 +1429,6 @@ unsigned int OnDeAuth(struct adapter *padapter, struct recv_frame *precv_frame) reason = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN)); - netdev_dbg(padapter->pnetdev, "Reason code(%d)\n", reason); - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; @@ -1565,8 +1494,6 @@ unsigned int OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame reason = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN)); - netdev_dbg(padapter->pnetdev, "Reason code(%d)\n", reason); - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; @@ -1652,7 +1579,7 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr struct recv_reorder_ctrl *preorder_ctrl; unsigned char *frame_body; unsigned char category, action; - unsigned short tid, status, reason_code = 0; + unsigned short tid, status; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; u8 *pframe = precv_frame->rx_data; @@ -1678,7 +1605,6 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr if (!pmlmeinfo->HT_enable) return _SUCCESS; action = frame_body[1]; - netdev_dbg(padapter->pnetdev, "action=%d\n", action); switch (action) { case RTW_WLAN_ACTION_ADDBA_REQ: /* ADDBA request */ memcpy(&pmlmeinfo->ADDBA_req, &frame_body[2], sizeof(struct ADDBA_request)); @@ -1693,8 +1619,6 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr status = get_unaligned_le16(&frame_body[3]); tid = ((frame_body[5] >> 2) & 0x7); if (status == 0) { /* successful */ - netdev_dbg(padapter->pnetdev, - "agg_enable for TID=%d\n", tid); psta->htpriv.agg_enable_bitmap |= 1 << tid; psta->htpriv.candidate_tid_bitmap &= ~BIT(tid); } else { @@ -1705,17 +1629,12 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr if ((frame_body[3] & BIT(3)) == 0) { psta->htpriv.agg_enable_bitmap &= ~(1 << ((frame_body[3] >> 4) & 0xf)); psta->htpriv.candidate_tid_bitmap &= ~(1 << ((frame_body[3] >> 4) & 0xf)); - reason_code = get_unaligned_le16(&frame_body[4]); } else if ((frame_body[3] & BIT(3)) == BIT(3)) { tid = (frame_body[3] >> 4) & 0x0F; preorder_ctrl = &psta->recvreorder_ctrl[tid]; preorder_ctrl->enable = false; preorder_ctrl->indicate_seq = 0xffff; } - netdev_dbg(padapter->pnetdev, - "DELBA: %x(%x)\n", - pmlmeinfo->agg_enable_bitmap, - reason_code); /* todo: how to notify the host while receiving DELETE BA */ break; default: @@ -2094,7 +2013,6 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8 *raddr, u8 *frame if (!pmgntframe) return; - netdev_dbg(padapter->pnetdev, "result=%d\n", result); /* update attribute */ pattrib = &pmgntframe->attrib; update_mgntframe_attrib(padapter, pattrib); @@ -3126,18 +3044,9 @@ static u8 is_matched_in_profilelist(u8 *peermacaddr, struct profile_info *profil { u8 i, match_result = 0; - pr_debug("peermac=%.2X %.2X %.2X %.2X %.2X %.2X\n", - peermacaddr[0], peermacaddr[1], peermacaddr[2], - peermacaddr[3], peermacaddr[4], peermacaddr[5]); - for (i = 0; i < P2P_MAX_PERSISTENT_GROUP_NUM; i++, profileinfo++) { - pr_debug("profileinfo_mac=%.2X %.2X %.2X %.2X %.2X %.2X\n", - profileinfo->peermac[0], profileinfo->peermac[1], - profileinfo->peermac[2], profileinfo->peermac[3], - profileinfo->peermac[4], profileinfo->peermac[5]); if (!memcmp(peermacaddr, profileinfo->peermac, ETH_ALEN)) { match_result = 1; - pr_debug("Match!\n"); break; } } @@ -3689,16 +3598,10 @@ static s32 rtw_action_public_decache(struct recv_frame *recv_frame, s32 token) if (GetRetry(frame)) { if (token >= 0) { if ((seq_ctrl == mlmeext->action_public_rxseq) && (token == mlmeext->action_public_dialog_token)) { - netdev_dbg(adapter->pnetdev, - "seq_ctrl = 0x%x, rxseq = 0x%x, token:%d\n", - seq_ctrl, mlmeext->action_public_rxseq, token); return _FAIL; } } else { if (seq_ctrl == mlmeext->action_public_rxseq) { - netdev_dbg(adapter->pnetdev, - "seq_ctrl = 0x%x, rxseq = 0x%x\n", - seq_ctrl, mlmeext->action_public_rxseq); return _FAIL; } } @@ -3741,7 +3644,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) switch (frame_body[6]) { /* OUI Subtype */ case P2P_GO_NEGO_REQ: - netdev_dbg(padapter->pnetdev, "Got GO Nego Req Frame\n"); memset(&pwdinfo->groupid_info, 0x00, sizeof(struct group_id_info)); if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ)) @@ -3753,9 +3655,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) _cancel_timer_ex(&pwdinfo->restore_p2p_state_timer); /* Restore the previous p2p state */ rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); - netdev_dbg(padapter->pnetdev, - "Restore the previous p2p state to %d\n", - rtw_p2p_state(pwdinfo)); } /* Commented by Kurt 20110902 */ @@ -3776,8 +3675,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) _set_timer(&pwdinfo->restore_p2p_state_timer, 5000); break; case P2P_GO_NEGO_RESP: - netdev_dbg(padapter->pnetdev, "Got GO Nego Resp Frame\n"); - if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) { /* Commented by Albert 20110425 */ /* The restore timer is enabled when issuing the nego request frame of rtw_p2p_connect function. */ @@ -3797,12 +3694,9 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL)) _set_timer(&pwdinfo->restore_p2p_state_timer, 5000); } else { - netdev_dbg(padapter->pnetdev, - "Skipped GO Nego Resp Frame (p2p_state != P2P_STATE_GONEGO_ING)\n"); } break; case P2P_GO_NEGO_CONF: - netdev_dbg(padapter->pnetdev, "Got GO Nego Confirm Frame\n"); result = process_p2p_group_negotation_confirm(pwdinfo, frame_body, len); if (P2P_STATUS_SUCCESS == result) { if (rtw_p2p_role(pwdinfo) == P2P_ROLE_CLIENT) { @@ -3816,7 +3710,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) /* Added by Albert 2010/10/05 */ /* Received the P2P Invite Request frame. */ - netdev_dbg(padapter->pnetdev, "Got invite request frame!\n"); p2p_ie = rtw_get_p2p_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &p2p_ielen); if (p2p_ie) { /* Parse the necessary information from the P2P Invitation Request frame. */ @@ -3836,14 +3729,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) /* After having the peer interface address, the sigma can find the correct conf file for wpa_supplicant. */ if (attr_contentlen) { - netdev_dbg(padapter->pnetdev, - "GO's BSSID = %.2X %.2X %.2X %.2X %.2X %.2X\n", - pwdinfo->p2p_peer_interface_addr[0], - pwdinfo->p2p_peer_interface_addr[1], - pwdinfo->p2p_peer_interface_addr[2], - pwdinfo->p2p_peer_interface_addr[3], - pwdinfo->p2p_peer_interface_addr[4], - pwdinfo->p2p_peer_interface_addr[5]); } if (invitation_flag & P2P_INVITATION_FLAGS_PERSISTENT) { @@ -3891,8 +3776,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) } } } else { - netdev_dbg(padapter->pnetdev, - "P2P Group ID Attribute NOT FOUND!\n"); status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE; } } else { @@ -3918,20 +3801,13 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) status_code = P2P_STATUS_SUCCESS; } } else { - netdev_dbg(padapter->pnetdev, - "P2P Group ID Attribute NOT FOUND!\n"); status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE; } } } else { - netdev_dbg(padapter->pnetdev, - "P2P Invitation Flags Attribute NOT FOUND!\n"); status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE; } - netdev_dbg(padapter->pnetdev, - "status_code = %d\n", status_code); - pwdinfo->inviteresp_info.token = frame_body[7]; issue_p2p_invitation_response(padapter, GetAddr2Ptr(pframe), pwdinfo->inviteresp_info.token, status_code); } @@ -3940,15 +3816,12 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) u8 attr_content = 0x00; u32 attr_contentlen = 0; - netdev_dbg(padapter->pnetdev, "Got invite response frame!\n"); _cancel_timer_ex(&pwdinfo->restore_p2p_state_timer); p2p_ie = rtw_get_p2p_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &p2p_ielen); if (p2p_ie) { rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_STATUS, &attr_content, &attr_contentlen); if (attr_contentlen == 1) { - netdev_dbg(padapter->pnetdev, - "Status = %d\n", attr_content); pwdinfo->invitereq_info.benable = false; if (attr_content == P2P_STATUS_SUCCESS) { @@ -3982,8 +3855,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) process_p2p_devdisc_resp(pwdinfo, pframe, len); break; case P2P_PROVISION_DISC_REQ: - netdev_dbg(padapter->pnetdev, - "Got Provisioning Discovery Request Frame\n"); process_p2p_provdisc_req(pwdinfo, pframe, len); memcpy(pwdinfo->rx_prov_disc_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN); @@ -3998,8 +3869,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) case P2P_PROVISION_DISC_RESP: /* Commented by Albert 20110707 */ /* Should we check the pwdinfo->tx_prov_disc_info.bsent flag here?? */ - netdev_dbg(padapter->pnetdev, - "Got Provisioning Discovery Response Frame\n"); /* Commented by Albert 20110426 */ /* The restore timer is enabled when issuing the provisioing request frame in rtw_p2p_prov_disc function. */ _cancel_timer_ex(&pwdinfo->restore_p2p_state_timer); @@ -4154,13 +4023,11 @@ struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv) pmgntframe = rtw_alloc_xmitframe(pxmitpriv); if (!pmgntframe) { - pr_debug("alloc xmitframe fail\n"); return NULL; } pxmitbuf = rtw_alloc_xmitbuf_ext(pxmitpriv); if (!pxmitbuf) { - pr_debug("alloc xmitbuf fail\n"); rtw_free_xmitframe(pxmitpriv, pmgntframe); return NULL; } @@ -4182,7 +4049,6 @@ void update_mgnt_tx_rate(struct adapter *padapter, u8 rate) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; pmlmeext->tx_rate = rate; - netdev_dbg(padapter->pnetdev, "rate = %x\n", rate); } void update_mgntframe_attrib(struct adapter *padapter, struct pkt_attrib *pattrib) @@ -4319,7 +4185,6 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) { - netdev_dbg(padapter->pnetdev, "alloc mgnt frame fail\n"); return; } spin_lock_bh(&pmlmepriv->bcn_update_lock); @@ -4502,7 +4367,6 @@ _issue_bcn: spin_unlock_bh(&pmlmepriv->bcn_update_lock); if ((pattrib->pktlen + TXDESC_SIZE) > 512) { - netdev_dbg(padapter->pnetdev, "beacon frame too large\n"); return; } @@ -4534,8 +4398,6 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) { - netdev_dbg(padapter->pnetdev, - "alloc mgnt frame fail\n"); return; } @@ -4761,7 +4623,6 @@ int issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, { int ret; int i = 0; - u32 start = jiffies; do { ret = _issue_probereq(padapter, pssid, da, wait_ms > 0); @@ -4783,17 +4644,9 @@ int issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, if (try_cnt && wait_ms) { if (da) - netdev_dbg(padapter->pnetdev, - "to %pM, ch:%u%s, %d/%d in %u ms\n", - da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", - i, try_cnt, rtw_get_passing_time_ms(start)); + ; else - netdev_dbg(padapter->pnetdev, - "ch:%u%s, %d/%d in %u ms\n", - rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", - i, try_cnt, rtw_get_passing_time_ms(start)); + ; } exit: return ret; @@ -5129,9 +4982,6 @@ void issue_assocreq(struct adapter *padapter) for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) { if (pmlmeinfo->network.SupportedRates[i] == 0) break; - netdev_dbg(padapter->pnetdev, - "network.SupportedRates[%d]=%02X\n", - i, pmlmeinfo->network.SupportedRates[i]); } for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) { @@ -5148,9 +4998,6 @@ void issue_assocreq(struct adapter *padapter) if (j == sta_bssrate_len) { /* the rate is not supported by STA */ - netdev_dbg(padapter->pnetdev, - "the rate[%d]=%02X is not supported by STA!\n", - i, pmlmeinfo->network.SupportedRates[i]); } else { /* the rate is supported by STA */ bssrate[index++] = pmlmeinfo->network.SupportedRates[i]; @@ -5158,7 +5005,6 @@ void issue_assocreq(struct adapter *padapter) } bssrate_len = index; - netdev_dbg(padapter->pnetdev, "bssrate_len=%d\n", bssrate_len); if (bssrate_len == 0) { rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); @@ -5443,7 +5289,6 @@ int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int pow { int ret; int i = 0; - u32 start = jiffies; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; @@ -5470,17 +5315,9 @@ int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int pow if (try_cnt && wait_ms) { if (da) - netdev_dbg(padapter->pnetdev, - "to %pM, ch:%u%s, %d/%d in %u ms\n", - da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", - i, try_cnt, rtw_get_passing_time_ms(start)); + ; else - netdev_dbg(padapter->pnetdev, - "ch:%u%s, %d/%d in %u ms\n", - rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", - i, try_cnt, rtw_get_passing_time_ms(start)); + ; } exit: return ret; @@ -5565,7 +5402,6 @@ int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int { int ret; int i = 0; - u32 start = jiffies; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; @@ -5592,17 +5428,9 @@ int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int if (try_cnt && wait_ms) { if (da) - netdev_dbg(padapter->pnetdev, - "to %pM, ch:%u%s, %d/%d in %u ms\n", - da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", - i, try_cnt, rtw_get_passing_time_ms(start)); + ; else - netdev_dbg(padapter->pnetdev, - "ch:%u%s, %d/%d in %u ms\n", - rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", - i, try_cnt, rtw_get_passing_time_ms(start)); + ; } exit: return ret; @@ -5673,7 +5501,6 @@ exit: int issue_deauth(struct adapter *padapter, unsigned char *da, unsigned short reason) { - netdev_dbg(padapter->pnetdev, "to %pM\n", da); return _issue_deauth(padapter, da, reason, false); } @@ -5682,7 +5509,6 @@ int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason, int { int ret; int i = 0; - u32 start = jiffies; do { ret = _issue_deauth(padapter, da, reason, wait_ms > 0); @@ -5703,17 +5529,9 @@ int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason, int if (try_cnt && wait_ms) { if (da) - netdev_dbg(padapter->pnetdev, - "to %pM, ch:%u%s, %d/%d in %u ms\n", - da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", - i, try_cnt, rtw_get_passing_time_ms(start)); + ; else - netdev_dbg(padapter->pnetdev, - "ch:%u%s, %d/%d in %u ms\n", - rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", - i, try_cnt, rtw_get_passing_time_ms(start)); + ; } exit: return ret; @@ -5740,10 +5558,6 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch struct sta_priv *pstapriv = &padapter->stapriv; struct registry_priv *pregpriv = &padapter->registrypriv; - netdev_dbg(padapter->pnetdev, - "category=%d, action=%d, status=%d\n", - category, action, status); - pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) return; @@ -5795,10 +5609,6 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch if (psta) { start_seq = (psta->sta_xmitpriv.txseq_tid[status & 0x07] & 0xfff) + 1; - netdev_dbg(padapter->pnetdev, - "BA_starting_seqctrl=%d for TID=%d\n", - start_seq, status & 0x07); - psta->BA_starting_seqctrl[status & 0x07] = start_seq; BA_starting_seqctrl = start_seq << 4; @@ -5987,8 +5797,6 @@ unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr) if (initiator == 0) { /* recipient */ for (tid = 0; tid < MAXTID; tid++) { if (psta->recvreorder_ctrl[tid].enable) { - netdev_dbg(padapter->pnetdev, - "rx agg disable tid(%d)\n", tid); issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, (((tid << 1) | initiator) & 0x1F)); psta->recvreorder_ctrl[tid].enable = false; psta->recvreorder_ctrl[tid].indicate_seq = 0xffff; @@ -5997,8 +5805,6 @@ unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr) } else if (initiator == 1) { /* originator */ for (tid = 0; tid < MAXTID; tid++) { if (psta->htpriv.agg_enable_bitmap & BIT(tid)) { - netdev_dbg(padapter->pnetdev, - "tx agg disable tid(%d)\n", tid); issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, (((tid << 1) | initiator) & 0x1F)); psta->htpriv.agg_enable_bitmap &= ~BIT(tid); psta->htpriv.candidate_tid_bitmap &= ~BIT(tid); @@ -6031,16 +5837,13 @@ unsigned int send_beacon(struct adapter *padapter) if (padapter->bSurpriseRemoved || padapter->bDriverStopped) return _FAIL; if (!bxmitok) { - netdev_dbg(padapter->pnetdev, "fail! %u ms\n", - rtw_get_passing_time_ms(start)); return _FAIL; } else { u32 passing_time = rtw_get_passing_time_ms(start); if (passing_time > 100 || issue > 3) - netdev_dbg(padapter->pnetdev, - "success, issue:%d, poll:%d, %u ms\n", - issue, poll, rtw_get_passing_time_ms(start)); + ; + return _SUCCESS; } } @@ -6249,16 +6052,11 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st /* checking SSID */ p = rtw_get_ie(bssid->IEs + ie_offset, _SSID_IE_, &len, bssid->IELength - ie_offset); if (!p) { - netdev_dbg(padapter->pnetdev, - "marc: cannot find SSID for survey event\n"); return _FAIL; } if (*(p + 1)) { if (len > NDIS_802_11_LENGTH_SSID) { - netdev_dbg(padapter->pnetdev, - "IE too long (%d) for survey event\n", - len); return _FAIL; } memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1)); @@ -6274,9 +6072,6 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st p = rtw_get_ie(bssid->IEs + ie_offset, _SUPPORTEDRATES_IE_, &len, bssid->IELength - ie_offset); if (p) { if (len > NDIS_802_11_LENGTH_RATES_EX) { - netdev_dbg(padapter->pnetdev, - "IE too long (%d) for survey event\n", - len); return _FAIL; } memcpy(bssid->SupportedRates, (p + 2), len); @@ -6286,9 +6081,6 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st p = rtw_get_ie(bssid->IEs + ie_offset, _EXT_SUPPORTEDRATES_IE_, &len, bssid->IELength - ie_offset); if (p) { if (len > (NDIS_802_11_LENGTH_RATES_EX - i)) { - netdev_dbg(padapter->pnetdev, - "IE too long (%d) for survey event\n", - len); return _FAIL; } memcpy(bssid->SupportedRates + i, (p + 2), len); @@ -6403,7 +6195,6 @@ void start_create_ibss(struct adapter *padapter) rtw_indicate_connect(padapter); } } else { - netdev_dbg(padapter->pnetdev, "invalid cap:%x\n", caps); return; } /* update bc/mc sta_info */ @@ -6773,9 +6564,6 @@ void report_surveydone_event(struct adapter *padapter) psurveydone_evt = (struct surveydone_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); psurveydone_evt->bss_cnt = pmlmeext->sitesurvey_res.bss_cnt; - netdev_dbg(padapter->pnetdev, "survey done event(%x)\n", - psurveydone_evt->bss_cnt); - rtw_enqueue_cmd(pcmdpriv, pcmd_obj); } @@ -6820,8 +6608,6 @@ void report_join_res(struct adapter *padapter, int res) pjoinbss_evt->network.join_res = res; pjoinbss_evt->network.aid = res; - netdev_dbg(padapter->pnetdev, "res=%d\n", res); - rtw_joinbss_event_prehandle(padapter, (u8 *)&pjoinbss_evt->network); rtw_enqueue_cmd(pcmdpriv, pcmd_obj); @@ -6876,8 +6662,6 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi pdel_sta_evt->mac_id = mac_id; - netdev_dbg(padapter->pnetdev, "delete STA, mac_id = %d\n", mac_id); - rtw_enqueue_cmd(pcmdpriv, pcmd_obj); } @@ -6920,8 +6704,6 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int memcpy((unsigned char *)(&padd_sta_evt->macaddr), MacAddr, ETH_ALEN); padd_sta_evt->cam_id = cam_idx; - netdev_dbg(padapter->pnetdev, "add STA\n"); - rtw_enqueue_cmd(pcmdpriv, pcmd_obj); } @@ -7133,8 +6915,6 @@ static void _linked_rx_signal_strength_display(struct adapter *padapter) GetHalDefVar8188EUsb(padapter, HW_DEF_RA_INFO_DUMP, &mac_id); GetHalDefVar8188EUsb(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); - netdev_dbg(padapter->pnetdev, - "UndecoratedSmoothedPWDB:%d\n", UndecoratedSmoothedPWDB); } static u8 chk_ap_is_alive(struct sta_info *psta) @@ -7159,20 +6939,14 @@ static void rtl8188e_sreset_linked_status_check(struct adapter *padapter) u8 fw_status; if (rx_dma_status != 0x00) { - netdev_dbg(padapter->pnetdev, "REG_RXDMA_STATUS:0x%08x\n", - rx_dma_status); rtw_write32(padapter, REG_RXDMA_STATUS, rx_dma_status); } fw_status = rtw_read8(padapter, REG_FMETHR); if (fw_status == 1) - netdev_dbg(padapter->pnetdev, - "REG_FW_STATUS (0x%02x), Read_Efuse_Fail !!\n", - fw_status); + ; else if (fw_status == 2) - netdev_dbg(padapter->pnetdev, - "REG_FW_STATUS (0x%02x), Condition_No_Match !!\n", - fw_status); + ; } void linked_status_chk(struct adapter *padapter) @@ -7306,15 +7080,8 @@ void survey_timer_hdl(struct adapter *padapter) if (!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE)) { rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_MAX); pmlmeext->sitesurvey_res.channel_idx = 3; - netdev_dbg(padapter->pnetdev, - "idx:%d, cnt:%u\n", - pmlmeext->sitesurvey_res.channel_idx, - pwdinfo->find_phase_state_exchange_cnt); } else { pmlmeext->sitesurvey_res.channel_idx = pmlmeext->sitesurvey_res.ch_num; - netdev_dbg(padapter->pnetdev, - "idx:%d\n", - pmlmeext->sitesurvey_res.channel_idx); } pmlmeext->scan_abort = false;/* reset */ @@ -7344,7 +7111,6 @@ void link_timer_hdl(struct adapter *padapter) struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { - netdev_dbg(padapter->pnetdev, "no beacon while connecting\n"); pmlmeinfo->state = WIFI_FW_NULL_STATE; report_join_res(padapter, -3); } else if (pmlmeinfo->state & WIFI_FW_AUTH_STATE) { @@ -7355,7 +7121,6 @@ void link_timer_hdl(struct adapter *padapter) return; } - netdev_dbg(padapter->pnetdev, "auth timeout and try again\n"); pmlmeinfo->auth_seq = 1; issue_auth(padapter, NULL, 0); set_link_timer(pmlmeext, REAUTH_TO); @@ -7367,7 +7132,6 @@ void link_timer_hdl(struct adapter *padapter) return; } - netdev_dbg(padapter->pnetdev, "assoc timeout and try again\n"); issue_assocreq(padapter); set_link_timer(pmlmeext, REASSOC_TO); } @@ -7558,8 +7322,6 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) break; } - netdev_dbg(padapter->pnetdev, - "set ch/bw before connected\n"); } } break; @@ -7812,29 +7574,16 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) if (psta) { ctrl = (BIT(15) | ((pparm->algorithm) << 2)); - netdev_dbg(padapter->pnetdev, "enc_algorithm=%d\n", - pparm->algorithm); - if ((psta->mac_id < 1) || (psta->mac_id > (NUM_STA - 4))) { - netdev_dbg(padapter->pnetdev, - "set_stakey failed, mac_id(aid)=%d\n", - psta->mac_id); return H2C_REJECTED; } cam_id = (psta->mac_id + 3);/* 0~3 for default key, cmd_id = macid + 3, macid = aid+1; */ - netdev_dbg(padapter->pnetdev, - "Write CAM, mac_addr =%x:%x:%x:%x:%x:%x, cam_entry=%d\n", - pparm->addr[0], pparm->addr[1], pparm->addr[2], - pparm->addr[3], pparm->addr[4], pparm->addr[5], - cam_id); - write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key); return H2C_SUCCESS_RSP; } else { - netdev_dbg(padapter->pnetdev, "sta has been free\n"); return H2C_REJECTED; } } @@ -7956,7 +7705,6 @@ u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf) u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) { if (send_beacon(padapter) == _FAIL) { - netdev_dbg(padapter->pnetdev, "issue_beacon, fail!\n"); return H2C_PARAMETERS_ERROR; } else { /* tx bc/mc frames after update TIM */ @@ -8015,9 +7763,6 @@ u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf) set_ch_parm = (struct set_ch_parm *)pbuf; - netdev_dbg(padapter->pnetdev, "ch:%u, bw:%u, ch_offset:%u\n", - set_ch_parm->ch, set_ch_parm->bw, set_ch_parm->ch_offset); - pmlmeext->cur_channel = set_ch_parm->ch; pmlmeext->cur_ch_offset = set_ch_parm->ch_offset; pmlmeext->cur_bwmode = set_ch_parm->bw; -- cgit From 34b6d9434e5fe9f89fdfe05ae1159eb97884e509 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:06:58 +0000 Subject: staging: r8188eu: remove DBG_88E calls from core subdir Remove all remaining DBG_88E calls from the core subdirectory. After some thought, it makes more sense to just entirely strip all of these calls, so that debugging code in the driver can be more consistent and useful going forwards. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-5-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_fw.c | 10 ------- drivers/staging/r8188eu/core/rtw_p2p.c | 35 ------------------------ drivers/staging/r8188eu/core/rtw_pwrctrl.c | 30 +++------------------ drivers/staging/r8188eu/core/rtw_recv.c | 36 +++---------------------- drivers/staging/r8188eu/core/rtw_wlan_util.c | 40 +--------------------------- 5 files changed, 8 insertions(+), 143 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188eu/core/rtw_fw.c index ce0e4e3b21f9..6d07927397de 100644 --- a/drivers/staging/r8188eu/core/rtw_fw.c +++ b/drivers/staging/r8188eu/core/rtw_fw.c @@ -191,10 +191,8 @@ static int fw_free_to_go(struct adapter *padapter) } while (counter++ < POLLING_READY_TIMEOUT_COUNT); if (counter >= POLLING_READY_TIMEOUT_COUNT) { - DBG_88E("%s: chksum report fail! REG_MCUFWDL:0x%08x\n", __func__, value32); return _FAIL; } - DBG_88E("%s: Checksum report OK! REG_MCUFWDL:0x%08x\n", __func__, value32); value32 = rtw_read32(padapter, REG_MCUFWDL); value32 |= MCUFWDL_RDY; @@ -208,13 +206,11 @@ static int fw_free_to_go(struct adapter *padapter) do { value32 = rtw_read32(padapter, REG_MCUFWDL); if (value32 & WINTINI_RDY) { - DBG_88E("%s: Polling FW ready success!! REG_MCUFWDL:0x%08x\n", __func__, value32); return _SUCCESS; } udelay(5); } while (counter++ < POLLING_READY_TIMEOUT_COUNT); - DBG_88E("%s: Polling FW ready fail!! REG_MCUFWDL:0x%08x\n", __func__, value32); return _FAIL; } @@ -306,20 +302,14 @@ int rtl8188e_firmware_download(struct adapter *padapter) if (ret == _SUCCESS || (rtw_get_passing_time_ms(fwdl_start_time) > 500 && write_fw_retry++ >= 3)) break; - - DBG_88E("%s write_fw_retry:%u, time after fwdl_start_time:%ums\n", - __func__, write_fw_retry, rtw_get_passing_time_ms(fwdl_start_time) - ); } fw_download_enable(padapter, false); if (ret != _SUCCESS) { - DBG_88E("DL Firmware failed!\n"); goto exit; } ret = fw_free_to_go(padapter); if (ret != _SUCCESS) { - DBG_88E("DL Firmware failed!\n"); goto exit; } diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c index 50b4fca869a7..8f4bad399bc4 100644 --- a/drivers/staging/r8188eu/core/rtw_p2p.c +++ b/drivers/staging/r8188eu/core/rtw_p2p.c @@ -30,8 +30,6 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) struct adapter *padapter = pwdinfo->padapter; struct sta_priv *pstapriv = &padapter->stapriv; - DBG_88E("%s\n", __func__); - pdata_attr = kzalloc(MAX_P2P_IE_LEN, GFP_KERNEL); pstart = pdata_attr; @@ -123,8 +121,6 @@ static void issue_group_disc_req(struct wifidirect_info *pwdinfo, u8 *da) u8 oui_subtype = P2P_GO_DISC_REQUEST; u8 dialogToken = 0; - DBG_88E("[%s]\n", __func__); - pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) return; @@ -182,8 +178,6 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 s u8 p2pie[8] = { 0x00 }; u32 p2pielen = 0; - DBG_88E("[%s]\n", __func__); - pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) return; @@ -329,8 +323,6 @@ static void issue_p2p_presence_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 u8 noa_attr_content[32] = { 0x00 }; u32 p2pielen = 0; - DBG_88E("[%s]\n", __func__); - pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (!pmgntframe) return; @@ -827,16 +819,13 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l p2p_ie = rtw_get_p2p_ie(ies, ies_len, NULL, &p2p_ielen); if (!p2p_ie) { - DBG_88E("[%s] P2P IE not Found!!\n", __func__); status_code = P2P_STATUS_FAIL_INVALID_PARAM; } else { - DBG_88E("[%s] P2P IE Found!!\n", __func__); } while (p2p_ie) { /* Check P2P Capability ATTR */ if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8 *)&le_tmp, (uint *)&attr_contentlen)) { - DBG_88E("[%s] Got P2P Capability Attr!!\n", __func__); cap_attr = le16_to_cpu(le_tmp); psta->dev_cap = cap_attr & 0xff; } @@ -845,7 +834,6 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l /* Check P2P Device Info ATTR */ if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, NULL, (uint *)&attr_contentlen)) { - DBG_88E("[%s] Got P2P DEVICE INFO Attr!!\n", __func__); pattr_content = kzalloc(attr_contentlen, GFP_KERNEL); pbuf = pattr_content; if (pattr_content) { @@ -1004,7 +992,6 @@ u8 process_p2p_provdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint l issue_p2p_provision_resp(pwdinfo, GetAddr2Ptr(pframe), frame_body, uconfig_method); } } - DBG_88E("[%s] config method = %s\n", __func__, pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req); return true; } @@ -1083,7 +1070,6 @@ u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo, u8 *pframe, memcpy(pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "pbc", 3); } } else { - DBG_88E("[%s] WPS IE not Found!!\n", __func__); result = P2P_STATUS_FAIL_INCOMPATIBLE_PARAM; rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL); return result; @@ -1101,7 +1087,6 @@ u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo, u8 *pframe, p2p_ie = rtw_get_p2p_ie(ies, ies_len, NULL, &p2p_ielen); if (!p2p_ie) { - DBG_88E("[%s] P2P IE not Found!!\n", __func__); result = P2P_STATUS_FAIL_INCOMPATIBLE_PARAM; rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL); } @@ -1119,7 +1104,6 @@ u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo, u8 *pframe, rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_ING); if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GO_INTENT, &attr_content, &attr_contentlen)) { - DBG_88E("[%s] GO Intent = %d, tie = %d\n", __func__, attr_content >> 1, attr_content & 0x01); pwdinfo->peer_intent = attr_content; /* include both intent and tie breaker values. */ if (pwdinfo->intent == (pwdinfo->peer_intent >> 1)) { @@ -1157,7 +1141,6 @@ u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo, u8 *pframe, ch_num_inclusioned = rtw_p2p_ch_inclusion(&padapter->mlmeextpriv, peer_ch_list, peer_ch_num, ch_list_inclusioned); if (ch_num_inclusioned == 0) { - DBG_88E("[%s] No common channel in channel list!\n", __func__); result = P2P_STATUS_FAIL_NO_COMMON_CH; rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL); break; @@ -1178,11 +1161,9 @@ u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo, u8 *pframe, * Change our operating channel as peer's for compatibility. */ pwdinfo->operating_channel = peer_operating_ch; - DBG_88E("[%s] Change op ch to %02x as peer's\n", __func__, pwdinfo->operating_channel); } else { /* Take first channel of ch_list_inclusioned as operating channel */ pwdinfo->operating_channel = ch_list_inclusioned[0]; - DBG_88E("[%s] Change op ch to %02x\n", __func__, pwdinfo->operating_channel); } } } @@ -1210,7 +1191,6 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe if (rtw_get_wps_ie(ies, ies_len, NULL, &wps_ielen)) { } else { - DBG_88E("[%s] WPS IE not Found!!\n", __func__); result = P2P_STATUS_FAIL_INCOMPATIBLE_PARAM; rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL); } @@ -1233,7 +1213,6 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe while (p2p_ie) { /* Found the P2P IE. */ rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_STATUS, &attr_content, &attr_contentlen); if (attr_contentlen == 1) { - DBG_88E("[%s] Status = %d\n", __func__, attr_content); if (attr_content == P2P_STATUS_SUCCESS) { /* Do nothing. */ } else { @@ -1259,7 +1238,6 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe attr_content = 0x00; attr_contentlen = 0; if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GO_INTENT, &attr_content, &attr_contentlen)) { - DBG_88E("[%s] GO Intent = %d, tie = %d\n", __func__, attr_content >> 1, attr_content & 0x01); pwdinfo->peer_intent = attr_content; /* include both intent and tie breaker values. */ if (pwdinfo->intent == (pwdinfo->peer_intent >> 1)) { @@ -1297,19 +1275,16 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe attr_contentlen = 0; if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen)) { - DBG_88E("[%s] Peer's operating channel = %d\n", __func__, operatingch_info[4]); pwdinfo->peer_operating_ch = operatingch_info[4]; } /* Try to get the channel list information */ if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CH_LIST, pwdinfo->channel_list_attr, &pwdinfo->channel_list_attr_len)) { - DBG_88E("[%s] channel list attribute found, len = %d\n", __func__, pwdinfo->channel_list_attr_len); peer_ch_num = rtw_p2p_get_peer_ch_list(pwdinfo, pwdinfo->channel_list_attr, pwdinfo->channel_list_attr_len, peer_ch_list); ch_num_inclusioned = rtw_p2p_ch_inclusion(&padapter->mlmeextpriv, peer_ch_list, peer_ch_num, ch_list_inclusioned); if (ch_num_inclusioned == 0) { - DBG_88E("[%s] No common channel in channel list!\n", __func__); result = P2P_STATUS_FAIL_NO_COMMON_CH; rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL); break; @@ -1330,16 +1305,13 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe * Change our operating channel as peer's for compatibility. */ pwdinfo->operating_channel = peer_operating_ch; - DBG_88E("[%s] Change op ch to %02x as peer's\n", __func__, pwdinfo->operating_channel); } else { /* Take first channel of ch_list_inclusioned as operating channel */ pwdinfo->operating_channel = ch_list_inclusioned[0]; - DBG_88E("[%s] Change op ch to %02x\n", __func__, pwdinfo->operating_channel); } } } } else { - DBG_88E("[%s] channel list attribute not found!\n", __func__); } /* Try to get the group id information if peer is GO */ @@ -1376,7 +1348,6 @@ u8 process_p2p_group_negotation_confirm(struct wifidirect_info *pwdinfo, u8 *pfr pwdinfo->negotiation_dialog_token = 1; rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_STATUS, &attr_content, &attr_contentlen); if (attr_contentlen == 1) { - DBG_88E("[%s] Status = %d\n", __func__, attr_content); result = attr_content; if (attr_content == P2P_STATUS_SUCCESS) { @@ -1408,14 +1379,12 @@ u8 process_p2p_group_negotation_confirm(struct wifidirect_info *pwdinfo, u8 *pfr attr_contentlen = 0; memset(groupid, 0x00, 38); if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, groupid, &attr_contentlen)) { - DBG_88E("[%s] Ssid = %s, ssidlen = %zu\n", __func__, &groupid[ETH_ALEN], strlen(&groupid[ETH_ALEN])); memcpy(pwdinfo->groupid_info.go_device_addr, &groupid[0], ETH_ALEN); memcpy(pwdinfo->groupid_info.ssid, &groupid[6], attr_contentlen - ETH_ALEN); } attr_contentlen = 0; if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen)) { - DBG_88E("[%s] Peer's operating channel = %d\n", __func__, operatingch_info[4]); pwdinfo->peer_operating_ch = operatingch_info[4]; } @@ -1653,7 +1622,6 @@ void p2p_ps_wk_hdl(struct adapter *padapter, u8 p2p_ps_state) if (pwdinfo->ctwindow > 0) { if (pwrpriv->smart_ps != 0) { pwrpriv->smart_ps = 0; - DBG_88E("%s(): Enter CTW, change SmartPS\n", __func__); SetHwReg8188EU(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&padapter->pwrctrlpriv.pwr_mode)); } } @@ -1723,7 +1691,6 @@ static void reset_ch_sitesurvey_timer_process(struct timer_list *t) if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; - DBG_88E("[%s] In\n", __func__); /* Reset the operation channel information */ pwdinfo->rx_invitereq_info.operation_ch[0] = 0; pwdinfo->rx_invitereq_info.scan_op_ch_only = 0; @@ -1737,7 +1704,6 @@ static void reset_ch_sitesurvey_timer_process2(struct timer_list *t) if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; - DBG_88E("[%s] In\n", __func__); /* Reset the operation channel information */ pwdinfo->p2p_info.operation_ch[0] = 0; pwdinfo->p2p_info.scan_op_ch_only = 0; @@ -1778,7 +1744,6 @@ static void pre_tx_scan_timer_process(struct timer_list *t) if (pwdinfo->invitereq_info.benable) p2p_protocol_wk_cmd(adapter, P2P_PRE_TX_INVITEREQ_PROCESS_WK); } else { - DBG_88E("[%s] p2p_state is %d, ignore!!\n", __func__, rtw_p2p_state(pwdinfo)); } spin_unlock_bh(&pmlmepriv->lock); diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c index ff35685eaa12..db7074bf5741 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -26,7 +26,6 @@ void ips_enter(struct adapter *padapter) pwrpriv->ips_mode = pwrpriv->ips_mode_req; pwrpriv->ips_enter_cnts++; - DBG_88E("==>ips_enter cnts:%d\n", pwrpriv->ips_enter_cnts); if (rf_off == pwrpriv->change_rfpwrstate) { pwrpriv->bpower_saving = true; @@ -55,7 +54,6 @@ int ips_leave(struct adapter *padapter) pwrpriv->bips_processing = true; pwrpriv->change_rfpwrstate = rf_on; pwrpriv->ips_leave_cnts++; - DBG_88E("==>ips_leave cnts:%d\n", pwrpriv->ips_leave_cnts); result = rtw_ips_pwr_up(padapter); if (result == _SUCCESS) { @@ -63,7 +61,6 @@ int ips_leave(struct adapter *padapter) } if ((_WEP40_ == psecuritypriv->dot11PrivacyAlgrthm) || (_WEP104_ == psecuritypriv->dot11PrivacyAlgrthm)) { - DBG_88E("==>%s, channel(%d), processing(%x)\n", __func__, padapter->mlmeextpriv.cur_channel, pwrpriv->bips_processing); set_channel_bwmode(padapter, padapter->mlmeextpriv.cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); for (keyid = 0; keyid < 4; keyid++) { if (pmlmepriv->key_mask & BIT(keyid)) { @@ -75,7 +72,6 @@ int ips_leave(struct adapter *padapter) } } - DBG_88E("==> ips_leave.....LED(0x%08x)...\n", rtw_read32(padapter, 0x4c)); pwrpriv->bips_processing = false; pwrpriv->bkeepfwalive = false; @@ -126,7 +122,6 @@ exit: void rtw_ps_processor(struct adapter *padapter) { struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; pwrpriv->ps_processing = true; @@ -140,7 +135,6 @@ void rtw_ps_processor(struct adapter *padapter) goto exit; if ((pwrpriv->rf_pwrstate == rf_on) && ((pwrpriv->pwr_state_check_cnts % 4) == 0)) { - DBG_88E("==>%s .fw_state(%x)\n", __func__, get_fwstate(pmlmepriv)); pwrpriv->change_rfpwrstate = rf_off; ips_enter(padapter); @@ -179,7 +173,6 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) if (pwrpriv->bInSuspend) return false; if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && !padapter->securitypriv.binstallGrpkey) { - DBG_88E("Group handshake still in progress !!!\n"); return false; } return true; @@ -205,14 +198,12 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a /* if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) */ if (ps_mode == PS_MODE_ACTIVE) { if (pwdinfo->opp_ps == 0) { - DBG_88E("rtw_set_ps_mode: Leave 802.11 power save\n"); pwrpriv->pwr_mode = ps_mode; SetHwReg8188EU(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode)); pwrpriv->bFwCurrentInPSMode = false; } } else { if (PS_RDY_CHECK(padapter)) { - DBG_88E("%s: Enter 802.11 power save\n", __func__); pwrpriv->bFwCurrentInPSMode = true; pwrpriv->pwr_mode = ps_mode; pwrpriv->smart_ps = smart_ps; @@ -247,13 +238,11 @@ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms) if (padapter->bSurpriseRemoved) { err = -2; - DBG_88E("%s: device surprise removed!!\n", __func__); break; } if (rtw_get_passing_time_ms(start_time) > delay_ms) { err = -1; - DBG_88E("%s: Wait for FW LPS leave more than %u ms!!!\n", __func__, delay_ms); break; } rtw_usleep_os(100); @@ -278,7 +267,6 @@ void LPS_Enter(struct adapter *padapter) if (pwrpriv->LpsIdleCount >= 2) { /* 4 Sec */ if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) { pwrpriv->bpower_saving = true; - DBG_88E("%s smart_ps:%d\n", __func__, pwrpriv->smart_ps); /* For Tenda W311R IOT issue */ rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, pwrpriv->smart_ps, 0x40); @@ -377,13 +365,12 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal pwrpriv->ips_deny_time = jiffies + rtw_ms_to_systime(ips_deffer_ms); if (pwrpriv->ps_processing) { - DBG_88E("%s wait ps_processing...\n", __func__); while (pwrpriv->ps_processing && rtw_get_passing_time_ms(start) <= 3000) msleep(10); if (pwrpriv->ps_processing) - DBG_88E("%s wait ps_processing timeout\n", __func__); + ; else - DBG_88E("%s wait ps_processing done\n", __func__); + ; } /* System suspend is not allowed to wakeup */ @@ -393,9 +380,9 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal (rtw_get_passing_time_ms(start) <= 500))) msleep(10); if (pwrpriv->bInSuspend) - DBG_88E("%s wait bInSuspend timeout\n", __func__); + ; else - DBG_88E("%s wait bInSuspend done\n", __func__); + ; } /* I think this should be check in IPS, LPS, autosuspend functions... */ @@ -404,9 +391,7 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal goto exit; } if (rf_off == pwrpriv->rf_pwrstate) { - DBG_88E("%s call ips_leave....\n", __func__); if (_FAIL == ips_leave(padapter)) { - DBG_88E("======> ips_leave fail.............\n"); ret = _FAIL; goto exit; } @@ -415,11 +400,6 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal /* TODO: the following checking need to be merged... */ if (padapter->bDriverStopped || !padapter->bup || !padapter->hw_init_completed) { - DBG_88E("%s: bDriverStopped=%d, bup=%d, hw_init_completed =%u\n" - , caller - , padapter->bDriverStopped - , padapter->bup - , padapter->hw_init_completed); ret = false; goto exit; } @@ -457,11 +437,9 @@ int rtw_pm_set_ips(struct adapter *padapter, u8 mode) if (mode == IPS_NORMAL || mode == IPS_LEVEL_2) { rtw_ips_mode_req(pwrctrlpriv, mode); - DBG_88E("%s %s\n", __func__, mode == IPS_NORMAL ? "IPS_NORMAL" : "IPS_LEVEL_2"); return 0; } else if (mode == IPS_NONE) { rtw_ips_mode_req(pwrctrlpriv, mode); - DBG_88E("%s %s\n", __func__, "IPS_NONE"); if ((padapter->bSurpriseRemoved == 0) && (_FAIL == rtw_pwr_wakeup(padapter))) return -EFAULT; } else { diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index acc0dd87b62e..0f8f757de02a 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -240,7 +240,6 @@ u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter) struct recv_frame *pending_frame; while ((pending_frame = rtw_alloc_recvframe(&adapter->recvpriv.uc_swdec_pending_queue))) { rtw_free_recvframe(pending_frame, &adapter->recvpriv.free_recv_queue); - DBG_88E("%s: dequeue uc_swdec_pending_queue\n", __func__); cnt++; } @@ -272,7 +271,6 @@ static int recvframe_chkmic(struct adapter *adapter, struct recv_frame *precvfr if (!psecuritypriv) { res = _FAIL; - DBG_88E("\n recvframe_chkmic:didn't install group key!!!!!!!!!!\n"); goto exit; } } else { @@ -303,9 +301,7 @@ static int recvframe_chkmic(struct adapter *adapter, struct recv_frame *precvfr if ((prxattrib->bdecrypted) && (brpt_micerror)) { rtw_handle_tkip_mic_err(adapter, (u8)is_multicast_ether_addr(prxattrib->ra)); - DBG_88E(" mic error :prxattrib->bdecrypted=%d\n", prxattrib->bdecrypted); } else { - DBG_88E(" mic error :prxattrib->bdecrypted=%d\n", prxattrib->bdecrypted); } res = _FAIL; } else { @@ -336,8 +332,6 @@ static struct recv_frame *decryptor(struct adapter *padapter, struct recv_frame prxattrib->key_index = (((iv[3]) >> 6) & 0x3); if (prxattrib->key_index > WEP_KEYS) { - DBG_88E("prxattrib->key_index(%d)>WEP_KEYS\n", prxattrib->key_index); - switch (prxattrib->encrypt) { case _WEP40_: case _WEP104_: @@ -686,7 +680,6 @@ static int ap2sta_data_frame( !memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || (memcmp(pattrib->bssid, mybssid, ETH_ALEN))) { if (!bmcast) { - DBG_88E("issue_deauth to the nonassociated ap=%pM for the reason(7)\n", (pattrib->bssid)); issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); } @@ -737,8 +730,6 @@ static int ap2sta_data_frame( if (!memcmp(myhwaddr, pattrib->dst, ETH_ALEN) && (!bmcast)) { *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */ if (!*psta) { - DBG_88E("issue_deauth to the ap =%pM for the reason(7)\n", (pattrib->bssid)); - issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); } } @@ -771,8 +762,6 @@ static int sta2ap_data_frame(struct adapter *adapter, *psta = rtw_get_stainfo(pstapriv, pattrib->src); if (!*psta) { - DBG_88E("issue_deauth to sta=%pM for the reason(7)\n", (pattrib->src)); - issue_deauth(adapter, pattrib->src, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); ret = RTW_RX_HANDLED; @@ -797,7 +786,6 @@ static int sta2ap_data_frame(struct adapter *adapter, ret = RTW_RX_HANDLED; goto exit; } - DBG_88E("issue_deauth to sta=%pM for the reason(7)\n", (pattrib->src)); issue_deauth(adapter, pattrib->src, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); ret = RTW_RX_HANDLED; goto exit; @@ -862,7 +850,6 @@ static int validate_recv_ctrl_frame(struct adapter *padapter, return _FAIL; if (psta->state & WIFI_STA_ALIVE_CHK_STATE) { - DBG_88E("%s alive check-rx ps-poll\n", __func__); psta->expire_to = pstapriv->expire_to; psta->state ^= WIFI_STA_ALIVE_CHK_STATE; } @@ -903,12 +890,9 @@ static int validate_recv_ctrl_frame(struct adapter *padapter, } else { if (pstapriv->tim_bitmap & BIT(psta->aid)) { if (psta->sleepq_len == 0) { - DBG_88E("no buffered packets to xmit\n"); - /* issue nulldata with More data bit = 0 to indicate we have no buffered packets */ issue_nulldata(padapter, psta->hwaddr, 0, 0, 0); } else { - DBG_88E("error!psta->sleepq_len=%d\n", psta->sleepq_len); psta->sleepq_len = 0; } @@ -1115,31 +1099,21 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv GetHalDefVar8188EUsb(adapter, HAL_DEF_DBG_DUMP_RXPKT, &bDumpRxPkt); if (bDumpRxPkt == 1) {/* dump all rx packets */ int i; - DBG_88E("#############################\n"); for (i = 0; i < 64; i = i + 8) - DBG_88E("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr + i), - *(ptr + i + 1), *(ptr + i + 2), *(ptr + i + 3), *(ptr + i + 4), *(ptr + i + 5), *(ptr + i + 6), *(ptr + i + 7)); - DBG_88E("#############################\n"); + ; } else if (bDumpRxPkt == 2) { if (type == WIFI_MGT_TYPE) { int i; - DBG_88E("#############################\n"); for (i = 0; i < 64; i = i + 8) - DBG_88E("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr + i), - *(ptr + i + 1), *(ptr + i + 2), *(ptr + i + 3), *(ptr + i + 4), *(ptr + i + 5), *(ptr + i + 6), *(ptr + i + 7)); - DBG_88E("#############################\n"); + ; } } else if (bDumpRxPkt == 3) { if (type == WIFI_DATA_TYPE) { int i; - DBG_88E("#############################\n"); - for (i = 0; i < 64; i = i + 8) - DBG_88E("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr + i), - *(ptr + i + 1), *(ptr + i + 2), *(ptr + i + 3), *(ptr + i + 4), *(ptr + i + 5), *(ptr + i + 6), *(ptr + i + 7)); - DBG_88E("#############################\n"); + ; } } switch (type) { @@ -1446,7 +1420,6 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) nSubframe_Length = RTW_GET_BE16(pdata + 12); if (a_len < ETH_HLEN + nSubframe_Length) { - DBG_88E("nRemain_Length is %d and nSubframe_Length is : %d\n", a_len, nSubframe_Length); goto exit; } @@ -1467,7 +1440,6 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) sub_skb->len = nSubframe_Length; skb_set_tail_pointer(sub_skb, nSubframe_Length); } else { - DBG_88E("skb_clone() Fail!!! , nr_subframes=%d\n", nr_subframes); break; } } @@ -1475,7 +1447,6 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) subframes[nr_subframes++] = sub_skb; if (nr_subframes >= MAX_SUBFRAME_COUNT) { - DBG_88E("ParseSubframe(): Too many Subframes! Packets dropped!\n"); break; } @@ -1871,7 +1842,6 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe) psecuritypriv->ndisauthtype == Ndis802_11AuthModeWPAPSK && !psecuritypriv->busetkipkey) { rtw_enqueue_recvframe(rframe, &padapter->recvpriv.uc_swdec_pending_queue); - DBG_88E("%s: no key, enqueue uc_swdec_pending_queue\n", __func__); if (recvpriv->free_recvframe_cnt < NR_RECVFRAME / 4) { /* to prevent from recvframe starvation, * get recvframe from uc_swdec_pending_queue to diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index c6288c2d5f33..abc2386dc8d9 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -335,7 +335,7 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne u8 center_ch; if (padapter->bNotifyChannelChange) - DBG_88E("[%s] ch = %d, offset = %d, bwmode = %d\n", __func__, channel, channel_offset, bwmode); + ; if ((bwmode == HT_CHANNEL_WIDTH_20) || (channel_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)) { @@ -572,8 +572,6 @@ void WMMOnAssocRsp(struct adapter *padapter) edca[XMIT_VO_QUEUE] = acParm; break; } - - DBG_88E("WMM(%x): %x, %x\n", ACI, ACM, acParm); } if (padapter->registrypriv.acm_method == 1) @@ -610,7 +608,6 @@ void WMMOnAssocRsp(struct adapter *padapter) for (i = 0; i < 4; i++) { pxmitpriv->wmm_para_seq[i] = inx[i]; - DBG_88E("wmm_para_seq(%d): %d\n", i, pxmitpriv->wmm_para_seq[i]); } } @@ -758,8 +755,6 @@ void HTOnAssocRsp(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - DBG_88E("%s\n", __func__); - if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable)) { pmlmeinfo->HT_enable = 1; } else { @@ -858,13 +853,10 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) len = packet_len - sizeof(struct rtw_ieee80211_hdr_3addr); if (len > MAX_IE_SZ) { - DBG_88E("%s IE too long for survey event\n", __func__); return _FAIL; } if (memcmp(cur_network->network.MacAddress, pbssid, 6)) { - DBG_88E("Oops: rtw_check_network_encrypt linked but recv other bssid bcn\n%pM %pM\n", - (pbssid), (cur_network->network.MacAddress)); return true; } @@ -902,11 +894,6 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) } if (ht_cap_info != cur_network->BcnInfo.ht_cap_info || ((ht_info_infos_0 & 0x03) != (cur_network->BcnInfo.ht_info_infos_0 & 0x03))) { - DBG_88E("%s bcn now: ht_cap_info:%x ht_info_infos_0:%x\n", __func__, - ht_cap_info, ht_info_infos_0); - DBG_88E("%s bcn link: ht_cap_info:%x ht_info_infos_0:%x\n", __func__, - cur_network->BcnInfo.ht_cap_info, cur_network->BcnInfo.ht_info_infos_0); - DBG_88E("%s bw mode change, disconnect\n", __func__); /* bcn_info_update */ cur_network->BcnInfo.ht_cap_info = ht_cap_info; cur_network->BcnInfo.ht_info_infos_0 = ht_info_infos_0; @@ -923,20 +910,16 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) if (pht_info) { bcn_channel = pht_info->primary_channel; } else { /* we don't find channel IE, so don't check it */ - DBG_88E("Oops: %s we don't find channel IE, so don't check it\n", __func__); bcn_channel = Adapter->mlmeextpriv.cur_channel; } } if (bcn_channel != Adapter->mlmeextpriv.cur_channel) { - DBG_88E("%s beacon channel:%d cur channel:%d disconnect\n", __func__, - bcn_channel, Adapter->mlmeextpriv.cur_channel); goto _mismatch; } /* checking SSID */ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); if (!p) { - DBG_88E("%s marc: cannot find SSID for survey event\n", __func__); hidden_ssid = true; } else { hidden_ssid = false; @@ -953,7 +936,6 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) if (memcmp(bssid->Ssid.Ssid, cur_network->network.Ssid.Ssid, 32) || bssid->Ssid.SsidLength != cur_network->network.Ssid.SsidLength) { if (bssid->Ssid.Ssid[0] != '\0' && bssid->Ssid.SsidLength != 0) { /* not hidden ssid */ - DBG_88E("%s(), SSID is not match return FAIL\n", __func__); goto _mismatch; } } @@ -967,7 +949,6 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) bssid->Privacy = 0; if (cur_network->network.Privacy != bssid->Privacy) { - DBG_88E("%s(), privacy is not match return FAIL\n", __func__); goto _mismatch; } @@ -983,7 +964,6 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) } if (cur_network->BcnInfo.encryp_protocol != encryp_protocol) { - DBG_88E("%s(): enctyp is not match , return FAIL\n", __func__); goto _mismatch; } @@ -999,14 +979,10 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) } if (pairwise_cipher != cur_network->BcnInfo.pairwise_cipher || group_cipher != cur_network->BcnInfo.group_cipher) { - DBG_88E("%s pairwise_cipher(%x:%x) or group_cipher(%x:%x) is not match , return FAIL\n", __func__, - pairwise_cipher, cur_network->BcnInfo.pairwise_cipher, - group_cipher, cur_network->BcnInfo.group_cipher); goto _mismatch; } if (is_8021x != cur_network->BcnInfo.is_8021x) { - DBG_88E("%s authentication is not match , return FAIL\n", __func__); goto _mismatch; } } @@ -1257,38 +1233,29 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) case _VENDOR_SPECIFIC_IE_: if ((!memcmp(pIE->data, ARTHEROS_OUI1, 3)) || (!memcmp(pIE->data, ARTHEROS_OUI2, 3))) { - DBG_88E("link to Artheros AP\n"); return HT_IOT_PEER_ATHEROS; } else if ((!memcmp(pIE->data, BROADCOM_OUI1, 3)) || (!memcmp(pIE->data, BROADCOM_OUI2, 3))) { - DBG_88E("link to Broadcom AP\n"); return HT_IOT_PEER_BROADCOM; } else if (!memcmp(pIE->data, MARVELL_OUI, 3)) { - DBG_88E("link to Marvell AP\n"); return HT_IOT_PEER_MARVELL; } else if (!memcmp(pIE->data, RALINK_OUI, 3)) { if (!ralink_vendor_flag) { ralink_vendor_flag = 1; } else { - DBG_88E("link to Ralink AP\n"); return HT_IOT_PEER_RALINK; } } else if (!memcmp(pIE->data, CISCO_OUI, 3)) { - DBG_88E("link to Cisco AP\n"); return HT_IOT_PEER_CISCO; } else if (!memcmp(pIE->data, REALTEK_OUI, 3)) { - DBG_88E("link to Realtek 96B\n"); return HT_IOT_PEER_REALTEK; } else if (!memcmp(pIE->data, AIRGOCAP_OUI, 3)) { - DBG_88E("link to Airgo Cap\n"); return HT_IOT_PEER_AIRGO; } else if (!memcmp(pIE->data, EPIGRAM_OUI, 3)) { epigram_vendor_flag = 1; if (ralink_vendor_flag) { - DBG_88E("link to Tenda W311R AP\n"); return HT_IOT_PEER_TENDA; } else { - DBG_88E("Capture EPIGRAM_OUI\n"); } } else { break; @@ -1302,13 +1269,10 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) } if (ralink_vendor_flag && !epigram_vendor_flag) { - DBG_88E("link to Ralink AP\n"); return HT_IOT_PEER_RALINK; } else if (ralink_vendor_flag && epigram_vendor_flag) { - DBG_88E("link to Tenda W311R AP\n"); return HT_IOT_PEER_TENDA; } else { - DBG_88E("link to new AP\n"); return HT_IOT_PEER_UNKNOWN; } } @@ -1518,13 +1482,11 @@ int rtw_handle_dualmac(struct adapter *adapter, bool init) if (init) { if (!pbuddy_padapter) { pbuddy_padapter = adapter; - DBG_88E("%s(): pbuddy_padapter == NULL, Set pbuddy_padapter\n", __func__); } else { adapter->pbuddy_adapter = pbuddy_padapter; pbuddy_padapter->pbuddy_adapter = adapter; /* clear global value */ pbuddy_padapter = NULL; - DBG_88E("%s(): pbuddy_padapter exist, Exchange Information\n", __func__); } } else { pbuddy_padapter = NULL; -- cgit From db67ebf6b49cd6909f210ee44eb51d3cf2e39ae4 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:06:59 +0000 Subject: staging: r8188eu: remove DBG_88E calls from hal subdir Remove all remaining DBG_88E calls from the hal subdirectory. After some thought, it makes more sense to just entirely strip all of these calls, so that debugging code in the driver can be more consistent and useful going forwards. Reported-by: kernel test robot Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-6-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/HalPwrSeqCmd.c | 1 - drivers/staging/r8188eu/hal/hal_intf.c | 3 +- drivers/staging/r8188eu/hal/rtl8188e_cmd.c | 26 ++------------- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 40 +---------------------- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 2 +- drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 4 +-- drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 5 +-- drivers/staging/r8188eu/hal/usb_halinit.c | 42 +------------------------ drivers/staging/r8188eu/hal/usb_ops_linux.c | 17 ---------- 9 files changed, 9 insertions(+), 131 deletions(-) diff --git a/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c b/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c index 47ad4ea273cc..eb22ac17c586 100644 --- a/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c +++ b/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c @@ -64,7 +64,6 @@ u8 HalPwrSeqCmdParsing(struct adapter *padapter, struct wl_pwr_cfg pwrseqcmd[]) udelay(10); if (poll_count++ > max_poll_count) { - DBG_88E("Fail to polling Offset[%#x]\n", offset); return false; } } while (!poll_bit); diff --git a/drivers/staging/r8188eu/hal/hal_intf.c b/drivers/staging/r8188eu/hal/hal_intf.c index fee3a598b59d..008098040a07 100644 --- a/drivers/staging/r8188eu/hal/hal_intf.c +++ b/drivers/staging/r8188eu/hal/hal_intf.c @@ -21,7 +21,6 @@ uint rtw_hal_init(struct adapter *adapt) hal_notch_filter_8188e(adapt, 1); } else { adapt->hw_init_completed = false; - DBG_88E("rtw_hal_init: hal__init fail\n"); } return status; @@ -36,7 +35,7 @@ uint rtw_hal_deinit(struct adapter *adapt) if (status == _SUCCESS) adapt->hw_init_completed = false; else - DBG_88E("\n rtw_hal_deinit: hal_init fail\n"); + ; return status; } diff --git a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c index a491c37777df..93dfd3dee59b 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c @@ -55,7 +55,6 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 *p u32 h2c_cmd_ex = 0; if (!adapt->bFWReady) { - DBG_88E("FillH2CCmd_88E(): return H2C cmd because fw is not ready\n"); return _FAIL; } @@ -67,7 +66,6 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 *p h2c_box_num = haldata->LastHMEBoxNum; if (!_is_fw_read_cmd_down(adapt, h2c_box_num)) { - DBG_88E(" fw read cmd failed...\n"); return _FAIL; } @@ -115,7 +113,6 @@ u8 rtl8188e_set_raid_cmd(struct adapter *adapt, u32 mask) FillH2CCmd_88E(adapt, H2C_DM_MACID_CFG, 3, buf); } else { - DBG_88E("==>%s fw dont support RA\n", __func__); res = _FAIL; } @@ -157,9 +154,6 @@ void rtl8188e_set_FwPwrMode_cmd(struct adapter *adapt, u8 Mode) struct pwrctrl_priv *pwrpriv = &adapt->pwrctrlpriv; u8 RLBM = 0; /* 0:Min, 1:Max, 2:User define */ - DBG_88E("%s: Mode=%d SmartPS=%d UAPSD=%d\n", __func__, - Mode, pwrpriv->smart_ps, adapt->registrypriv.uapsd_enable); - switch (Mode) { case PS_MODE_ACTIVE: H2CSetPwrMode.Mode = 0; @@ -200,12 +194,8 @@ void rtl8188e_set_FwPwrMode_cmd(struct adapter *adapt, u8 Mode) void rtl8188e_set_FwMediaStatus_cmd(struct adapter *adapt, __le16 mstatus_rpt) { - u8 opmode, macid; u16 mst_rpt = le16_to_cpu(mstatus_rpt); - opmode = (u8)mst_rpt; - macid = (u8)(mst_rpt >> 8); - DBG_88E("### %s: MStatus=%x MACID=%d\n", __func__, opmode, macid); FillH2CCmd_88E(adapt, H2C_COM_MEDIA_STATUS_RPT, sizeof(mst_rpt), (u8 *)&mst_rpt); } @@ -286,7 +276,6 @@ static void ConstructBeacon(struct adapter *adapt, u8 *pframe, u32 *pLength) _ConstructBeacon: if ((pktlen + TXDESC_SIZE) > 512) { - DBG_88E("beacon frame too large\n"); return; } @@ -453,10 +442,8 @@ static void SetFwRsvdPagePkt(struct adapter *adapt, bool bDLFinished) u32 TotalPacketLen; struct rsvdpage_loc RsvdPageLoc; - DBG_88E("%s\n", __func__); ReservedPagePacket = kzalloc(1000, GFP_KERNEL); if (!ReservedPagePacket) { - DBG_88E("%s: alloc ReservedPagePacket fail!\n", __func__); return; } @@ -535,7 +522,6 @@ static void SetFwRsvdPagePkt(struct adapter *adapt, bool bDLFinished) rtl8188eu_mgnt_xmit(adapt, pmgntframe); - DBG_88E("%s: Set RSVD page location to Fw\n", __func__); FillH2CCmd_88E(adapt, H2C_COM_RSVD_PAGE, sizeof(RsvdPageLoc), (u8 *)&RsvdPageLoc); exit: @@ -552,8 +538,6 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *adapt, u8 mstatus) u8 DLBcnCount = 0; u32 poll = 0; - DBG_88E("%s mstatus(%x)\n", __func__, mstatus); - if (mstatus == 1) { /* We should set AID, correct TSF, HW seq enable before set JoinBssReport to Fw in 88/92C. */ /* Suggested by filen. Added by tynli. */ @@ -571,7 +555,6 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *adapt, u8 mstatus) rtw_write8(adapt, REG_BCN_CTRL, rtw_read8(adapt, REG_BCN_CTRL) | BIT(4)); if (haldata->RegFwHwTxQCtrl & BIT(6)) { - DBG_88E("HalDownloadRSVDPage(): There is an Adapter is sending beacon.\n"); bSendBeacon = true; } @@ -599,9 +582,9 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *adapt, u8 mstatus) if (adapt->bSurpriseRemoved || adapt->bDriverStopped) ; else if (!bcn_valid) - DBG_88E("%s: 1 Download RSVD page failed! DLBcnCount:%u, poll:%u\n", __func__, DLBcnCount, poll); + ; else - DBG_88E("%s: 1 Download RSVD success! DLBcnCount:%u, poll:%u\n", __func__, DLBcnCount, poll); + ; /* */ /* We just can send the reserved page twice during the time that Tx thread is stopped (e.g. pnpsetpower) */ /* because we need to free the Tx BCN Desc which is used by the first reserved page packet. */ @@ -626,7 +609,6 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *adapt, u8 mstatus) /* Update RSVD page location H2C to Fw. */ if (bcn_valid) { SetHwReg8188EU(adapt, HW_VAR_BCN_VALID, NULL); - DBG_88E("Set RSVD page location to Fw.\n"); } /* Do not enable HW DMA BCN or it will cause Pcie interface hang by timing issue. 2011.11.24. by tynli. */ @@ -646,11 +628,9 @@ void rtl8188e_set_p2p_ps_offload_cmd(struct adapter *adapt, u8 p2p_ps_state) switch (p2p_ps_state) { case P2P_PS_DISABLE: - DBG_88E("P2P_PS_DISABLE\n"); memset(p2p_ps_offload, 0, 1); break; case P2P_PS_ENABLE: - DBG_88E("P2P_PS_ENABLE\n"); /* update CTWindow value. */ if (pwdinfo->ctwindow > 0) { p2p_ps_offload->CTWindow_En = 1; @@ -690,11 +670,9 @@ void rtl8188e_set_p2p_ps_offload_cmd(struct adapter *adapt, u8 p2p_ps_state) } break; case P2P_PS_SCAN: - DBG_88E("P2P_PS_SCAN\n"); p2p_ps_offload->discovery = 1; break; case P2P_PS_SCAN_DONE: - DBG_88E("P2P_PS_SCAN_DONE\n"); p2p_ps_offload->discovery = 0; pwdinfo->p2p_ps_state = P2P_PS_ENABLE; break; diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index 8fe74e21992e..f83ae7a7e5d9 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -20,7 +20,6 @@ static void iol_mode_enable(struct adapter *padapter, u8 enable) rtw_write8(padapter, REG_SYS_CFG, reg_0xf0 | SW_OFFLOAD_EN); if (!padapter->bFWReady) { - DBG_88E("bFWReady == false call reset 8051...\n"); rtw_reset_8051(padapter); } @@ -78,13 +77,11 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) efuseTbl = kzalloc(EFUSE_MAP_LEN_88E, GFP_KERNEL); if (!efuseTbl) { - DBG_88E("%s: alloc efuseTbl fail!\n", __func__); goto exit; } eFuseWord = rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); if (!eFuseWord) { - DBG_88E("%s: alloc eFuseWord fail!\n", __func__); goto exit; } @@ -102,7 +99,6 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) efuse_utilized++; eFuse_Addr++; } else { - DBG_88E("EFUSE is empty efuse_Addr-%d efuse_data =%x\n", eFuse_Addr, rtemp8); goto exit; } @@ -207,8 +203,6 @@ static void efuse_read_phymap_from_txpktbuf( if (bcnhead < 0) /* if not valid */ bcnhead = rtw_read8(adapter, REG_TDECTRL + 1); - DBG_88E("%s bcnhead:%d\n", __func__, bcnhead); - rtw_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT); dbg_addr = bcnhead * 128 / 8; /* 8-bytes addressing */ @@ -220,7 +214,6 @@ static void efuse_read_phymap_from_txpktbuf( start = jiffies; while (!(reg_0x143 = rtw_read8(adapter, REG_TXPKTBUF_DBG)) && (passing_time = rtw_get_passing_time_ms(start)) < 1000) { - DBG_88E("%s polling reg_0x143:0x%02x, reg_0x106:0x%02x\n", __func__, reg_0x143, rtw_read8(adapter, 0x106)); rtw_usleep_os(100); } @@ -233,14 +226,12 @@ static void efuse_read_phymap_from_txpktbuf( * do not remove it as the rtw_read16() call consumes * 2 bytes from the EEPROM source. */ - u16 lenc = rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L); + rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L); len = le32_to_cpu(lo32) & 0x0000ffff; limit = (len - 2 < limit) ? len - 2 : limit; - DBG_88E("%s len:%u, lenc:%u\n", __func__, len, lenc); - memcpy(pos, ((u8 *)&lo32) + 2, (limit >= count + 2) ? 2 : limit - count); count += (limit >= count + 2) ? 2 : limit - count; pos = content + count; @@ -261,7 +252,6 @@ static void efuse_read_phymap_from_txpktbuf( i++; } rtw_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, DISABLE_TRXPKT_BUF_ACCESS); - DBG_88E("%s read count:%u\n", __func__, count); *size = count; } @@ -285,7 +275,6 @@ s32 rtl8188e_iol_efuse_patch(struct adapter *padapter) { s32 result = _SUCCESS; - DBG_88E("==> %s\n", __func__); if (rtw_IOL_applied(padapter)) { iol_mode_enable(padapter, 1); result = iol_execute(padapter, CMD_READ_EFUSE_MAP); @@ -385,19 +374,16 @@ static void Hal_EfuseReadEFuse88E(struct adapter *Adapter, /* Do NOT excess total size of EFuse table. Added by Roger, 2008.11.10. */ /* */ if ((_offset + _size_byte) > EFUSE_MAP_LEN_88E) {/* total E-Fuse table is 512bytes */ - DBG_88E("Hal_EfuseReadEFuse88E(): Invalid offset(%#x) with read bytes(%#x)!!\n", _offset, _size_byte); goto exit; } efuseTbl = kzalloc(EFUSE_MAP_LEN_88E, GFP_KERNEL); if (!efuseTbl) { - DBG_88E("%s: alloc efuseTbl fail!\n", __func__); goto exit; } eFuseWord = rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); if (!eFuseWord) { - DBG_88E("%s: alloc eFuseWord fail!\n", __func__); goto exit; } @@ -415,7 +401,6 @@ static void Hal_EfuseReadEFuse88E(struct adapter *Adapter, efuse_utilized++; eFuse_Addr++; } else { - DBG_88E("EFUSE is empty efuse_Addr-%d efuse_data =%x\n", eFuse_Addr, *rtemp8); goto exit; } @@ -542,11 +527,9 @@ void rtl8188e_SetHalODMVar(struct adapter *Adapter, void *pValue1, bool bSet) struct sta_info *psta = (struct sta_info *)pValue1; if (bSet) { - DBG_88E("### Set STA_(%d) info\n", psta->mac_id); podmpriv->pODM_StaInfo[psta->mac_id] = psta; ODM_RAInfo_Init(podmpriv, psta->mac_id); } else { - DBG_88E("### Clean STA_(%d) info\n", psta->mac_id); podmpriv->pODM_StaInfo[psta->mac_id] = NULL; } } @@ -554,10 +537,8 @@ void rtl8188e_SetHalODMVar(struct adapter *Adapter, void *pValue1, bool bSet) void hal_notch_filter_8188e(struct adapter *adapter, bool enable) { if (enable) { - DBG_88E("Enable notch filter\n"); rtw_write8(adapter, rOFDM0_RxDSP + 1, rtw_read8(adapter, rOFDM0_RxDSP + 1) | BIT(1)); } else { - DBG_88E("Disable notch filter\n"); rtw_write8(adapter, rOFDM0_RxDSP + 1, rtw_read8(adapter, rOFDM0_RxDSP + 1) & ~BIT(1)); } } @@ -791,11 +772,6 @@ void Hal_ReadPowerSavingMode88E(struct adapter *padapter, u8 *hwinfo, bool AutoL /* decide hw if support remote wakeup function */ /* if hw supported, 8051 (SIE) will generate WeakUP signal(D+/D- toggle) when autoresume */ padapter->pwrctrlpriv.bSupportRemoteWakeup = (hwinfo[EEPROM_USB_OPTIONAL_FUNCTION0] & BIT(1)) ? true : false; - - DBG_88E("%s , bSupportRemoteWakeup(%x)\n", __func__, - padapter->pwrctrlpriv.bSupportRemoteWakeup); - - DBG_88E("### PS params => power_mgnt(%x), usbss_enable(%x) ###\n", padapter->registrypriv.power_mgnt, padapter->registrypriv.usbss_enable); } } @@ -816,17 +792,10 @@ void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool Auto pHalData->Index24G_BW40_Base[ch] = pwrInfo24G.IndexBW40_Base[0][4]; else pHalData->Index24G_BW40_Base[ch] = pwrInfo24G.IndexBW40_Base[0][group]; - - DBG_88E("======= Path 0, Channel %d =======\n", ch); - DBG_88E("Index24G_CCK_Base[%d] = 0x%x\n", ch, pHalData->Index24G_CCK_Base[ch]); - DBG_88E("Index24G_BW40_Base[%d] = 0x%x\n", ch, pHalData->Index24G_BW40_Base[ch]); } for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { pHalData->OFDM_24G_Diff[TxCount] = pwrInfo24G.OFDM_Diff[0][TxCount]; pHalData->BW20_24G_Diff[TxCount] = pwrInfo24G.BW20_Diff[0][TxCount]; - DBG_88E("======= TxCount %d =======\n", TxCount); - DBG_88E("OFDM_24G_Diff[%d] = %d\n", TxCount, pHalData->OFDM_24G_Diff[TxCount]); - DBG_88E("BW20_24G_Diff[%d] = %d\n", TxCount, pHalData->BW20_24G_Diff[TxCount]); } /* 2010/10/19 MH Add Regulator recognize for CU. */ @@ -837,7 +806,6 @@ void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool Auto } else { pHalData->EEPROMRegulatory = 0; } - DBG_88E("EEPROMRegulatory = 0x%x\n", pHalData->EEPROMRegulatory); } void Hal_EfuseParseXtal_8188E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoadFail) @@ -851,7 +819,6 @@ void Hal_EfuseParseXtal_8188E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoa } else { pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E; } - DBG_88E("CrystalCap: 0x%2x\n", pHalData->CrystalCap); } void rtl8188e_EfuseParseChnlPlan(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail) @@ -861,8 +828,6 @@ void rtl8188e_EfuseParseChnlPlan(struct adapter *padapter, u8 *hwinfo, bool Auto hwinfo ? hwinfo[EEPROM_ChannelPlan_88E] : 0xFF, padapter->registrypriv.channel_plan, RT_CHANNEL_DOMAIN_WORLD_WIDE_13, AutoLoadFail); - - DBG_88E("mlmepriv.ChannelPlan = 0x%02x\n", padapter->mlmepriv.ChannelPlan); } void Hal_ReadAntennaDiversity88E(struct adapter *pAdapter, u8 *PROMContent, bool AutoLoadFail) @@ -894,7 +859,6 @@ void Hal_ReadAntennaDiversity88E(struct adapter *pAdapter, u8 *PROMContent, bool } else { pHalData->AntDivCfg = 0; } - DBG_88E("EEPROM : AntDivCfg = %x, TRxAntDivType = %x\n", pHalData->AntDivCfg, pHalData->TRxAntDivType); } void Hal_ReadThermalMeter_88E(struct adapter *Adapter, u8 *PROMContent, bool AutoloadFail) @@ -909,6 +873,4 @@ void Hal_ReadThermalMeter_88E(struct adapter *Adapter, u8 *PROMContent, bool Aut if (pHalData->EEPROMThermalMeter == 0xff || AutoloadFail) pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E; - - DBG_88E("ThermalMeter = 0x%x\n", pHalData->EEPROMThermalMeter); } diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index b0e5b9f6a005..5c8d43014603 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -685,7 +685,7 @@ static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel) struct hal_data_8188e *pHalData = &Adapter->haldata; if (Adapter->bNotifyChannelChange) - DBG_88E("[%s] ch = %d\n", __func__, channel); + ; /* s1. pre common command - CmdID_SetTxPowerLevel */ PHY_SetTxPowerLevel8188E(Adapter, channel); diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 8031ac9f9d43..08bdf715d872 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -107,11 +107,11 @@ void rtl8188eu_free_recv_priv(struct adapter *padapter) kfree(precvpriv->pallocated_recv_buf); if (skb_queue_len(&precvpriv->rx_skb_queue)) - DBG_88E(KERN_WARNING "rx_skb_queue not empty\n"); + ; skb_queue_purge(&precvpriv->rx_skb_queue); if (skb_queue_len(&precvpriv->free_recv_skb_queue)) - DBG_88E(KERN_WARNING "free_recv_skb_queue not empty, %d\n", skb_queue_len(&precvpriv->free_recv_skb_queue)); + ; skb_queue_purge(&precvpriv->free_recv_skb_queue); } diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c index f2555c97b0c4..db6ad97d6a2b 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c @@ -265,10 +265,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate(pmlmeext->tx_rate)); } else if ((pxmitframe->frame_tag & 0x0f) == TXAGG_FRAMETAG) { - DBG_88E("pxmitframe->frame_tag == TXAGG_FRAMETAG\n"); } else { - DBG_88E("pxmitframe->frame_tag = %d\n", pxmitframe->frame_tag); - /* offset 4 */ ptxdesc->txdw1 |= cpu_to_le32((4) & 0x3f);/* CAM_ID(MAC_ID) */ @@ -573,7 +570,7 @@ static s32 xmitframe_direct(struct adapter *adapt, struct xmit_frame *pxmitframe if (res == _SUCCESS) rtw_dump_xframe(adapt, pxmitframe); else - DBG_88E("==> %s xmitframe_coalsece failed\n", __func__); + ; return res; } diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index ca2833d3e7dc..59d21a212d23 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -33,7 +33,6 @@ static void _ConfigNormalChipOutEP_8188E(struct adapter *adapt, u8 NumOutPipe) default: break; } - DBG_88E("%s OutEpQueueSel(0x%02x), OutEpNumber(%d)\n", __func__, haldata->OutEpQueueSel, haldata->OutEpNumber); } static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumOutPipe) @@ -59,7 +58,6 @@ u32 rtl8188eu_InitPowerOn(struct adapter *adapt) return _SUCCESS; if (!HalPwrSeqCmdParsing(adapt, Rtl8188E_NIC_PWR_ON_FLOW)) { - DBG_88E(KERN_ERR "%s: run power on flow fail\n", __func__); return _FAIL; } @@ -490,7 +488,6 @@ static void _InitAntenna_Selection(struct adapter *Adapter) if (haldata->AntDivCfg == 0) return; - DBG_88E("==> %s ....\n", __func__); rtw_write32(Adapter, REG_LEDCFG0, rtw_read32(Adapter, REG_LEDCFG0) | BIT(23)); rtl8188e_PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, BIT(13), 0x01); @@ -499,7 +496,6 @@ static void _InitAntenna_Selection(struct adapter *Adapter) haldata->CurAntenna = Antenna_A; else haldata->CurAntenna = Antenna_B; - DBG_88E("%s,Cur_ant:(%x)%s\n", __func__, haldata->CurAntenna, (haldata->CurAntenna == Antenna_A) ? "Antenna_A" : "Antenna_B"); } static void hw_var_set_macaddr(struct adapter *Adapter, u8 *val) @@ -522,7 +518,6 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) struct hal_data_8188e *haldata = &Adapter->haldata; struct pwrctrl_priv *pwrctrlpriv = &Adapter->pwrctrlpriv; struct registry_priv *pregistrypriv = &Adapter->registrypriv; - u32 init_start_time = jiffies; if (Adapter->pwrctrlpriv.bkeepfwalive) { if (haldata->odmpriv.RFCalibrateInfo.bIQKInitialized) { @@ -570,7 +565,6 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) status = rtl8188e_firmware_download(Adapter); if (status != _SUCCESS) { - DBG_88E("%s: Download Firmware failed!!\n", __func__); Adapter->bFWReady = false; haldata->fw_ractrl = false; return status; @@ -584,7 +578,6 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) status = PHY_MACConfig8188E(Adapter); if (status == _FAIL) { - DBG_88E(" ### Failed to init MAC ......\n "); goto exit; } @@ -593,19 +586,16 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) /* */ status = PHY_BBConfig8188E(Adapter); if (status == _FAIL) { - DBG_88E(" ### Failed to init BB ......\n "); goto exit; } status = PHY_RFConfig8188E(Adapter); if (status == _FAIL) { - DBG_88E(" ### Failed to init RF ......\n "); goto exit; } status = rtl8188e_iol_efuse_patch(Adapter); if (status == _FAIL) { - DBG_88E("%s rtl8188e_iol_efuse_patch failed\n", __func__); goto exit; } @@ -726,8 +716,6 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) rtw_write32(Adapter, REG_FWHW_TXQ_CTRL, rtw_read32(Adapter, REG_FWHW_TXQ_CTRL) | BIT(12)); exit: - DBG_88E("%s in %dms\n", __func__, rtw_get_passing_time_ms(init_start_time)); - return status; } @@ -789,13 +777,9 @@ static void CardDisableRTL8188EU(struct adapter *Adapter) u32 rtl8188eu_hal_deinit(struct adapter *Adapter) { - - DBG_88E("==> %s\n", __func__); - rtw_write32(Adapter, REG_HIMR_88E, IMR_DISABLED_88E); rtw_write32(Adapter, REG_HIMRE_88E, IMR_DISABLED_88E); - DBG_88E("bkeepfwalive(%x)\n", Adapter->pwrctrlpriv.bkeepfwalive); if (!Adapter->pwrctrlpriv.bkeepfwalive) { if (Adapter->hw_init_completed) { CardDisableRTL8188EU(Adapter); @@ -864,9 +848,6 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter) eeprom->EepromOrEfuse = (eeValue & BOOT_FROM_EEPROM); eeprom->bautoload_fail_flag = !(eeValue & EEPROM_EN); - DBG_88E("Boot from %s, Autoload %s !\n", (eeprom->EepromOrEfuse ? "EEPROM" : "EFUSE"), - (eeprom->bautoload_fail_flag ? "Fail" : "OK")); - if (!is_boot_from_eeprom(Adapter)) EFUSE_ShadowMapUpdate(Adapter); @@ -927,8 +908,6 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 *val) val8 |= mode; rtw_write8(Adapter, MSR, val8); - DBG_88E("%s()-%d mode = %d\n", __func__, __LINE__, mode); - if ((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) { StopTxBeacon(Adapter); @@ -1005,7 +984,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) /* For 8190, we select only 24M, 12M, 6M, 11M, 5.5M, 2M, and 1M from the Basic rate. */ /* We do not use other rates. */ HalSetBrateCfg(Adapter, val, &BrateCfg); - DBG_88E("HW_VAR_BASIC_RATE: BrateCfg(%#x)\n", BrateCfg); /* 2011.03.30 add by Luke Lee */ /* CCK 2M ACK should be disabled for some BCM and Atheros AP IOT */ @@ -1215,7 +1193,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) else AcmCtrl &= (~AcmHw_BeqEn); - DBG_88E("[HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl); rtw_write8(Adapter, REG_ACMHWCTRL, AcmCtrl); } break; @@ -1355,7 +1332,7 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) break; } while (trycnt--); if (trycnt == 0) - DBG_88E("Stop RX DMA failed......\n"); + ; /* RQPN Load 0 */ rtw_write16(Adapter, REG_RQPN_NPQ, 0x0); @@ -1367,7 +1344,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) case HW_VAR_TX_RPT_MAX_MACID: { u8 maxMacid = *val; - DBG_88E("### MacID(%d),Set Max Tx RPT MID(%d)\n", maxMacid, maxMacid + 1); rtw_write8(Adapter, REG_TX_RPT_CTRL + 1, maxMacid + 1); } break; @@ -1451,16 +1427,7 @@ void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariab break; case HW_DEF_RA_INFO_DUMP: { - u8 entry_id = *((u8 *)pValue); if (check_fwstate(&Adapter->mlmepriv, _FW_LINKED)) { - DBG_88E("============ RA status check ===================\n"); - DBG_88E("Mac_id:%d , RateID = %d, RAUseRate = 0x%08x, RateSGI = %d, DecisionRate = 0x%02x ,PTStage = %d\n", - entry_id, - haldata->odmpriv.RAInfo[entry_id].RateID, - haldata->odmpriv.RAInfo[entry_id].RAUseRate, - haldata->odmpriv.RAInfo[entry_id].RateSGI, - haldata->odmpriv.RAInfo[entry_id].DecisionRate, - haldata->odmpriv.RAInfo[entry_id].PTStage); } } break; @@ -1488,15 +1455,12 @@ void SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariab if (dm_func == 0) { /* disable all dynamic func */ podmpriv->SupportAbility = DYNAMIC_FUNC_DISABLE; - DBG_88E("==> Disable all dynamic function...\n"); } else if (dm_func == 1) {/* disable DIG */ podmpriv->SupportAbility &= (~DYNAMIC_BB_DIG); - DBG_88E("==> Disable DIG...\n"); } else if (dm_func == 2) {/* disable High power */ podmpriv->SupportAbility &= (~DYNAMIC_BB_DYNAMIC_TXPWR); } else if (dm_func == 3) {/* disable tx power tracking */ podmpriv->SupportAbility &= (~DYNAMIC_RF_CALIBRATION); - DBG_88E("==> Disable tx power tracking...\n"); } else if (dm_func == 5) {/* disable antenna diversity */ podmpriv->SupportAbility &= (~DYNAMIC_BB_ANT_DIV); } else if (dm_func == 6) {/* turn on all dynamic func */ @@ -1505,7 +1469,6 @@ void SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariab pDigTable->CurIGValue = rtw_read8(Adapter, 0xc50); } podmpriv->SupportAbility = DYNAMIC_ALL_FUNC_ENABLE; - DBG_88E("==> Turn on all dynamic function...\n"); } } break; @@ -1569,8 +1532,6 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level) rate_bitmap = 0x0fffffff; rate_bitmap = ODM_Get_Rate_Bitmap(&haldata->odmpriv, mac_id, mask, rssi_level); - DBG_88E("%s => mac_id:%d, networkType:0x%02x, mask:0x%08x\n\t ==> rssi_level:%d, rate_bitmap:0x%08x\n", - __func__, mac_id, networkType, mask, rssi_level, rate_bitmap); mask &= rate_bitmap; @@ -1584,7 +1545,6 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level) if (shortGIrate) arg |= BIT(5); mask |= ((raid << 28) & 0xf0000000); - DBG_88E("update raid entry, mask=0x%x, arg=0x%x\n", mask, arg); psta->ra_mask = mask; mask |= ((raid << 28) & 0xf0000000); diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index b7b51af7f2c3..2f3cdc356d2a 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -210,7 +210,6 @@ static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb) precvframe = rtw_alloc_recvframe(pfree_recv_queue); if (!precvframe) { - DBG_88E("%s()-%d: rtw_alloc_recvframe() failed! RX Drop!\n", __func__, __LINE__); goto _exit_recvbuf2recvframe; } @@ -223,8 +222,6 @@ static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb) pattrib = &precvframe->attrib; if ((pattrib->crc_err) || (pattrib->icv_err)) { - DBG_88E("%s: RX Warning! crc_err=%d icv_err=%d, skip!\n", __func__, pattrib->crc_err, pattrib->icv_err); - rtw_free_recvframe(precvframe, pfree_recv_queue); goto _exit_recvbuf2recvframe; } @@ -235,7 +232,6 @@ static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb) pkt_offset = RXDESC_SIZE + pattrib->drvinfo_sz + pattrib->shift_sz + pattrib->pkt_len; if ((pattrib->pkt_len <= 0) || (pkt_offset > transfer_len)) { - DBG_88E("%s()-%d: RX Warning!,pkt_len<=0 or pkt_offset> transfoer_len\n", __func__, __LINE__); rtw_free_recvframe(precvframe, pfree_recv_queue); goto _exit_recvbuf2recvframe; } @@ -276,7 +272,6 @@ static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb) precvframe->rx_data = pkt_copy->data; } else { if ((pattrib->mfrag == 1) && (pattrib->frag_num == 0)) { - DBG_88E("recvbuf2recvframe: alloc_skb fail , drop frag frame\n"); rtw_free_recvframe(precvframe, pfree_recv_queue); goto _exit_recvbuf2recvframe; } @@ -287,7 +282,6 @@ static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb) precvframe->rx_data = precvframe->rx_tail; precvframe->rx_end = pbuf + pattrib->drvinfo_sz + RXDESC_SIZE + alloc_sz; } else { - DBG_88E("recvbuf2recvframe: skb_clone fail\n"); rtw_free_recvframe(precvframe, pfree_recv_queue); goto _exit_recvbuf2recvframe; } @@ -341,7 +335,6 @@ void rtl8188eu_recv_tasklet(unsigned long priv) while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) { if ((adapt->bDriverStopped) || (adapt->bSurpriseRemoved)) { - DBG_88E("recv_tasklet => bDriverStopped or bSurpriseRemoved\n"); dev_kfree_skb_any(pskb); break; } @@ -362,9 +355,6 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) if (adapt->bSurpriseRemoved || adapt->bDriverStopped || adapt->bReadPortCancel) { precvbuf->reuse = true; - DBG_88E("%s() RX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bReadPortCancel(%d)\n", - __func__, adapt->bDriverStopped, - adapt->bSurpriseRemoved, adapt->bReadPortCancel); return; } @@ -372,7 +362,6 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) if ((purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)) { precvbuf->reuse = true; rtw_read_port(adapt, (unsigned char *)precvbuf); - DBG_88E("%s()-%d: RX Warning!\n", __func__, __LINE__); } else { rtw_reset_continual_urb_error(adapter_to_dvobj(adapt)); @@ -388,7 +377,6 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) rtw_read_port(adapt, (unsigned char *)precvbuf); } } else { - DBG_88E("###=> usb_read_port_complete => urb status(%d)\n", purb->status); skb_put(precvbuf->pskb, purb->actual_length); precvbuf->pskb = NULL; @@ -409,7 +397,6 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) rtw_read_port(adapt, (unsigned char *)precvbuf); break; case -EINPROGRESS: - DBG_88E("ERROR: URB IS IN PROGRESS!/n"); break; default: break; @@ -449,7 +436,6 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) if (!precvbuf->reuse || !precvbuf->pskb) { precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); if (!precvbuf->pskb) { - DBG_88E("#### usb_read_port() alloc_skb fail!#####\n"); return _FAIL; } @@ -487,8 +473,6 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) err = usb_submit_urb(purb, GFP_ATOMIC); if ((err) && (err != (-EPERM))) { - DBG_88E("cannot submit rx in-token(err = 0x%08x),urb_status = %d\n", - err, purb->status); ret = _FAIL; } @@ -508,7 +492,6 @@ void rtl8188eu_xmit_tasklet(unsigned long priv) if ((adapt->bDriverStopped) || (adapt->bSurpriseRemoved) || (adapt->bWritePortCancel)) { - DBG_88E("xmit_tasklet => bDriverStopped or bSurpriseRemoved or bWritePortCancel\n"); break; } -- cgit From 1cdb45322a6cfd877cc59e3f81923a78590b9ad0 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:07:00 +0000 Subject: staging: r8188eu: remove DBG_88E calls from os_dep/ioctl_linux.c Remove all remaining DBG_88E calls from os_dep/ioctl_linux.c, patching separately from the rest of the os_dep subdirectory for ease of review due to the sheer number of calls. After some thought, it makes more sense to just entirely strip all of these calls, so that debugging code in the driver can be more consistent and useful going forwards. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-7-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 286 ++------------------------- 1 file changed, 13 insertions(+), 273 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 3bb2714a6a54..97cce74b2b28 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -342,26 +342,21 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value) int ret = 0; if ((value & AUTH_ALG_SHARED_KEY) && (value & AUTH_ALG_OPEN_SYSTEM)) { - DBG_88E("wpa_set_auth_algs, AUTH_ALG_SHARED_KEY and AUTH_ALG_OPEN_SYSTEM [value:0x%x]\n", value); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeAutoSwitch; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; } else if (value & AUTH_ALG_SHARED_KEY) { - DBG_88E("wpa_set_auth_algs, AUTH_ALG_SHARED_KEY [value:0x%x]\n", value); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeShared; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; } else if (value & AUTH_ALG_OPEN_SYSTEM) { - DBG_88E("wpa_set_auth_algs, AUTH_ALG_OPEN_SYSTEM\n"); if (padapter->securitypriv.ndisauthtype < Ndis802_11AuthModeWPAPSK) { padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; } } else if (value & AUTH_ALG_LEAP) { - DBG_88E("wpa_set_auth_algs, AUTH_ALG_LEAP\n"); } else { - DBG_88E("wpa_set_auth_algs, error!\n"); ret = -EINVAL; } return ret; @@ -398,8 +393,6 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, } if (strcmp(param->u.crypt.alg, "WEP") == 0) { - DBG_88E("wpa_set_encryption, crypt.alg = WEP\n"); - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_; padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_; @@ -407,8 +400,6 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, wep_key_idx = param->u.crypt.idx; wep_key_len = param->u.crypt.key_len; - DBG_88E("(1)wep_key_idx =%d\n", wep_key_idx); - if (wep_key_idx > WEP_KEYS) return -EINVAL; @@ -433,11 +424,9 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, pwep->KeyIndex |= 0x80000000; memcpy(pwep->KeyMaterial, param->u.crypt.key, pwep->KeyLength); if (param->u.crypt.set_tx) { - DBG_88E("wep, set_tx = 1\n"); if (rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) ret = -EOPNOTSUPP; } else { - DBG_88E("wep, set_tx = 0\n"); if (wep_key_idx >= WEP_KEYS) { ret = -EOPNOTSUPP; goto exit; @@ -474,15 +463,12 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, padapter->securitypriv.busetkipkey = false; } - DBG_88E(" ~~~~set sta key:unicastkey\n"); - rtw_setstakey_cmd(padapter, (unsigned char *)psta, true); } else { /* group key */ memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, ¶m->u.crypt.key[16], 8); memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, ¶m->u.crypt.key[24], 8); padapter->securitypriv.binstallGrpkey = true; - DBG_88E(" ~~~~set sta key:groupkey\n"); padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; @@ -538,9 +524,8 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie /* dump */ { int i; - DBG_88E("\n wpa_ie(length:%d):\n", ielen); for (i = 0; i < ielen; i += 8) - DBG_88E("0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x\n", buf[i], buf[i + 1], buf[i + 2], buf[i + 3], buf[i + 4], buf[i + 5], buf[i + 6], buf[i + 7]); + ; } if (ielen < RSN_HEADER_LEN) { @@ -614,8 +599,6 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie while (cnt < ielen) { eid = buf[cnt]; if ((eid == _VENDOR_SPECIFIC_IE_) && (!memcmp(&buf[cnt + 2], wps_oui, 4))) { - DBG_88E("SET WPS_IE\n"); - padapter->securitypriv.wps_ie_len = ((buf[cnt + 1] + 2) < (MAX_WPA_IE_LEN << 2)) ? (buf[cnt + 1] + 2) : (MAX_WPA_IE_LEN << 2); memcpy(padapter->securitypriv.wps_ie, &buf[cnt], padapter->securitypriv.wps_ie_len); @@ -728,19 +711,15 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a, switch (wrqu->mode) { case IW_MODE_AUTO: networkType = Ndis802_11AutoUnknown; - DBG_88E("set_mode = IW_MODE_AUTO\n"); break; case IW_MODE_ADHOC: networkType = Ndis802_11IBSS; - DBG_88E("set_mode = IW_MODE_ADHOC\n"); break; case IW_MODE_MASTER: networkType = Ndis802_11APMode; - DBG_88E("set_mode = IW_MODE_MASTER\n"); break; case IW_MODE_INFRA: networkType = Ndis802_11Infrastructure; - DBG_88E("set_mode = IW_MODE_INFRA\n"); break; default: ret = -EINVAL; @@ -791,7 +770,6 @@ static int rtw_wx_set_pmkid(struct net_device *dev, memcpy(strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN); if (pPMK->cmd == IW_PMKSA_ADD) { - DBG_88E("[rtw_wx_set_pmkid] IW_PMKSA_ADD!\n"); if (!memcmp(strIssueBssid, strZeroMacAddress, ETH_ALEN)) return ret; else @@ -802,7 +780,6 @@ static int rtw_wx_set_pmkid(struct net_device *dev, for (j = 0; j < NUM_PMKID_CACHE; j++) { if (!memcmp(psecuritypriv->PMKIDList[j].Bssid, strIssueBssid, ETH_ALEN)) { /* BSSID is matched, the same AP => rewrite with new PMKID. */ - DBG_88E("[rtw_wx_set_pmkid] BSSID exists in the PMKList.\n"); memcpy(psecuritypriv->PMKIDList[j].PMKID, pPMK->pmkid, IW_PMKID_LEN); psecuritypriv->PMKIDList[j].bUsed = true; psecuritypriv->PMKIDIndex = j + 1; @@ -813,9 +790,6 @@ static int rtw_wx_set_pmkid(struct net_device *dev, if (!blInserted) { /* Find a new entry */ - DBG_88E("[rtw_wx_set_pmkid] Use the new entry index = %d for this PMKID.\n", - psecuritypriv->PMKIDIndex); - memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, strIssueBssid, ETH_ALEN); memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pPMK->pmkid, IW_PMKID_LEN); @@ -825,7 +799,6 @@ static int rtw_wx_set_pmkid(struct net_device *dev, psecuritypriv->PMKIDIndex = 0; } } else if (pPMK->cmd == IW_PMKSA_REMOVE) { - DBG_88E("[rtw_wx_set_pmkid] IW_PMKSA_REMOVE!\n"); ret = true; for (j = 0; j < NUM_PMKID_CACHE; j++) { if (!memcmp(psecuritypriv->PMKIDList[j].Bssid, strIssueBssid, ETH_ALEN)) { @@ -836,7 +809,6 @@ static int rtw_wx_set_pmkid(struct net_device *dev, } } } else if (pPMK->cmd == IW_PMKSA_FLUSH) { - DBG_88E("[rtw_wx_set_pmkid] IW_PMKSA_FLUSH!\n"); memset(&psecuritypriv->PMKIDList[0], 0x00, sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE); psecuritypriv->PMKIDIndex = 0; ret = true; @@ -1055,19 +1027,12 @@ static int rtw_wx_set_mlme(struct net_device *dev, union iwreq_data *wrqu, char *extra) { int ret = 0; - u16 reason; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_mlme *mlme = (struct iw_mlme *)extra; if (!mlme) return -1; - DBG_88E("%s\n", __func__); - - reason = mlme->reason_code; - - DBG_88E("%s, cmd =%d, reason =%d\n", __func__, mlme->cmd, reason); - switch (mlme->cmd) { case IW_MLME_DEAUTH: if (!rtw_set_802_11_disassociate(padapter)) @@ -1099,7 +1064,6 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, } if (padapter->bDriverStopped) { - DBG_88E("bDriverStopped =%d\n", padapter->bDriverStopped); ret = -1; goto exit; } @@ -1149,15 +1113,12 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, memcpy(ssid[0].Ssid, req->essid, len); ssid[0].SsidLength = len; - DBG_88E("IW_SCAN_THIS_ESSID, ssid =%s, len =%d\n", req->essid, req->essid_len); - spin_lock_bh(&pmlmepriv->lock); _status = rtw_sitesurvey_cmd(padapter, ssid, 1, NULL, 0); spin_unlock_bh(&pmlmepriv->lock); } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { - DBG_88E("rtw_wx_set_scan, req->scan_type == IW_SCAN_TYPE_PASSIVE\n"); } } else { if (wrqu->data.length >= WEXT_CSCAN_HEADER_SIZE && @@ -1320,12 +1281,11 @@ static int rtw_wx_set_essid(struct net_device *dev, } authmode = padapter->securitypriv.ndisauthtype; - DBG_88E("=>%s\n", __func__); if (wrqu->essid.flags && wrqu->essid.length) { len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? wrqu->essid.length : IW_ESSID_MAX_SIZE; if (wrqu->essid.length != 33) - DBG_88E("ssid =%s, len =%d\n", extra, wrqu->essid.length); + ; memset(&ndis_ssid, 0, sizeof(struct ndis_802_11_ssid)); ndis_ssid.SsidLength = len; @@ -1369,11 +1329,6 @@ static int rtw_wx_set_essid(struct net_device *dev, } exit: - - DBG_88E("<=%s, ret %d\n", __func__, ret); - - - return ret; } @@ -1513,10 +1468,6 @@ static int rtw_wx_set_rts(struct net_device *dev, padapter->registrypriv.rts_thresh = wrqu->rts.value; } - DBG_88E("%s, rts_thresh =%d\n", __func__, padapter->registrypriv.rts_thresh); - - - return 0; } @@ -1528,8 +1479,6 @@ static int rtw_wx_get_rts(struct net_device *dev, - DBG_88E("%s, rts_thresh =%d\n", __func__, padapter->registrypriv.rts_thresh); - wrqu->rts.value = padapter->registrypriv.rts_thresh; wrqu->rts.fixed = 0; /* no auto select */ /* wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); */ @@ -1557,10 +1506,6 @@ static int rtw_wx_set_frag(struct net_device *dev, padapter->xmitpriv.frag_len = wrqu->frag.value & ~0x1; } - DBG_88E("%s, frag_len =%d\n", __func__, padapter->xmitpriv.frag_len); - - - return 0; } @@ -1572,8 +1517,6 @@ static int rtw_wx_get_frag(struct net_device *dev, - DBG_88E("%s, frag_len =%d\n", __func__, padapter->xmitpriv.frag_len); - wrqu->frag.value = padapter->xmitpriv.frag_len; wrqu->frag.fixed = 0; /* no auto select */ @@ -1605,7 +1548,6 @@ static int rtw_wx_set_enc(struct net_device *dev, struct iw_point *erq = &wrqu->encoding; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; - DBG_88E("+rtw_wx_set_enc, flags = 0x%x\n", erq->flags); memset(&wep, 0, sizeof(struct ndis_802_11_wep)); @@ -1614,7 +1556,6 @@ static int rtw_wx_set_enc(struct net_device *dev, if (erq->flags & IW_ENCODE_DISABLED) { - DBG_88E("EncryptionDisabled\n"); padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_; padapter->securitypriv.dot118021XGrpPrivacy = _NO_PRIVACY_; @@ -1633,12 +1574,10 @@ static int rtw_wx_set_enc(struct net_device *dev, } else { keyindex_provided = 0; key = padapter->securitypriv.dot11PrivacyKeyIndex; - DBG_88E("rtw_wx_set_enc, key =%d\n", key); } /* set authentication mode */ if (erq->flags & IW_ENCODE_OPEN) { - DBG_88E("rtw_wx_set_enc():IW_ENCODE_OPEN\n"); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;/* Ndis802_11EncryptionDisabled; */ padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_; @@ -1646,7 +1585,6 @@ static int rtw_wx_set_enc(struct net_device *dev, authmode = Ndis802_11AuthModeOpen; padapter->securitypriv.ndisauthtype = authmode; } else if (erq->flags & IW_ENCODE_RESTRICTED) { - DBG_88E("rtw_wx_set_enc():IW_ENCODE_RESTRICTED\n"); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_; @@ -1654,8 +1592,6 @@ static int rtw_wx_set_enc(struct net_device *dev, authmode = Ndis802_11AuthModeShared; padapter->securitypriv.ndisauthtype = authmode; } else { - DBG_88E("rtw_wx_set_enc():erq->flags = 0x%x\n", erq->flags); - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;/* Ndis802_11EncryptionDisabled; */ padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; /* open system */ padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_; @@ -1676,8 +1612,6 @@ static int rtw_wx_set_enc(struct net_device *dev, /* set key_id only, no given KeyMaterial(erq->length == 0). */ padapter->securitypriv.dot11PrivacyKeyIndex = key; - DBG_88E("(keyindex_provided == 1), keyid =%d, key_len =%d\n", key, padapter->securitypriv.dot11DefKeylen[key]); - switch (padapter->securitypriv.dot11DefKeylen[key]) { case 5: padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_; @@ -1865,7 +1799,6 @@ static int rtw_wx_set_auth(struct net_device *dev, if (check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { LeaveAllPowerSaveMode(padapter); rtw_disassoc_cmd(padapter, 500, false); - DBG_88E("%s...call rtw_indicate_disconnect\n ", __func__); rtw_indicate_disconnect(padapter); rtw_free_assoc_resources(padapter, 1); } @@ -2003,11 +1936,9 @@ static int rtw_wx_read32(struct net_device *dev, sprintf(extra, "0x%08X", data32); break; default: - DBG_88E(KERN_INFO "%s: usage> read [bytes],[address(hex)]\n", __func__); ret = -EINVAL; goto err_free_ptmp; } - DBG_88E(KERN_INFO "%s: addr = 0x%08X data =%s\n", __func__, addr, extra); kfree(ptmp); return 0; @@ -2035,18 +1966,14 @@ static int rtw_wx_write32(struct net_device *dev, switch (bytes) { case 1: rtw_write8(padapter, addr, (u8)data32); - DBG_88E(KERN_INFO "%s: addr = 0x%08X data = 0x%02X\n", __func__, addr, (u8)data32); break; case 2: rtw_write16(padapter, addr, (u16)data32); - DBG_88E(KERN_INFO "%s: addr = 0x%08X data = 0x%04X\n", __func__, addr, (u16)data32); break; case 4: rtw_write32(padapter, addr, data32); - DBG_88E(KERN_INFO "%s: addr = 0x%08X data = 0x%08X\n", __func__, addr, data32); break; default: - DBG_88E(KERN_INFO "%s: usage> write [bytes],[address(hex)],[data(hex)]\n", __func__); return -EINVAL; } @@ -2099,11 +2026,10 @@ static int rtw_wx_set_channel_plan(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; u8 channel_plan_req = (u8)(*((int *)wrqu)); if (_SUCCESS == rtw_set_chplan_cmd(padapter, channel_plan_req)) - DBG_88E("%s set channel_plan = 0x%02X\n", __func__, pmlmepriv->ChannelPlan); + ; else return -EPERM; @@ -2126,8 +2052,6 @@ static int rtw_get_ap_info(struct net_device *dev, struct __queue *queue = &pmlmepriv->scanned_queue; struct iw_point *pdata = &wrqu->data; - DBG_88E("+rtw_get_aplist_info\n"); - if (padapter->bDriverStopped || !pdata) { ret = -EINVAL; goto exit; @@ -2159,15 +2083,12 @@ static int rtw_get_ap_info(struct net_device *dev, pnetwork = container_of(plist, struct wlan_network, list); if (!mac_pton(data, bssid)) { - DBG_88E("Invalid BSSID '%s'.\n", (u8 *)data); spin_unlock_bh(&pmlmepriv->scanned_queue.lock); return -EINVAL; } if (!memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN)) { /* BSSID match, then check if supporting wpa/wpa2 */ - DBG_88E("BSSID:%pM\n", (bssid)); - pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength - 12); if (pbuf && (wpa_ielen > 0)) { pdata->flags = 1; @@ -2216,9 +2137,7 @@ static int rtw_set_pid(struct net_device *dev, if (selector < 3 && selector >= 0) { padapter->pid[selector] = *(pdata + 1); ui_pid[selector] = *(pdata + 1); - DBG_88E("%s set pid[%d] =%d\n", __func__, selector, padapter->pid[selector]); } else { - DBG_88E("%s selector %d error\n", __func__, selector); } exit: return ret; @@ -2249,8 +2168,6 @@ static int rtw_wps_start(struct net_device *dev, if (u32wps_start == 0) u32wps_start = *extra; - DBG_88E("[%s] wps_start = %d\n", __func__, u32wps_start); - if (u32wps_start == 1) /* WPS Start */ rtw_led_control(padapter, LED_CTL_START_WPS); else if (u32wps_start == 2) /* WPS Stop because of wps success */ @@ -2319,7 +2236,6 @@ static void rtw_p2p_set_go_nego_ssid(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; - DBG_88E("[%s] ssid = %s, len = %zu\n", __func__, extra, strlen(extra)); memcpy(pwdinfo->nego_ssid, extra, strlen(extra)); pwdinfo->nego_ssidlen = strlen(extra); } @@ -2345,7 +2261,6 @@ static int rtw_p2p_set_intent(struct net_device *dev, pwdinfo->intent = intent; else ret = -1; - DBG_88E("[%s] intent = %d\n", __func__, intent); return ret; } @@ -2374,8 +2289,6 @@ static int rtw_p2p_set_listen_ch(struct net_device *dev, ret = -1; } - DBG_88E("[%s] listen_ch = %d\n", __func__, pwdinfo->listen_channel); - return ret; } @@ -2405,8 +2318,6 @@ static int rtw_p2p_set_op_ch(struct net_device *dev, else ret = -1; - DBG_88E("[%s] op_ch = %d\n", __func__, pwdinfo->operating_channel); - return ret; } @@ -2428,8 +2339,6 @@ static int rtw_p2p_profilefound(struct net_device *dev, /* YY => SSID Length */ /* SSID => SSID for persistence group */ - DBG_88E("[%s] In value = %s, len = %d\n", __func__, extra, wrqu->data.length - 1); - /* The upper application should pass the SSID to driver by using this rtw_p2p_profilefound function. */ if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { if (extra[0] == '0') { @@ -2464,7 +2373,6 @@ static void rtw_p2p_setDN(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; - DBG_88E("[%s] %s %d\n", __func__, extra, wrqu->data.length - 1); memset(pwdinfo->device_name, 0x00, WPS_MAX_DEVICE_NAME_LEN); memcpy(pwdinfo->device_name, extra, wrqu->data.length - 1); pwdinfo->device_name_len = wrqu->data.length - 1; @@ -2478,9 +2386,7 @@ static void rtw_p2p_get_status(struct net_device *dev, struct wifidirect_info *pwdinfo = &padapter->wdinfo; if (padapter->bShowGetP2PState) - DBG_88E("[%s] Role = %d, Status = %d, peer addr = %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), - pwdinfo->p2p_peer_interface_addr[0], pwdinfo->p2p_peer_interface_addr[1], pwdinfo->p2p_peer_interface_addr[2], - pwdinfo->p2p_peer_interface_addr[3], pwdinfo->p2p_peer_interface_addr[4], pwdinfo->p2p_peer_interface_addr[5]); + ; /* Commented by Albert 2010/10/12 */ /* Because of the output size limitation, I had removed the "Role" information. */ @@ -2512,10 +2418,6 @@ static void rtw_p2p_get_role(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; - DBG_88E("[%s] Role = %d, Status = %d, peer addr = %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), - pwdinfo->p2p_peer_interface_addr[0], pwdinfo->p2p_peer_interface_addr[1], pwdinfo->p2p_peer_interface_addr[2], - pwdinfo->p2p_peer_interface_addr[3], pwdinfo->p2p_peer_interface_addr[4], pwdinfo->p2p_peer_interface_addr[5]); - sprintf(extra, "\n\nRole =%.2d\n", rtw_p2p_role(pwdinfo)); wrqu->data.length = strlen(extra); } @@ -2527,9 +2429,6 @@ static void rtw_p2p_get_peer_ifaddr(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; - DBG_88E("[%s] Role = %d, Status = %d, peer addr = %pM\n", __func__, - rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), - pwdinfo->p2p_peer_interface_addr); sprintf(extra, "\nMAC %pM", pwdinfo->p2p_peer_interface_addr); wrqu->data.length = strlen(extra); @@ -2543,9 +2442,6 @@ static void rtw_p2p_get_peer_devaddr(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; - DBG_88E("[%s] Role = %d, Status = %d, peer addr = %pM\n", __func__, - rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), - pwdinfo->rx_prov_disc_info.peerDevAddr); sprintf(extra, "\n%pM", pwdinfo->rx_prov_disc_info.peerDevAddr); wrqu->data.length = strlen(extra); @@ -2560,9 +2456,6 @@ static void rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; - DBG_88E("[%s] Role = %d, Status = %d, peer addr = %pM\n", - __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), - pwdinfo->p2p_peer_device_addr); sprintf(extra, "\nMAC %pM", pwdinfo->p2p_peer_device_addr); wrqu->data.length = strlen(extra); @@ -2592,8 +2485,6 @@ static void rtw_p2p_get_op_ch(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; - DBG_88E("[%s] Op_ch = %02x\n", __func__, pwdinfo->operating_channel); - sprintf(extra, "\n\nOp_ch =%.2d\n", pwdinfo->operating_channel); wrqu->data.length = strlen(extra); } @@ -2621,7 +2512,6 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, /* After knowing its WPS config method, the application can decide the config method for provisioning discovery. */ /* Format: iwpriv wlanx p2p_get_wpsCM 00:E0:4C:00:00:05 */ - DBG_88E("[%s] data = %s\n", __func__, (char *)extra); if (copy_from_user(peerMACStr, wrqu->data.pointer + 6, 17)) return -EFAULT; @@ -2689,7 +2579,6 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev, /* The input data is the GO's interface address which the application wants to know its device address. */ /* Format: iwpriv wlanx p2p_get2 go_devadd = 00:E0:4C:00:00:05 */ - DBG_88E("[%s] data = %s\n", __func__, (char *)extra); if (copy_from_user(peerMACStr, wrqu->data.pointer + 10, 17)) return -EFAULT; @@ -2769,7 +2658,6 @@ static int rtw_p2p_get_device_type(struct net_device *dev, /* Such user interface could know the device type. */ /* Format: iwpriv wlanx p2p_get2 dev_type = 00:E0:4C:00:00:05 */ - DBG_88E("[%s] data = %s\n", __func__, (char *)extra); if (copy_from_user(peerMACStr, wrqu->data.pointer + 9, 17)) return -EFAULT; @@ -2844,7 +2732,6 @@ static int rtw_p2p_get_device_name(struct net_device *dev, /* Such user interface could show peer device's device name instead of ssid. */ /* Format: iwpriv wlanx p2p_get2 devN = 00:E0:4C:00:00:05 */ - DBG_88E("[%s] data = %s\n", __func__, (char *)extra); if (copy_from_user(peerMACStr, wrqu->data.pointer + 5, 17)) return -EFAULT; @@ -2911,7 +2798,6 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, /* The application wants to know P2P initiation procedure is supported or not. */ /* Format: iwpriv wlanx p2p_get2 InvProc = 00:E0:4C:00:00:05 */ - DBG_88E("[%s] data = %s\n", __func__, (char *)extra); if (copy_from_user(peerMACStr, wrqu->data.pointer + 8, 17)) return -EFAULT; @@ -2984,10 +2870,7 @@ static int rtw_p2p_connect(struct net_device *dev, /* Format: 00:E0:4C:00:00:05 */ /* Format: 00:E0:4C:00:00:05 */ - DBG_88E("[%s] data = %s\n", __func__, extra); - if (pwdinfo->p2p_state == P2P_STATE_NONE) { - DBG_88E("[%s] WiFi Direct is disable!\n", __func__); return ret; } @@ -3031,11 +2914,9 @@ static int rtw_p2p_connect(struct net_device *dev, rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_ING); - DBG_88E("[%s] Start PreTx Procedure!\n", __func__); _set_timer(&pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT); _set_timer(&pwdinfo->restore_p2p_state_timer, P2P_GO_NEGO_TIMEOUT); } else { - DBG_88E("[%s] Not Found in Scanning Queue~\n", __func__); ret = -1; } return ret; @@ -3064,15 +2945,11 @@ static void rtw_p2p_invite_req(struct net_device *dev, /* Command line sample: iwpriv wlan0 p2p_set invite ="00:11:22:33:44:55 00:E0:4C:00:00:05 DIRECT-xy" */ /* Format: 00:11:22:33:44:55 00:E0:4C:00:00:05 DIRECT-xy */ - DBG_88E("[%s] data = %s\n", __func__, extra); - if (wrqu->data.length <= 37) { - DBG_88E("[%s] Wrong format!\n", __func__); return; } if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { - DBG_88E("[%s] WiFi Direct is disable!\n", __func__); return; } else { /* Reset the content of struct tx_invite_req_info */ @@ -3144,7 +3021,6 @@ static void rtw_p2p_invite_req(struct net_device *dev, _set_timer(&pwdinfo->restore_p2p_state_timer, P2P_INVITE_TIMEOUT); } else { - DBG_88E("[%s] NOT Found in the Scanning Queue!\n", __func__); } } @@ -3159,10 +3035,7 @@ static void rtw_p2p_set_persistent(struct net_device *dev, /* 0: disable persistent group functionality */ /* 1: enable persistent group founctionality */ - DBG_88E("[%s] data = %s\n", __func__, extra); - if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { - DBG_88E("[%s] WiFi Direct is disable!\n", __func__); return; } else { if (extra[0] == '0') /* Disable the persistent group function. */ @@ -3200,10 +3073,7 @@ static void rtw_p2p_prov_disc(struct net_device *dev, /* Format: 00:E0:4C:00:00:05_pbc */ /* Format: 00:E0:4C:00:00:05_label */ - DBG_88E("[%s] data = %s\n", __func__, extra); - if (pwdinfo->p2p_state == P2P_STATE_NONE) { - DBG_88E("[%s] WiFi Direct is disable!\n", __func__); return; } else { /* Reset the content of struct tx_provdisc_req_info excluded the wps_config_method_request. */ @@ -3227,7 +3097,6 @@ static void rtw_p2p_prov_disc(struct net_device *dev, } else if (!memcmp(&extra[18], "label", 5)) { pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_LABEL; } else { - DBG_88E("[%s] Unknown WPS config methodn", __func__); return; } @@ -3277,7 +3146,6 @@ static void rtw_p2p_prov_disc(struct net_device *dev, spin_unlock_bh(&pmlmepriv->scanned_queue.lock); if (peer_channel) { - DBG_88E("[%s] peer channel: %d!\n", __func__, peer_channel); memcpy(pwdinfo->tx_prov_disc_info.peerIFAddr, pnetwork->network.MacAddress, ETH_ALEN); memcpy(pwdinfo->tx_prov_disc_info.peerDevAddr, peerMAC, ETH_ALEN); pwdinfo->tx_prov_disc_info.peer_channel_num[0] = (u16)peer_channel; @@ -3298,7 +3166,6 @@ static void rtw_p2p_prov_disc(struct net_device *dev, _set_timer(&pwdinfo->restore_p2p_state_timer, P2P_PROVISION_TIMEOUT); } else { - DBG_88E("[%s] NOT Found in the Scanning Queue!\n", __func__); } } @@ -3312,7 +3179,6 @@ static void rtw_p2p_got_wpsinfo(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; - DBG_88E("[%s] data = %s\n", __func__, extra); /* Added by Albert 20110328 */ /* if the input data is P2P_NO_WPSINFO -> reset the wpsinfo */ /* if the input data is P2P_GOT_WPSINFO_PEER_DISPLAY_PIN -> the utility just input the PIN code got from the peer P2P device. */ @@ -3337,7 +3203,6 @@ static int rtw_p2p_set(struct net_device *dev, { int ret = 0; - DBG_88E("[%s] extra = %s\n", __func__, extra); if (!memcmp(extra, "enable =", 7)) { rtw_wext_p2p_enable(dev, info, wrqu, &extra[7]); } else if (!memcmp(extra, "setDN =", 6)) { @@ -3394,7 +3259,7 @@ static int rtw_p2p_get(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); if (padapter->bShowGetP2PState) - DBG_88E("[%s] extra = %s\n", __func__, (char *)wrqu->data.pointer); + ; if (!memcmp(wrqu->data.pointer, "status", 6)) { rtw_p2p_get_status(dev, info, wrqu, extra); } else if (!memcmp(wrqu->data.pointer, "role", 4)) { @@ -3423,7 +3288,6 @@ static int rtw_p2p_get2(struct net_device *dev, { int ret = 0; - DBG_88E("[%s] extra = %s\n", __func__, (char *)wrqu->data.pointer); if (!memcmp(extra, "wpsCM =", 6)) { wrqu->data.length -= 6; ret = rtw_p2p_get_wps_configmethod(dev, info, wrqu, &extra[6]); @@ -3470,7 +3334,6 @@ static int rtw_rereg_nd_name(struct net_device *dev, if (0 == strcmp(rereg_priv->old_ifname, new_ifname)) return ret; - DBG_88E("%s new_ifname:%s\n", __func__, new_ifname); ret = rtw_change_ifname(padapter, new_ifname); if (0 != ret) goto exit; @@ -3485,7 +3348,6 @@ static int rtw_rereg_nd_name(struct net_device *dev, rereg_priv->old_ifname[IFNAMSIZ - 1] = 0; if (!memcmp(new_ifname, "disable%d", 9)) { - DBG_88E("%s disable\n", __func__); /* free network queue for Android's timming issue */ rtw_free_network_queue(padapter, true); @@ -3568,7 +3430,6 @@ static int rtw_dbg_port(struct net_device *dev, struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - struct security_priv *psecuritypriv = &padapter->securitypriv; struct wlan_network *cur_network = &pmlmepriv->cur_network; struct sta_priv *pstapriv = &padapter->stapriv; @@ -3585,13 +3446,10 @@ static int rtw_dbg_port(struct net_device *dev, case 0x70:/* read_reg */ switch (minor_cmd) { case 1: - DBG_88E("rtw_read8(0x%x) = 0x%02x\n", arg, rtw_read8(padapter, arg)); break; case 2: - DBG_88E("rtw_read16(0x%x) = 0x%04x\n", arg, rtw_read16(padapter, arg)); break; case 4: - DBG_88E("rtw_read32(0x%x) = 0x%08x\n", arg, rtw_read32(padapter, arg)); break; } break; @@ -3599,31 +3457,25 @@ static int rtw_dbg_port(struct net_device *dev, switch (minor_cmd) { case 1: rtw_write8(padapter, arg, extra_arg); - DBG_88E("rtw_write8(0x%x) = 0x%02x\n", arg, rtw_read8(padapter, arg)); break; case 2: rtw_write16(padapter, arg, extra_arg); - DBG_88E("rtw_write16(0x%x) = 0x%04x\n", arg, rtw_read16(padapter, arg)); break; case 4: rtw_write32(padapter, arg, extra_arg); - DBG_88E("rtw_write32(0x%x) = 0x%08x\n", arg, rtw_read32(padapter, arg)); break; } break; case 0x72:/* read_bb */ - DBG_88E("read_bbreg(0x%x) = 0x%x\n", arg, rtl8188e_PHY_QueryBBReg(padapter, arg, 0xffffffff)); break; case 0x73:/* write_bb */ rtl8188e_PHY_SetBBReg(padapter, arg, 0xffffffff, extra_arg); - DBG_88E("write_bbreg(0x%x) = 0x%x\n", arg, rtl8188e_PHY_QueryBBReg(padapter, arg, 0xffffffff)); break; case 0x74:/* read_rf */ if (minor_cmd != RF_PATH_A) { ret = -EINVAL; break; } - DBG_88E("read RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", RF_PATH_A, arg, rtl8188e_PHY_QueryRFReg(padapter, arg, 0xffffffff)); break; case 0x75:/* write_rf */ if (minor_cmd != RF_PATH_A) { @@ -3631,7 +3483,6 @@ static int rtw_dbg_port(struct net_device *dev, break; } rtl8188e_PHY_SetRFReg(padapter, arg, 0xffffffff, extra_arg); - DBG_88E("write RF_reg path(0x%02x), offset(0x%x), value(0x%08x)\n", RF_PATH_A, arg, rtl8188e_PHY_QueryRFReg(padapter, arg, 0xffffffff)); break; case 0x76: @@ -3710,9 +3561,9 @@ static int rtw_dbg_port(struct net_device *dev, final = rtw_read8(padapter, reg); if (start_value + write_num - 1 == final) - DBG_88E("continuous IOL_CMD_WB_REG to 0x%x %u times Success, start:%u, final:%u\n", reg, write_num, start_value, final); + ; else - DBG_88E("continuous IOL_CMD_WB_REG to 0x%x %u times Fail, start:%u, final:%u\n", reg, write_num, start_value, final); + ; } break; @@ -3739,9 +3590,9 @@ static int rtw_dbg_port(struct net_device *dev, final = rtw_read16(padapter, reg); if (start_value + write_num - 1 == final) - DBG_88E("continuous IOL_CMD_WW_REG to 0x%x %u times Success, start:%u, final:%u\n", reg, write_num, start_value, final); + ; else - DBG_88E("continuous IOL_CMD_WW_REG to 0x%x %u times Fail, start:%u, final:%u\n", reg, write_num, start_value, final); + ; } break; case 0x08: /* continuous write dword test */ @@ -3767,11 +3618,9 @@ static int rtw_dbg_port(struct net_device *dev, final = rtw_read32(padapter, reg); if (start_value + write_num - 1 == final) - DBG_88E("continuous IOL_CMD_WD_REG to 0x%x %u times Success, start:%u, final:%u\n", - reg, write_num, start_value, final); + ; else - DBG_88E("continuous IOL_CMD_WD_REG to 0x%x %u times Fail, start:%u, final:%u\n", - reg, write_num, start_value, final); + ; } break; } @@ -3786,8 +3635,6 @@ static int rtw_dbg_port(struct net_device *dev, u8 sign = minor_cmd; u16 write_value = 0; - DBG_88E("%s set RESP_TXAGC to %s %u\n", __func__, sign ? "minus" : "plus", value); - if (sign) value = value | 0x10; @@ -3802,24 +3649,14 @@ static int rtw_dbg_port(struct net_device *dev, case 0x7F: switch (minor_cmd) { case 0x0: - DBG_88E("fwstate = 0x%x\n", get_fwstate(pmlmepriv)); break; case 0x01: - DBG_88E("auth_alg = 0x%x, enc_alg = 0x%x, auth_type = 0x%x, enc_type = 0x%x\n", - psecuritypriv->dot11AuthAlgrthm, psecuritypriv->dot11PrivacyAlgrthm, - psecuritypriv->ndisauthtype, psecuritypriv->ndisencryptstatus); break; case 0x02: - DBG_88E("pmlmeinfo->state = 0x%x\n", pmlmeinfo->state); break; case 0x03: - DBG_88E("qos_option =%d\n", pmlmepriv->qospriv.qos_option); - DBG_88E("ht_option =%d\n", pmlmepriv->htpriv.ht_option); break; case 0x04: - DBG_88E("cur_ch =%d\n", pmlmeext->cur_channel); - DBG_88E("cur_bw =%d\n", pmlmeext->cur_bwmode); - DBG_88E("cur_ch_off =%d\n", pmlmeext->cur_ch_offset); break; case 0x05: psta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress); @@ -3827,47 +3664,25 @@ static int rtw_dbg_port(struct net_device *dev, int i; struct recv_reorder_ctrl *preorder_ctrl; - DBG_88E("SSID =%s\n", cur_network->network.Ssid.Ssid); - DBG_88E("sta's macaddr: %pM\n", psta->hwaddr); - DBG_88E("cur_channel =%d, cur_bwmode =%d, cur_ch_offset =%d\n", pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset); - DBG_88E("rtsen =%d, cts2slef =%d\n", psta->rtsen, psta->cts2self); - DBG_88E("state = 0x%x, aid =%d, macid =%d, raid =%d\n", psta->state, psta->aid, psta->mac_id, psta->raid); - DBG_88E("qos_en =%d, ht_en =%d, init_rate =%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); - DBG_88E("bwmode =%d, ch_offset =%d, sgi =%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); - DBG_88E("ampdu_enable = %d\n", psta->htpriv.ampdu_enable); - DBG_88E("agg_enable_bitmap =%x, candidate_tid_bitmap =%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap); for (i = 0; i < 16; i++) { preorder_ctrl = &psta->recvreorder_ctrl[i]; if (preorder_ctrl->enable) - DBG_88E("tid =%d, indicate_seq =%d\n", i, preorder_ctrl->indicate_seq); + ; } } else { - DBG_88E("can't get sta's macaddr, cur_network's macaddr:%pM\n", (cur_network->network.MacAddress)); } break; case 0x06: { u32 ODMFlag; GetHwReg8188EU(padapter, HW_VAR_DM_FLAG, (u8 *)(&ODMFlag)); - DBG_88E("(B)DMFlag = 0x%x, arg = 0x%x\n", ODMFlag, arg); ODMFlag = (u32)(0x0f & arg); - DBG_88E("(A)DMFlag = 0x%x\n", ODMFlag); SetHwReg8188EU(padapter, HW_VAR_DM_FLAG, (u8 *)(&ODMFlag)); } break; case 0x07: - DBG_88E("bSurpriseRemoved =%d, bDriverStopped =%d\n", - padapter->bSurpriseRemoved, padapter->bDriverStopped); break; case 0x08: - { - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - struct recv_priv *precvpriv = &padapter->recvpriv; - - DBG_88E("free_xmitbuf_cnt =%d, free_xmitframe_cnt =%d, free_xmit_extbuf_cnt =%d\n", - pxmitpriv->free_xmitbuf_cnt, pxmitpriv->free_xmitframe_cnt, pxmitpriv->free_xmit_extbuf_cnt); - DBG_88E("rx_urb_pending_cn =%d\n", precvpriv->rx_pending_cnt); - } break; case 0x09: { @@ -3875,7 +3690,6 @@ static int rtw_dbg_port(struct net_device *dev, struct list_head *plist, *phead; struct recv_reorder_ctrl *preorder_ctrl; - DBG_88E("sta_dz_bitmap = 0x%x, tim_bitmap = 0x%x\n", pstapriv->sta_dz_bitmap, pstapriv->tim_bitmap); spin_lock_bh(&pstapriv->sta_hash_lock); for (i = 0; i < NUM_STA; i++) { @@ -3888,26 +3702,10 @@ static int rtw_dbg_port(struct net_device *dev, plist = plist->next; if (extra_arg == psta->aid) { - DBG_88E("sta's macaddr:%pM\n", (psta->hwaddr)); - DBG_88E("rtsen =%d, cts2slef =%d\n", psta->rtsen, psta->cts2self); - DBG_88E("state = 0x%x, aid =%d, macid =%d, raid =%d\n", psta->state, psta->aid, psta->mac_id, psta->raid); - DBG_88E("qos_en =%d, ht_en =%d, init_rate =%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); - DBG_88E("bwmode =%d, ch_offset =%d, sgi =%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); - DBG_88E("ampdu_enable = %d\n", psta->htpriv.ampdu_enable); - DBG_88E("agg_enable_bitmap =%x, candidate_tid_bitmap =%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap); - - DBG_88E("capability = 0x%x\n", psta->capability); - DBG_88E("flags = 0x%x\n", psta->flags); - DBG_88E("wpa_psk = 0x%x\n", psta->wpa_psk); - DBG_88E("wpa2_group_cipher = 0x%x\n", psta->wpa2_group_cipher); - DBG_88E("wpa2_pairwise_cipher = 0x%x\n", psta->wpa2_pairwise_cipher); - DBG_88E("qos_info = 0x%x\n", psta->qos_info); - DBG_88E("dot118021XPrivacy = 0x%x\n", psta->dot118021XPrivacy); - for (j = 0; j < 16; j++) { preorder_ctrl = &psta->recvreorder_ctrl[j]; if (preorder_ctrl->enable) - DBG_88E("tid =%d, indicate_seq =%d\n", j, preorder_ctrl->indicate_seq); + ; } } } @@ -3917,24 +3715,16 @@ static int rtw_dbg_port(struct net_device *dev, break; case 0x0c:/* dump rx/tx packet */ if (arg == 0) { - DBG_88E("dump rx packet (%d)\n", extra_arg); SetHalDefVar8188EUsb(padapter, HAL_DEF_DBG_DUMP_RXPKT, &extra_arg); } else if (arg == 1) { - DBG_88E("dump tx packet (%d)\n", extra_arg); SetHalDefVar8188EUsb(padapter, HAL_DEF_DBG_DUMP_TXPKT, &extra_arg); } break; case 0x15: - { - struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; - DBG_88E("==>silent resete cnts:%d\n", pwrpriv->ips_enter_cnts); - } break; case 0x10:/* driver version display */ - DBG_88E("rtw driver version =%s\n", DRIVERVERSION); break; case 0x11: - DBG_88E("turn %s Rx RSSI display function\n", (extra_arg == 1) ? "on" : "off"); padapter->bRxRSSIDisplay = extra_arg; break; case 0x12: /* set rx_stbc */ @@ -3947,9 +3737,7 @@ static int rtw_dbg_port(struct net_device *dev, extra_arg == 2 || extra_arg == 3) { pregpriv->rx_stbc = extra_arg; - DBG_88E("set rx_stbc =%d\n", pregpriv->rx_stbc); } else { - DBG_88E("get rx_stbc =%d\n", pregpriv->rx_stbc); } } break; @@ -3959,24 +3747,16 @@ static int rtw_dbg_port(struct net_device *dev, /* 0: disable, 0x1:enable (but wifi_spec should be 0), 0x2: force enable (don't care wifi_spec) */ if (extra_arg >= 0 && extra_arg < 3) { pregpriv->ampdu_enable = extra_arg; - DBG_88E("set ampdu_enable =%d\n", pregpriv->ampdu_enable); } else { - DBG_88E("get ampdu_enable =%d\n", pregpriv->ampdu_enable); } } break; case 0x14: /* get wifi_spec */ - { - struct registry_priv *pregpriv = &padapter->registrypriv; - DBG_88E("get wifi_spec =%d\n", pregpriv->wifi_spec); - } break; case 0x23: - DBG_88E("turn %s the bNotifyChannelChange Variable\n", (extra_arg == 1) ? "on" : "off"); padapter->bNotifyChannelChange = extra_arg; break; case 0x24: - DBG_88E("turn %s the bShowGetP2PState Variable\n", (extra_arg == 1) ? "on" : "off"); padapter->bShowGetP2PState = extra_arg; break; case 0xdd:/* registers dump, 0 for mac reg, 1 for bb reg, 2 for rf reg */ @@ -3993,14 +3773,6 @@ static int rtw_dbg_port(struct net_device *dev, if (0xf == extra_arg) { GetHalDefVar8188EUsb(padapter, HAL_DEF_DBG_DM_FUNC, &odm_flag); - DBG_88E(" === DMFlag(0x%08x) ===\n", odm_flag); - DBG_88E("extra_arg = 0 - disable all dynamic func\n"); - DBG_88E("extra_arg = 1 - disable DIG- BIT(0)\n"); - DBG_88E("extra_arg = 2 - disable High power - BIT(1)\n"); - DBG_88E("extra_arg = 3 - disable tx power tracking - BIT(2)\n"); - DBG_88E("extra_arg = 4 - disable BT coexistence - BIT(3)\n"); - DBG_88E("extra_arg = 5 - disable antenna diversity - BIT(4)\n"); - DBG_88E("extra_arg = 6 - enable all dynamic func\n"); } else { /* extra_arg = 0 - disable all dynamic func extra_arg = 1 - disable DIG @@ -4009,51 +3781,21 @@ static int rtw_dbg_port(struct net_device *dev, */ SetHalDefVar8188EUsb(padapter, HAL_DEF_DBG_DM_FUNC, &extra_arg); GetHalDefVar8188EUsb(padapter, HAL_DEF_DBG_DM_FUNC, &odm_flag); - DBG_88E(" === DMFlag(0x%08x) ===\n", odm_flag); } } break; case 0xfd: rtw_write8(padapter, 0xc50, arg); - DBG_88E("wr(0xc50) = 0x%x\n", rtw_read8(padapter, 0xc50)); rtw_write8(padapter, 0xc58, arg); - DBG_88E("wr(0xc58) = 0x%x\n", rtw_read8(padapter, 0xc58)); break; case 0xfe: - DBG_88E("rd(0xc50) = 0x%x\n", rtw_read8(padapter, 0xc50)); - DBG_88E("rd(0xc58) = 0x%x\n", rtw_read8(padapter, 0xc58)); break; case 0xff: - DBG_88E("dbg(0x210) = 0x%x\n", rtw_read32(padapter, 0x210)); - DBG_88E("dbg(0x608) = 0x%x\n", rtw_read32(padapter, 0x608)); - DBG_88E("dbg(0x280) = 0x%x\n", rtw_read32(padapter, 0x280)); - DBG_88E("dbg(0x284) = 0x%x\n", rtw_read32(padapter, 0x284)); - DBG_88E("dbg(0x288) = 0x%x\n", rtw_read32(padapter, 0x288)); - - DBG_88E("dbg(0x664) = 0x%x\n", rtw_read32(padapter, 0x664)); - - DBG_88E("\n"); - - DBG_88E("dbg(0x430) = 0x%x\n", rtw_read32(padapter, 0x430)); - DBG_88E("dbg(0x438) = 0x%x\n", rtw_read32(padapter, 0x438)); - - DBG_88E("dbg(0x440) = 0x%x\n", rtw_read32(padapter, 0x440)); - - DBG_88E("dbg(0x458) = 0x%x\n", rtw_read32(padapter, 0x458)); - - DBG_88E("dbg(0x484) = 0x%x\n", rtw_read32(padapter, 0x484)); - DBG_88E("dbg(0x488) = 0x%x\n", rtw_read32(padapter, 0x488)); - - DBG_88E("dbg(0x444) = 0x%x\n", rtw_read32(padapter, 0x444)); - DBG_88E("dbg(0x448) = 0x%x\n", rtw_read32(padapter, 0x448)); - DBG_88E("dbg(0x44c) = 0x%x\n", rtw_read32(padapter, 0x44c)); - DBG_88E("dbg(0x450) = 0x%x\n", rtw_read32(padapter, 0x450)); break; } break; default: - DBG_88E("error dbg cmd!\n"); break; } return ret; @@ -4130,8 +3872,6 @@ static int rtw_pm_set(struct net_device *dev, unsigned mode = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - DBG_88E("[%s] extra = %s\n", __func__, extra); - if (!memcmp(extra, "lps =", 4)) { sscanf(extra + 4, "%u", &mode); ret = rtw_pm_set_lps(padapter, mode); -- cgit From 8a1961c95e0b4bbfd0d75f897ffcb27600dc18b6 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:07:01 +0000 Subject: staging: r8188eu: remove remaining DBG_88E calls from os_dep subdir Remove all remaining DBG_88E calls from the os_dep subdirectory. After some thought, it makes more sense to just entirely strip all of these calls, so that debugging code in the driver can be more consistent and useful going forwards. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-8-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/mlme_linux.c | 4 -- drivers/staging/r8188eu/os_dep/os_intfs.c | 24 ------------ drivers/staging/r8188eu/os_dep/usb_intf.c | 57 +---------------------------- 3 files changed, 1 insertion(+), 84 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/mlme_linux.c b/drivers/staging/r8188eu/os_dep/mlme_linux.c index f7ce724ebf87..72ad9700130e 100644 --- a/drivers/staging/r8188eu/os_dep/mlme_linux.c +++ b/drivers/staging/r8188eu/os_dep/mlme_linux.c @@ -181,8 +181,6 @@ void rtw_indicate_sta_assoc_event(struct adapter *padapter, struct sta_info *pst memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN); - DBG_88E("+rtw_indicate_sta_assoc_event\n"); - wireless_send_event(padapter->pnetdev, IWEVREGISTERED, &wrqu, NULL); } @@ -204,7 +202,5 @@ void rtw_indicate_sta_disassoc_event(struct adapter *padapter, struct sta_info * memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN); - DBG_88E("+rtw_indicate_sta_disassoc_event\n"); - wireless_send_event(padapter->pnetdev, IWEVEXPIRED, &wrqu, NULL); } diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c index ef4ba0f22c09..4230819cbf8c 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -362,7 +362,6 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) pnetdev->dev.type = &wlan_type; padapter = rtw_netdev_priv(pnetdev); padapter->pnetdev = pnetdev; - DBG_88E("register rtw_netdev_ops to netdev_ops\n"); pnetdev->netdev_ops = &rtw_netdev_ops; pnetdev->watchdog_timeo = HZ * 3; /* 3 second timeout */ pnetdev->wireless_handlers = (struct iw_handler_def *)&rtw_handlers_def; @@ -493,17 +492,14 @@ u8 rtw_init_drv_sw(struct adapter *padapter) return _FAIL; if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { - DBG_88E("Can't _rtw_init_xmit_priv\n"); return _FAIL; } if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { - DBG_88E("Can't _rtw_init_recv_priv\n"); return _FAIL; } if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) { - DBG_88E("Can't _rtw_init_sta_priv\n"); return _FAIL; } @@ -611,8 +607,6 @@ int _netdev_open(struct net_device *pnetdev) struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; - DBG_88E("+88eu_drv - drv_open, bup =%d\n", padapter->bup); - if (pwrctrlpriv->ps_flag) { padapter->net_closed = false; goto netdev_open_normal_process; @@ -661,14 +655,12 @@ int _netdev_open(struct net_device *pnetdev) netdev_br_init(pnetdev); netdev_open_normal_process: - DBG_88E("-88eu_drv - drv_open, bup =%d\n", padapter->bup); return 0; netdev_open_error: padapter->bup = false; netif_carrier_off(pnetdev); netif_tx_stop_all_queues(pnetdev); - DBG_88E("-88eu_drv - drv_open fail, bup =%d\n", padapter->bup); return -1; } @@ -687,7 +679,6 @@ static int ips_netdrv_open(struct adapter *padapter) { int status = _SUCCESS; padapter->net_closed = false; - DBG_88E("===> %s.........\n", __func__); padapter->bDriverStopped = false; padapter->bSurpriseRemoved = false; @@ -706,31 +697,23 @@ static int ips_netdrv_open(struct adapter *padapter) return _SUCCESS; netdev_open_error: - DBG_88E("-ips_netdrv_open - drv_open failure, bup =%d\n", padapter->bup); - return _FAIL; } int rtw_ips_pwr_up(struct adapter *padapter) { int result; - u32 start_time = jiffies; - DBG_88E("===> rtw_ips_pwr_up..............\n"); rtw_reset_drv_sw(padapter); result = ips_netdrv_open(padapter); rtw_led_control(padapter, LED_CTL_NO_LINK); - DBG_88E("<=== rtw_ips_pwr_up.............. in %dms\n", rtw_get_passing_time_ms(start_time)); return result; } void rtw_ips_pwr_down(struct adapter *padapter) { - u32 start_time = jiffies; - DBG_88E("===> rtw_ips_pwr_down...................\n"); - padapter->bCardDisableWOHSM = true; padapter->net_closed = true; @@ -738,13 +721,10 @@ void rtw_ips_pwr_down(struct adapter *padapter) rtw_ips_dev_unload(padapter); padapter->bCardDisableWOHSM = false; - DBG_88E("<=== rtw_ips_pwr_down..................... in %dms\n", rtw_get_passing_time_ms(start_time)); } void rtw_ips_dev_unload(struct adapter *padapter) { - DBG_88E("====> %s...\n", __func__); - SetHwReg8188EU(padapter, HW_VAR_FIFO_CLEARN_UP, NULL); if (padapter->intf_stop) @@ -763,9 +743,6 @@ int netdev_close(struct net_device *pnetdev) padapter->net_closed = true; if (padapter->pwrctrlpriv.rf_pwrstate == rf_on) { - DBG_88E("(2)88eu_drv - drv_close, bup =%d, hw_init_completed =%d\n", - padapter->bup, padapter->hw_init_completed); - /* s1. */ if (pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) @@ -792,6 +769,5 @@ int netdev_close(struct net_device *pnetdev) kfree(dvobj->firmware.data); dvobj->firmware.data = NULL; - DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup); return 0; } diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c index ae3750a3f056..79d2d640ddfa 100644 --- a/drivers/staging/r8188eu/os_dep/usb_intf.c +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c @@ -145,7 +145,6 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf) * on sitesurvey for the first time when * device is up . Reset usb port for sitesurvey * fail issue. */ - DBG_88E("usb attached..., try to reset usb device\n"); usb_reset_device(interface_to_usbdev(usb_intf)); } } @@ -175,7 +174,6 @@ static void usb_intf_stop(struct adapter *padapter) static void rtw_dev_unload(struct adapter *padapter) { if (padapter->bup) { - DBG_88E("===> rtw_dev_unload\n"); padapter->bDriverStopped = true; if (padapter->xmitpriv.ack_tx) rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP); @@ -193,8 +191,6 @@ static void rtw_dev_unload(struct adapter *padapter) padapter->bup = false; } - - DBG_88E("<=== rtw_dev_unload\n"); } static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) @@ -206,16 +202,9 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; int ret = 0; - u32 start_time = jiffies; - - - DBG_88E("==> %s (%s:%d)\n", __func__, current->comm, current->pid); if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) { - DBG_88E("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", - padapter->bup, padapter->bDriverStopped, - padapter->bSurpriseRemoved); goto exit; } @@ -235,13 +224,6 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { - DBG_88E("%s:%d %s(%pM), length:%d assoc_ssid.length:%d\n", - __func__, __LINE__, - pmlmepriv->cur_network.network.Ssid.Ssid, - pmlmepriv->cur_network.network.MacAddress, - pmlmepriv->cur_network.network.Ssid.SsidLength, - pmlmepriv->assoc_ssid.SsidLength); - pmlmepriv->to_roaming = 1; } /* s2-2. indicate disconnect to os */ @@ -261,9 +243,6 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) rtw_indicate_disconnect(padapter); exit: - DBG_88E("<=== %s return %d.............. in %dms\n", __func__ - , ret, rtw_get_passing_time_ms(start_time)); - return ret; } @@ -274,9 +253,6 @@ static int rtw_resume(struct usb_interface *pusb_intf) struct net_device *pnetdev; struct pwrctrl_priv *pwrpriv = NULL; int ret = -1; - u32 start_time = jiffies; - - DBG_88E("==> %s (%s:%d)\n", __func__, current->comm, current->pid); pnetdev = padapter->pnetdev; pwrpriv = &padapter->pwrctrlpriv; @@ -286,7 +262,6 @@ static int rtw_resume(struct usb_interface *pusb_intf) if (pwrpriv) pwrpriv->bkeepfwalive = false; - DBG_88E("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive); if (netdev_open(pnetdev) != 0) { mutex_unlock(&pwrpriv->lock); goto exit; @@ -298,7 +273,6 @@ static int rtw_resume(struct usb_interface *pusb_intf) mutex_unlock(&pwrpriv->lock); if (padapter->pid[1] != 0) { - DBG_88E("pid[1]:%d\n", padapter->pid[1]); rtw_signal_process(padapter->pid[1], SIGUSR2); } @@ -308,9 +282,6 @@ static int rtw_resume(struct usb_interface *pusb_intf) exit: if (pwrpriv) pwrpriv->bInSuspend = false; - DBG_88E("<=== %s return %d.............. in %dms\n", __func__, - ret, rtw_get_passing_time_ms(start_time)); - return ret; } @@ -379,40 +350,27 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, dvobj->pusbdev->do_remote_wakeup = 1; pusb_intf->needs_remote_wakeup = 1; device_init_wakeup(&pusb_intf->dev, 1); - DBG_88E("\n padapter->pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n", - device_may_wakeup(&pusb_intf->dev)); } #endif /* 2012-07-11 Move here to prevent the 8723AS-VAU BT auto * suspend influence */ if (usb_autopm_get_interface(pusb_intf) < 0) - DBG_88E("can't get autopm:\n"); + ; /* alloc dev name after read efuse. */ if (rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname) < 0) { - DBG_88E("rtw_init_netdev_name failed, ifname:%s\n", - padapter->registrypriv.ifname); goto free_drv_sw; } rtw_macaddr_cfg(padapter->eeprompriv.mac_addr); rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr, padapter->eeprompriv.mac_addr); eth_hw_addr_set(pnetdev, padapter->eeprompriv.mac_addr); - DBG_88E("MAC Address from pnetdev->dev_addr = %pM\n", - pnetdev->dev_addr); /* step 6. Tell the network stack we exist */ if (register_netdev(pnetdev) != 0) goto free_drv_sw; - DBG_88E("bDriverStopped:%d, bSurpriseRemoved:%d, bup:%d, hw_init_completed:%d\n" - , padapter->bDriverStopped - , padapter->bSurpriseRemoved - , padapter->bup - , padapter->hw_init_completed - ); - return padapter; free_drv_sw: @@ -446,8 +404,6 @@ static void rtw_usb_if1_deinit(struct adapter *if1) rtw_cancel_all_timer(if1); rtw_dev_unload(if1); - DBG_88E("+r871xu_dev_remove, hw_init_completed=%d\n", - if1->hw_init_completed); rtw_handle_dualmac(if1, 0); rtw_free_drv_sw(if1); if (pnetdev) @@ -466,12 +422,10 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device if1 = rtw_usb_if1_init(dvobj, pusb_intf); if (!if1) { - DBG_88E("rtw_init_primarystruct adapter Failed!\n"); goto free_dvobj; } if (ui_pid[1] != 0) { - DBG_88E("ui_pid[1]:%d\n", ui_pid[1]); rtw_signal_process(ui_pid[1], SIGUSR2); } @@ -492,8 +446,6 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf) struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf); struct adapter *padapter = dvobj->if1; - DBG_88E("+rtw_dev_remove\n"); - if (usb_drv->drv_registered) padapter->bSurpriseRemoved = true; @@ -505,14 +457,10 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf) rtw_usb_if1_deinit(padapter); usb_dvobj_deinit(pusb_intf); - - DBG_88E("-r871xu_dev_remove, done\n"); } static int __init rtw_drv_entry(void) { - DBG_88E(DRV_NAME " driver version=%s\n", DRIVERVERSION); - mutex_init(&usb_drv->hw_init_mutex); usb_drv->drv_registered = true; @@ -521,13 +469,10 @@ static int __init rtw_drv_entry(void) static void __exit rtw_drv_halt(void) { - DBG_88E("+rtw_drv_halt\n"); - usb_drv->drv_registered = false; usb_deregister(&usb_drv->usbdrv); mutex_destroy(&usb_drv->hw_init_mutex); - DBG_88E("-rtw_drv_halt\n"); } module_init(rtw_drv_entry); -- cgit From 475dae07f1cd67ff0be30b2d42fc381d4cadfe18 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:07:02 +0000 Subject: staging: r8188eu: remove remaining DBG_88E call from include/usb_ops.h Remove the one remaining DBG_88E call from include/usb_ops.h. After some thought, it makes more sense to just entirely strip all of these calls, so that debugging code in the driver can be more consistent and useful going forwards. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-9-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/usb_ops.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/include/usb_ops.h b/drivers/staging/r8188eu/include/usb_ops.h index 62e4706c0497..edef3ad1ccd9 100644 --- a/drivers/staging/r8188eu/include/usb_ops.h +++ b/drivers/staging/r8188eu/include/usb_ops.h @@ -31,8 +31,6 @@ static inline int rtw_inc_and_chk_continual_urb_error(struct dvobj_priv *dvobj) int value; value = atomic_inc_return(&dvobj->continual_urb_error); if (value > MAX_CONTINUAL_URB_ERR) { - DBG_88E("[dvobj:%p][ERROR] continual_urb_error:%d > %d\n", - dvobj, value, MAX_CONTINUAL_URB_ERR); ret = true; } return ret; -- cgit From ef04359725728585bc54033ed3c8a21e08ce11d5 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:07:03 +0000 Subject: staging: r8188eu: remove all aliased DBG_88E calls Remove all remaining calls to preprocessor aliases of DBG_88E, as well as these definitions themselves. This is a prerequisite for removing the DBG_88E macro itself. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-10-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_br_ext.c | 39 ---------------------------- drivers/staging/r8188eu/core/rtw_xmit.c | 7 +---- drivers/staging/r8188eu/include/rtw_br_ext.h | 5 ---- 3 files changed, 1 insertion(+), 50 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c index 5c40babcd45c..6fa27b66920e 100644 --- a/drivers/staging/r8188eu/core/rtw_br_ext.c +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c @@ -72,7 +72,6 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag) data_len = tag->tag_len + TAG_HDR_LEN; if (skb_tailroom(skb) < data_len) { - _DEBUG_ERR("skb_tailroom() failed in add SID tag!\n"); return -1; } @@ -162,9 +161,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char if (len >= 8) { mac = scan_tlv(&data[8], len-8, 1, 1); if (mac) { - _DEBUG_INFO("Router Solicitation, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], - replace_mac[0], replace_mac[1], replace_mac[2], replace_mac[3], replace_mac[4], replace_mac[5]); memcpy(mac, replace_mac, 6); return 1; } @@ -173,9 +169,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char if (len >= 16) { mac = scan_tlv(&data[16], len-16, 1, 1); if (mac) { - _DEBUG_INFO("Router Advertisement, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], - replace_mac[0], replace_mac[1], replace_mac[2], replace_mac[3], replace_mac[4], replace_mac[5]); memcpy(mac, replace_mac, 6); return 1; } @@ -184,9 +177,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char if (len >= 24) { mac = scan_tlv(&data[24], len-24, 1, 1); if (mac) { - _DEBUG_INFO("Neighbor Solicitation, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], - replace_mac[0], replace_mac[1], replace_mac[2], replace_mac[3], replace_mac[4], replace_mac[5]); memcpy(mac, replace_mac, 6); return 1; } @@ -195,9 +185,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char if (len >= 24) { mac = scan_tlv(&data[24], len-24, 2, 1); if (mac) { - _DEBUG_INFO("Neighbor Advertisement, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], - replace_mac[0], replace_mac[1], replace_mac[2], replace_mac[3], replace_mac[4], replace_mac[5]); memcpy(mac, replace_mac, 6); return 1; } @@ -206,9 +193,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char if (len >= 40) { mac = scan_tlv(&data[40], len-40, 2, 1); if (mac) { - _DEBUG_INFO("Redirect, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], - replace_mac[0], replace_mac[1], replace_mac[2], replace_mac[3], replace_mac[4], replace_mac[5]); memcpy(mac, replace_mac, 6); return 1; } @@ -400,7 +384,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN); if (((unsigned char *)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len)) { - DEBUG_WARN("NAT25: malformed IP packet !\n"); return -1; } @@ -413,7 +396,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) if (iph->saddr == 0) return 0; tmp = be32_to_cpu(iph->saddr); - DEBUG_INFO("NAT25: Insert IP, SA =%08x, DA =%08x\n", tmp, iph->daddr); __nat25_generate_ipv4_network_addr(networkAddr, &tmp); /* record source IP address and , source mac address into db */ __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); @@ -430,7 +412,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) unsigned int *sender; if (arp->ar_pro != __constant_htons(ETH_P_IP)) { - DEBUG_WARN("NAT25: arp protocol unknown (%4x)!\n", be16_to_cpu(arp->ar_pro)); return -1; } @@ -438,9 +419,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) case NAT25_CHECK: return 0; /* skb_copy for all ARP frame */ case NAT25_INSERT: - DEBUG_INFO("NAT25: Insert ARP, MAC =%02x%02x%02x%02x%02x%02x\n", arp_ptr[0], - arp_ptr[1], arp_ptr[2], arp_ptr[3], arp_ptr[4], arp_ptr[5]); - /* change to ARP sender mac address to wlan STA address */ memcpy(arp_ptr, GET_MY_HWADDR(priv), ETH_ALEN); arp_ptr += arp->ar_hln; @@ -477,7 +455,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) if (pOldTag) { /* if SID existed, copy old value and delete it */ old_tag_len = ntohs(pOldTag->tag_len); if (old_tag_len+TAG_HDR_LEN+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN > sizeof(tag_buf)) { - DEBUG_ERR("SID tag length too long!\n"); return -1; } @@ -485,7 +462,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) pOldTag->tag_data, old_tag_len); if (skb_pull_and_merge(skb, (unsigned char *)pOldTag, TAG_HDR_LEN+old_tag_len) < 0) { - DEBUG_ERR("call skb_pull_and_merge() failed in PADI/R packet!\n"); return -1; } ph->length = htons(ntohs(ph->length)-TAG_HDR_LEN-old_tag_len); @@ -502,13 +478,9 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) /* Add relay tag */ if (__nat25_add_pppoe_tag(skb, tag) < 0) return -1; - - DEBUG_INFO("NAT25: Insert PPPoE, forward %s packet\n", - (ph->code == PADI_CODE ? "PADI" : "PADR")); } else { /* not add relay tag */ if (priv->pppoe_connection_in_progress && memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN)) { - DEBUG_ERR("Discard PPPoE packet due to another PPPoE connection is in progress!\n"); return -2; } @@ -521,8 +493,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) return -1; } } else { /* session phase */ - DEBUG_INFO("NAT25: Insert PPPoE, insert session packet to %s\n", skb->dev->name); - __nat25_generate_pppoe_network_addr(networkAddr, skb->data, &ph->sid); __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); @@ -567,7 +537,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN); if (sizeof(*iph) >= (skb->len - ETH_HLEN)) { - DEBUG_WARN("NAT25: malformed IPv6 packet !\n"); return -1; } @@ -577,13 +546,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) return 0; return -1; case NAT25_INSERT: - DEBUG_INFO("NAT25: Insert IP, SA =%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x," - " DA =%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x\n", - iph->saddr.s6_addr16[0], iph->saddr.s6_addr16[1], iph->saddr.s6_addr16[2], iph->saddr.s6_addr16[3], - iph->saddr.s6_addr16[4], iph->saddr.s6_addr16[5], iph->saddr.s6_addr16[6], iph->saddr.s6_addr16[7], - iph->daddr.s6_addr16[0], iph->daddr.s6_addr16[1], iph->daddr.s6_addr16[2], iph->daddr.s6_addr16[3], - iph->daddr.s6_addr16[4], iph->daddr.s6_addr16[5], iph->daddr.s6_addr16[6], iph->daddr.s6_addr16[7]); - if (memcmp(&iph->saddr, "\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0", 16)) { __nat25_generate_ipv6_network_addr(networkAddr, (unsigned int *)&iph->saddr); __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); @@ -658,7 +620,6 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb) /* if not broadcast */ register int sum = 0; - DEBUG_INFO("DHCP: change flag of DHCP request to broadcast.\n"); /* or BROADCAST flag */ dhcph->flags |= htons(BROADCAST_FLAG); /* recalculate checksum */ diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index 7d616a409c0c..3ad124f6f3c7 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -1589,7 +1589,6 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) newskb = skb_copy(skb, GFP_ATOMIC); if (!newskb) { - DEBUG_ERR("TX DROP: skb_copy fail!\n"); return -1; } dev_kfree_skb_any(skb); @@ -1604,18 +1603,16 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) } if (skb_is_nonlinear(skb)) - DEBUG_ERR("%s(): skb_is_nonlinear!!\n", __func__); + ; res = skb_linearize(skb); if (res < 0) { - DEBUG_ERR("TX DROP: skb_linearize fail!\n"); return -1; } res = nat25_db_handle(padapter, skb, NAT25_INSERT); if (res < 0) { if (res == -2) { - DEBUG_ERR("TX DROP: nat25_db_handle fail!\n"); return -1; } return 0; @@ -1637,8 +1634,6 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) /* check if SA is equal to our MAC */ if (memcmp(skb->data + ETH_ALEN, GET_MY_HWADDR(padapter), ETH_ALEN)) { - DEBUG_ERR("TX DROP: untransformed frame SA:%02X%02X%02X%02X%02X%02X!\n", - skb->data[6], skb->data[7], skb->data[8], skb->data[9], skb->data[10], skb->data[11]); return -1; } return 0; diff --git a/drivers/staging/r8188eu/include/rtw_br_ext.h b/drivers/staging/r8188eu/include/rtw_br_ext.h index 17a6154e760a..56772af3bec5 100644 --- a/drivers/staging/r8188eu/include/rtw_br_ext.h +++ b/drivers/staging/r8188eu/include/rtw_br_ext.h @@ -4,11 +4,6 @@ #ifndef _RTW_BR_EXT_H_ #define _RTW_BR_EXT_H_ -#define _DEBUG_ERR DBG_88E -#define _DEBUG_INFO DBG_88E -#define DEBUG_WARN DBG_88E -#define DEBUG_INFO DBG_88E -#define DEBUG_ERR DBG_88E #define GET_MY_HWADDR(padapter) ((padapter)->eeprompriv.mac_addr) #define NAT25_HASH_BITS 4 -- cgit From cd480b0cc9fad2e566bd960935fd0200eb030ec0 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:07:04 +0000 Subject: staging: r8188eu: remove DBG_88E macro definition Remove DBG_88E macro definition as it has no remaining callers within the driver. This is part of the ongoing effort to cleanup the driver to use standard debug mechanisms where appropriate. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-11-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_debug.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtw_debug.h b/drivers/staging/r8188eu/include/rtw_debug.h index 311051757715..959fb6bd25ca 100644 --- a/drivers/staging/r8188eu/include/rtw_debug.h +++ b/drivers/staging/r8188eu/include/rtw_debug.h @@ -54,10 +54,4 @@ extern u32 GlobalDebugLevel; -#define DBG_88E(...) \ - do { \ - if (_drv_err_ <= GlobalDebugLevel) \ - pr_info(DRIVER_PREFIX __VA_ARGS__); \ - } while (0) - #endif /* __RTW_DEBUG_H__ */ -- cgit From db381acc41b43e03cbb2beb2abc89ba665d86a44 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:07:05 +0000 Subject: staging: r8188eu: remove rtw_debug module parameter Remove rtw_debug module parameter, and also the internal GlobalDebugLevel flag and all places where it is referenced. As hal/odm_debug.c is now essentially empty, also remove this file and edit the Makefile to no longer reference it. The DBG_88E macro was the last user of these and has now been removed, making the parameter and flag redundant. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-12-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/Makefile | 1 - drivers/staging/r8188eu/hal/odm_debug.c | 6 ------ drivers/staging/r8188eu/include/rtw_debug.h | 2 -- drivers/staging/r8188eu/os_dep/os_intfs.c | 4 ---- 4 files changed, 13 deletions(-) delete mode 100644 drivers/staging/r8188eu/hal/odm_debug.c diff --git a/drivers/staging/r8188eu/Makefile b/drivers/staging/r8188eu/Makefile index 84627fc89ec9..1d7982b618ba 100644 --- a/drivers/staging/r8188eu/Makefile +++ b/drivers/staging/r8188eu/Makefile @@ -10,7 +10,6 @@ r8188eu-y = \ hal/hal_intf.o \ hal/hal_com.o \ hal/odm.o \ - hal/odm_debug.o \ hal/odm_HWConfig.o \ hal/odm_RegConfig8188E.o \ hal/odm_RTL8188E.o \ diff --git a/drivers/staging/r8188eu/hal/odm_debug.c b/drivers/staging/r8188eu/hal/odm_debug.c deleted file mode 100644 index 7a134229fe39..000000000000 --- a/drivers/staging/r8188eu/hal/odm_debug.c +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* Copyright(c) 2007 - 2011 Realtek Corporation. */ - -#include "../include/rtw_debug.h" - -u32 GlobalDebugLevel; diff --git a/drivers/staging/r8188eu/include/rtw_debug.h b/drivers/staging/r8188eu/include/rtw_debug.h index 959fb6bd25ca..01a7d987d6cc 100644 --- a/drivers/staging/r8188eu/include/rtw_debug.h +++ b/drivers/staging/r8188eu/include/rtw_debug.h @@ -52,6 +52,4 @@ #define DRIVER_PREFIX "R8188EU: " -extern u32 GlobalDebugLevel; - #endif /* __RTW_DEBUG_H__ */ diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c index 4230819cbf8c..9884dbc6eab5 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -45,7 +45,6 @@ static int rtw_smart_ps = 2; module_param(rtw_ips_mode, int, 0644); MODULE_PARM_DESC(rtw_ips_mode, "The default IPS mode"); -static int rtw_debug = 1; static int rtw_radio_enable = 1; static int rtw_long_retry_lmt = 7; static int rtw_short_retry_lmt = 7; @@ -148,14 +147,11 @@ MODULE_PARM_DESC(rtw_80211d, "Enable 802.11d mechanism"); static uint rtw_notch_filter = RTW_NOTCH_FILTER; module_param(rtw_notch_filter, uint, 0644); MODULE_PARM_DESC(rtw_notch_filter, "0:Disable, 1:Enable, 2:Enable only for P2P"); -module_param_named(debug, rtw_debug, int, 0444); -MODULE_PARM_DESC(debug, "Set debug level (1-9) (default 1)"); static uint loadparam(struct adapter *padapter) { struct registry_priv *registry_par = &padapter->registrypriv; - GlobalDebugLevel = rtw_debug; registry_par->chip_version = (u8)rtw_chip_version; registry_par->rfintfs = (u8)rtw_rfintfs; registry_par->lbkmode = (u8)rtw_lbkmode; -- cgit From fee26e2257c58b390b813f668a3982049e8d19ff Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:07:06 +0000 Subject: staging: r8188eu: fix lines modified by DBG_88E cleanup A number of style problems were left behind by the DBG_88E cleanup: (1) Empty if/else blocks. (2) Parenthesised if/while statements containing only one line. (3) Entire blocks which server zero purpose after removal of DBG_88E. (4) Various warnings about whitespace, and constant comparison order. (5) Use of __constant_htons instead when htons should be used. Fix up these issues across the driver in any file touched by the previous cleanup. Long line warnings will be addresses in a later patch. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-13-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_ap.c | 4 - drivers/staging/r8188eu/core/rtw_br_ext.c | 22 ++--- drivers/staging/r8188eu/core/rtw_cmd.c | 6 +- drivers/staging/r8188eu/core/rtw_fw.c | 12 +-- drivers/staging/r8188eu/core/rtw_ieee80211.c | 18 +--- drivers/staging/r8188eu/core/rtw_iol.c | 6 +- drivers/staging/r8188eu/core/rtw_mlme.c | 11 +-- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 123 +++++------------------- drivers/staging/r8188eu/core/rtw_p2p.c | 25 ++--- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 14 +-- drivers/staging/r8188eu/core/rtw_recv.c | 41 ++------ drivers/staging/r8188eu/core/rtw_security.c | 3 +- drivers/staging/r8188eu/core/rtw_sta_mgt.c | 10 +- drivers/staging/r8188eu/core/rtw_wlan_util.c | 57 ++++------- drivers/staging/r8188eu/core/rtw_xmit.c | 43 +++------ drivers/staging/r8188eu/hal/HalPwrSeqCmd.c | 3 +- drivers/staging/r8188eu/hal/hal_intf.c | 2 - drivers/staging/r8188eu/hal/rtl8188e_cmd.c | 24 ++--- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 31 +++--- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 3 - drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 5 - drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 6 +- drivers/staging/r8188eu/hal/usb_halinit.c | 22 ++--- drivers/staging/r8188eu/hal/usb_ops_linux.c | 12 +-- drivers/staging/r8188eu/include/usb_ops.h | 4 +- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 115 +++------------------- drivers/staging/r8188eu/os_dep/os_intfs.c | 9 +- drivers/staging/r8188eu/os_dep/usb_intf.c | 24 ++--- drivers/staging/r8188eu/os_dep/usb_ops_linux.c | 3 +- drivers/staging/r8188eu/os_dep/xmit_linux.c | 3 +- 30 files changed, 161 insertions(+), 500 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c index 505517dbbf8c..ed66331de319 100644 --- a/drivers/staging/r8188eu/core/rtw_ap.c +++ b/drivers/staging/r8188eu/core/rtw_ap.c @@ -382,7 +382,6 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) psta->raid = raid; psta->init_rate = init_rate; - } else { } } @@ -457,7 +456,6 @@ void update_bmc_sta(struct adapter *padapter) psta->state = _FW_LINKED; spin_unlock_bh(&psta->lock); - } else { } } @@ -873,8 +871,6 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) psta->no_ht_set = 1; pmlmepriv->num_sta_no_ht++; } - if (pmlmepriv->htpriv.ht_option) { - } } if (rtw_ht_operation_update(padapter) > 0) { diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c index 6fa27b66920e..ddc3a2c8aaca 100644 --- a/drivers/staging/r8188eu/core/rtw_br_ext.c +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c @@ -71,9 +71,8 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag) int data_len; data_len = tag->tag_len + TAG_HDR_LEN; - if (skb_tailroom(skb) < data_len) { + if (skb_tailroom(skb) < data_len) return -1; - } skb_put(skb, data_len); /* have a room for new tag */ @@ -383,9 +382,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) if (protocol == ETH_P_IP) { struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN); - if (((unsigned char *)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len)) { + if (((unsigned char *)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len)) return -1; - } switch (method) { case NAT25_CHECK: @@ -411,9 +409,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) unsigned char *arp_ptr = (unsigned char *)(arp + 1); unsigned int *sender; - if (arp->ar_pro != __constant_htons(ETH_P_IP)) { + if (arp->ar_pro != htons(ETH_P_IP)) return -1; - } switch (method) { case NAT25_CHECK: @@ -454,16 +451,15 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) pOldTag = (struct pppoe_tag *)__nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID)); if (pOldTag) { /* if SID existed, copy old value and delete it */ old_tag_len = ntohs(pOldTag->tag_len); - if (old_tag_len+TAG_HDR_LEN+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN > sizeof(tag_buf)) { + if (old_tag_len+TAG_HDR_LEN+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN > sizeof(tag_buf)) return -1; - } memcpy(tag->tag_data+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN, pOldTag->tag_data, old_tag_len); - if (skb_pull_and_merge(skb, (unsigned char *)pOldTag, TAG_HDR_LEN+old_tag_len) < 0) { + if (skb_pull_and_merge(skb, (unsigned char *)pOldTag, TAG_HDR_LEN+old_tag_len) < 0) return -1; - } + ph->length = htons(ntohs(ph->length)-TAG_HDR_LEN-old_tag_len); } @@ -480,9 +476,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) return -1; } else { /* not add relay tag */ if (priv->pppoe_connection_in_progress && - memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN)) { + memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN)) return -2; - } if (priv->pppoe_connection_in_progress == 0) memcpy(priv->pppoe_addr, skb->data+ETH_ALEN, ETH_ALEN); @@ -536,9 +531,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) /*------------------------------------------------*/ struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN); - if (sizeof(*iph) >= (skb->len - ETH_HLEN)) { + if (sizeof(*iph) >= (skb->len - ETH_HLEN)) return -1; - } switch (method) { case NAT25_CHECK: diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index 5d49428f0431..46a49f30f900 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -251,9 +251,8 @@ int rtw_cmd_thread(void *context) _next: if (padapter->bDriverStopped || - padapter->bSurpriseRemoved) { + padapter->bSurpriseRemoved) break; - } pcmd = rtw_dequeue_cmd(pcmdpriv); if (!pcmd) @@ -937,9 +936,8 @@ static void rtl8188e_sreset_xmit_status_check(struct adapter *padapter) u32 txdma_status; txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS); - if (txdma_status != 0x00) { + if (txdma_status != 0x00) rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status); - } /* total xmit irp = 4 */ } diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188eu/core/rtw_fw.c index 6d07927397de..625d186c3647 100644 --- a/drivers/staging/r8188eu/core/rtw_fw.c +++ b/drivers/staging/r8188eu/core/rtw_fw.c @@ -190,9 +190,8 @@ static int fw_free_to_go(struct adapter *padapter) break; } while (counter++ < POLLING_READY_TIMEOUT_COUNT); - if (counter >= POLLING_READY_TIMEOUT_COUNT) { + if (counter >= POLLING_READY_TIMEOUT_COUNT) return _FAIL; - } value32 = rtw_read32(padapter, REG_MCUFWDL); value32 |= MCUFWDL_RDY; @@ -205,9 +204,8 @@ static int fw_free_to_go(struct adapter *padapter) counter = 0; do { value32 = rtw_read32(padapter, REG_MCUFWDL); - if (value32 & WINTINI_RDY) { + if (value32 & WINTINI_RDY) return _SUCCESS; - } udelay(5); } while (counter++ < POLLING_READY_TIMEOUT_COUNT); @@ -304,14 +302,12 @@ int rtl8188e_firmware_download(struct adapter *padapter) break; } fw_download_enable(padapter, false); - if (ret != _SUCCESS) { + if (ret != _SUCCESS) goto exit; - } ret = fw_free_to_go(padapter); - if (ret != _SUCCESS) { + if (ret != _SUCCESS) goto exit; - } exit: return ret; diff --git a/drivers/staging/r8188eu/core/rtw_ieee80211.c b/drivers/staging/r8188eu/core/rtw_ieee80211.c index c8998cb276be..62354c3194bd 100644 --- a/drivers/staging/r8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/r8188eu/core/rtw_ieee80211.c @@ -653,11 +653,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, /* first 3 bytes in vendor specific information element are the IEEE * OUI of the vendor. The following byte is used a vendor specific * sub-type. */ - if (elen < 4) { - if (show_errors) { - } + if (elen < 4) return -1; - } oui = RTW_GET_BE24(pos); switch (oui) { @@ -672,9 +669,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, elems->wpa_ie_len = elen; break; case WME_OUI_TYPE: /* this is a Wi-Fi WME info. element */ - if (elen < 5) { + if (elen < 5) return -1; - } switch (pos[4]) { case WME_OUI_SUBTYPE_INFORMATION_ELEMENT: case WME_OUI_SUBTYPE_PARAMETER_ELEMENT: @@ -740,11 +736,8 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len, elen = *pos++; left -= 2; - if (elen > left) { - if (show_errors) { - } + if (elen > left) return ParseFailed; - } switch (id) { case WLAN_EID_SSID: @@ -825,8 +818,6 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len, break; default: unknown++; - if (!show_errors) - break; break; } left -= elen; @@ -874,9 +865,8 @@ void rtw_macaddr_cfg(u8 *mac_addr) ether_addr_copy(mac, mac_addr); } - if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) { + if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) eth_random_addr(mac_addr); - } } /** diff --git a/drivers/staging/r8188eu/core/rtw_iol.c b/drivers/staging/r8188eu/core/rtw_iol.c index 5f73413a4511..e14e3746efdd 100644 --- a/drivers/staging/r8188eu/core/rtw_iol.c +++ b/drivers/staging/r8188eu/core/rtw_iol.c @@ -11,9 +11,8 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter) struct xmit_priv *pxmitpriv = &adapter->xmitpriv; xmit_frame = rtw_alloc_xmitframe(pxmitpriv); - if (!xmit_frame) { + if (!xmit_frame) return NULL; - } xmitbuf = rtw_alloc_xmitbuf(pxmitpriv); if (!xmitbuf) { @@ -46,9 +45,8 @@ int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len ori_len = buf_offset + pattrib->pktlen; /* check if the io_buf can accommodate new cmds */ - if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) { + if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) return _FAIL; - } memcpy(xmit_frame->buf_addr + buf_offset + pattrib->pktlen, IOL_cmds, cmd_len); pattrib->pktlen += cmd_len; diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index d7494d820756..45eff3018d73 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -610,9 +610,8 @@ static int rtw_is_desired_network(struct adapter *adapter, struct wlan_network * } } - if ((desired_encmode != Ndis802_11EncryptionDisabled) && (privacy == 0)) { + if ((desired_encmode != Ndis802_11EncryptionDisabled) && (privacy == 0)) bselected = false; - } if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { if (pnetwork->network.InfrastructureMode != pmlmepriv->cur_network.network.InfrastructureMode) @@ -1318,9 +1317,8 @@ void _rtw_join_timeout_handler (struct adapter *adapter) pmlmepriv->to_roaming--; if (rtw_to_roaming(adapter) != 0) { /* try another */ do_join_r = rtw_do_join(adapter); - if (_SUCCESS != do_join_r) { + if (do_join_r != _SUCCESS) continue; - } break; } else { rtw_indicate_disconnect(adapter); @@ -1446,8 +1444,6 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv *candidate = competitor; updated = true; } - if (updated) { - } exit: return updated; @@ -1486,7 +1482,6 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) if (!candidate) { ret = _FAIL; goto exit; - } else { } /* check for situation of _FW_LINKED */ @@ -1960,8 +1955,6 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) /* Config SM Power Save setting */ pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2; - if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) - ; /* Config current HT Protection mode. */ pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 6c07a03dfa84..785eda58a5e5 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -314,9 +314,8 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_c memset(channel_set, 0, sizeof(struct rt_channel_info) * MAX_CHANNEL_NUM); - if (ChannelPlan >= RT_CHANNEL_DOMAIN_MAX && ChannelPlan != RT_CHANNEL_DOMAIN_REALTEK_DEFINE) { + if (ChannelPlan >= RT_CHANNEL_DOMAIN_MAX && ChannelPlan != RT_CHANNEL_DOMAIN_REALTEK_DEFINE) return chanset_size; - } if (padapter->registrypriv.wireless_mode & WIRELESS_11G) { b2_4GBand = true; @@ -433,10 +432,9 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) if (psta) { if (GetRetry(pframe)) { - if (precv_frame->attrib.seq_num == psta->RxMgmtFrameSeqNum) { + if (precv_frame->attrib.seq_num == psta->RxMgmtFrameSeqNum) /* drop the duplicate management frame */ return; - } } psta->RxMgmtFrameSeqNum = precv_frame->attrib.seq_num; } @@ -931,15 +929,13 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame return _FAIL; frame_type = GetFrameSubType(pframe); - if (frame_type == WIFI_ASSOCREQ) { + if (frame_type == WIFI_ASSOCREQ) ie_offset = _ASOCREQ_IE_OFFSET_; - } else { /* WIFI_REASSOCREQ */ + else /* WIFI_REASSOCREQ */ ie_offset = _REASOCREQ_IE_OFFSET_; - } - if (pkt_len < IEEE80211_3ADDR_LEN + ie_offset) { + if (pkt_len < IEEE80211_3ADDR_LEN + ie_offset) return _FAIL; - } pstat = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); if (pstat == (struct sta_info *)NULL) { @@ -1085,14 +1081,13 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS); if (!wpa_ie) { - if (elems.wps_ie) { + if (elems.wps_ie) pstat->flags |= WLAN_STA_WPS; /* wpabuf_free(sta->wps_ie); */ /* sta->wps_ie = wpabuf_alloc_copy(elems.wps_ie + 4, */ /* elems.wps_ie_len - 4); */ - } else { + else pstat->flags |= WLAN_STA_MAYBE_WPS; - } /* AP support WPA/RSN, and sta is going to do WPS, but AP is not ready */ /* that the selected registrar of AP is _FLASE */ @@ -1202,14 +1197,6 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame goto OnAssocReqFail; } - if ((pstat->flags & WLAN_STA_HT) && - ((pstat->wpa2_pairwise_cipher & WPA_CIPHER_TKIP) || - (pstat->wpa_pairwise_cipher & WPA_CIPHER_TKIP))) { - - /* status = WLAN_STATUS_CIPHER_REJECTED_PER_POLICY; */ - /* goto OnAssocReqFail; */ - } - pstat->flags |= WLAN_STA_NONERP; for (i = 0; i < pstat->bssratelen; i++) { if ((pstat->bssrateset[i] & 0x7f) > 22) { @@ -1248,8 +1235,7 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame /* Customer proprietary IE */ /* get a unique AID */ - if (pstat->aid > 0) { - } else { + if (pstat->aid == 0) { for (pstat->aid = 1; pstat->aid <= NUM_STA; pstat->aid++) if (!pstapriv->sta_aid[pstat->aid - 1]) break; @@ -3597,13 +3583,11 @@ static s32 rtw_action_public_decache(struct recv_frame *recv_frame, s32 token) if (GetRetry(frame)) { if (token >= 0) { - if ((seq_ctrl == mlmeext->action_public_rxseq) && (token == mlmeext->action_public_dialog_token)) { + if ((seq_ctrl == mlmeext->action_public_rxseq) && (token == mlmeext->action_public_dialog_token)) return _FAIL; - } } else { - if (seq_ctrl == mlmeext->action_public_rxseq) { + if (seq_ctrl == mlmeext->action_public_rxseq) return _FAIL; - } } } @@ -3693,7 +3677,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) pwdinfo->negotiation_dialog_token = 1; if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL)) _set_timer(&pwdinfo->restore_p2p_state_timer, 5000); - } else { } break; case P2P_GO_NEGO_CONF: @@ -3728,9 +3711,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) /* #> iwpriv wlan0 p2p_get peer_ifa */ /* After having the peer interface address, the sigma can find the correct conf file for wpa_supplicant. */ - if (attr_contentlen) { - } - if (invitation_flag & P2P_INVITATION_FLAGS_PERSISTENT) { /* Re-invoke the persistent group. */ @@ -4022,9 +4002,8 @@ struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv) struct xmit_buf *pxmitbuf; pmgntframe = rtw_alloc_xmitframe(pxmitpriv); - if (!pmgntframe) { + if (!pmgntframe) return NULL; - } pxmitbuf = rtw_alloc_xmitbuf_ext(pxmitpriv); if (!pxmitbuf) { @@ -4184,9 +4163,8 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) struct wifidirect_info *pwdinfo = &padapter->wdinfo; pmgntframe = alloc_mgtxmitframe(pxmitpriv); - if (!pmgntframe) { + if (!pmgntframe) return; - } spin_lock_bh(&pmlmepriv->bcn_update_lock); /* update attribute */ @@ -4366,9 +4344,8 @@ _issue_bcn: spin_unlock_bh(&pmlmepriv->bcn_update_lock); - if ((pattrib->pktlen + TXDESC_SIZE) > 512) { + if ((pattrib->pktlen + TXDESC_SIZE) > 512) return; - } pattrib->last_txcmdsz = pattrib->pktlen; @@ -4397,9 +4374,8 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p struct wifidirect_info *pwdinfo = &padapter->wdinfo; pmgntframe = alloc_mgtxmitframe(pxmitpriv); - if (!pmgntframe) { + if (!pmgntframe) return; - } /* update attribute */ pattrib = &pmgntframe->attrib; @@ -4641,13 +4617,6 @@ int issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, ret = _SUCCESS; goto exit; } - - if (try_cnt && wait_ms) { - if (da) - ; - else - ; - } exit: return ret; } @@ -4979,11 +4948,6 @@ void issue_assocreq(struct adapter *padapter) if (pmlmeext->cur_channel == 14)/* for JAPAN, channel 14 can only uses B Mode(CCK) */ sta_bssrate_len = 4; - for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) { - if (pmlmeinfo->network.SupportedRates[i] == 0) - break; - } - for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) { if (pmlmeinfo->network.SupportedRates[i] == 0) break; @@ -4996,12 +4960,9 @@ void issue_assocreq(struct adapter *padapter) break; } - if (j == sta_bssrate_len) { - /* the rate is not supported by STA */ - } else { + if (j != sta_bssrate_len) /* the rate is supported by STA */ bssrate[index++] = pmlmeinfo->network.SupportedRates[i]; - } } bssrate_len = index; @@ -5312,13 +5273,6 @@ int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int pow ret = _SUCCESS; goto exit; } - - if (try_cnt && wait_ms) { - if (da) - ; - else - ; - } exit: return ret; } @@ -5425,13 +5379,6 @@ int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int ret = _SUCCESS; goto exit; } - - if (try_cnt && wait_ms) { - if (da) - ; - else - ; - } exit: return ret; } @@ -5526,13 +5473,6 @@ int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason, int ret = _SUCCESS; goto exit; } - - if (try_cnt && wait_ms) { - if (da) - ; - else - ; - } exit: return ret; } @@ -5839,10 +5779,7 @@ unsigned int send_beacon(struct adapter *padapter) if (!bxmitok) { return _FAIL; } else { - u32 passing_time = rtw_get_passing_time_ms(start); - - if (passing_time > 100 || issue > 3) - ; + rtw_get_passing_time_ms(start); return _SUCCESS; } @@ -6051,14 +5988,12 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st /* checking SSID */ p = rtw_get_ie(bssid->IEs + ie_offset, _SSID_IE_, &len, bssid->IELength - ie_offset); - if (!p) { + if (!p) return _FAIL; - } if (*(p + 1)) { - if (len > NDIS_802_11_LENGTH_SSID) { + if (len > NDIS_802_11_LENGTH_SSID) return _FAIL; - } memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1)); bssid->Ssid.SsidLength = *(p + 1); } else { @@ -6071,18 +6006,16 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st i = 0; p = rtw_get_ie(bssid->IEs + ie_offset, _SUPPORTEDRATES_IE_, &len, bssid->IELength - ie_offset); if (p) { - if (len > NDIS_802_11_LENGTH_RATES_EX) { + if (len > NDIS_802_11_LENGTH_RATES_EX) return _FAIL; - } memcpy(bssid->SupportedRates, (p + 2), len); i = len; } p = rtw_get_ie(bssid->IEs + ie_offset, _EXT_SUPPORTEDRATES_IE_, &len, bssid->IELength - ie_offset); if (p) { - if (len > (NDIS_802_11_LENGTH_RATES_EX - i)) { + if (len > (NDIS_802_11_LENGTH_RATES_EX - i)) return _FAIL; - } memcpy(bssid->SupportedRates + i, (p + 2), len); } @@ -6936,17 +6869,11 @@ static u8 chk_ap_is_alive(struct sta_info *psta) static void rtl8188e_sreset_linked_status_check(struct adapter *padapter) { u32 rx_dma_status = rtw_read32(padapter, REG_RXDMA_STATUS); - u8 fw_status; - if (rx_dma_status != 0x00) { + if (rx_dma_status != 0x00) rtw_write32(padapter, REG_RXDMA_STATUS, rx_dma_status); - } - fw_status = rtw_read8(padapter, REG_FMETHR); - if (fw_status == 1) - ; - else if (fw_status == 2) - ; + rtw_read8(padapter, REG_FMETHR); } void linked_status_chk(struct adapter *padapter) @@ -7320,8 +7247,7 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) default: pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; break; - } - + } } } break; @@ -7574,9 +7500,8 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) if (psta) { ctrl = (BIT(15) | ((pparm->algorithm) << 2)); - if ((psta->mac_id < 1) || (psta->mac_id > (NUM_STA - 4))) { + if ((psta->mac_id < 1) || (psta->mac_id > (NUM_STA - 4))) return H2C_REJECTED; - } cam_id = (psta->mac_id + 3);/* 0~3 for default key, cmd_id = macid + 3, macid = aid+1; */ diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c index 8f4bad399bc4..9467a5dcc990 100644 --- a/drivers/staging/r8188eu/core/rtw_p2p.c +++ b/drivers/staging/r8188eu/core/rtw_p2p.c @@ -818,10 +818,8 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l p2p_ie = rtw_get_p2p_ie(ies, ies_len, NULL, &p2p_ielen); - if (!p2p_ie) { + if (!p2p_ie) status_code = P2P_STATUS_FAIL_INVALID_PARAM; - } else { - } while (p2p_ie) { /* Check P2P Capability ATTR */ @@ -1156,15 +1154,14 @@ u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo, u8 *pframe, peer_operating_ch = operatingch_info[4]; if (rtw_p2p_is_channel_list_ok(peer_operating_ch, - ch_list_inclusioned, ch_num_inclusioned)) { + ch_list_inclusioned, ch_num_inclusioned)) /** * Change our operating channel as peer's for compatibility. */ pwdinfo->operating_channel = peer_operating_ch; - } else { + else /* Take first channel of ch_list_inclusioned as operating channel */ pwdinfo->operating_channel = ch_list_inclusioned[0]; - } } } } @@ -1189,8 +1186,7 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe /* Be able to know which one is the P2P GO and which one is P2P client. */ - if (rtw_get_wps_ie(ies, ies_len, NULL, &wps_ielen)) { - } else { + if (!rtw_get_wps_ie(ies, ies_len, NULL, &wps_ielen)) { result = P2P_STATUS_FAIL_INCOMPATIBLE_PARAM; rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL); } @@ -1274,9 +1270,8 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe /* Try to get the operation channel information */ attr_contentlen = 0; - if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen)) { + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen)) pwdinfo->peer_operating_ch = operatingch_info[4]; - } /* Try to get the channel list information */ if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CH_LIST, pwdinfo->channel_list_attr, &pwdinfo->channel_list_attr_len)) { @@ -1300,18 +1295,16 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe peer_operating_ch = operatingch_info[4]; if (rtw_p2p_is_channel_list_ok(peer_operating_ch, - ch_list_inclusioned, ch_num_inclusioned)) { + ch_list_inclusioned, ch_num_inclusioned)) /** * Change our operating channel as peer's for compatibility. */ pwdinfo->operating_channel = peer_operating_ch; - } else { + else /* Take first channel of ch_list_inclusioned as operating channel */ pwdinfo->operating_channel = ch_list_inclusioned[0]; - } } } - } else { } /* Try to get the group id information if peer is GO */ @@ -1384,9 +1377,8 @@ u8 process_p2p_group_negotation_confirm(struct wifidirect_info *pwdinfo, u8 *pfr } attr_contentlen = 0; - if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen)) { + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen)) pwdinfo->peer_operating_ch = operatingch_info[4]; - } /* Get the next P2P IE */ p2p_ie = rtw_get_p2p_ie(p2p_ie + p2p_ielen, ies_len - (p2p_ie - ies + p2p_ielen), NULL, &p2p_ielen); @@ -1743,7 +1735,6 @@ static void pre_tx_scan_timer_process(struct timer_list *t) } else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_INVITE_REQ)) { if (pwdinfo->invitereq_info.benable) p2p_protocol_wk_cmd(adapter, P2P_PRE_TX_INVITEREQ_PROCESS_WK); - } else { } spin_unlock_bh(&pmlmepriv->lock); diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c index db7074bf5741..c7c79cd9e213 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -14,9 +14,8 @@ void ips_enter(struct adapter *padapter) struct xmit_priv *pxmit_priv = &padapter->xmitpriv; if (pxmit_priv->free_xmitbuf_cnt != NR_XMITBUFF || - pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) { + pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) return; - } mutex_lock(&pwrpriv->lock); @@ -172,9 +171,8 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) return false; if (pwrpriv->bInSuspend) return false; - if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && !padapter->securitypriv.binstallGrpkey) { + if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && !padapter->securitypriv.binstallGrpkey) return false; - } return true; } @@ -367,10 +365,6 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal if (pwrpriv->ps_processing) { while (pwrpriv->ps_processing && rtw_get_passing_time_ms(start) <= 3000) msleep(10); - if (pwrpriv->ps_processing) - ; - else - ; } /* System suspend is not allowed to wakeup */ @@ -379,10 +373,6 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal (rtw_get_passing_time_ms(start) <= 3000 || (rtw_get_passing_time_ms(start) <= 500))) msleep(10); - if (pwrpriv->bInSuspend) - ; - else - ; } /* I think this should be check in IPS, LPS, autosuspend functions... */ diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 0f8f757de02a..0144c4642911 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -299,10 +299,9 @@ static int recvframe_chkmic(struct adapter *adapter, struct recv_frame *precvfr if (is_multicast_ether_addr(prxattrib->ra) && prxattrib->key_index != pmlmeinfo->key_index) brpt_micerror = false; - if ((prxattrib->bdecrypted) && (brpt_micerror)) { + if ((prxattrib->bdecrypted) && (brpt_micerror)) rtw_handle_tkip_mic_err(adapter, (u8)is_multicast_ether_addr(prxattrib->ra)); - } else { - } + res = _FAIL; } else { /* mic checked ok */ @@ -679,9 +678,8 @@ static int ap2sta_data_frame( if (!memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || !memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || (memcmp(pattrib->bssid, mybssid, ETH_ALEN))) { - if (!bmcast) { + if (!bmcast) issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); - } ret = _FAIL; goto exit; @@ -729,9 +727,8 @@ static int ap2sta_data_frame( } else { if (!memcmp(myhwaddr, pattrib->dst, ETH_ALEN) && (!bmcast)) { *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */ - if (!*psta) { + if (!*psta) issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); - } } ret = _FAIL; @@ -889,12 +886,11 @@ static int validate_recv_ctrl_frame(struct adapter *padapter, } } else { if (pstapriv->tim_bitmap & BIT(psta->aid)) { - if (psta->sleepq_len == 0) { + if (psta->sleepq_len == 0) /* issue nulldata with More data bit = 0 to indicate we have no buffered packets */ issue_nulldata(padapter, psta->hwaddr, 0, 0, 0); - } else { + else psta->sleepq_len = 0; - } pstapriv->tim_bitmap &= ~BIT(psta->aid); @@ -1097,25 +1093,6 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv /* Dump rx packets */ GetHalDefVar8188EUsb(adapter, HAL_DEF_DBG_DUMP_RXPKT, &bDumpRxPkt); - if (bDumpRxPkt == 1) {/* dump all rx packets */ - int i; - - for (i = 0; i < 64; i = i + 8) - ; - } else if (bDumpRxPkt == 2) { - if (type == WIFI_MGT_TYPE) { - int i; - - for (i = 0; i < 64; i = i + 8) - ; - } - } else if (bDumpRxPkt == 3) { - if (type == WIFI_DATA_TYPE) { - int i; - for (i = 0; i < 64; i = i + 8) - ; - } - } switch (type) { case WIFI_MGT_TYPE: /* mgnt */ validate_recv_mgnt_frame(adapter, precv_frame); @@ -1419,9 +1396,8 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) /* Offset 12 denote 2 mac address */ nSubframe_Length = RTW_GET_BE16(pdata + 12); - if (a_len < ETH_HLEN + nSubframe_Length) { + if (a_len < ETH_HLEN + nSubframe_Length) goto exit; - } /* move the data point to data content */ pdata += ETH_HLEN; @@ -1446,9 +1422,8 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) subframes[nr_subframes++] = sub_skb; - if (nr_subframes >= MAX_SUBFRAME_COUNT) { + if (nr_subframes >= MAX_SUBFRAME_COUNT) break; - } pdata += nSubframe_Length; a_len -= nSubframe_Length; diff --git a/drivers/staging/r8188eu/core/rtw_security.c b/drivers/staging/r8188eu/core/rtw_security.c index fdd2dbf65eb7..7861dfa235c0 100644 --- a/drivers/staging/r8188eu/core/rtw_security.c +++ b/drivers/staging/r8188eu/core/rtw_security.c @@ -1327,9 +1327,8 @@ static int aes_decipher(struct adapter *padapter, u8 *key, uint hdrlen, /* compare the mic */ for (i = 0; i < 8; i++) { - if (pframe[hdrlen + 8 + plen - 8 + i] != message[hdrlen + 8 + plen - 8 + i]) { + if (pframe[hdrlen + 8 + plen - 8 + i] != message[hdrlen + 8 + plen - 8 + i]) res = _FAIL; - } } return res; diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c index 1fb9b6cc7eda..91ff82f24f1f 100644 --- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c @@ -101,19 +101,11 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta) { - int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info); - - if (!stainfo_offset_valid(offset)) - ; - - return offset; + return (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info); } inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset) { - if (!stainfo_offset_valid(offset)) - ; - return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info)); } diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index abc2386dc8d9..e8bf5672ff6c 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -334,9 +334,6 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne { u8 center_ch; - if (padapter->bNotifyChannelChange) - ; - if ((bwmode == HT_CHANNEL_WIDTH_20) || (channel_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)) { /* SelectChannel(padapter, channel); */ @@ -606,9 +603,8 @@ void WMMOnAssocRsp(struct adapter *padapter) } } - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) pxmitpriv->wmm_para_seq[i] = inx[i]; - } } static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) @@ -852,13 +848,11 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) len = packet_len - sizeof(struct rtw_ieee80211_hdr_3addr); - if (len > MAX_IE_SZ) { + if (len > MAX_IE_SZ) return _FAIL; - } - if (memcmp(cur_network->network.MacAddress, pbssid, 6)) { + if (memcmp(cur_network->network.MacAddress, pbssid, 6)) return true; - } bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); if (!bssid) @@ -907,23 +901,20 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) bcn_channel = *(p + 2); } else {/* In 5G, some ap do not have DSSET IE checking HT info for channel */ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); - if (pht_info) { - bcn_channel = pht_info->primary_channel; - } else { /* we don't find channel IE, so don't check it */ - bcn_channel = Adapter->mlmeextpriv.cur_channel; - } - } - if (bcn_channel != Adapter->mlmeextpriv.cur_channel) { - goto _mismatch; + if (pht_info) + bcn_channel = pht_info->primary_channel; + else /* we don't find channel IE, so don't check it */ + bcn_channel = Adapter->mlmeextpriv.cur_channel; } + if (bcn_channel != Adapter->mlmeextpriv.cur_channel) + goto _mismatch; /* checking SSID */ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); - if (!p) { + if (!p) hidden_ssid = true; - } else { + else hidden_ssid = false; - } if ((NULL != p) && (false == hidden_ssid && (*(p + 1)))) { memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1)); @@ -935,9 +926,8 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) if (memcmp(bssid->Ssid.Ssid, cur_network->network.Ssid.Ssid, 32) || bssid->Ssid.SsidLength != cur_network->network.Ssid.SsidLength) { - if (bssid->Ssid.Ssid[0] != '\0' && bssid->Ssid.SsidLength != 0) { /* not hidden ssid */ + if (bssid->Ssid.Ssid[0] != '\0' && bssid->Ssid.SsidLength != 0) /* not hidden ssid */ goto _mismatch; - } } /* check encryption info */ @@ -948,9 +938,8 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) else bssid->Privacy = 0; - if (cur_network->network.Privacy != bssid->Privacy) { + if (cur_network->network.Privacy != bssid->Privacy) goto _mismatch; - } rtw_get_sec_ie(bssid->IEs, bssid->IELength, NULL, &rsn_len, NULL, &wpa_len); @@ -963,9 +952,8 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) encryp_protocol = ENCRYP_PROTOCOL_WEP; } - if (cur_network->BcnInfo.encryp_protocol != encryp_protocol) { + if (cur_network->BcnInfo.encryp_protocol != encryp_protocol) goto _mismatch; - } if (encryp_protocol == ENCRYP_PROTOCOL_WPA || encryp_protocol == ENCRYP_PROTOCOL_WPA2) { pbuf = rtw_get_wpa_ie(&bssid->IEs[12], &wpa_ielen, bssid->IELength - 12); @@ -978,13 +966,11 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) rtw_parse_wpa2_ie(pbuf, wpa_ielen + 2, &group_cipher, &pairwise_cipher, &is_8021x); } - if (pairwise_cipher != cur_network->BcnInfo.pairwise_cipher || group_cipher != cur_network->BcnInfo.group_cipher) { + if (pairwise_cipher != cur_network->BcnInfo.pairwise_cipher || group_cipher != cur_network->BcnInfo.group_cipher) goto _mismatch; - } - if (is_8021x != cur_network->BcnInfo.is_8021x) { + if (is_8021x != cur_network->BcnInfo.is_8021x) goto _mismatch; - } } kfree(bssid); @@ -1253,10 +1239,8 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) return HT_IOT_PEER_AIRGO; } else if (!memcmp(pIE->data, EPIGRAM_OUI, 3)) { epigram_vendor_flag = 1; - if (ralink_vendor_flag) { + if (ralink_vendor_flag) return HT_IOT_PEER_TENDA; - } else { - } } else { break; } @@ -1268,13 +1252,12 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) i += (pIE->Length + 2); } - if (ralink_vendor_flag && !epigram_vendor_flag) { + if (ralink_vendor_flag && !epigram_vendor_flag) return HT_IOT_PEER_RALINK; - } else if (ralink_vendor_flag && epigram_vendor_flag) { + else if (ralink_vendor_flag && epigram_vendor_flag) return HT_IOT_PEER_TENDA; - } else { + else return HT_IOT_PEER_UNKNOWN; - } } void update_IOT_info(struct adapter *padapter) diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index 3ad124f6f3c7..0b87ce342bfb 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -458,7 +458,6 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p } } } - } else if (0x888e == pattrib->ether_type) { } if ((pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1)) @@ -887,9 +886,8 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct if (!psta) return _FAIL; - if (!pxmitframe->buf_addr) { + if (!pxmitframe->buf_addr) return _FAIL; - } pbuf_start = pxmitframe->buf_addr; @@ -1123,9 +1121,8 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv) pxmitbuf->priv_data = NULL; /* pxmitbuf->ext_tag = true; */ - if (pxmitbuf->sctx) { + if (pxmitbuf->sctx) rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC); - } } spin_unlock_irqrestore(&pfree_queue->lock, flags); @@ -1177,9 +1174,8 @@ struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv) if (pxmitbuf) { pxmitpriv->free_xmitbuf_cnt--; pxmitbuf->priv_data = NULL; - if (pxmitbuf->sctx) { + if (pxmitbuf->sctx) rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC); - } } spin_unlock_irqrestore(&pfree_xmitbuf_queue->lock, flags); @@ -1194,9 +1190,8 @@ s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) if (!pxmitbuf) return _FAIL; - if (pxmitbuf->sctx) { + if (pxmitbuf->sctx) rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_FREE); - } if (pxmitbuf->ext_tag) { rtw_free_xmitbuf_ext(pxmitpriv, pxmitbuf); @@ -1588,9 +1583,8 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) } newskb = skb_copy(skb, GFP_ATOMIC); - if (!newskb) { + if (!newskb) return -1; - } dev_kfree_skb_any(skb); *pskb = skb = newskb; @@ -1602,19 +1596,15 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) } } - if (skb_is_nonlinear(skb)) - ; - res = skb_linearize(skb); - if (res < 0) { - return -1; - } + if (res < 0) + return -1; res = nat25_db_handle(padapter, skb, NAT25_INSERT); if (res < 0) { - if (res == -2) { + if (res == -2) return -1; - } + return 0; } } @@ -1633,9 +1623,9 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) } /* check if SA is equal to our MAC */ - if (memcmp(skb->data + ETH_ALEN, GET_MY_HWADDR(padapter), ETH_ALEN)) { + if (memcmp(skb->data + ETH_ALEN, GET_MY_HWADDR(padapter), ETH_ALEN)) return -1; - } + return 0; } @@ -1702,9 +1692,8 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) s32 res; pxmitframe = rtw_alloc_xmitframe(pxmitpriv); - if (!pxmitframe) { + if (!pxmitframe) return -1; - } rcu_read_lock(); br_port = rcu_dereference(padapter->pnetdev->rx_handler_data); @@ -2124,12 +2113,11 @@ int rtw_sctx_wait(struct submit_ctx *sctx) int status = 0; expire = sctx->timeout_ms ? msecs_to_jiffies(sctx->timeout_ms) : MAX_SCHEDULE_TIMEOUT; - if (!wait_for_completion_timeout(&sctx->done, expire)) { + if (!wait_for_completion_timeout(&sctx->done, expire)) /* timeout, do something?? */ status = RTW_SCTX_DONE_TIMEOUT; - } else { + else status = sctx->status; - } if (status == RTW_SCTX_DONE_SUCCESS) ret = _SUCCESS; @@ -2155,8 +2143,7 @@ static bool rtw_sctx_chk_waring_status(int status) void rtw_sctx_done_err(struct submit_ctx **sctx, int status) { if (*sctx) { - if (rtw_sctx_chk_waring_status(status)) - ; + rtw_sctx_chk_waring_status(status); (*sctx)->status = status; complete(&((*sctx)->done)); *sctx = NULL; diff --git a/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c b/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c index eb22ac17c586..5b91aec6a7e3 100644 --- a/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c +++ b/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c @@ -63,9 +63,8 @@ u8 HalPwrSeqCmdParsing(struct adapter *padapter, struct wl_pwr_cfg pwrseqcmd[]) else udelay(10); - if (poll_count++ > max_poll_count) { + if (poll_count++ > max_poll_count) return false; - } } while (!poll_bit); break; case PWR_CMD_DELAY: diff --git a/drivers/staging/r8188eu/hal/hal_intf.c b/drivers/staging/r8188eu/hal/hal_intf.c index 008098040a07..37935aef71ea 100644 --- a/drivers/staging/r8188eu/hal/hal_intf.c +++ b/drivers/staging/r8188eu/hal/hal_intf.c @@ -34,8 +34,6 @@ uint rtw_hal_deinit(struct adapter *adapt) if (status == _SUCCESS) adapt->hw_init_completed = false; - else - ; return status; } diff --git a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c index 93dfd3dee59b..f1464e4ba429 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c @@ -54,9 +54,8 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 *p u32 h2c_cmd = 0; u32 h2c_cmd_ex = 0; - if (!adapt->bFWReady) { + if (!adapt->bFWReady) return _FAIL; - } if (!pCmdBuffer || CmdLen > RTL88E_MAX_CMD_LEN || adapt->bSurpriseRemoved) return _FAIL; @@ -65,9 +64,8 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 *p do { h2c_box_num = haldata->LastHMEBoxNum; - if (!_is_fw_read_cmd_down(adapt, h2c_box_num)) { + if (!_is_fw_read_cmd_down(adapt, h2c_box_num)) return _FAIL; - } *(u8 *)(&h2c_cmd) = ElementID; @@ -275,9 +273,8 @@ static void ConstructBeacon(struct adapter *adapt, u8 *pframe, u32 *pLength) _ConstructBeacon: - if ((pktlen + TXDESC_SIZE) > 512) { + if ((pktlen + TXDESC_SIZE) > 512) return; - } *pLength = pktlen; } @@ -443,9 +440,8 @@ static void SetFwRsvdPagePkt(struct adapter *adapt, bool bDLFinished) struct rsvdpage_loc RsvdPageLoc; ReservedPagePacket = kzalloc(1000, GFP_KERNEL); - if (!ReservedPagePacket) { + if (!ReservedPagePacket) return; - } pxmitpriv = &adapt->xmitpriv; pmlmeext = &adapt->mlmeextpriv; @@ -554,9 +550,8 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *adapt, u8 mstatus) rtw_write8(adapt, REG_BCN_CTRL, rtw_read8(adapt, REG_BCN_CTRL) & (~BIT(3))); rtw_write8(adapt, REG_BCN_CTRL, rtw_read8(adapt, REG_BCN_CTRL) | BIT(4)); - if (haldata->RegFwHwTxQCtrl & BIT(6)) { + if (haldata->RegFwHwTxQCtrl & BIT(6)) bSendBeacon = true; - } /* Set FWHW_TXQ_CTRL 0x422[6]=0 to tell Hw the packet is not a real beacon frame. */ rtw_write8(adapt, REG_FWHW_TXQ_CTRL + 2, (haldata->RegFwHwTxQCtrl & (~BIT(6)))); @@ -579,12 +574,6 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *adapt, u8 mstatus) } while (!bcn_valid && (poll % 10) != 0 && !adapt->bSurpriseRemoved && !adapt->bDriverStopped); } while (!bcn_valid && DLBcnCount <= 100 && !adapt->bSurpriseRemoved && !adapt->bDriverStopped); - if (adapt->bSurpriseRemoved || adapt->bDriverStopped) - ; - else if (!bcn_valid) - ; - else - ; /* */ /* We just can send the reserved page twice during the time that Tx thread is stopped (e.g. pnpsetpower) */ /* because we need to free the Tx BCN Desc which is used by the first reserved page packet. */ @@ -607,9 +596,8 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *adapt, u8 mstatus) } /* Update RSVD page location H2C to Fw. */ - if (bcn_valid) { + if (bcn_valid) SetHwReg8188EU(adapt, HW_VAR_BCN_VALID, NULL); - } /* Do not enable HW DMA BCN or it will cause Pcie interface hang by timing issue. 2011.11.24. by tynli. */ /* Clear CR[8] or beacon packet will not be send to TxBuf anymore. */ diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index f83ae7a7e5d9..cf58dfc3ff4d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -19,9 +19,8 @@ static void iol_mode_enable(struct adapter *padapter, u8 enable) reg_0xf0 = rtw_read8(padapter, REG_SYS_CFG); rtw_write8(padapter, REG_SYS_CFG, reg_0xf0 | SW_OFFLOAD_EN); - if (!padapter->bFWReady) { + if (!padapter->bFWReady) rtw_reset_8051(padapter); - } } else { /* disable initial offload */ @@ -76,14 +75,12 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) u8 u1temp = 0; efuseTbl = kzalloc(EFUSE_MAP_LEN_88E, GFP_KERNEL); - if (!efuseTbl) { + if (!efuseTbl) goto exit; - } eFuseWord = rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); - if (!eFuseWord) { + if (!eFuseWord) goto exit; - } /* 0. Refresh efuse init map as all oxFF. */ for (i = 0; i < EFUSE_MAX_SECTION_88E; i++) @@ -213,9 +210,8 @@ static void efuse_read_phymap_from_txpktbuf( rtw_write8(adapter, REG_TXPKTBUF_DBG, 0); start = jiffies; while (!(reg_0x143 = rtw_read8(adapter, REG_TXPKTBUF_DBG)) && - (passing_time = rtw_get_passing_time_ms(start)) < 1000) { + (passing_time = rtw_get_passing_time_ms(start)) < 1000) rtw_usleep_os(100); - } /* data from EEPROM needs to be in LE */ lo32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L)); @@ -373,19 +369,16 @@ static void Hal_EfuseReadEFuse88E(struct adapter *Adapter, /* */ /* Do NOT excess total size of EFuse table. Added by Roger, 2008.11.10. */ /* */ - if ((_offset + _size_byte) > EFUSE_MAP_LEN_88E) {/* total E-Fuse table is 512bytes */ + if ((_offset + _size_byte) > EFUSE_MAP_LEN_88E) /* total E-Fuse table is 512bytes */ goto exit; - } efuseTbl = kzalloc(EFUSE_MAP_LEN_88E, GFP_KERNEL); - if (!efuseTbl) { + if (!efuseTbl) goto exit; - } eFuseWord = rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); - if (!eFuseWord) { + if (!eFuseWord) goto exit; - } /* 0. Refresh efuse init map as all oxFF. */ for (i = 0; i < EFUSE_MAX_SECTION_88E; i++) @@ -536,11 +529,10 @@ void rtl8188e_SetHalODMVar(struct adapter *Adapter, void *pValue1, bool bSet) void hal_notch_filter_8188e(struct adapter *adapter, bool enable) { - if (enable) { + if (enable) rtw_write8(adapter, rOFDM0_RxDSP + 1, rtw_read8(adapter, rOFDM0_RxDSP + 1) | BIT(1)); - } else { + else rtw_write8(adapter, rOFDM0_RxDSP + 1, rtw_read8(adapter, rOFDM0_RxDSP + 1) & ~BIT(1)); - } } u8 GetEEPROMSize8188E(struct adapter *padapter) @@ -764,15 +756,14 @@ static void hal_get_chnl_group_88e(u8 chnl, u8 *group) void Hal_ReadPowerSavingMode88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail) { - if (AutoLoadFail) { + if (AutoLoadFail) padapter->pwrctrlpriv.bSupportRemoteWakeup = false; - } else { + else /* hw power down mode selection , 0:rf-off / 1:power down */ /* decide hw if support remote wakeup function */ /* if hw supported, 8051 (SIE) will generate WeakUP signal(D+/D- toggle) when autoresume */ padapter->pwrctrlpriv.bSupportRemoteWakeup = (hwinfo[EEPROM_USB_OPTIONAL_FUNCTION0] & BIT(1)) ? true : false; - } } void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool AutoLoadFail) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index 5c8d43014603..ea75ff11ad17 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -684,9 +684,6 @@ static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel) u32 param1, param2; struct hal_data_8188e *pHalData = &Adapter->haldata; - if (Adapter->bNotifyChannelChange) - ; - /* s1. pre common command - CmdID_SetTxPowerLevel */ PHY_SetTxPowerLevel8188E(Adapter, channel); diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 08bdf715d872..6af72b3e7a7d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -106,12 +106,7 @@ void rtl8188eu_free_recv_priv(struct adapter *padapter) kfree(precvpriv->pallocated_recv_buf); - if (skb_queue_len(&precvpriv->rx_skb_queue)) - ; skb_queue_purge(&precvpriv->rx_skb_queue); - if (skb_queue_len(&precvpriv->free_recv_skb_queue)) - ; - skb_queue_purge(&precvpriv->free_recv_skb_queue); } diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c index db6ad97d6a2b..69b66eb458b0 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c @@ -264,8 +264,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag ptxdesc->txdw5 |= cpu_to_le32(0x00300000);/* retry limit = 12 */ ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate(pmlmeext->tx_rate)); - } else if ((pxmitframe->frame_tag & 0x0f) == TXAGG_FRAMETAG) { - } else { + } else if ((pxmitframe->frame_tag & 0x0f) != TXAGG_FRAMETAG) { /* offset 4 */ ptxdesc->txdw1 |= cpu_to_le32((4) & 0x3f);/* CAM_ID(MAC_ID) */ @@ -569,8 +568,7 @@ static s32 xmitframe_direct(struct adapter *adapt, struct xmit_frame *pxmitframe res = rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe); if (res == _SUCCESS) rtw_dump_xframe(adapt, pxmitframe); - else - ; + return res; } diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 59d21a212d23..0704fa3156af 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -57,9 +57,8 @@ u32 rtl8188eu_InitPowerOn(struct adapter *adapt) if (haldata->bMacPwrCtrlOn) return _SUCCESS; - if (!HalPwrSeqCmdParsing(adapt, Rtl8188E_NIC_PWR_ON_FLOW)) { + if (!HalPwrSeqCmdParsing(adapt, Rtl8188E_NIC_PWR_ON_FLOW)) return _FAIL; - } /* Enable MAC DMA/WMAC/SCHEDULE/SEC block */ /* Set CR bit10 to enable 32k calibration. Suggested by SD1 Gimmy. Added by tynli. 2011.08.31. */ @@ -577,27 +576,23 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) haldata->LastHMEBoxNum = 0; status = PHY_MACConfig8188E(Adapter); - if (status == _FAIL) { + if (status == _FAIL) goto exit; - } /* */ /* d. Initialize BB related configurations. */ /* */ status = PHY_BBConfig8188E(Adapter); - if (status == _FAIL) { + if (status == _FAIL) goto exit; - } status = PHY_RFConfig8188E(Adapter); - if (status == _FAIL) { + if (status == _FAIL) goto exit; - } status = rtl8188e_iol_efuse_patch(Adapter); - if (status == _FAIL) { + if (status == _FAIL) goto exit; - } _InitTxBufferBoundary(Adapter, txpktbuf_bndy); @@ -1331,8 +1326,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) if (!(rtw_read32(Adapter, REG_RXPKT_NUM) & RXDMA_IDLE)) break; } while (trycnt--); - if (trycnt == 0) - ; /* RQPN Load 0 */ rtw_write16(Adapter, REG_RQPN_NPQ, 0x0); @@ -1426,10 +1419,7 @@ void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariab *((u32 *)pValue) = haldata->odmpriv.SupportAbility; break; case HW_DEF_RA_INFO_DUMP: - { - if (check_fwstate(&Adapter->mlmepriv, _FW_LINKED)) { - } - } + check_fwstate(&Adapter->mlmepriv, _FW_LINKED); break; case HAL_DEF_DBG_DUMP_RXPKT: *((u8 *)pValue) = haldata->bDumpRxPkt; diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 2f3cdc356d2a..6bd2164ce1fa 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -209,9 +209,8 @@ static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb) prxstat = (struct recv_stat *)pbuf; precvframe = rtw_alloc_recvframe(pfree_recv_queue); - if (!precvframe) { + if (!precvframe) goto _exit_recvbuf2recvframe; - } INIT_LIST_HEAD(&precvframe->list); precvframe->precvbuf = NULL; /* can't access the precvbuf for new arch. */ @@ -435,9 +434,8 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) /* re-assign for linux based on skb */ if (!precvbuf->reuse || !precvbuf->pskb) { precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); - if (!precvbuf->pskb) { + if (!precvbuf->pskb) return _FAIL; - } tmpaddr = (size_t)precvbuf->pskb->data; alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1); @@ -472,9 +470,8 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) precvbuf);/* context is precvbuf */ err = usb_submit_urb(purb, GFP_ATOMIC); - if ((err) && (err != (-EPERM))) { + if ((err) && (err != (-EPERM))) ret = _FAIL; - } return ret; } @@ -491,9 +488,8 @@ void rtl8188eu_xmit_tasklet(unsigned long priv) while (1) { if ((adapt->bDriverStopped) || (adapt->bSurpriseRemoved) || - (adapt->bWritePortCancel)) { + (adapt->bWritePortCancel)) break; - } ret = rtl8188eu_xmitframe_complete(adapt, pxmitpriv, NULL); diff --git a/drivers/staging/r8188eu/include/usb_ops.h b/drivers/staging/r8188eu/include/usb_ops.h index edef3ad1ccd9..14526fcff4ae 100644 --- a/drivers/staging/r8188eu/include/usb_ops.h +++ b/drivers/staging/r8188eu/include/usb_ops.h @@ -30,9 +30,9 @@ static inline int rtw_inc_and_chk_continual_urb_error(struct dvobj_priv *dvobj) int ret = false; int value; value = atomic_inc_return(&dvobj->continual_urb_error); - if (value > MAX_CONTINUAL_URB_ERR) { + if (value > MAX_CONTINUAL_URB_ERR) ret = true; - } + return ret; } diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 97cce74b2b28..eb9375b0c660 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -355,8 +355,7 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value) padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; } - } else if (value & AUTH_ALG_LEAP) { - } else { + } else if (!(value & AUTH_ALG_LEAP)) { ret = -EINVAL; } return ret; @@ -521,13 +520,6 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie goto exit; } - /* dump */ - { - int i; - for (i = 0; i < ielen; i += 8) - ; - } - if (ielen < RSN_HEADER_LEN) { ret = -1; goto exit; @@ -1118,7 +1110,6 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, _status = rtw_sitesurvey_cmd(padapter, ssid, 1, NULL, 0); spin_unlock_bh(&pmlmepriv->lock); - } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { } } else { if (wrqu->data.length >= WEXT_CSCAN_HEADER_SIZE && @@ -1284,9 +1275,6 @@ static int rtw_wx_set_essid(struct net_device *dev, if (wrqu->essid.flags && wrqu->essid.length) { len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? wrqu->essid.length : IW_ESSID_MAX_SIZE; - if (wrqu->essid.length != 33) - ; - memset(&ndis_ssid, 0, sizeof(struct ndis_802_11_ssid)); ndis_ssid.SsidLength = len; memcpy(ndis_ssid.Ssid, extra, len); @@ -2028,9 +2016,7 @@ static int rtw_wx_set_channel_plan(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 channel_plan_req = (u8)(*((int *)wrqu)); - if (_SUCCESS == rtw_set_chplan_cmd(padapter, channel_plan_req)) - ; - else + if (rtw_set_chplan_cmd(padapter, channel_plan_req) != _SUCCESS) return -EPERM; return 0; @@ -2137,7 +2123,6 @@ static int rtw_set_pid(struct net_device *dev, if (selector < 3 && selector >= 0) { padapter->pid[selector] = *(pdata + 1); ui_pid[selector] = *(pdata + 1); - } else { } exit: return ret; @@ -2385,9 +2370,6 @@ static void rtw_p2p_get_status(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo = &padapter->wdinfo; - if (padapter->bShowGetP2PState) - ; - /* Commented by Albert 2010/10/12 */ /* Because of the output size limitation, I had removed the "Role" information. */ /* About the "Role" information, we will use the new private IOCTL to get the "Role" information. */ @@ -2870,9 +2852,8 @@ static int rtw_p2p_connect(struct net_device *dev, /* Format: 00:E0:4C:00:00:05 */ /* Format: 00:E0:4C:00:00:05 */ - if (pwdinfo->p2p_state == P2P_STATE_NONE) { + if (pwdinfo->p2p_state == P2P_STATE_NONE) return ret; - } if (pwdinfo->ui_got_wps_info == P2P_NO_WPSINFO) return -1; @@ -2945,9 +2926,8 @@ static void rtw_p2p_invite_req(struct net_device *dev, /* Command line sample: iwpriv wlan0 p2p_set invite ="00:11:22:33:44:55 00:E0:4C:00:00:05 DIRECT-xy" */ /* Format: 00:11:22:33:44:55 00:E0:4C:00:00:05 DIRECT-xy */ - if (wrqu->data.length <= 37) { + if (wrqu->data.length <= 37) return; - } if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { return; @@ -3020,7 +3000,6 @@ static void rtw_p2p_invite_req(struct net_device *dev, _set_timer(&pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT); _set_timer(&pwdinfo->restore_p2p_state_timer, P2P_INVITE_TIMEOUT); - } else { } } @@ -3088,17 +3067,16 @@ static void rtw_p2p_prov_disc(struct net_device *dev, for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) peerMAC[jj] = key_2char2num(extra[kk], extra[kk + 1]); - if (!memcmp(&extra[18], "display", 7)) { + if (!memcmp(&extra[18], "display", 7)) pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_DISPLYA; - } else if (!memcmp(&extra[18], "keypad", 7)) { + else if (!memcmp(&extra[18], "keypad", 7)) pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_KEYPAD; - } else if (!memcmp(&extra[18], "pbc", 3)) { + else if (!memcmp(&extra[18], "pbc", 3)) pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON; - } else if (!memcmp(&extra[18], "label", 5)) { + else if (!memcmp(&extra[18], "label", 5)) pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_LABEL; - } else { + else return; - } spin_lock_bh(&pmlmepriv->scanned_queue.lock); @@ -3165,7 +3143,6 @@ static void rtw_p2p_prov_disc(struct net_device *dev, _set_timer(&pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT); _set_timer(&pwdinfo->restore_p2p_state_timer, P2P_PROVISION_TIMEOUT); - } else { } } @@ -3256,10 +3233,6 @@ static int rtw_p2p_get(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - - if (padapter->bShowGetP2PState) - ; if (!memcmp(wrqu->data.pointer, "status", 6)) { rtw_p2p_get_status(dev, info, wrqu, extra); } else if (!memcmp(wrqu->data.pointer, "role", 4)) { @@ -3425,7 +3398,6 @@ static int rtw_dbg_port(struct net_device *dev, u16 arg; s32 extra_arg; u32 *pdata, val32; - struct sta_info *psta; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -3545,7 +3517,6 @@ static int rtw_dbg_port(struct net_device *dev, u16 start_value = 0; u32 write_num = extra_arg; int i; - u8 final; struct xmit_frame *xmit_frame; xmit_frame = rtw_IOL_accquire_xmit_frame(padapter); @@ -3559,11 +3530,7 @@ static int rtw_dbg_port(struct net_device *dev, if (rtl8188e_IOL_exec_cmds_sync(padapter, xmit_frame, 5000, 0) != _SUCCESS) ret = -EPERM; - final = rtw_read8(padapter, reg); - if (start_value + write_num - 1 == final) - ; - else - ; + rtw_read8(padapter, reg); } break; @@ -3574,7 +3541,6 @@ static int rtw_dbg_port(struct net_device *dev, u32 write_num = extra_arg; int i; - u16 final; struct xmit_frame *xmit_frame; xmit_frame = rtw_IOL_accquire_xmit_frame(padapter); @@ -3588,11 +3554,7 @@ static int rtw_dbg_port(struct net_device *dev, if (rtl8188e_IOL_exec_cmds_sync(padapter, xmit_frame, 5000, 0) != _SUCCESS) ret = -EPERM; - final = rtw_read16(padapter, reg); - if (start_value + write_num - 1 == final) - ; - else - ; + rtw_read16(padapter, reg); } break; case 0x08: /* continuous write dword test */ @@ -3602,7 +3564,6 @@ static int rtw_dbg_port(struct net_device *dev, u32 write_num = extra_arg; int i; - u32 final; struct xmit_frame *xmit_frame; xmit_frame = rtw_IOL_accquire_xmit_frame(padapter); @@ -3616,11 +3577,7 @@ static int rtw_dbg_port(struct net_device *dev, if (rtl8188e_IOL_exec_cmds_sync(padapter, xmit_frame, 5000, 0) != _SUCCESS) ret = -EPERM; - final = rtw_read32(padapter, reg); - if (start_value + write_num - 1 == final) - ; - else - ; + rtw_read32(padapter, reg); } break; } @@ -3659,18 +3616,7 @@ static int rtw_dbg_port(struct net_device *dev, case 0x04: break; case 0x05: - psta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress); - if (psta) { - int i; - struct recv_reorder_ctrl *preorder_ctrl; - - for (i = 0; i < 16; i++) { - preorder_ctrl = &psta->recvreorder_ctrl[i]; - if (preorder_ctrl->enable) - ; - } - } else { - } + rtw_get_stainfo(pstapriv, cur_network->network.MacAddress); break; case 0x06: { @@ -3685,33 +3631,6 @@ static int rtw_dbg_port(struct net_device *dev, case 0x08: break; case 0x09: - { - int i, j; - struct list_head *plist, *phead; - struct recv_reorder_ctrl *preorder_ctrl; - - spin_lock_bh(&pstapriv->sta_hash_lock); - - for (i = 0; i < NUM_STA; i++) { - phead = &pstapriv->sta_hash[i]; - plist = phead->next; - - while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); - - plist = plist->next; - - if (extra_arg == psta->aid) { - for (j = 0; j < 16; j++) { - preorder_ctrl = &psta->recvreorder_ctrl[j]; - if (preorder_ctrl->enable) - ; - } - } - } - } - spin_unlock_bh(&pstapriv->sta_hash_lock); - } break; case 0x0c:/* dump rx/tx packet */ if (arg == 0) { @@ -3735,20 +3654,16 @@ static int rtw_dbg_port(struct net_device *dev, if (extra_arg == 0 || extra_arg == 1 || extra_arg == 2 || - extra_arg == 3) { + extra_arg == 3) pregpriv->rx_stbc = extra_arg; - } else { - } } break; case 0x13: /* set ampdu_enable */ { struct registry_priv *pregpriv = &padapter->registrypriv; /* 0: disable, 0x1:enable (but wifi_spec should be 0), 0x2: force enable (don't care wifi_spec) */ - if (extra_arg >= 0 && extra_arg < 3) { + if (extra_arg >= 0 && extra_arg < 3) pregpriv->ampdu_enable = extra_arg; - } else { - } } break; case 0x14: /* get wifi_spec */ diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c index 9884dbc6eab5..197568422ece 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -487,17 +487,14 @@ u8 rtw_init_drv_sw(struct adapter *padapter) if (init_mlme_ext_priv(padapter) == _FAIL) return _FAIL; - if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { + if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) return _FAIL; - } - if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { + if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) return _FAIL; - } - if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) { + if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) return _FAIL; - } padapter->stapriv.padapter = padapter; diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c index 79d2d640ddfa..ffd727fb32e3 100644 --- a/drivers/staging/r8188eu/os_dep/usb_intf.c +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c @@ -139,14 +139,13 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf) dvobj->NumInterfaces != 3) || (dvobj->InterfaceNumber == 1)) { if (interface_to_usbdev(usb_intf)->state != - USB_STATE_NOTATTACHED) { + USB_STATE_NOTATTACHED) /* If we didn't unplug usb dongle and * remove/insert module, driver fails * on sitesurvey for the first time when * device is up . Reset usb port for sitesurvey * fail issue. */ usb_reset_device(interface_to_usbdev(usb_intf)); - } } kfree(dvobj); } @@ -204,9 +203,8 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) int ret = 0; if ((!padapter->bup) || (padapter->bDriverStopped) || - (padapter->bSurpriseRemoved)) { + (padapter->bSurpriseRemoved)) goto exit; - } pwrpriv->bInSuspend = true; rtw_cancel_all_timer(padapter); @@ -223,9 +221,8 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) rtw_disassoc_cmd(padapter, 0, false); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && - check_fwstate(pmlmepriv, _FW_LINKED)) { + check_fwstate(pmlmepriv, _FW_LINKED)) pmlmepriv->to_roaming = 1; - } /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect(padapter); /* s2-3. */ @@ -272,9 +269,8 @@ static int rtw_resume(struct usb_interface *pusb_intf) mutex_unlock(&pwrpriv->lock); - if (padapter->pid[1] != 0) { + if (padapter->pid[1] != 0) rtw_signal_process(padapter->pid[1], SIGUSR2); - } rtw_roaming(padapter, NULL); @@ -355,13 +351,11 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, /* 2012-07-11 Move here to prevent the 8723AS-VAU BT auto * suspend influence */ - if (usb_autopm_get_interface(pusb_intf) < 0) - ; + usb_autopm_get_interface(pusb_intf); /* alloc dev name after read efuse. */ - if (rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname) < 0) { + if (rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname) < 0) goto free_drv_sw; - } rtw_macaddr_cfg(padapter->eeprompriv.mac_addr); rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr, padapter->eeprompriv.mac_addr); @@ -421,13 +415,11 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device goto err; if1 = rtw_usb_if1_init(dvobj, pusb_intf); - if (!if1) { + if (!if1) goto free_dvobj; - } - if (ui_pid[1] != 0) { + if (ui_pid[1] != 0) rtw_signal_process(ui_pid[1], SIGUSR2); - } return 0; diff --git a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c index 82e680abcd61..c4b6dbc8d66d 100644 --- a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c +++ b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c @@ -62,9 +62,8 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) } if (padapter->bSurpriseRemoved || padapter->bDriverStopped || - padapter->bWritePortCancel) { + padapter->bWritePortCancel) goto check_completion; - } if (purb->status) { if (purb->status == -EINPROGRESS) { diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c index 6032831364c4..717b980a8c72 100644 --- a/drivers/staging/r8188eu/os_dep/xmit_linux.c +++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c @@ -78,9 +78,8 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb for (i = 0; i < 8; i++) { pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); - if (!pxmitbuf->pxmit_urb[i]) { + if (!pxmitbuf->pxmit_urb[i]) return _FAIL; - } } return _SUCCESS; } -- cgit From 9106c8c7898236848927884d3333327d88eb2177 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:07:07 +0000 Subject: staging: r8188eu: remove rtw_sctx_chk_waring_status function Remove the rtw_sctx_chk_waring_status function from core/rtw_amit.c, as it has only one caller which is unnecessary. Suggested-by: Dan Carpenter Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-14-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_xmit.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index 0b87ce342bfb..c2a550e7250e 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -2125,25 +2125,9 @@ int rtw_sctx_wait(struct submit_ctx *sctx) return ret; } -static bool rtw_sctx_chk_waring_status(int status) -{ - switch (status) { - case RTW_SCTX_DONE_UNKNOWN: - case RTW_SCTX_DONE_BUF_ALLOC: - case RTW_SCTX_DONE_BUF_FREE: - - case RTW_SCTX_DONE_DRV_STOP: - case RTW_SCTX_DONE_DEV_REMOVE: - return true; - default: - return false; - } -} - void rtw_sctx_done_err(struct submit_ctx **sctx, int status) { if (*sctx) { - rtw_sctx_chk_waring_status(status); (*sctx)->status = status; complete(&((*sctx)->done)); *sctx = NULL; -- cgit From 7e2f6bf6adf21e02396f4baf8e8f2aa113de9ff5 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:07:08 +0000 Subject: staging: r8188eu: remove padapter param from aes_decipher function Remove padapter parameter from aes_decipher function in core/rtw_security.c, as I added it previously during debugging tweaks and it is no longer required. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-15-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_security.c b/drivers/staging/r8188eu/core/rtw_security.c index 7861dfa235c0..b73aea8a7fb5 100644 --- a/drivers/staging/r8188eu/core/rtw_security.c +++ b/drivers/staging/r8188eu/core/rtw_security.c @@ -1144,7 +1144,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe) return res; } -static int aes_decipher(struct adapter *padapter, u8 *key, uint hdrlen, +static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) { static u8 message[MAX_MSG_SIZE]; @@ -1365,7 +1365,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, struct recv_frame *precvframe) prwskey = &stainfo->dot118021x_UncstKey.skey[0]; } length = precvframe->len - prxattrib->hdrlen - prxattrib->iv_len; - res = aes_decipher(padapter, prwskey, prxattrib->hdrlen, pframe, length); + res = aes_decipher(prwskey, prxattrib->hdrlen, pframe, length); } else { res = _FAIL; } -- cgit From 695eac3c62b8141f3e0f474677bb390a0eeee023 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Wed, 16 Feb 2022 01:07:09 +0000 Subject: staging: r8188eu: correct long line warnings near prior DBG_88E calls Where it is possible (without out-of-patch-series-scope large scale refactoring), correct code to remove checkpatch warnings about lines that are too long, also correcting operator spacing where appropriate for these lines as well. These warnings occur mostly due to so many DBG_88E removals and parentheses tweaks etc. being adjacent to such long lines, which are therefore included in the resultant diff. Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220216010709.791-16-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_br_ext.c | 12 +++++++++--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ++- drivers/staging/r8188eu/core/rtw_p2p.c | 15 ++++++++++++--- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 3 ++- drivers/staging/r8188eu/core/rtw_wlan_util.c | 6 ++++-- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c index ddc3a2c8aaca..d68611ef22f8 100644 --- a/drivers/staging/r8188eu/core/rtw_br_ext.c +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c @@ -382,7 +382,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) if (protocol == ETH_P_IP) { struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN); - if (((unsigned char *)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len)) + if (((unsigned char *)(iph) + (iph->ihl << 2)) >= (skb->data + ETH_HLEN + skb->len)) return -1; switch (method) { @@ -451,7 +451,11 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) pOldTag = (struct pppoe_tag *)__nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID)); if (pOldTag) { /* if SID existed, copy old value and delete it */ old_tag_len = ntohs(pOldTag->tag_len); - if (old_tag_len+TAG_HDR_LEN+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN > sizeof(tag_buf)) + if (old_tag_len + + TAG_HDR_LEN + + MAGIC_CODE_LEN + + RTL_RELAY_TAG_LEN > + sizeof(tag_buf)) return -1; memcpy(tag->tag_data+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN, @@ -476,7 +480,9 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) return -1; } else { /* not add relay tag */ if (priv->pppoe_connection_in_progress && - memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN)) + memcmp(skb->data + ETH_ALEN, + priv->pppoe_addr, + ETH_ALEN)) return -2; if (priv->pppoe_connection_in_progress == 0) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 785eda58a5e5..0b77ddde6ce2 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3583,7 +3583,8 @@ static s32 rtw_action_public_decache(struct recv_frame *recv_frame, s32 token) if (GetRetry(frame)) { if (token >= 0) { - if ((seq_ctrl == mlmeext->action_public_rxseq) && (token == mlmeext->action_public_dialog_token)) + if ((seq_ctrl == mlmeext->action_public_rxseq) && + (token == mlmeext->action_public_dialog_token)) return _FAIL; } else { if (seq_ctrl == mlmeext->action_public_rxseq) diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c index 9467a5dcc990..48500fb82250 100644 --- a/drivers/staging/r8188eu/core/rtw_p2p.c +++ b/drivers/staging/r8188eu/core/rtw_p2p.c @@ -1154,7 +1154,8 @@ u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo, u8 *pframe, peer_operating_ch = operatingch_info[4]; if (rtw_p2p_is_channel_list_ok(peer_operating_ch, - ch_list_inclusioned, ch_num_inclusioned)) + ch_list_inclusioned, + ch_num_inclusioned)) /** * Change our operating channel as peer's for compatibility. */ @@ -1270,7 +1271,11 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe /* Try to get the operation channel information */ attr_contentlen = 0; - if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen)) + if (rtw_get_p2p_attr_content(p2p_ie, + p2p_ielen, + P2P_ATTR_OPERATING_CH, + operatingch_info, + &attr_contentlen)) pwdinfo->peer_operating_ch = operatingch_info[4]; /* Try to get the channel list information */ @@ -1377,7 +1382,11 @@ u8 process_p2p_group_negotation_confirm(struct wifidirect_info *pwdinfo, u8 *pfr } attr_contentlen = 0; - if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen)) + if (rtw_get_p2p_attr_content(p2p_ie, + p2p_ielen, + P2P_ATTR_OPERATING_CH, + operatingch_info, + &attr_contentlen)) pwdinfo->peer_operating_ch = operatingch_info[4]; /* Get the next P2P IE */ diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c index c7c79cd9e213..b20436f75459 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -171,7 +171,8 @@ static u8 PS_RDY_CHECK(struct adapter *padapter) return false; if (pwrpriv->bInSuspend) return false; - if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && !padapter->securitypriv.binstallGrpkey) + if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && + !padapter->securitypriv.binstallGrpkey) return false; return true; } diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index e8bf5672ff6c..33c0228204ad 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -926,7 +926,8 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) if (memcmp(bssid->Ssid.Ssid, cur_network->network.Ssid.Ssid, 32) || bssid->Ssid.SsidLength != cur_network->network.Ssid.SsidLength) { - if (bssid->Ssid.Ssid[0] != '\0' && bssid->Ssid.SsidLength != 0) /* not hidden ssid */ + /* not hidden ssid */ + if (bssid->Ssid.Ssid[0] != '\0' && bssid->Ssid.SsidLength != 0) goto _mismatch; } @@ -966,7 +967,8 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) rtw_parse_wpa2_ie(pbuf, wpa_ielen + 2, &group_cipher, &pairwise_cipher, &is_8021x); } - if (pairwise_cipher != cur_network->BcnInfo.pairwise_cipher || group_cipher != cur_network->BcnInfo.group_cipher) + if (pairwise_cipher != cur_network->BcnInfo.pairwise_cipher || + group_cipher != cur_network->BcnInfo.group_cipher) goto _mismatch; if (is_8021x != cur_network->BcnInfo.is_8021x) -- cgit From 1f3c2a776a370d8388e9958c94d13494388089b0 Mon Sep 17 00:00:00 2001 From: Riccardo Ferrazzo Date: Fri, 18 Feb 2022 11:53:58 +0100 Subject: staging: wfx: fix scan with WFM200 and WW regulation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some variants of the WF200 disallow active scan on channel 12 and 13. For these parts, the channels 12 and 13 are marked IEEE80211_CHAN_NO_IR. However, the beacon hint procedure was removing the flag IEEE80211_CHAN_NO_IR from channels where a BSS is discovered. This was making subsequent scans to fail because the driver was trying active scans on prohibited channels. Signed-off-by: Riccardo Ferrazzo Reviewed-by: Jérôme Pouiller Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220218105358.283769-1-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index d832a22850c7..5999e81dc44d 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -381,6 +381,7 @@ int wfx_probe(struct wfx_dev *wdev) } if (wdev->hw_caps.region_sel_mode) { + wdev->hw->wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS; wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[11].flags |= IEEE80211_CHAN_NO_IR; wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[12].flags |= -- cgit From 60f1d3c92dc1ef1026e5b917a329a7fa947da036 Mon Sep 17 00:00:00 2001 From: Xiaoke Wang Date: Fri, 18 Feb 2022 21:59:45 +0800 Subject: staging: wfx: fix an error handling in wfx_init_common() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One error handler of wfx_init_common() return without calling ieee80211_free_hw(hw), which may result in memory leak. And I add one err label to unify the error handler, which is useful for the subsequent changes. Suggested-by: Jérôme Pouiller Reviewed-by: Dan Carpenter Reviewed-by: Jérôme Pouiller Signed-off-by: Xiaoke Wang Link: https://lore.kernel.org/r/tencent_24A24A3EFF61206ECCC4B94B1C5C1454E108@qq.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 5999e81dc44d..ef23e0621065 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -305,7 +305,8 @@ struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_da of_property_read_string(dev->of_node, "silabs,antenna-config-file", &wdev->pdata.file_pds); wdev->pdata.gpio_wakeup = devm_gpiod_get_optional(dev, "wakeup", GPIOD_OUT_LOW); if (IS_ERR(wdev->pdata.gpio_wakeup)) - return NULL; + goto err; + if (wdev->pdata.gpio_wakeup) gpiod_set_consumer_name(wdev->pdata.gpio_wakeup, "wfx wakeup"); @@ -322,6 +323,10 @@ struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_da return NULL; return wdev; + +err: + ieee80211_free_hw(hw); + return NULL; } int wfx_probe(struct wfx_dev *wdev) -- cgit From 4fcc0c275e3f59cd68f977c57953783f8014ed15 Mon Sep 17 00:00:00 2001 From: Hangyu Hua Date: Mon, 21 Feb 2022 16:55:52 +0800 Subject: staging: qlge: add unregister_netdev in qlge_probe unregister_netdev need to be called when register_netdev succeeds qlge_health_create_reporters fails. Fixes: d8827ae8e22b ("staging: qlge: deal with the case that devlink_health_reporter_create fails") Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20220221085552.93561-1-hbh25y@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/qlge/qlge_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 9873bb2a9ee4..113a3efd12e9 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -4605,14 +4605,12 @@ static int qlge_probe(struct pci_dev *pdev, err = register_netdev(ndev); if (err) { dev_err(&pdev->dev, "net device registration failed.\n"); - qlge_release_all(pdev); - pci_disable_device(pdev); - goto netdev_free; + goto cleanup_pdev; } err = qlge_health_create_reporters(qdev); if (err) - goto netdev_free; + goto unregister_netdev; /* Start up the timer to trigger EEH if * the bus goes dead @@ -4626,6 +4624,11 @@ static int qlge_probe(struct pci_dev *pdev, devlink_register(devlink); return 0; +unregister_netdev: + unregister_netdev(ndev); +cleanup_pdev: + qlge_release_all(pdev); + pci_disable_device(pdev); netdev_free: free_netdev(ndev); devlink_free: -- cgit From 2b92c3946ea7b223c3a418f3f423bd1711f723f7 Mon Sep 17 00:00:00 2001 From: Marcelo Aloisio da Silva Date: Fri, 18 Feb 2022 01:01:40 -0300 Subject: staging: r8188eu: move out assignment in if condition Should not use assignment in if condition. Signed-off-by: Marcelo Aloisio da Silva Link: https://lore.kernel.org/r/20220218040140.GA22796@snoopy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_cmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index 46a49f30f900..6eca30124ee8 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -1318,7 +1318,8 @@ static void c2h_wk_callback(struct work_struct *work) evtpriv->c2h_wk_alive = true; while (!rtw_cbuf_empty(evtpriv->c2h_queue)) { - if ((c2h_evt = (struct c2h_evt_hdr *)rtw_cbuf_pop(evtpriv->c2h_queue)) != NULL) { + c2h_evt = (struct c2h_evt_hdr *)rtw_cbuf_pop(evtpriv->c2h_queue); + if (c2h_evt) { /* This C2H event is read, clear it */ rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE); } else { -- cgit From d9ae592bd743411e68718d4755b7af0711915c7f Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Fri, 18 Feb 2022 10:30:31 +0100 Subject: staging: r8188eu: RxMIMOSignalQuality is set but not used The RxMIMOSignalQuality array in struct signal_stat is set but not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220218093034.854049-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_HWConfig.c | 6 ------ drivers/staging/r8188eu/include/rtw_recv.h | 1 - 2 files changed, 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c index dcc38b036280..8ebcd3050892 100644 --- a/drivers/staging/r8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c @@ -67,9 +67,6 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm, isCCKrate = ((pPktinfo->Rate >= DESC92C_RATE1M) && (pPktinfo->Rate <= DESC92C_RATE11M)) ? true : false; - pPhyInfo->RxMIMOSignalQuality[RF_PATH_A] = -1; - pPhyInfo->RxMIMOSignalQuality[RF_PATH_B] = -1; - if (isCCKrate) { u8 cck_agc_rpt; @@ -150,8 +147,6 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm, SQ = ((64 - SQ_rpt) * 100) / 44; } pPhyInfo->SignalQuality = SQ; - pPhyInfo->RxMIMOSignalQuality[RF_PATH_A] = SQ; - pPhyInfo->RxMIMOSignalQuality[RF_PATH_B] = -1; } } else { /* is OFDM rate */ dm_odm->PhyDbgInfo.NumQryPhyStatusOFDM++; @@ -203,7 +198,6 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm, if (pPktinfo->bPacketMatchBSSID) { if (i == RF_PATH_A) /* Fill value in RFD, Get the first spatial stream only */ pPhyInfo->SignalQuality = (u8)(EVM & 0xff); - pPhyInfo->RxMIMOSignalQuality[i] = (u8)(EVM & 0xff); } } } diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index 920f33235e00..f82a26a675c0 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -72,7 +72,6 @@ struct signal_stat { struct phy_info { u8 RxPWDBAll; u8 SignalQuality; /* in 0-100 index. */ - u8 RxMIMOSignalQuality[MAX_PATH_NUM_92CS]; /* EVM */ u8 RxMIMOSignalStrength[MAX_PATH_NUM_92CS];/* in 0~100 index */ s8 RxPower; /* in dBm Translate from PWdB */ /* Real power in dBm for this packet, no beautification and aggregation. -- cgit From 5ae17c443b7ebafea0ddce3cd3bc1ea4d07f09f2 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Fri, 18 Feb 2022 10:30:32 +0100 Subject: staging: r8188eu: RxSNR is set but not used The RxSNR array in struct phy_info is set but not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220218093034.854049-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_HWConfig.c | 1 - drivers/staging/r8188eu/include/rtw_recv.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c index 8ebcd3050892..7d47ecd53757 100644 --- a/drivers/staging/r8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c @@ -171,7 +171,6 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm, pPhyInfo->RxMIMOSignalStrength[i] = (u8)RSSI; /* Get Rx snr value in DB */ - pPhyInfo->RxSNR[i] = (s32)(pPhyStaRpt->path_rxsnr[i] / 2); dm_odm->PhyDbgInfo.RxSNRdB[i] = (s32)(pPhyStaRpt->path_rxsnr[i] / 2); } /* (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) */ diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index f82a26a675c0..5e65cf6b87bc 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -79,7 +79,6 @@ struct phy_info { s8 recvpower; u8 SignalStrength; /* in 0-100 index. */ u8 RxPwr[MAX_PATH_NUM_92CS];/* per-path's pwdb */ - u8 RxSNR[MAX_PATH_NUM_92CS];/* per-path's SNR */ }; struct rx_pkt_attrib { -- cgit From 9e14cec808fea705b4f297d58d72c57b04c067be Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Fri, 18 Feb 2022 10:30:33 +0100 Subject: staging: r8188eu: NumQryPhyStatusCCK is set but not used NumQryPhyStatusCCK in struct odm_phy_dbg_info is set but not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220218093034.854049-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_HWConfig.c | 1 - drivers/staging/r8188eu/include/odm.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c index 7d47ecd53757..833c8fd7fb0c 100644 --- a/drivers/staging/r8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c @@ -70,7 +70,6 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm, if (isCCKrate) { u8 cck_agc_rpt; - dm_odm->PhyDbgInfo.NumQryPhyStatusCCK++; /* (1)Hardware does not provide RSSI for CCK */ /* (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) */ diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 9fb09e0a0df9..66b5413b6846 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -86,7 +86,6 @@ struct odm_phy_dbg_info { /* ODM Write,debug info */ s8 RxSNRdB[MAX_PATH_NUM_92CS]; u64 NumQryPhyStatus; - u64 NumQryPhyStatusCCK; u64 NumQryPhyStatusOFDM; /* Others */ s32 RxEVM[MAX_PATH_NUM_92CS]; -- cgit From 60352184705ac6d53a41e6d7dd2d0bae327fd3dd Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Fri, 18 Feb 2022 10:30:34 +0100 Subject: staging: r8188eu: NumQryPhyStatusOFDM is set but not used NumQryPhyStatusOFDM in struct odm_phy_dbg_info is set but not used. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220218093034.854049-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm_HWConfig.c | 2 -- drivers/staging/r8188eu/include/odm.h | 1 - 2 files changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c index 833c8fd7fb0c..87e9a5270be0 100644 --- a/drivers/staging/r8188eu/hal/odm_HWConfig.c +++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c @@ -148,8 +148,6 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm, pPhyInfo->SignalQuality = SQ; } } else { /* is OFDM rate */ - dm_odm->PhyDbgInfo.NumQryPhyStatusOFDM++; - /* (1)Get RSSI for HT rate */ for (i = RF_PATH_A; i < RF_PATH_MAX; i++) { diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 66b5413b6846..4c97f222987a 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -86,7 +86,6 @@ struct odm_phy_dbg_info { /* ODM Write,debug info */ s8 RxSNRdB[MAX_PATH_NUM_92CS]; u64 NumQryPhyStatus; - u64 NumQryPhyStatusOFDM; /* Others */ s32 RxEVM[MAX_PATH_NUM_92CS]; }; -- cgit From bffd6e0a73988ef358e93e6b1a9ab298f38dfafd Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 20 Feb 2022 11:02:08 +0100 Subject: staging: r8188eu: remove ODM_CmnInfoHook() Each case in ODM_CmnInfoHook() just sets a single variable. Set the variables directly and remove ODM_CmnInfoHook(). Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220220100212.7466-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm.c | 31 ------------------------------- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 13 +++++++------ drivers/staging/r8188eu/include/odm.h | 14 -------------- 3 files changed, 7 insertions(+), 51 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index e0824eefd83a..6f594ae33c6e 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -639,37 +639,6 @@ void ODM_CmnInfoInit(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def Cmn pDM_Odm->BbSwingFlagOfdm = false; } -void ODM_CmnInfoHook(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def CmnInfo, void *pValue) -{ - /* */ - /* Hook call by reference pointer. */ - /* */ - switch (CmnInfo) { - /* Dynamic call by reference pointer. */ - case ODM_CMNINFO_WM_MODE: - pDM_Odm->pWirelessMode = (u8 *)pValue; - break; - case ODM_CMNINFO_SEC_CHNL_OFFSET: - pDM_Odm->pSecChOffset = (u8 *)pValue; - break; - case ODM_CMNINFO_BW: - pDM_Odm->pBandWidth = (u8 *)pValue; - break; - case ODM_CMNINFO_CHNL: - pDM_Odm->pChannel = (u8 *)pValue; - break; - case ODM_CMNINFO_SCAN: - pDM_Odm->pbScanInProcess = (bool *)pValue; - break; - case ODM_CMNINFO_POWER_SAVING: - pDM_Odm->pbPowerSaving = (bool *)pValue; - break; - default: - /* do nothing */ - break; - } -} - /* Update Band/CHannel/.. The values are dynamic but non-per-packet. */ void ODM_CmnInfoUpdate(struct odm_dm_struct *pDM_Odm, u32 CmnInfo, u64 Value) { diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c index a05d8687c18d..09e78c4855f9 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -38,12 +38,13 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) ODM_CmnInfoUpdate(dm_odm, ODM_CMNINFO_ABILITY, pdmpriv->InitODMFlag); - ODM_CmnInfoHook(dm_odm, ODM_CMNINFO_WM_MODE, &pmlmeext->cur_wireless_mode); - ODM_CmnInfoHook(dm_odm, ODM_CMNINFO_SEC_CHNL_OFFSET, &hal_data->nCur40MhzPrimeSC); - ODM_CmnInfoHook(dm_odm, ODM_CMNINFO_BW, &hal_data->CurrentChannelBW); - ODM_CmnInfoHook(dm_odm, ODM_CMNINFO_CHNL, &hal_data->CurrentChannel); - ODM_CmnInfoHook(dm_odm, ODM_CMNINFO_SCAN, &pmlmepriv->bScanInProcess); - ODM_CmnInfoHook(dm_odm, ODM_CMNINFO_POWER_SAVING, &pwrctrlpriv->bpower_saving); + dm_odm->pWirelessMode = &pmlmeext->cur_wireless_mode; + dm_odm->pSecChOffset = &hal_data->nCur40MhzPrimeSC; + dm_odm->pBandWidth = (u8 *)&hal_data->CurrentChannelBW; + dm_odm->pChannel = &hal_data->CurrentChannel; + dm_odm->pbScanInProcess = (bool *)&pmlmepriv->bScanInProcess; + dm_odm->pbPowerSaving = (bool *)&pwrctrlpriv->bpower_saving; + ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_RF_ANTENNA_TYPE, hal_data->TRxAntDivType); for (i = 0; i < NUM_STA; i++) diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 4c97f222987a..2f9e241de5c4 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -124,17 +124,6 @@ enum odm_common_info_def { ODM_CMNINFO_MP_TEST_CHIP, /* HOOK BEFORE REG INIT----------- */ - /* Dynamic value: */ -/* POINTER REFERENCE----------- */ - ODM_CMNINFO_WM_MODE, /* ODM_WIRELESS_MODE_E */ - ODM_CMNINFO_SEC_CHNL_OFFSET, /* ODM_SEC_CHNL_OFFSET_E */ - ODM_CMNINFO_BW, /* ODM_BW_E */ - ODM_CMNINFO_CHNL, - - ODM_CMNINFO_SCAN, - ODM_CMNINFO_POWER_SAVING, -/* POINTER REFERENCE----------- */ - /* CALL BY VALUE------------- */ ODM_CMNINFO_LINK, ODM_CMNINFO_RSSI_MIN, @@ -470,9 +459,6 @@ void ODM_DMWatchdog(struct odm_dm_struct *pDM_Odm); void ODM_CmnInfoInit(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def CmnInfo, u32 Value); -void ODM_CmnInfoHook(struct odm_dm_struct *pDM_Odm, - enum odm_common_info_def CmnInfo, void *pValue); - void ODM_CmnInfoUpdate(struct odm_dm_struct *pDM_Odm, u32 CmnInfo, u64 Value); #endif -- cgit From 165f2997adfc66ed812a192662142f49026b97c5 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 20 Feb 2022 11:02:09 +0100 Subject: staging: r8188eu: convert two u8 variables to bool The variables bScanInProcess in struct mlme_priv and bpower_saving in struct pwrctrl_priv are both unsed to store only boolean values true and false. Convert them from u8 to bool to avoid type casts in the function Update_ODM_ComInfo_88E(). Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220220100212.7466-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 4 ++-- drivers/staging/r8188eu/include/rtw_mlme.h | 2 +- drivers/staging/r8188eu/include/rtw_pwrctrl.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c index 09e78c4855f9..082104c9b2e8 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -42,8 +42,8 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) dm_odm->pSecChOffset = &hal_data->nCur40MhzPrimeSC; dm_odm->pBandWidth = (u8 *)&hal_data->CurrentChannelBW; dm_odm->pChannel = &hal_data->CurrentChannel; - dm_odm->pbScanInProcess = (bool *)&pmlmepriv->bScanInProcess; - dm_odm->pbPowerSaving = (bool *)&pwrctrlpriv->bpower_saving; + dm_odm->pbScanInProcess = &pmlmepriv->bScanInProcess; + dm_odm->pbPowerSaving = &pwrctrlpriv->bpower_saving; ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_RF_ANTENNA_TYPE, hal_data->TRxAntDivType); diff --git a/drivers/staging/r8188eu/include/rtw_mlme.h b/drivers/staging/r8188eu/include/rtw_mlme.h index 1e16fa615b94..d418d57f99b6 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme.h +++ b/drivers/staging/r8188eu/include/rtw_mlme.h @@ -310,7 +310,7 @@ struct qos_priv { struct mlme_priv { spinlock_t lock; int fw_state; /* shall we protect this variable? maybe not necessarily... */ - u8 bScanInProcess; + bool bScanInProcess; u8 to_join; /* flag */ u8 to_roaming; /* roaming trying times */ diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h index 2d5298373d74..7c3cb895c3cd 100644 --- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h @@ -49,7 +49,7 @@ struct pwrctrl_priv { u32 alives; struct work_struct cpwm_event; - u8 bpower_saving; + bool bpower_saving; u8 reg_rfoff; u8 reg_pdnmode; /* powerdown mode */ -- cgit From ec868592f5c54aebbd175d9fd9105c09ccde3997 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 20 Feb 2022 11:02:10 +0100 Subject: staging: r8188eu: remove enum odm_bw The enums odm_bw and ht_channel_width are redundant. Keep ht_channel_width and remove odm_bw. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220220100212.7466-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm.c | 4 ++-- drivers/staging/r8188eu/include/odm.h | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index 6f594ae33c6e..5d2f934d78ae 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -266,7 +266,7 @@ static void odm_CommonInfoSelfUpdate(struct odm_dm_struct *pDM_Odm) u8 i; struct sta_info *pEntry; - if (*pDM_Odm->pBandWidth == ODM_BW40M) { + if (*pDM_Odm->pBandWidth == HT_CHANNEL_WIDTH_40) { if (*pDM_Odm->pSecChOffset == 1) pDM_Odm->ControlChannel = *pDM_Odm->pChannel - 2; else if (*pDM_Odm->pSecChOffset == 2) @@ -766,7 +766,7 @@ u32 ODM_Get_Rate_Bitmap(struct odm_dm_struct *pDM_Odm, u32 macid, u32 ra_mask, u } else if (rssi_level == DM_RATR_STA_MIDDLE) { rate_bitmap = 0x000ff000; } else { - if (*pDM_Odm->pBandWidth == ODM_BW40M) + if (*pDM_Odm->pBandWidth == HT_CHANNEL_WIDTH_40) rate_bitmap = 0x000ff015; else rate_bitmap = 0x000ff005; diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 2f9e241de5c4..1150c7d25ef5 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -164,12 +164,6 @@ enum odm_wireless_mode { ODM_WM_AUTO = BIT(5), }; -/* ODM_CMNINFO_BW */ -enum odm_bw { - ODM_BW20M = 0, - ODM_BW40M = 1, -}; - struct odm_ra_info { u8 RateID; u32 RateMask; -- cgit From c16be3c61dc99d1f8364f0074645339d8a8a6628 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 20 Feb 2022 11:02:11 +0100 Subject: staging: r8188eu: convert type of pBandWidth in odm_dm_struct The variable pBandWidth in odm_dm_struct stores constants from enum ht_channel_width. Change the type of pBandWidth from u8 pointer to enum ht_channel_width pointer to get rid of a type cast in function Update_ODM_ComInfo_88E(). Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220220100212.7466-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 2 +- drivers/staging/r8188eu/include/odm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c index 082104c9b2e8..df0b412c52eb 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -40,7 +40,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) dm_odm->pWirelessMode = &pmlmeext->cur_wireless_mode; dm_odm->pSecChOffset = &hal_data->nCur40MhzPrimeSC; - dm_odm->pBandWidth = (u8 *)&hal_data->CurrentChannelBW; + dm_odm->pBandWidth = &hal_data->CurrentChannelBW; dm_odm->pChannel = &hal_data->CurrentChannel; dm_odm->pbScanInProcess = &pmlmepriv->bScanInProcess; dm_odm->pbPowerSaving = &pwrctrlpriv->bpower_saving; diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 1150c7d25ef5..7d923403288c 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -322,7 +322,7 @@ struct odm_dm_struct { /* Secondary channel offset don't_care/below/above = 0/1/2 */ u8 *pSecChOffset; /* BW info 20M/40M/80M = 0/1/2 */ - u8 *pBandWidth; + enum ht_channel_width *pBandWidth; /* Central channel location Ch1/Ch2/.... */ u8 *pChannel; /* central channel number */ -- cgit From f474a4546feb3836e229df220bd45c92994fa12b Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 20 Feb 2022 11:02:12 +0100 Subject: staging: r8188eu: remove ODM_CmnInfoUpdate() Each case in ODM_CmnInfoUpdate() just sets a single variable. Set the variables directly and remove ODM_CmnInfoUpdate(). Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220220100212.7466-6-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/odm.c | 21 +-------------------- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 4 ++-- drivers/staging/r8188eu/include/odm.h | 7 ------- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c index 5d2f934d78ae..94f9b125d860 100644 --- a/drivers/staging/r8188eu/hal/odm.c +++ b/drivers/staging/r8188eu/hal/odm.c @@ -464,7 +464,7 @@ static void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm) pdmpriv->EntryMinUndecoratedSmoothedPWDB = 0; FindMinimumRSSI(Adapter); - ODM_CmnInfoUpdate(&pHalData->odmpriv, ODM_CMNINFO_RSSI_MIN, pdmpriv->MinUndecoratedPWDBForDM); + pHalData->odmpriv.RSSI_Min = pdmpriv->MinUndecoratedPWDBForDM; } static void odm_TXPowerTrackingThermalMeterInit(struct odm_dm_struct *pDM_Odm) @@ -639,25 +639,6 @@ void ODM_CmnInfoInit(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def Cmn pDM_Odm->BbSwingFlagOfdm = false; } -/* Update Band/CHannel/.. The values are dynamic but non-per-packet. */ -void ODM_CmnInfoUpdate(struct odm_dm_struct *pDM_Odm, u32 CmnInfo, u64 Value) -{ - /* */ - /* This init variable may be changed in run time. */ - /* */ - switch (CmnInfo) { - case ODM_CMNINFO_ABILITY: - pDM_Odm->SupportAbility = (u32)Value; - break; - case ODM_CMNINFO_LINK: - pDM_Odm->bLinked = (bool)Value; - break; - case ODM_CMNINFO_RSSI_MIN: - pDM_Odm->RSSI_Min = (u8)Value; - break; - } -} - void ODM_Write_DIG(struct odm_dm_struct *pDM_Odm, u8 CurrentIGI) { struct rtw_dig *pDM_DigTable = &pDM_Odm->DM_DigTable; diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c index df0b412c52eb..6d28e3dc0d26 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c @@ -36,7 +36,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) if (hal_data->AntDivCfg) pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV; - ODM_CmnInfoUpdate(dm_odm, ODM_CMNINFO_ABILITY, pdmpriv->InitODMFlag); + dm_odm->SupportAbility = pdmpriv->InitODMFlag; dm_odm->pWirelessMode = &pmlmeext->cur_wireless_mode; dm_odm->pSecChOffset = &hal_data->nCur40MhzPrimeSC; @@ -80,7 +80,7 @@ void rtl8188e_HalDmWatchDog(struct adapter *Adapter) bLinked = true; } - ODM_CmnInfoUpdate(&hal_data->odmpriv, ODM_CMNINFO_LINK, bLinked); + hal_data->odmpriv.bLinked = bLinked; ODM_DMWatchdog(&hal_data->odmpriv); } diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h index 7d923403288c..1902aa48a255 100644 --- a/drivers/staging/r8188eu/include/odm.h +++ b/drivers/staging/r8188eu/include/odm.h @@ -120,19 +120,14 @@ enum odm_common_info_def { /* Fixed value: */ /* HOOK BEFORE REG INIT----------- */ - ODM_CMNINFO_ABILITY, /* ODM_ABILITY_E */ ODM_CMNINFO_MP_TEST_CHIP, /* HOOK BEFORE REG INIT----------- */ /* CALL BY VALUE------------- */ - ODM_CMNINFO_LINK, - ODM_CMNINFO_RSSI_MIN, ODM_CMNINFO_RF_ANTENNA_TYPE, /* u8 */ /* CALL BY VALUE-------------*/ }; -/* 2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY */ - enum odm_ability_def { /* BB ODM section BIT 0-15 */ ODM_BB_RSSI_MONITOR = BIT(4), @@ -453,6 +448,4 @@ void ODM_DMWatchdog(struct odm_dm_struct *pDM_Odm); void ODM_CmnInfoInit(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def CmnInfo, u32 Value); -void ODM_CmnInfoUpdate(struct odm_dm_struct *pDM_Odm, u32 CmnInfo, u64 Value); - #endif -- cgit From 4fcde4ec0170259264264ffbc1eb94f0e840bae9 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 20 Feb 2022 20:52:53 +0100 Subject: staging: r8188eu: remove unused macros from rtw_security.h There are lots of unused macros in the rtw_security.h header. Remove them. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220220195254.11759-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_security.h | 98 -------------------------- 1 file changed, 98 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtw_security.h b/drivers/staging/r8188eu/include/rtw_security.h index 9231201f1009..94729ff2daac 100644 --- a/drivers/staging/r8188eu/include/rtw_security.h +++ b/drivers/staging/r8188eu/include/rtw_security.h @@ -14,18 +14,11 @@ #define _TKIP_WTMIC_ 0x3 #define _AES_ 0x4 #define _WEP104_ 0x5 -#define _WEP_WPA_MIXED_ 0x07 /* WEP + WPA */ #define _SMS4_ 0x06 -#define is_wep_enc(alg) (((alg) == _WEP40_) || ((alg) == _WEP104_)) - #define _WPA_IE_ID_ 0xdd #define _WPA2_IE_ID_ 0x30 -#define SHA256_MAC_LEN 32 -#define AES_BLOCK_SIZE 16 -#define AES_PRIV_SIZE (4 * 44) - enum { ENCRYP_PROTOCOL_OPENSYS, /* open system */ ENCRYP_PROTOCOL_WEP, /* WEP */ @@ -236,97 +229,6 @@ extern const u32 rcon[10]; extern const u8 Td4s[256]; extern const u8 rcons[10]; -#define RCON(i) (rcons[(i)] << 24) - -static inline u32 rotr(u32 val, int bits) -{ - return (val >> bits) | (val << (32 - bits)); -} - -#define TE0(i) Te0[((i) >> 24) & 0xff] -#define TE1(i) rotr(Te0[((i) >> 16) & 0xff], 8) -#define TE2(i) rotr(Te0[((i) >> 8) & 0xff], 16) -#define TE3(i) rotr(Te0[(i) & 0xff], 24) -#define TE41(i) ((Te0[((i) >> 24) & 0xff] << 8) & 0xff000000) -#define TE42(i) (Te0[((i) >> 16) & 0xff] & 0x00ff0000) -#define TE43(i) (Te0[((i) >> 8) & 0xff] & 0x0000ff00) -#define TE44(i) ((Te0[(i) & 0xff] >> 8) & 0x000000ff) -#define TE421(i) ((Te0[((i) >> 16) & 0xff] << 8) & 0xff000000) -#define TE432(i) (Te0[((i) >> 8) & 0xff] & 0x00ff0000) -#define TE443(i) (Te0[(i) & 0xff] & 0x0000ff00) -#define TE414(i) ((Te0[((i) >> 24) & 0xff] >> 8) & 0x000000ff) -#define TE4(i) ((Te0[(i)] >> 8) & 0x000000ff) - -#define TD0(i) Td0[((i) >> 24) & 0xff] -#define TD1(i) rotr(Td0[((i) >> 16) & 0xff], 8) -#define TD2(i) rotr(Td0[((i) >> 8) & 0xff], 16) -#define TD3(i) rotr(Td0[(i) & 0xff], 24) -#define TD41(i) (Td4s[((i) >> 24) & 0xff] << 24) -#define TD42(i) (Td4s[((i) >> 16) & 0xff] << 16) -#define TD43(i) (Td4s[((i) >> 8) & 0xff] << 8) -#define TD44(i) (Td4s[(i) & 0xff]) -#define TD0_(i) Td0[(i) & 0xff] -#define TD1_(i) rotr(Td0[(i) & 0xff], 8) -#define TD2_(i) rotr(Td0[(i) & 0xff], 16) -#define TD3_(i) rotr(Td0[(i) & 0xff], 24) - -#define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ \ - ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) - -#define PUTU32(ct, st) { \ -(ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); \ -(ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); } - -#define WPA_GET_BE32(a) ((((u32)(a)[0]) << 24) | (((u32)(a)[1]) << 16) | \ - (((u32)(a)[2]) << 8) | ((u32)(a)[3])) - -#define WPA_PUT_LE16(a, val) \ - do { \ - (a)[1] = ((u16)(val)) >> 8; \ - (a)[0] = ((u16)(val)) & 0xff; \ - } while (0) - -#define WPA_PUT_BE32(a, val) \ - do { \ - (a)[0] = (u8)((((u32)(val)) >> 24) & 0xff); \ - (a)[1] = (u8)((((u32)(val)) >> 16) & 0xff); \ - (a)[2] = (u8)((((u32)(val)) >> 8) & 0xff); \ - (a)[3] = (u8)(((u32)(val)) & 0xff); \ - } while (0) - -#define WPA_PUT_BE64(a, val) \ - do { \ - (a)[0] = (u8)(((u64)(val)) >> 56); \ - (a)[1] = (u8)(((u64)(val)) >> 48); \ - (a)[2] = (u8)(((u64)(val)) >> 40); \ - (a)[3] = (u8)(((u64)(val)) >> 32); \ - (a)[4] = (u8)(((u64)(val)) >> 24); \ - (a)[5] = (u8)(((u64)(val)) >> 16); \ - (a)[6] = (u8)(((u64)(val)) >> 8); \ - (a)[7] = (u8)(((u64)(val)) & 0xff); \ - } while (0) - -/* ===== start - public domain SHA256 implementation ===== */ - -/* This is based on SHA256 implementation in LibTomCrypt that was released into - * public domain by Tom St Denis. */ - -/* Various logical functions */ -#define RORc(x, y) \ - (((((unsigned long)(x) & 0xFFFFFFFFUL) >> (unsigned long)((y)&31)) | \ - ((unsigned long)(x) << (unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) -#define Ch(x, y ,z) (z ^ (x & (y ^ z))) -#define Maj(x, y, z) (((x | y) & z) | (x & y)) -#define S(x, n) RORc((x), (n)) -#define R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) -#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) -#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) -#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) -#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) -#ifndef MIN -#define MIN(x, y) (((x) < (y)) ? (x) : (y)) -#endif - void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key); void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b); void rtw_secmicappend(struct mic_data *pmicdata, u8 *src, u32 nBytes); -- cgit From 98e8e0c3115da2ce76c9523ebab4b235309c26bd Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 20 Feb 2022 20:52:54 +0100 Subject: staging: r8188eu: remove unused aes tables from rtw_security.c Remove unused aes tables from rtw_security.c and, while at it, remove unused extern declarations from rtw_security.h. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220220195254.11759-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_security.c | 174 ------------------------- drivers/staging/r8188eu/include/rtw_security.h | 14 -- 2 files changed, 188 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_security.c b/drivers/staging/r8188eu/core/rtw_security.c index b73aea8a7fb5..2cdcdfd5ca5c 100644 --- a/drivers/staging/r8188eu/core/rtw_security.c +++ b/drivers/staging/r8188eu/core/rtw_security.c @@ -1374,177 +1374,3 @@ u32 rtw_aes_decrypt(struct adapter *padapter, struct recv_frame *precvframe) exit: return res; } - -/* AES tables*/ -const u32 Te0[256] = { - 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, - 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, - 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, - 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, - 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, - 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, - 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, - 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, - 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, - 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, - 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, - 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, - 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, - 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, - 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, - 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, - 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, - 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, - 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, - 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, - 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, - 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, - 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, - 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, - 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, - 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, - 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, - 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, - 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, - 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, - 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, - 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, - 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, - 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, - 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, - 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, - 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, - 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, - 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, - 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, - 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, - 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, - 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, - 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, - 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, - 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, - 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, - 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, - 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, - 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, - 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, - 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, - 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, - 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, - 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, - 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, - 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, - 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, - 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, - 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, - 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, - 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, - 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, - 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, -}; - -const u32 Td0[256] = { - 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, - 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, - 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, - 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, - 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, - 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, - 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, - 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, - 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, - 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, - 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, - 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, - 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, - 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, - 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, - 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, - 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, - 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, - 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, - 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, - 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, - 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, - 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, - 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, - 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, - 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, - 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, - 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, - 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, - 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, - 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, - 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, - 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, - 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, - 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, - 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, - 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, - 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, - 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, - 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, - 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, - 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, - 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, - 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, - 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, - 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, - 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, - 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, - 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, - 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, - 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, - 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, - 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, - 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, - 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, - 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, - 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, - 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, - 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, - 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, - 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, - 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, - 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, - 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, -}; - -const u8 Td4s[256] = { - 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U, - 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU, - 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U, - 0x34U, 0x8eU, 0x43U, 0x44U, 0xc4U, 0xdeU, 0xe9U, 0xcbU, - 0x54U, 0x7bU, 0x94U, 0x32U, 0xa6U, 0xc2U, 0x23U, 0x3dU, - 0xeeU, 0x4cU, 0x95U, 0x0bU, 0x42U, 0xfaU, 0xc3U, 0x4eU, - 0x08U, 0x2eU, 0xa1U, 0x66U, 0x28U, 0xd9U, 0x24U, 0xb2U, - 0x76U, 0x5bU, 0xa2U, 0x49U, 0x6dU, 0x8bU, 0xd1U, 0x25U, - 0x72U, 0xf8U, 0xf6U, 0x64U, 0x86U, 0x68U, 0x98U, 0x16U, - 0xd4U, 0xa4U, 0x5cU, 0xccU, 0x5dU, 0x65U, 0xb6U, 0x92U, - 0x6cU, 0x70U, 0x48U, 0x50U, 0xfdU, 0xedU, 0xb9U, 0xdaU, - 0x5eU, 0x15U, 0x46U, 0x57U, 0xa7U, 0x8dU, 0x9dU, 0x84U, - 0x90U, 0xd8U, 0xabU, 0x00U, 0x8cU, 0xbcU, 0xd3U, 0x0aU, - 0xf7U, 0xe4U, 0x58U, 0x05U, 0xb8U, 0xb3U, 0x45U, 0x06U, - 0xd0U, 0x2cU, 0x1eU, 0x8fU, 0xcaU, 0x3fU, 0x0fU, 0x02U, - 0xc1U, 0xafU, 0xbdU, 0x03U, 0x01U, 0x13U, 0x8aU, 0x6bU, - 0x3aU, 0x91U, 0x11U, 0x41U, 0x4fU, 0x67U, 0xdcU, 0xeaU, - 0x97U, 0xf2U, 0xcfU, 0xceU, 0xf0U, 0xb4U, 0xe6U, 0x73U, - 0x96U, 0xacU, 0x74U, 0x22U, 0xe7U, 0xadU, 0x35U, 0x85U, - 0xe2U, 0xf9U, 0x37U, 0xe8U, 0x1cU, 0x75U, 0xdfU, 0x6eU, - 0x47U, 0xf1U, 0x1aU, 0x71U, 0x1dU, 0x29U, 0xc5U, 0x89U, - 0x6fU, 0xb7U, 0x62U, 0x0eU, 0xaaU, 0x18U, 0xbeU, 0x1bU, - 0xfcU, 0x56U, 0x3eU, 0x4bU, 0xc6U, 0xd2U, 0x79U, 0x20U, - 0x9aU, 0xdbU, 0xc0U, 0xfeU, 0x78U, 0xcdU, 0x5aU, 0xf4U, - 0x1fU, 0xddU, 0xa8U, 0x33U, 0x88U, 0x07U, 0xc7U, 0x31U, - 0xb1U, 0x12U, 0x10U, 0x59U, 0x27U, 0x80U, 0xecU, 0x5fU, - 0x60U, 0x51U, 0x7fU, 0xa9U, 0x19U, 0xb5U, 0x4aU, 0x0dU, - 0x2dU, 0xe5U, 0x7aU, 0x9fU, 0x93U, 0xc9U, 0x9cU, 0xefU, - 0xa0U, 0xe0U, 0x3bU, 0x4dU, 0xaeU, 0x2aU, 0xf5U, 0xb0U, - 0xc8U, 0xebU, 0xbbU, 0x3cU, 0x83U, 0x53U, 0x99U, 0x61U, - 0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U, - 0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU, -}; -const u8 rcons[] = { - 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36 - /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ -}; diff --git a/drivers/staging/r8188eu/include/rtw_security.h b/drivers/staging/r8188eu/include/rtw_security.h index 94729ff2daac..783ae18a122a 100644 --- a/drivers/staging/r8188eu/include/rtw_security.h +++ b/drivers/staging/r8188eu/include/rtw_security.h @@ -215,20 +215,6 @@ struct mic_data { u32 nBytesInM; /* # bytes in M */ }; -extern const u32 Te0[256]; -extern const u32 Te1[256]; -extern const u32 Te2[256]; -extern const u32 Te3[256]; -extern const u32 Te4[256]; -extern const u32 Td0[256]; -extern const u32 Td1[256]; -extern const u32 Td2[256]; -extern const u32 Td3[256]; -extern const u32 Td4[256]; -extern const u32 rcon[10]; -extern const u8 Td4s[256]; -extern const u8 rcons[10]; - void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key); void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b); void rtw_secmicappend(struct mic_data *pmicdata, u8 *src, u32 nBytes); -- cgit From 1a461527f6bc4b0e29b4badb64b7d1f1fc9437ae Mon Sep 17 00:00:00 2001 From: Marcelo Aloisio da Silva Date: Sun, 20 Feb 2022 15:04:34 -0300 Subject: staging: r8188eu: move open brace to the previous line Fix the following error reported by checkpatch.pl: ERROR: that open brace { should be on the previous line + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + { Signed-off-by: Marcelo Aloisio da Silva Link: https://lore.kernel.org/r/20220220180434.GA12386@snoopy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 45eff3018d73..3abc7e21bc0d 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -1378,8 +1378,7 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter) if (pregistrypriv->wifi_spec == 1) { struct wifidirect_info *pwdinfo = &adapter->wdinfo; - if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { /* auto site survey */ rtw_auto_scan_handler(adapter); } -- cgit From c4b5dfd8403bd29ba34b9173a1e4e2f3ee655ce2 Mon Sep 17 00:00:00 2001 From: Moses Christopher Bollavarapu Date: Sat, 19 Feb 2022 19:32:34 +0100 Subject: staging: rtl8192e: use BIT macro instead of left shifting There is a BIT(nr) macro available in vdso/bits.h which is doing the same left shift operation Example: (1 << 7) == BIT(7) Reviewed-by: Dan Carpenter Signed-off-by: Moses Christopher Bollavarapu Link: https://lore.kernel.org/r/20220219183234.31216-1-mosescb.dev@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_debug.h | 54 +++++++++++++++++---------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_debug.h b/drivers/staging/rtl8192e/rtllib_debug.h index 9065901636f5..e3e8302945eb 100644 --- a/drivers/staging/rtl8192e/rtllib_debug.h +++ b/drivers/staging/rtl8192e/rtllib_debug.h @@ -7,6 +7,8 @@ #ifndef _RTL_DEBUG_H #define _RTL_DEBUG_H +#include + /* Allow files to override DRV_NAME */ #ifndef DRV_NAME #define DRV_NAME "rtllib_92e" @@ -16,32 +18,32 @@ extern u32 rt_global_debug_component; /* These are the defines for rt_global_debug_component */ enum RTL_DEBUG { - COMP_TRACE = (1 << 0), - COMP_DBG = (1 << 1), - COMP_INIT = (1 << 2), - COMP_RECV = (1 << 3), - COMP_POWER = (1 << 6), - COMP_SWBW = (1 << 8), - COMP_SEC = (1 << 9), - COMP_LPS = (1 << 10), - COMP_QOS = (1 << 11), - COMP_RATE = (1 << 12), - COMP_RXDESC = (1 << 13), - COMP_PHY = (1 << 14), - COMP_DIG = (1 << 15), - COMP_TXAGC = (1 << 16), - COMP_HALDM = (1 << 17), - COMP_POWER_TRACKING = (1 << 18), - COMP_CH = (1 << 19), - COMP_RF = (1 << 20), - COMP_FIRMWARE = (1 << 21), - COMP_RESET = (1 << 23), - COMP_CMDPKT = (1 << 24), - COMP_SCAN = (1 << 25), - COMP_PS = (1 << 26), - COMP_DOWN = (1 << 27), - COMP_INTR = (1 << 28), - COMP_ERR = (1 << 31) + COMP_TRACE = BIT(0), + COMP_DBG = BIT(1), + COMP_INIT = BIT(2), + COMP_RECV = BIT(3), + COMP_POWER = BIT(6), + COMP_SWBW = BIT(8), + COMP_SEC = BIT(9), + COMP_LPS = BIT(10), + COMP_QOS = BIT(11), + COMP_RATE = BIT(12), + COMP_RXDESC = BIT(13), + COMP_PHY = BIT(14), + COMP_DIG = BIT(15), + COMP_TXAGC = BIT(16), + COMP_HALDM = BIT(17), + COMP_POWER_TRACKING = BIT(18), + COMP_CH = BIT(19), + COMP_RF = BIT(20), + COMP_FIRMWARE = BIT(21), + COMP_RESET = BIT(23), + COMP_CMDPKT = BIT(24), + COMP_SCAN = BIT(25), + COMP_PS = BIT(26), + COMP_DOWN = BIT(27), + COMP_INTR = BIT(28), + COMP_ERR = BIT(31) }; #define RT_TRACE(component, x, args...) \ -- cgit From 7c6444d8e0f1be30e7fd910e40c0d495c36e6935 Mon Sep 17 00:00:00 2001 From: Marcelo Aloisio da Silva Date: Sun, 20 Feb 2022 14:41:50 -0300 Subject: staging: r8188eu: remove unnecessary braces in if statements Braces are not necessary for single statement blocks. Reviewed-by: Dan Carpenter Signed-off-by: Marcelo Aloisio da Silva Link: https://lore.kernel.org/r/20220220174150.GA11496@snoopy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 3abc7e21bc0d..4bb6edcc0b78 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -1391,14 +1391,12 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter) /* expire NAT2.5 entry */ nat25_db_expire(adapter); - if (adapter->pppoe_connection_in_progress > 0) { + if (adapter->pppoe_connection_in_progress > 0) adapter->pppoe_connection_in_progress--; - } /* due to rtw_dynamic_check_timer_handlder() is called every 2 seconds */ - if (adapter->pppoe_connection_in_progress > 0) { + if (adapter->pppoe_connection_in_progress > 0) adapter->pppoe_connection_in_progress--; - } } rcu_read_unlock(); -- cgit From a17b34502aebaac8533b3e1fd73fd6e1360d31db Mon Sep 17 00:00:00 2001 From: Xiaoke Wang Date: Tue, 22 Feb 2022 10:00:24 +0800 Subject: staging: wfx: check the return value of devm_kmalloc() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit devm_kmalloc() returns a pointer to allocated memory on success, NULL on failure. While there is a memory allocation of devm_kmalloc() without proper check. It is better to check the return value of it to prevent wrong memory access. And I use the err label which is introduced by the previous patch to handle the error. Link: https://lore.kernel.org/r/tencent_24A24A3EFF61206ECCC4B94B1C5C1454E108@qq.com Reviewed-by: Dan Carpenter Reviewed-by: Jérôme Pouiller Signed-off-by: Xiaoke Wang Link: https://lore.kernel.org/r/tencent_D9887936F780A393C232DC48C9EC3F1D4405@qq.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index ef23e0621065..b93b16b900c8 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -293,6 +293,9 @@ struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_da hw->wiphy->n_iface_combinations = ARRAY_SIZE(wfx_iface_combinations); hw->wiphy->iface_combinations = wfx_iface_combinations; hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmalloc(dev, sizeof(wfx_band_2ghz), GFP_KERNEL); + if (!hw->wiphy->bands[NL80211_BAND_2GHZ]) + goto err; + /* FIXME: also copy wfx_rates and wfx_2ghz_chantable */ memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, sizeof(wfx_band_2ghz)); -- cgit From 26c511f8b7c33760057622693d16ac9527e772af Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 21 Feb 2022 22:24:59 +0100 Subject: staging: vt6656: Fix CamelCase warnings in mac.h and mac.c This patch fixes the checkpatch.pl warnings like: CHECK: Avoid CamelCase: 175: FILE: drivers/staging/vt6656/mac.h:175: +#define EnCFG_BBType_a 0x00 and affected places in mac.c Reviewed-by: Dan Carpenter Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/d04b36cc5446d1c996ac8bc71ff391d822cedd9d.1645477326.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/mac.c | 14 +++++++------- drivers/staging/vt6656/mac.h | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index 4f1f9b03a678..49430c0a99b8 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -39,7 +39,7 @@ int vnt_mac_set_bb_type(struct vnt_private *priv, u8 type) u8 data[2]; data[0] = type; - data[1] = EnCFG_BBType_MASK; + data[1] = EN_CFG_BB_TYPE_MASK; return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), @@ -120,8 +120,8 @@ int vnt_mac_enable_protect_mode(struct vnt_private *priv) { u8 data[2]; - data[0] = EnCFG_ProtectMd; - data[1] = EnCFG_ProtectMd; + data[0] = EN_CFG_PROTECT_MD; + data[1] = EN_CFG_PROTECT_MD; return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); @@ -132,7 +132,7 @@ int vnt_mac_disable_protect_mode(struct vnt_private *priv) u8 data[2]; data[0] = 0; - data[1] = EnCFG_ProtectMd; + data[1] = EN_CFG_PROTECT_MD; return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); @@ -142,8 +142,8 @@ int vnt_mac_enable_barker_preamble_mode(struct vnt_private *priv) { u8 data[2]; - data[0] = EnCFG_BarkerPream; - data[1] = EnCFG_BarkerPream; + data[0] = EN_CFG_BARKER_PREAM; + data[1] = EN_CFG_BARKER_PREAM; return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2, MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); @@ -154,7 +154,7 @@ int vnt_mac_disable_barker_preamble_mode(struct vnt_private *priv) u8 data[2]; data[0] = 0; - data[1] = EnCFG_BarkerPream; + data[1] = EN_CFG_BARKER_PREAM; return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2, MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data); diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h index 05af9ca7d69c..0ac845bd3c5a 100644 --- a/drivers/staging/vt6656/mac.h +++ b/drivers/staging/vt6656/mac.h @@ -172,20 +172,20 @@ #define TFTCTL_TSFCNTREN BIT(0) /* Bits in the EnhanceCFG_0 register */ -#define EnCFG_BBType_a 0x00 -#define EnCFG_BBType_b BIT(0) -#define EnCFG_BBType_g BIT(1) -#define EnCFG_BBType_MASK (EnCFG_BBType_b | EnCFG_BBType_g) -#define EnCFG_ProtectMd BIT(5) +#define EN_CFG_BB_TYPE_A 0x00 +#define EN_CFG_BB_TYPE_B BIT(0) +#define EN_CFG_BB_TYPE_G BIT(1) +#define EN_CFG_BB_TYPE_MASK (EN_CFG_BB_TYPE_B | EN_CFG_BB_TYPE_G) +#define EN_CFG_PROTECT_MD BIT(5) /* Bits in the EnhanceCFG_1 register */ -#define EnCFG_BcnSusInd BIT(0) -#define EnCFG_BcnSusClr BIT(1) +#define EN_CFG_BCN_SUS_IND BIT(0) +#define EN_CFG_BCN_SUS_CLR BIT(1) /* Bits in the EnhanceCFG_2 register */ -#define EnCFG_NXTBTTCFPSTR BIT(0) -#define EnCFG_BarkerPream BIT(1) -#define EnCFG_PktBurstMode BIT(2) +#define EN_CFG_NXTBTTCFPSTR BIT(0) +#define EN_CFG_BARKER_PREAM BIT(1) +#define EN_CFG_PKT_BURST_MD BIT(2) /* Bits in the CFG register */ #define CFG_TKIPOPT BIT(7) @@ -333,7 +333,7 @@ #define PKT_TYPE_ERROR_CRC BIT(1) #define PKT_TYPE_BSSID BIT(0) -#define Default_BI 0x200 +#define DEFAULT_BI 0x200 /* MiscFIFO Offset */ #define MISCFIFO_KEYETRY0 32 -- cgit From efae250a1a12196523f6fdbac3c5f7a440b5edce Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 21 Feb 2022 22:25:05 +0100 Subject: staging: vt6656: Add comment for locks This patch fixes the checkpatch.pl warnings like: - CHECK: spinlock_t definition without comment Reviewed-by: Dan Carpenter Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/c6a5ef8e7704b488c54145b09ac44bd4880c13b4.1645477326.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/device.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 8b6623a751f0..dda38c2a6f06 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -268,8 +268,8 @@ struct vnt_private { u32 rx_buf_sz; int mc_list_count; - spinlock_t lock; - struct mutex usb_lock; + spinlock_t lock; /* prepare tx USB URB */ + struct mutex usb_lock; /* USB control messages */ unsigned long flags; -- cgit From ac1569b7dca22e6bc05585093c90cb11fcc10fbd Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 21 Feb 2022 22:25:10 +0100 Subject: staging: vt6656: Fix CamelCase warnings in macro This patch fixes the checkpatch.pl warnings like: - CHECK: Avoid CamelCase: Reviewed-by: Dan Carpenter Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/53072a97348b08276b083ce18188b9199cbfaae6.1645477326.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/device.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index dda38c2a6f06..0ab2d60204e8 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -381,11 +381,11 @@ struct vnt_private { struct ieee80211_low_level_stats low_stats; }; -#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ - if ((uVar) >= ((uModulo) - 1)) \ - (uVar) = 0; \ +#define ADD_ONE_WITH_WRAP_AROUND(var, modulo) { \ + if ((var) >= ((modulo) - 1)) \ + (var) = 0; \ else \ - (uVar)++; \ + (var)++; \ } int vnt_init(struct vnt_private *priv); -- cgit From efc72b11b3eb5dc6f9d63224da8e1dde2bed24c3 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 21 Feb 2022 22:25:16 +0100 Subject: staging: vt6656: Change macro to function and moved to better file This patch fixes the checkpatch.pl warning like: - CHECK: Macro argument reuse 'uVar' - possible side-effects? Moved the only twice used function to the file where it is used. Reviewed-by: Dan Carpenter Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/fa37dde640cfe5093ff23ca0881aba4673751a49.1645477326.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/device.h | 7 ------- drivers/staging/vt6656/wcmd.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 0ab2d60204e8..ca974d61d3f4 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -381,13 +381,6 @@ struct vnt_private { struct ieee80211_low_level_stats low_stats; }; -#define ADD_ONE_WITH_WRAP_AROUND(var, modulo) { \ - if ((var) >= ((modulo) - 1)) \ - (var) = 0; \ - else \ - (var)++; \ -} - int vnt_init(struct vnt_private *priv); #endif diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index e8ee2fbee76c..14b8aa587119 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -31,6 +31,15 @@ static void vnt_cmd_timer_wait(struct vnt_private *priv, unsigned long msecs) schedule_delayed_work(&priv->run_command_work, msecs_to_jiffies(msecs)); } +static u32 add_one_with_wrap_around(u32 var, u8 modulo) +{ + if (var >= (modulo - 1)) + var = 0; + else + var++; + return var; +} + static int vnt_cmd_complete(struct vnt_private *priv) { priv->command_state = WLAN_CMD_IDLE; @@ -42,7 +51,7 @@ static int vnt_cmd_complete(struct vnt_private *priv) priv->command = priv->cmd_queue[priv->cmd_dequeue_idx]; - ADD_ONE_WITH_WRAP_AROUND(priv->cmd_dequeue_idx, CMD_Q_SIZE); + priv->cmd_dequeue_idx = add_one_with_wrap_around(priv->cmd_dequeue_idx, CMD_Q_SIZE); priv->free_cmd_queue++; priv->cmd_running = true; @@ -157,7 +166,7 @@ int vnt_schedule_command(struct vnt_private *priv, enum vnt_cmd command) priv->cmd_queue[priv->cmd_enqueue_idx] = command; - ADD_ONE_WITH_WRAP_AROUND(priv->cmd_enqueue_idx, CMD_Q_SIZE); + priv->cmd_enqueue_idx = add_one_with_wrap_around(priv->cmd_enqueue_idx, CMD_Q_SIZE); priv->free_cmd_queue--; if (!priv->cmd_running) -- cgit From 1929be8c45a21954d3f328cd4c9e9b671e7ac688 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 21 Feb 2022 22:25:23 +0100 Subject: staging: vt6656: Remove ftrace-like logging This patch fixes the checkpatch.pl warning like: WARNING: Unnecessary ftrace-like logging - prefer using ftrace Reviewed-by: Dan Carpenter Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/084064a5c94aad940600ae62d6c21bb26629cb2c.1645477326.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/rxtx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index a31947f2620d..5839b34b2e93 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -58,8 +58,6 @@ static struct vnt_usb_send_context struct vnt_usb_send_context *context = NULL; int ii; - dev_dbg(&priv->usb->dev, "%s\n", __func__); - for (ii = 0; ii < priv->num_tx_context; ii++) { if (!priv->tx_context[ii]) return NULL; -- cgit From d4cbaca3d086ed70a0dfa07f2bc51c87d4299cea Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 21 Feb 2022 22:25:29 +0100 Subject: staging: vt6656: Remove unnecessary line breaks This patch fixes the checkpatch.pl warning like: CHECK: Lines should not end with a '(' Reviewed-by: Dan Carpenter Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/e0d6d3d787051e3aef56fdba1aee8c2bbbe14e89.1645477326.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/rxtx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 5839b34b2e93..4d29f8ebb393 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -353,10 +353,8 @@ static bool vnt_fill_txkey(struct vnt_tx_buffer *tx_buffer, struct sk_buff *skb) ether_addr_copy(mic_hdr->addr2, hdr->addr2); ether_addr_copy(mic_hdr->addr3, hdr->addr3); - mic_hdr->frame_control = cpu_to_le16( - le16_to_cpu(hdr->frame_control) & 0xc78f); - mic_hdr->seq_ctrl = cpu_to_le16( - le16_to_cpu(hdr->seq_ctrl) & 0xf); + mic_hdr->frame_control = cpu_to_le16(le16_to_cpu(hdr->frame_control) & 0xc78f); + mic_hdr->seq_ctrl = cpu_to_le16(le16_to_cpu(hdr->seq_ctrl) & 0xf); if (ieee80211_has_a4(hdr->frame_control)) ether_addr_copy(mic_hdr->addr4, hdr->addr4); -- cgit From 57cbe4277d3420ea94142fbb162116030d4035f3 Mon Sep 17 00:00:00 2001 From: Phillip Potter Date: Tue, 22 Feb 2022 23:35:06 +0000 Subject: staging: r8188eu: remove unused variable from UpdateHalRAMask8188EUsb Remove the 'arg' variable from the block inside the if statement in the UpdateHalRAMask8188EUsb function in hal/usb_halinit.c, as due to the recent DBG_88E cleanup series, this is now set but not used. Also remove the rest of the lines in this block that further modify 'arg' as they are superfluous, due to it never being used afterwards. Reported-by: kernel test robot Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220222233506.72778-1-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_halinit.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 0704fa3156af..d7dcef3ece3d 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1528,12 +1528,6 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level) init_rate = get_highest_rate_idx(mask) & 0x3f; if (haldata->fw_ractrl) { - u8 arg; - - arg = mac_id & 0x1f;/* MACID */ - arg |= BIT(7); - if (shortGIrate) - arg |= BIT(5); mask |= ((raid << 28) & 0xf0000000); psta->ra_mask = mask; mask |= ((raid << 28) & 0xf0000000); -- cgit From 6f29d72d2b7ae4caba2d9e578424ed32ba66ec3e Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 22 Feb 2022 09:28:45 +0100 Subject: staging: r8188eu: remove 5 GHz channels from ch_freq_map According to the Realtek documentation the chips this driver supports are 2.4 GHz only chips. Frequencies for 5 GHz channels can be removed from the ch_freq_map array. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220222082847.6687-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_rf.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_rf.c b/drivers/staging/r8188eu/core/rtw_rf.c index e704092d31d0..51425971782b 100644 --- a/drivers/staging/r8188eu/core/rtw_rf.c +++ b/drivers/staging/r8188eu/core/rtw_rf.c @@ -17,22 +17,6 @@ static struct ch_freq ch_freq_map[] = { {1, 2412}, {2, 2417}, {3, 2422}, {4, 2427}, {5, 2432}, {6, 2437}, {7, 2442}, {8, 2447}, {9, 2452}, {10, 2457}, {11, 2462}, {12, 2467}, {13, 2472}, {14, 2484}, - /* UNII */ - {36, 5180}, {40, 5200}, {44, 5220}, {48, 5240}, {52, 5260}, - {56, 5280}, {60, 5300}, {64, 5320}, {149, 5745}, {153, 5765}, - {157, 5785}, {161, 5805}, {165, 5825}, {167, 5835}, {169, 5845}, - {171, 5855}, {173, 5865}, - /* HiperLAN2 */ - {100, 5500}, {104, 5520}, {108, 5540}, {112, 5560}, {116, 5580}, - {120, 5600}, {124, 5620}, {128, 5640}, {132, 5660}, {136, 5680}, - {140, 5700}, - /* Japan MMAC */ - {34, 5170}, {38, 5190}, {42, 5210}, {46, 5230}, - /* Japan */ - {184, 4920}, {188, 4940}, {192, 4960}, {196, 4980}, - {208, 5040},/* Japan, means J08 */ - {212, 5060},/* Japan, means J12 */ - {216, 5080},/* Japan, means J16 */ }; static int ch_freq_map_num = ARRAY_SIZE(ch_freq_map); -- cgit From b052de6526383a7199079ae68afd92f9187c0862 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 22 Feb 2022 09:28:46 +0100 Subject: staging: r8188eu: refactor rtw_ch2freq() Convert the array ch_freq_map to a simple integer array and use the indices as channel numbers. This simplifies the code and avoids looping through the array to get the frequency. To avoid out of bounds array access return a default value for invalid channel values, like the original code did. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220222082847.6687-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_rf.c | 41 +++++++++++++++-------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_rf.c b/drivers/staging/r8188eu/core/rtw_rf.c index 51425971782b..68178699a0c6 100644 --- a/drivers/staging/r8188eu/core/rtw_rf.c +++ b/drivers/staging/r8188eu/core/rtw_rf.c @@ -8,32 +8,27 @@ #include "../include/recv_osdep.h" #include "../include/xmit_osdep.h" -struct ch_freq { - u32 channel; - u32 frequency; +static const u32 ch_freq_map[] = { + 2412, + 2417, + 2422, + 2427, + 2432, + 2437, + 2442, + 2447, + 2452, + 2457, + 2462, + 2467, + 2472, + 2484 }; -static struct ch_freq ch_freq_map[] = { - {1, 2412}, {2, 2417}, {3, 2422}, {4, 2427}, {5, 2432}, - {6, 2437}, {7, 2442}, {8, 2447}, {9, 2452}, {10, 2457}, - {11, 2462}, {12, 2467}, {13, 2472}, {14, 2484}, -}; - -static int ch_freq_map_num = ARRAY_SIZE(ch_freq_map); - u32 rtw_ch2freq(u32 channel) { - u8 i; - u32 freq = 0; - - for (i = 0; i < ch_freq_map_num; i++) { - if (channel == ch_freq_map[i].channel) { - freq = ch_freq_map[i].frequency; - break; - } - } - if (i == ch_freq_map_num) - freq = 2412; + if (channel == 0 || channel > ARRAY_SIZE(ch_freq_map)) + return 2412; - return freq; + return ch_freq_map[channel - 1]; } -- cgit From 91b0ad05b6fd5761afc86dafaa8403cf457f4519 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 22 Feb 2022 09:28:47 +0100 Subject: staging: r8188eu: clean up rtw_rf.c Remove unnecessary includes and the unused define _RTW_RF_C_ from rtw_rf.c. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220222082847.6687-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_rf.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_rf.c b/drivers/staging/r8188eu/core/rtw_rf.c index 68178699a0c6..2d2f0fc4c942 100644 --- a/drivers/staging/r8188eu/core/rtw_rf.c +++ b/drivers/staging/r8188eu/core/rtw_rf.c @@ -1,12 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2007 - 2011 Realtek Corporation. */ -#define _RTW_RF_C_ - -#include "../include/osdep_service.h" #include "../include/drv_types.h" -#include "../include/recv_osdep.h" -#include "../include/xmit_osdep.h" static const u32 ch_freq_map[] = { 2412, -- cgit From 8beb52f6baf5b5510c4978df406255ea42efe7e8 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 24 Feb 2022 23:06:58 +0000 Subject: staging: r8188eu: remove redundant variable reg_0x143 Variable reg_0x143 is being assigned a value, however is not being read. The variable is redundant and can be removed. Reviewed-by: Phillip Potter Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20220224230658.151338-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index cf58dfc3ff4d..53ebea311723 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -189,7 +189,6 @@ static void efuse_read_phymap_from_txpktbuf( { u16 dbg_addr = 0; u32 start = 0, passing_time = 0; - u8 reg_0x143 = 0; __le32 lo32 = 0, hi32 = 0; u16 len = 0, count = 0; int i = 0; @@ -209,7 +208,7 @@ static void efuse_read_phymap_from_txpktbuf( rtw_write8(adapter, REG_TXPKTBUF_DBG, 0); start = jiffies; - while (!(reg_0x143 = rtw_read8(adapter, REG_TXPKTBUF_DBG)) && + while (!rtw_read8(adapter, REG_TXPKTBUF_DBG) && (passing_time = rtw_get_passing_time_ms(start)) < 1000) rtw_usleep_os(100); -- cgit From cf38b73e48798e333271a0a42c45bea7c23ffc52 Mon Sep 17 00:00:00 2001 From: Tong Zhang Date: Wed, 23 Feb 2022 22:40:29 -0800 Subject: staging: rtl8192u: fix broken debug macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is an extra space in the debug macro, when CONFIG_IEEE80211_DEBUG is switched off, compiler will complain. drivers/staging/rtl8192u/ieee80211/ieee80211.h:470:42: error: expected ‘)’ before ‘...’ token 470 | #define IEEE80211_DEBUG (level, fmt, args...) do {} while (0) drivers/staging/rtl8192u/ieee80211/ieee80211.h:470:47: error: expected ‘;’ before ‘do’ 470 | #define IEEE80211_DEBUG (level, fmt, args...) do {} while (0) Signed-off-by: Tong Zhang Link: https://lore.kernel.org/r/20220224064033.1530924-1-ztong0001@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 15207dc1f5c5..ab1e380688ee 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -467,8 +467,8 @@ do { if (ieee80211_debug_level & (level)) \ } \ } while (0) #else -#define IEEE80211_DEBUG (level, fmt, args...) do {} while (0) -#define IEEE80211_DEBUG_DATA (level, data, datalen) do {} while (0) +#define IEEE80211_DEBUG(level, fmt, args...) +#define IEEE80211_DEBUG_DATA(level, data, datalen) #endif /* CONFIG_IEEE80211_DEBUG */ /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ -- cgit From 907f6fae37cd65b036fd257b15ab5222a2f13ca5 Mon Sep 17 00:00:00 2001 From: Tong Zhang Date: Wed, 23 Feb 2022 22:40:30 -0800 Subject: staging: rtl8192u: add empty debug functions Add two empty functions to handle the case when CONFIG_IEEE80211_DEBUG is turned off. These two functions will be used by module init() and and exit(). Signed-off-by: Tong Zhang Link: https://lore.kernel.org/r/20220224064033.1530924-2-ztong0001@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index ab1e380688ee..68c0bf9a191a 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -2315,8 +2315,13 @@ int ieee80211_wx_get_freq(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *b); /* ieee80211_module.c */ +#ifdef CONFIG_IEEE80211_DEBUG int ieee80211_debug_init(void); void ieee80211_debug_exit(void); +#else +static inline int ieee80211_debug_init(void) { return 0; } +static inline void ieee80211_debug_exit(void) { } +#endif //extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); void ieee80211_wx_sync_scan_wq(struct work_struct *work); -- cgit From 57078a3c2e24fcc1ee8b7d44b69d27dba41c6598 Mon Sep 17 00:00:00 2001 From: Tong Zhang Date: Wed, 23 Feb 2022 22:40:31 -0800 Subject: staging: rtl8192u: rework init and exit function The init and exit functions are not releasing resource properly. An error can be observed when we load/unload/load r8192u_usb module due to this issue. This patch rework init and exit functions to do proper resource release on init error and module unload. The __exit attribute is stripped from some functions since they are now being used by module init functions. [ 493.068012] proc_dir_entry 'net/ieee80211' already registered [ 493.271973] proc_mkdir+0x18/0x20 [ 493.272136] ieee80211_debug_init+0x28/0xde8 [r8192u_usb] [ 493.272404] rtl8192_usb_module_init+0x10/0x161 [r8192u_usb] [ 13.910616] proc_dir_entry 'net/rtl819xU' already registered [ 13.918931] proc_mkdir+0x18/0x20 [ 13.919098] rtl8192_usb_module_init+0x142/0x16d [r8192u_usb] Reviewed-by: Dan Carpenter Signed-off-by: Tong Zhang Link: https://lore.kernel.org/r/20220224064033.1530924-3-ztong0001@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192u/ieee80211/ieee80211_crypt.c | 2 +- .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 2 +- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 2 +- .../rtl8192u/ieee80211/ieee80211_crypt_wep.c | 2 +- .../staging/rtl8192u/ieee80211/ieee80211_module.c | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 45 ++++++++++++++++------ 6 files changed, 38 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 01012dddcd73..840db6250b87 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -214,7 +214,7 @@ out: return ret; } -void __exit ieee80211_crypto_deinit(void) +void ieee80211_crypto_deinit(void) { struct list_head *ptr, *n; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index ccff385cf1f8..101c28265e91 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -415,7 +415,7 @@ int __init ieee80211_crypto_ccmp_init(void) return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); } -void __exit ieee80211_crypto_ccmp_exit(void) +void ieee80211_crypto_ccmp_exit(void) { ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index e8fa1d385f24..689d8843f538 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -712,7 +712,7 @@ int __init ieee80211_crypto_tkip_init(void) return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); } -void __exit ieee80211_crypto_tkip_exit(void) +void ieee80211_crypto_tkip_exit(void) { ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index a41b6510481b..8a51ea1dd6e5 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -240,7 +240,7 @@ int __init ieee80211_crypto_wep_init(void) return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); } -void __exit ieee80211_crypto_wep_exit(void) +void ieee80211_crypto_wep_exit(void) { ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index c52540b734fd..b94fe9b449b6 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -276,7 +276,7 @@ int __init ieee80211_debug_init(void) return 0; } -void __exit ieee80211_debug_exit(void) +void ieee80211_debug_exit(void) { if (ieee80211_proc) { remove_proc_entry("debug_level", ieee80211_proc); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 364e1ca94f70..ce807c9d4219 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4783,49 +4783,70 @@ static int __init rtl8192_usb_module_init(void) { int ret; -#ifdef CONFIG_IEEE80211_DEBUG + pr_info("\nLinux kernel driver for RTL8192 based WLAN cards\n"); + pr_info("Copyright (c) 2007-2008, Realsil Wlan\n"); + RT_TRACE(COMP_INIT, "Initializing module"); + RT_TRACE(COMP_INIT, "Wireless extensions version %d", WIRELESS_EXT); + ret = ieee80211_debug_init(); if (ret) { pr_err("ieee80211_debug_init() failed %d\n", ret); return ret; } -#endif + ret = ieee80211_crypto_init(); if (ret) { pr_err("ieee80211_crypto_init() failed %d\n", ret); - return ret; + goto debug_exit; } ret = ieee80211_crypto_tkip_init(); if (ret) { pr_err("ieee80211_crypto_tkip_init() failed %d\n", ret); - return ret; + goto crypto_exit; } ret = ieee80211_crypto_ccmp_init(); if (ret) { pr_err("ieee80211_crypto_ccmp_init() failed %d\n", ret); - return ret; + goto crypto_tkip_exit; } ret = ieee80211_crypto_wep_init(); if (ret) { pr_err("ieee80211_crypto_wep_init() failed %d\n", ret); - return ret; + goto crypto_ccmp_exit; } - pr_info("\nLinux kernel driver for RTL8192 based WLAN cards\n"); - pr_info("Copyright (c) 2007-2008, Realsil Wlan\n"); - RT_TRACE(COMP_INIT, "Initializing module"); - RT_TRACE(COMP_INIT, "Wireless extensions version %d", WIRELESS_EXT); rtl8192_proc_module_init(); - return usb_register(&rtl8192_usb_driver); + ret = usb_register(&rtl8192_usb_driver); + if (ret) + goto rtl8192_proc_module_exit; + return ret; + +rtl8192_proc_module_exit: + remove_proc_entry(RTL819XU_MODULE_NAME, init_net.proc_net); + ieee80211_crypto_wep_exit(); +crypto_ccmp_exit: + ieee80211_crypto_ccmp_exit(); +crypto_tkip_exit: + ieee80211_crypto_tkip_exit(); +crypto_exit: + ieee80211_crypto_deinit(); +debug_exit: + ieee80211_debug_exit(); + return ret; } static void __exit rtl8192_usb_module_exit(void) { usb_deregister(&rtl8192_usb_driver); - + remove_proc_entry(RTL819XU_MODULE_NAME, init_net.proc_net); + ieee80211_crypto_wep_exit(); + ieee80211_crypto_ccmp_exit(); + ieee80211_crypto_tkip_exit(); + ieee80211_crypto_deinit(); + ieee80211_debug_exit(); RT_TRACE(COMP_DOWN, "Exiting"); } -- cgit From 91c9ba35bb0695279c6924ef7e364196ce59a7c6 Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Fri, 25 Feb 2022 21:03:17 +1300 Subject: staging: pi433: add index value to write dev_dbg statement Add index value to the string that will be printed by dev_dbg for better easier visualisation when debugging. For instance, if I have a big message payload that will inevitably get split into chunks, it would be a hassle trying to debug if the offset of the original payload that got sent at that time. This patch adds index value to write dev_dbg statement. Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/YhiNRSi7jijxJWCL@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/rf69.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index 901f8db3e3ce..1a0081ebf63c 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -869,7 +869,7 @@ int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) /* print content written from fifo for debugging purposes */ for (i = 0; i < size; i++) - dev_dbg(&spi->dev, "0x%x\n", buffer[i]); + dev_dbg(&spi->dev, "%d - 0x%x\n", i, buffer[i]); return spi_write(spi, local_buffer, size + 1); } -- cgit From a42614f2b48bfae8b706b581cc73b32d0ff1b114 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 25 Feb 2022 12:23:56 +0100 Subject: staging: wfx: sta.o was linked twice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sta.o was listed twice in the Makefile. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220225112405.355599-2-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile index ae94c6552d77..c8b356f71c99 100644 --- a/drivers/staging/wfx/Makefile +++ b/drivers/staging/wfx/Makefile @@ -17,7 +17,6 @@ wfx-y := \ sta.o \ key.o \ main.o \ - sta.o \ debug.o wfx-$(CONFIG_SPI) += bus_spi.o # When CONFIG_MMC == m, append to 'wfx-y' (and not to 'wfx-m') -- cgit From 0d585ee974bce2f71851722a58d37de082ac6718 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 25 Feb 2022 12:23:57 +0100 Subject: staging: wfx: fix struct alignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no reason to add multiple spaces between a variable name and its type. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220225112405.355599-3-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bus_spi.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index 062826aa7e6c..a0a98c074cb5 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -65,14 +65,14 @@ static int wfx_spi_copy_from_io(void *priv, unsigned int addr, void *dst, size_t { struct wfx_spi_priv *bus = priv; u16 regaddr = (addr << 12) | (count / 2) | SET_READ; - struct spi_message m; - struct spi_transfer t_addr = { - .tx_buf = ®addr, - .len = sizeof(regaddr), + struct spi_message m; + struct spi_transfer t_addr = { + .tx_buf = ®addr, + .len = sizeof(regaddr), }; - struct spi_transfer t_msg = { - .rx_buf = dst, - .len = count, + struct spi_transfer t_msg = { + .rx_buf = dst, + .len = count, }; u16 *dst16 = dst; int ret, i; @@ -101,14 +101,14 @@ static int wfx_spi_copy_to_io(void *priv, unsigned int addr, const void *src, si /* FIXME: use a bounce buffer */ u16 *src16 = (void *)src; int ret, i; - struct spi_message m; - struct spi_transfer t_addr = { - .tx_buf = ®addr, - .len = sizeof(regaddr), + struct spi_message m; + struct spi_transfer t_addr = { + .tx_buf = ®addr, + .len = sizeof(regaddr), }; - struct spi_transfer t_msg = { - .tx_buf = src, - .len = count, + struct spi_transfer t_msg = { + .tx_buf = src, + .len = count, }; WARN(count % 2, "buffer size must be a multiple of 2"); -- cgit From e71b18ba664d624a65282c7fa9fbf600c823360f Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 25 Feb 2022 12:23:58 +0100 Subject: staging: wfx: format comments on 100 columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A few comments were not yet formatted on 100 columns. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220225112405.355599-4-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/data_tx.c | 8 ++------ drivers/staging/wfx/queue.c | 9 ++++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index d7bcf3bae08a..e07381b2ff4d 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -117,9 +117,7 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif, struct ieee80211_tx_rate *rat if (idx >= 0) { *renew = false; } else { - /* If policy is not found create a new one using the oldest - * entry in "free" list - */ + /* If policy is not found create a new one using the oldest entry in "free" list */ *renew = true; entry = list_entry(cache->free.prev, struct wfx_tx_policy, link); memcpy(entry->rates, wanted.rates, sizeof(entry->rates)); @@ -494,9 +492,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg) wfx_tx_fill_rates(wdev, tx_info, arg); skb_trim(skb, skb->len - tx_priv->icv_size); - /* From now, you can touch to tx_info->status, but do not touch to - * tx_priv anymore - */ + /* From now, you can touch to tx_info->status, but do not touch to tx_priv anymore */ /* FIXME: use ieee80211_tx_info_clear_status() */ memset(tx_info->rate_driver_data, 0, sizeof(tx_info->rate_driver_data)); memset(tx_info->pad, 0, sizeof(tx_info->pad)); diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 9186726ff07f..729825230db2 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -210,8 +210,8 @@ bool wfx_tx_queues_has_cab(struct wfx_vif *wvif) if (wvif->vif->type != NL80211_IFTYPE_AP) return false; for (i = 0; i < IEEE80211_NUM_ACS; ++i) - /* Note: since only AP can have mcast frames in queue and only - * one vif can be AP, all queued frames has same interface id + /* Note: since only AP can have mcast frames in queue and only one vif can be AP, + * all queued frames has same interface id */ if (!skb_queue_empty_lockless(&wvif->tx_queue[i].cab)) return true; @@ -253,9 +253,8 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) skb = skb_dequeue(&queues[i]->cab); if (!skb) continue; - /* Note: since only AP can have mcast frames in queue - * and only one vif can be AP, all queued frames has - * same interface id + /* Note: since only AP can have mcast frames in queue and only one vif can + * be AP, all queued frames has same interface id */ hif = (struct wfx_hif_msg *)skb->data; WARN_ON(hif->interface != wvif->id); -- cgit From 5265c43d40d04d57ac2108a8350e4e35e47dc518 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 25 Feb 2022 12:23:59 +0100 Subject: staging: wfx: format code on 100 columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A few lines were not yet formatted on 100 columns. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220225112405.355599-5-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/fwio.c | 3 +-- drivers/staging/wfx/hif_rx.c | 3 +-- drivers/staging/wfx/hif_tx.c | 3 +-- drivers/staging/wfx/hif_tx_mib.c | 3 +-- drivers/staging/wfx/hwio.c | 9 +++------ drivers/staging/wfx/sta.c | 7 +++---- drivers/staging/wfx/sta.h | 3 +-- 7 files changed, 11 insertions(+), 20 deletions(-) diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c index 9005a6fe48c8..3d1b8a135dc0 100644 --- a/drivers/staging/wfx/fwio.c +++ b/drivers/staging/wfx/fwio.c @@ -192,8 +192,7 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) return ret; } if (ktime_compare(now, start)) - dev_dbg(wdev->dev, "answer after %lldus\n", - ktime_us_delta(now, start)); + dev_dbg(wdev->dev, "answer after %lldus\n", ktime_us_delta(now, start)); ret = wfx_sram_write_dma_safe(wdev, WFX_DNLD_FIFO + (offs % DNLD_FIFO_SIZE), data + offs, DNLD_BLOCK_SIZE); diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index 302bdb2bf036..64ca8acb8e4f 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -244,8 +244,7 @@ static int wfx_hif_generic_indication(struct wfx_dev *wdev, mutex_unlock(&wdev->tx_power_loop_info_lock); return 0; default: - dev_err(wdev->dev, "generic_indication: unknown indication type: %#.8x\n", - type); + dev_err(wdev->dev, "generic_indication: unknown indication type: %#.8x\n", type); return -EIO; } } diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index ea2582714bb9..236f9d62e3a9 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -169,8 +169,7 @@ int wfx_hif_reset(struct wfx_vif *wvif, bool reset_stat) return ret; } -int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *val, size_t val_len) +int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, size_t val_len) { int ret; struct wfx_hif_msg *hif; diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index 1c57dd2b697c..df1bcb1e2c02 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -84,8 +84,7 @@ int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac) &arg, sizeof(arg)); } -int wfx_hif_set_rx_filter(struct wfx_vif *wvif, - bool filter_bssid, bool filter_prbreq) +int wfx_hif_set_rx_filter(struct wfx_vif *wvif, bool filter_bssid, bool filter_prbreq) { struct wfx_hif_mib_rx_filter arg = { }; diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c index c15810bdaecb..3f9750b470be 100644 --- a/drivers/staging/wfx/hwio.c +++ b/drivers/staging/wfx/hwio.c @@ -71,8 +71,7 @@ static int wfx_write32_locked(struct wfx_dev *wdev, int reg, u32 val) return ret; } -static int wfx_write32_bits_locked(struct wfx_dev *wdev, - int reg, u32 mask, u32 val) +static int wfx_write32_bits_locked(struct wfx_dev *wdev, int reg, u32 mask, u32 val) { int ret; u32 val_r, val_w; @@ -94,8 +93,7 @@ err: return ret; } -static int wfx_indirect_read(struct wfx_dev *wdev, int reg, u32 addr, - void *buf, size_t len) +static int wfx_indirect_read(struct wfx_dev *wdev, int reg, u32 addr, void *buf, size_t len) { int ret; int i; @@ -199,8 +197,7 @@ static int wfx_indirect_read32_locked(struct wfx_dev *wdev, int reg, u32 addr, u return ret; } -static int wfx_indirect_write32_locked(struct wfx_dev *wdev, int reg, - u32 addr, u32 val) +static int wfx_indirect_write32_locked(struct wfx_dev *wdev, int reg, u32 addr, u32 val) { int ret; __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index ba53e4d70c4f..28474614a8e5 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -432,8 +432,7 @@ static void wfx_join(struct wfx_vif *wvif) wfx_tx_unlock(wvif->wdev); } -static void wfx_join_finalize(struct wfx_vif *wvif, - struct ieee80211_bss_conf *info) +static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info) { struct ieee80211_sta *sta = NULL; int ampdu_density = 0; @@ -539,8 +538,8 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wfx_enable_beacon(wvif, info->enable_beacon); if (changed & BSS_CHANGED_KEEP_ALIVE) - wfx_hif_keep_alive_period(wvif, info->max_idle_period * - USEC_PER_TU / USEC_PER_MSEC); + wfx_hif_keep_alive_period(wvif, + info->max_idle_period * USEC_PER_TU / USEC_PER_MSEC); if (changed & BSS_CHANGED_ERP_CTS_PROT) wfx_hif_erp_use_protection(wvif, info->use_cts_prot); diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index 082329d7bbcd..c69b2227e9ac 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -46,8 +46,7 @@ int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params); int wfx_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf); void wfx_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf); -void wfx_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf, - u32 changed); +void wfx_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf, u32 changed); int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_chanctx_conf *conf); void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, -- cgit From 063cf5f58922470ed102316d143ef5b5c475c6f0 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 25 Feb 2022 12:24:00 +0100 Subject: staging: wfx: remove useless variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Obviously, the variable "ret" was useless. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220225112405.355599-6-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/sta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 28474614a8e5..b1e9fb14d2b4 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -687,7 +687,7 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed) int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { - int i, ret = 0; + int i; struct wfx_dev *wdev = hw->priv; struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; @@ -747,7 +747,7 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) else wfx_hif_set_block_ack_policy(wvif, 0x00, 0x00); } - return ret; + return 0; } void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -- cgit From a564d55a0cc123b7ea844b7ca8e79c116914e416 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 25 Feb 2022 12:24:01 +0100 Subject: staging: wfx: drop useless include MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ieee80211.h is useless since commit 5e911c3d9dbc9 ("staging: wfx: avoid defining array of flexible struct") Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220225112405.355599-7-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_api_cmd.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h index 444ff7ed882d..8b91b1d4a46b 100644 --- a/drivers/staging/wfx/hif_api_cmd.h +++ b/drivers/staging/wfx/hif_api_cmd.h @@ -8,8 +8,6 @@ #ifndef WFX_HIF_API_CMD_H #define WFX_HIF_API_CMD_H -#include - #include "hif_api_general.h" enum wfx_hif_requests_ids { -- cgit From 1de8eec7c339700e266e9768258eb2e9625a0622 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 25 Feb 2022 12:24:02 +0100 Subject: staging: wfx: remove duplicated code in wfx_cmd_send() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code to execute on end of the function is the same whatever the command replies or not. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220225112405.355599-8-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_tx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 236f9d62e3a9..0b1ed12c0e83 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -74,9 +74,8 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request, if (no_reply) { /* Chip won't reply. Give enough time to the wq to send the buffer. */ msleep(100); - wdev->hif_cmd.buf_send = NULL; - mutex_unlock(&wdev->hif_cmd.lock); - return 0; + ret = 0; + goto end; } if (wdev->poll_irq) @@ -98,6 +97,7 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request, ret = wdev->hif_cmd.ret; } +end: wdev->hif_cmd.buf_send = NULL; mutex_unlock(&wdev->hif_cmd.lock); -- cgit From 0803a85a6f236f648b80584bc02b86b092f43d5a Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 25 Feb 2022 12:24:03 +0100 Subject: staging: wfx: prefer to wait for an event instead to sleep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When possible it is better to wait for an explicit event instead of wait an arbitrary amount of time. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220225112405.355599-9-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 0b1ed12c0e83..ae3cc5919dcd 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -72,8 +72,8 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request, wfx_bh_request_tx(wdev); if (no_reply) { - /* Chip won't reply. Give enough time to the wq to send the buffer. */ - msleep(100); + /* Chip won't reply. Ensure the wq has send the buffer before to continue. */ + flush_workqueue(system_highpri_wq); ret = 0; goto end; } -- cgit From c86176d51340d5ee29afffce63d79c4ece5d96bb Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 25 Feb 2022 12:24:04 +0100 Subject: staging: wfx: ensure HIF request has been sent before polling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wfx_bh_request_tx() send HIF request asynchronously through bh_work(). Then the caller will run wfx_bh_poll_irq() to poll the answer. However it useless to burn CPU cycles for the polling while the request has yet been sent. Worse, wfx_bh_poll_irq() may get the CPU and prevent wfx_bh_request_tx() to run. This problem has been observed on mono core architecture. This first exchange is correct: kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003000 kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003000 kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003004 kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003004 kworker/0:1H-40 [000] .... : io_read: QUEUE: 08 00 09 0c 00 00 00 00 3a 7b 00 30 (12 bytes) kworker/0:1H-40 [000] .... : piggyback: CONTROL: 00003000 kworker/0:1H-40 [000] .... : hif_recv: 0:2:CNF_CONFIGURATION: 00 00 00 00 (8 bytes) kworker/0:1H-40 [000] .... : io_read32: CONFIG: 03010200 kworker/0:1H-40 [000] .... : bh_stats: IND/REQ/CNF: 0/ 0/ 1, REQ in progress: 0, WUP: release ... while the following is not: kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003000 kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003000 kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003000 [...loop until timeout...] wfx-sdio mmc0:0001:1: time out while polling control register Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220225112405.355599-10-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bh.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index 4c6ba9c342a6..bcea9d5b119c 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -295,6 +295,7 @@ void wfx_bh_poll_irq(struct wfx_dev *wdev) u32 reg; WARN(!wdev->poll_irq, "unexpected IRQ polling can mask IRQ"); + flush_workqueue(system_highpri_wq); start = ktime_get(); for (;;) { wfx_control_reg_read(wdev, ®); -- cgit From fe5c03d478d43e89914797016c62dfb701a0c565 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 25 Feb 2022 12:24:05 +0100 Subject: staging: wfx: flags for SPI IRQ were ignored MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The flags declared in the DT were not forwarded to request_irq(). Fixes: a7efb62509d8 ("staging: wfx: use threaded IRQ with SPI") Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20220225112405.355599-11-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bus_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index a0a98c074cb5..bb31f8a005bf 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -162,7 +162,7 @@ static int wfx_spi_irq_subscribe(void *priv) flags = IRQF_TRIGGER_HIGH; flags |= IRQF_ONESHOT; return devm_request_threaded_irq(&bus->func->dev, bus->func->irq, NULL, - wfx_spi_irq_handler, IRQF_ONESHOT, "wfx", bus); + wfx_spi_irq_handler, flags, "wfx", bus); } static int wfx_spi_irq_unsubscribe(void *priv) -- cgit From 63a9c6676ef09f46119ea08e0ab296920a065d15 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 25 Feb 2022 13:08:40 +0100 Subject: staging: r8188eu: EepromAddressSize is set but not used EepromAddressSize in struct adapter is set but not used. Remove it and remove the now unused function GetEEPROMSize8188E(). Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220225120843.10674-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 15 --------------- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/drv_types.h | 1 - drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 - 4 files changed, 20 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index 53ebea311723..6811be95da9a 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -534,21 +534,6 @@ void hal_notch_filter_8188e(struct adapter *adapter, bool enable) rtw_write8(adapter, rOFDM0_RxDSP + 1, rtw_read8(adapter, rOFDM0_RxDSP + 1) & ~BIT(1)); } -u8 GetEEPROMSize8188E(struct adapter *padapter) -{ - u8 size = 0; - u32 cr; - - cr = rtw_read16(padapter, REG_9346CR); - /* 6: EEPROM used is 93C46, 4: boot from E-Fuse. */ - size = (cr & BOOT_FROM_EEPROM) ? 6 : 4; - - netdev_dbg(padapter->pnetdev, "EEPROM type is %s\n", - size == 4 ? "E-FUSE" : "93C46"); - - return size; -} - /* */ /* */ /* LLT R/W/Init function */ diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index d7dcef3ece3d..6ada22a9616e 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -835,9 +835,6 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter) struct led_priv *ledpriv = &Adapter->ledpriv; u8 eeValue; - /* Read EEPROM size before call any EEPROM function */ - Adapter->EepromAddressSize = GetEEPROMSize8188E(Adapter); - /* check system boot selection */ eeValue = rtw_read8(Adapter, REG_9346CR); eeprom->EepromOrEfuse = (eeValue & BOOT_FROM_EEPROM); diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h index 894e70a0d506..09fc27082f7c 100644 --- a/drivers/staging/r8188eu/include/drv_types.h +++ b/drivers/staging/r8188eu/include/drv_types.h @@ -177,7 +177,6 @@ struct adapter { s32 bSurpriseRemoved; s32 bCardDisableWOHSM; - u8 EepromAddressSize; u8 hw_init_completed; s8 signal_strength; diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h index 44321a53a345..82cb4f7f4d3e 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h @@ -176,7 +176,6 @@ struct hal_data_8188e { s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy); /* EFuse */ -u8 GetEEPROMSize8188E(struct adapter *padapter); void Hal_EfuseParseIDCode88E(struct adapter *padapter, u8 *hwinfo); void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail); -- cgit From 8f7b7c0df5e8d789e616111a23d1d84ee7073336 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 25 Feb 2022 13:08:41 +0100 Subject: staging: r8188eu: remove unused function prototype The function prototype rtl8188e_query_rx_phy_status() is not used. Remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220225120843.10674-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtl8188e_recv.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/rtl8188e_recv.h b/drivers/staging/r8188eu/include/rtl8188e_recv.h index 0be9896eaf0f..87dd4152082a 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_recv.h +++ b/drivers/staging/r8188eu/include/rtl8188e_recv.h @@ -42,7 +42,6 @@ s32 rtl8188eu_init_recv_priv(struct adapter *padapter); void rtl8188eu_free_recv_priv(struct adapter * padapter); void rtl8188eu_recv_hdl(struct adapter * padapter, struct recv_buf *precvbuf); void rtl8188eu_recv_tasklet(unsigned long priv); -void rtl8188e_query_rx_phy_status(struct recv_frame *fr, struct phy_stat *phy); void rtl8188e_process_phy_info(struct adapter * padapter, void *prframe); void update_recvframe_phyinfo_88e(struct recv_frame *fra, struct phy_stat *phy); void update_recvframe_attrib_88e(struct recv_frame *fra, struct recv_stat *stat); -- cgit From b073b837fc549c3480430f503196ec80cfcf442c Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 25 Feb 2022 13:08:42 +0100 Subject: staging: r8188eu: remove update_bcn_p2p_ie() The function update_bcn_p2p_ie() is empty. Remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220225120843.10674-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_ap.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c index ed66331de319..2ff78ed1faab 100644 --- a/drivers/staging/r8188eu/core/rtw_ap.c +++ b/drivers/staging/r8188eu/core/rtw_ap.c @@ -613,16 +613,10 @@ exit: kfree(pbackup_remainder_ie); } -static void update_bcn_p2p_ie(struct adapter *padapter) -{ -} - static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui) { if (!memcmp(WPS_OUI, oui, 4)) update_bcn_wps_ie(padapter); - else if (!memcmp(P2P_OUI, oui, 4)) - update_bcn_p2p_ie(padapter); } void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) -- cgit From 83ba9a33b56673263981d5633fd6a96d83dabc21 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 25 Feb 2022 13:08:43 +0100 Subject: staging: r8188eu: remove ETH_ALEN from ieee80211.h The definition of ETH_ALEN in ieee80211.h is redundant as it is an in-kernel constant. Remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220225120843.10674-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/ieee80211.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/ieee80211.h b/drivers/staging/r8188eu/include/ieee80211.h index 1793b99feb9f..3a860e132cbd 100644 --- a/drivers/staging/r8188eu/include/ieee80211.h +++ b/drivers/staging/r8188eu/include/ieee80211.h @@ -11,7 +11,6 @@ #define MGMT_QUEUE_NUM 5 -#define ETH_ALEN 6 #define ETH_TYPE_LEN 2 #define PAYLOAD_TYPE_LEN 1 -- cgit From 50dc963bc12ce84fb70b90a83109f27ce92fc42f Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Sat, 26 Feb 2022 17:52:59 +1300 Subject: staging: pi433: remove TODOs-related item from the TODO file All occurences of code annotated with TODO in this driver have been addressed in the last couple of years by the community. The last occurrence of the word "TODO" was in the form of a multi-line comment in the header file intended to be exposed to userspace once this driver moves away from the staging folder. This patch removes that TODO as well as the TODO-related item from the driver's TODO file Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/YhmyK1Utaoj924im@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/TODO | 1 - drivers/staging/pi433/pi433_if.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/staging/pi433/TODO b/drivers/staging/pi433/TODO index 8d0f1b57961a..5cf3fd99d521 100644 --- a/drivers/staging/pi433/TODO +++ b/drivers/staging/pi433/TODO @@ -1,4 +1,3 @@ -* still TODOs, annotated in the code * currently the code introduces new IOCTLs. I'm afraid this is a bad idea. -> Replace this with another interface, hints are welcome! * Some missing data (marked with ###) needs to be added in the documentation diff --git a/drivers/staging/pi433/pi433_if.h b/drivers/staging/pi433/pi433_if.h index 855f0bebdc1c..25ee0b77a32c 100644 --- a/drivers/staging/pi433/pi433_if.h +++ b/drivers/staging/pi433/pi433_if.h @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * include/linux/TODO - * * userspace interface for pi433 radio module * * Pi433 is a 433MHz radio module for the Raspberry Pi. -- cgit From ed01d1b9bca21b186aa05b5beab4df88d42cf335 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 25 Feb 2022 18:48:27 +0100 Subject: staging: r8188eu: remove _linked_rx_signal_strength_display() The function _linked_rx_signal_strength_display() only sets two local variables that are not used after setting. Remove the function and remove resulting dead code. The HW_DEF_RA_INFO_DUMP case in GetHalDefVar8188EUsb() does not set the passed variable. It just calls check_fwstate() which does nothing than return true or false. So it is safe to remove this call to GetHalDefVar8188EUsb(). The HAL_DEF_UNDERCORATEDSMOOTHEDPWDB case in GetHalDefVar8188EUsb() does nothing than set the passed variable and it is safe to remove this call to GetHalDefVar8188EUsb() as well. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220225174827.15927-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 20 -------------------- drivers/staging/r8188eu/hal/usb_halinit.c | 13 ------------- drivers/staging/r8188eu/include/hal_intf.h | 2 -- 3 files changed, 35 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 0b77ddde6ce2..580d0c15b958 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -6834,23 +6834,6 @@ void mlmeext_sta_del_event_callback(struct adapter *padapter) Following are the functions for the timer handlers *****************************************************************************/ -static void _linked_rx_signal_strength_display(struct adapter *padapter) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - u8 mac_id; - int UndecoratedSmoothedPWDB; - - if ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) - mac_id = 0; - else if ((pmlmeinfo->state & 0x03) == _HW_STATE_AP_) - mac_id = 2; - - GetHalDefVar8188EUsb(padapter, HW_DEF_RA_INFO_DUMP, &mac_id); - - GetHalDefVar8188EUsb(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); -} - static u8 chk_ap_is_alive(struct sta_info *psta) { u8 ret = false; @@ -6886,9 +6869,6 @@ void linked_status_chk(struct adapter *padapter) struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct sta_priv *pstapriv = &padapter->stapriv; - if (padapter->bRxRSSIDisplay) - _linked_rx_signal_strength_display(padapter); - rtl8188e_sreset_linked_status_check(padapter); if (is_client_associated_to_ap(padapter)) { diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 6ada22a9616e..a92774352d2d 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1396,16 +1396,6 @@ void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariab struct hal_data_8188e *haldata = &Adapter->haldata; switch (eVariable) { - case HAL_DEF_UNDERCORATEDSMOOTHEDPWDB: - { - struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; - struct sta_priv *pstapriv = &Adapter->stapriv; - struct sta_info *psta; - psta = rtw_get_stainfo(pstapriv, pmlmepriv->cur_network.network.MacAddress); - if (psta) - *((int *)pValue) = psta->rssi_stat.UndecoratedSmoothedPWDB; - } - break; case HAL_DEF_IS_SUPPORT_ANT_DIV: *((u8 *)pValue) = (haldata->AntDivCfg == 0) ? false : true; break; @@ -1415,9 +1405,6 @@ void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariab case HAL_DEF_DBG_DM_FUNC: *((u32 *)pValue) = haldata->odmpriv.SupportAbility; break; - case HW_DEF_RA_INFO_DUMP: - check_fwstate(&Adapter->mlmepriv, _FW_LINKED); - break; case HAL_DEF_DBG_DUMP_RXPKT: *((u8 *)pValue) = haldata->bDumpRxPkt; break; diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index 8e204d61cc53..3cededa4dcfc 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -43,12 +43,10 @@ enum hw_variables { }; enum hal_def_variable { - HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, HAL_DEF_IS_SUPPORT_ANT_DIV, HAL_DEF_CURRENT_ANTENNA, HAL_DEF_DBG_DUMP_RXPKT,/* for dbg */ HAL_DEF_DBG_DM_FUNC,/* for dbg */ - HW_DEF_RA_INFO_DUMP, HAL_DEF_DBG_DUMP_TXPKT, }; -- cgit From 2d19e698e7f1c2453340b515f18adc779c42b11e Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Sat, 26 Feb 2022 11:40:33 +1300 Subject: staging: pi433: remove rf69_get_flag function resolving enum conflict The reason why rf69_get_flag() existed was to provide a high-level way to obtain values out of 1 (of 2) flags registers using bit masking. The idea was to map the possible flag values found in the data sheet like shown in page 70 of the RFM69HCW datasheet. However, due to the fact that enums values in C must be unique, there was a naming conflict on 'fifo_not_empty' which is used by the tx_start_condition enum. So the author decided to create a 'fifo_empty' one which would negate the value that comes from the flag register as the solution to that conflict (which is very confusing). this patch removes rf69_get_flag function which subsequently solves the enum redeclaration problem so kernel developers can follow the data sheet more easily. Reviewed-by: Dan Carpenter Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/Yhla4a1Clpguoo2h@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/pi433_if.c | 8 +++---- drivers/staging/pi433/rf69.c | 44 --------------------------------------- drivers/staging/pi433/rf69.h | 1 - drivers/staging/pi433/rf69_enum.h | 20 ------------------ 4 files changed, 4 insertions(+), 69 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 069255f023c8..3f3e863e6cc8 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -434,7 +434,7 @@ static int pi433_receive(void *data) return retval; /* now check RSSI, if low wait for getting high (RSSI interrupt) */ - while (!rf69_get_flag(dev->spi, rssi_exceeded_threshold)) { + while (!(rf69_read_reg(spi, REG_IRQFLAGS1) & MASK_IRQFLAGS1_RSSI)) { /* allow tx to interrupt us while waiting for high RSSI */ dev->interrupt_rx_allowed = true; wake_up_interruptible(&dev->tx_wait_queue); @@ -442,8 +442,8 @@ static int pi433_receive(void *data) /* wait for RSSI level to become high */ dev_dbg(dev->dev, "rx: going to wait for high RSSI level\n"); retval = wait_event_interruptible(dev->rx_wait_queue, - rf69_get_flag(dev->spi, - rssi_exceeded_threshold)); + rf69_read_reg(spi, REG_IRQFLAGS1) + & MASK_IRQFLAGS1_RSSI); if (retval) /* wait was interrupted */ goto abort; dev->interrupt_rx_allowed = false; @@ -510,7 +510,7 @@ static int pi433_receive(void *data) /* get payload */ while (dev->rx_position < bytes_total) { - if (!rf69_get_flag(dev->spi, payload_ready)) { + if (!(rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_PAYLOAD_READY)) { retval = wait_event_interruptible(dev->fifo_wait_queue, dev->free_in_fifo < FIFO_SIZE); if (retval) /* wait was interrupted */ diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index 1a0081ebf63c..e5b23ab39c69 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -578,50 +578,6 @@ int rf69_set_dio_mapping(struct spi_device *spi, u8 dio_number, u8 value) return rf69_write_reg(spi, dio_addr, dio_value); } -bool rf69_get_flag(struct spi_device *spi, enum flag flag) -{ - switch (flag) { - case mode_switch_completed: - return (rf69_read_reg(spi, REG_IRQFLAGS1) & MASK_IRQFLAGS1_MODE_READY); - case ready_to_receive: - return (rf69_read_reg(spi, REG_IRQFLAGS1) & MASK_IRQFLAGS1_RX_READY); - case ready_to_send: - return (rf69_read_reg(spi, REG_IRQFLAGS1) & MASK_IRQFLAGS1_TX_READY); - case pll_locked: - return (rf69_read_reg(spi, REG_IRQFLAGS1) & MASK_IRQFLAGS1_PLL_LOCK); - case rssi_exceeded_threshold: - return (rf69_read_reg(spi, REG_IRQFLAGS1) & MASK_IRQFLAGS1_RSSI); - case timeout: - return (rf69_read_reg(spi, REG_IRQFLAGS1) & MASK_IRQFLAGS1_TIMEOUT); - case automode: - return (rf69_read_reg(spi, REG_IRQFLAGS1) & MASK_IRQFLAGS1_AUTOMODE); - case sync_address_match: - return (rf69_read_reg(spi, REG_IRQFLAGS1) & MASK_IRQFLAGS1_SYNC_ADDRESS_MATCH); - case fifo_full: - return (rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_FIFO_FULL); -/* - * case fifo_not_empty: - * return (rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_FIFO_NOT_EMPTY); - */ - case fifo_empty: - return !(rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_FIFO_NOT_EMPTY); - case fifo_level_below_threshold: - return (rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_FIFO_LEVEL); - case fifo_overrun: - return (rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_FIFO_OVERRUN); - case packet_sent: - return (rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_PACKET_SENT); - case payload_ready: - return (rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_PAYLOAD_READY); - case crc_ok: - return (rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_CRC_OK); - case battery_low: - return (rf69_read_reg(spi, REG_IRQFLAGS2) & MASK_IRQFLAGS2_LOW_BAT); - default: - return false; - } -} - int rf69_set_rssi_threshold(struct spi_device *spi, u8 threshold) { /* no value check needed - u8 exactly matches register size */ diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h index 3ff5609ecf2e..78fa0b8bab8b 100644 --- a/drivers/staging/pi433/rf69.h +++ b/drivers/staging/pi433/rf69.h @@ -42,7 +42,6 @@ int rf69_set_bandwidth_during_afc(struct spi_device *spi, int rf69_set_ook_threshold_dec(struct spi_device *spi, enum threshold_decrement threshold_decrement); int rf69_set_dio_mapping(struct spi_device *spi, u8 dio_number, u8 value); -bool rf69_get_flag(struct spi_device *spi, enum flag flag); int rf69_set_rssi_threshold(struct spi_device *spi, u8 threshold); int rf69_set_preamble_length(struct spi_device *spi, u16 preamble_length); int rf69_enable_sync(struct spi_device *spi); diff --git a/drivers/staging/pi433/rf69_enum.h b/drivers/staging/pi433/rf69_enum.h index b33a33a85d3b..9dc906124e98 100644 --- a/drivers/staging/pi433/rf69_enum.h +++ b/drivers/staging/pi433/rf69_enum.h @@ -84,26 +84,6 @@ enum threshold_decrement { dec_16times }; -enum flag { - mode_switch_completed, - ready_to_receive, - ready_to_send, - pll_locked, - rssi_exceeded_threshold, - timeout, - automode, - sync_address_match, - fifo_full, -// fifo_not_empty, collision with next enum; replaced by following enum... - fifo_empty, - fifo_level_below_threshold, - fifo_overrun, - packet_sent, - payload_ready, - crc_ok, - battery_low -}; - enum fifo_fill_condition { after_sync_interrupt, always -- cgit From 18ba5748c24dc42a3280f94eb7b52a9bbb756c48 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 26 Feb 2022 19:14:51 +0100 Subject: staging: r8188eu: smooth_rssi_data is not used struct smooth_rssi_data is not used in this driver. It can be removed. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220226181457.1138035-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_recv.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index 5e65cf6b87bc..13df95781747 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -55,13 +55,6 @@ struct stainfo_rxcache { */ }; -struct smooth_rssi_data { - u32 elements[100]; /* array to store values */ - u32 index; /* index to current array to store */ - u32 total_num; /* num of valid elements */ - u32 total_val; /* sum of valid elements */ -}; - struct signal_stat { u8 update_req; /* used to indicate */ u8 avg_val; /* avg of valid elements */ -- cgit From 6e1e59c1caf6d1981bfab8a2c920ad2e9995471c Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 26 Feb 2022 19:14:52 +0100 Subject: staging: r8188eu: irq_prepare_beacon_tasklet is unused irq_prepare_beacon_tasklet in struct recv_priv is not used for r8188eu. Remove it. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220226181457.1138035-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_recv.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index 13df95781747..a417a70835e7 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -170,7 +170,6 @@ struct recv_priv { struct semaphore allrxreturnevt; u8 rx_pending_cnt; - struct tasklet_struct irq_prepare_beacon_tasklet; struct tasklet_struct recv_tasklet; struct sk_buff_head free_recv_skb_queue; struct sk_buff_head rx_skb_queue; -- cgit From 1327fcf175fa63d3b7a058b8148ed7714acdc035 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 26 Feb 2022 19:14:53 +0100 Subject: staging: r8188eu: fix endless loop in recv_func Fix an endless loop in recv_func. If pending_frame is not NULL, we're stuck in the while loop forever. We have to call rtw_alloc_recvframe each time we loop. Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver") Reported-by: Pavel Skripkin Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220226181457.1138035-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 0144c4642911..c9878907de33 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1800,8 +1800,7 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe) struct recv_frame *pending_frame; int cnt = 0; - pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue); - while (pending_frame) { + while ((pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue))) { cnt++; recv_func_posthandle(padapter, pending_frame); } -- cgit From 905eebcf28d06a6d6e1a74afa1577c21b1601cca Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 26 Feb 2022 19:14:54 +0100 Subject: staging: r8188eu: cnt is set but not used In function recv_func, the cnt variable is set but not used. It can be removed. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220226181457.1138035-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index c9878907de33..6dacb2687034 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1798,12 +1798,9 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe) if (check_fwstate(mlmepriv, WIFI_STATION_STATE) && psecuritypriv->busetkipkey) { struct recv_frame *pending_frame; - int cnt = 0; - while ((pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue))) { - cnt++; + while ((pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue))) recv_func_posthandle(padapter, pending_frame); - } } ret = recv_func_prehandle(padapter, rframe); -- cgit From dde7b6ea87806376832dc3e663546d3aa97218a5 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 26 Feb 2022 19:14:55 +0100 Subject: staging: r8188eu: recvframe_push is not used The recvframe_push function is not used. It can be removed. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220226181457.1138035-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_recv.h | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index a417a70835e7..25afcbe862e6 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -286,26 +286,6 @@ static inline u8 *get_rx_status(struct recv_frame *precvframe) return get_rxmem(precvframe); } -static inline u8 *recvframe_push(struct recv_frame *precvframe, int sz) -{ - /* append data before rx_data */ - - /* add data to the start of recv_frame - * - * This function extends the used data area of the recv_frame at the buffer - * start. rx_data must be still larger than rx_head, after pushing. - */ - if (precvframe == NULL) - return NULL; - precvframe->rx_data -= sz ; - if (precvframe->rx_data < precvframe->rx_head) { - precvframe->rx_data += sz; - return NULL; - } - precvframe->len += sz; - return precvframe->rx_data; -} - static inline u8 *recvframe_pull(struct recv_frame *precvframe, int sz) { /* rx_data += sz; move rx_data sz bytes hereafter */ -- cgit From 1b627cc172910d2678c3e5362daa8e7ad97f4eb6 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 26 Feb 2022 19:14:56 +0100 Subject: staging: r8188eu: get_rx_status is not used Remove the unused function get_rx_status. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220226181457.1138035-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_recv.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index 25afcbe862e6..d2c1efbe62f0 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -281,11 +281,6 @@ static inline u8 *get_rxmem(struct recv_frame *precvframe) return precvframe->rx_head; } -static inline u8 *get_rx_status(struct recv_frame *precvframe) -{ - return get_rxmem(precvframe); -} - static inline u8 *recvframe_pull(struct recv_frame *precvframe, int sz) { /* rx_data += sz; move rx_data sz bytes hereafter */ -- cgit From e092f715ff5fee7f54beeb060e065398f91e8150 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 26 Feb 2022 19:14:57 +0100 Subject: staging: r8188eu: remove unused define Remove the rtw_dequeue_recvframe define, which is not used. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220226181457.1138035-8-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_recv.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index d2c1efbe62f0..6a6f6373467b 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -264,7 +264,6 @@ struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue); struct recv_frame *rtw_alloc_recvframe(struct __queue *pfree_recv_queue); int rtw_free_recvframe(struct recv_frame *precvframe, struct __queue *pfree_recv_queue); -#define rtw_dequeue_recvframe(queue) rtw_alloc_recvframe(queue) int _rtw_enqueue_recvframe(struct recv_frame *precvframe, struct __queue *queue); int rtw_enqueue_recvframe(struct recv_frame *precvframe, struct __queue *queue); void rtw_free_recvframe_queue(struct __queue *pframequeue, -- cgit From e9f3ac5edb25e47d6cc2b6fd2f4e1542ec7150e6 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 27 Feb 2022 17:41:40 +0100 Subject: staging: r8188eu: use ieee80211 define for management frame type Replace the driver-internal define for management frame type with IEEE80211_FTYPE_MGMT. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220227164147.1168847-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ++- drivers/staging/r8188eu/core/rtw_recv.c | 2 +- drivers/staging/r8188eu/include/wifi.h | 25 ++++++++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 580d0c15b958..10d5f1222936 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3,6 +3,7 @@ #define _RTW_MLME_EXT_C_ +#include #include "../include/osdep_service.h" #include "../include/drv_types.h" #include "../include/wifi.h" @@ -414,7 +415,7 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) u8 *pframe = precv_frame->rx_data; struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(pframe)); - if (GetFrameType(pframe) != WIFI_MGT_TYPE) + if (GetFrameType(pframe) != IEEE80211_FTYPE_MGMT) return; /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */ diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 6dacb2687034..1133239f29bc 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1094,7 +1094,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv /* Dump rx packets */ GetHalDefVar8188EUsb(adapter, HAL_DEF_DBG_DUMP_RXPKT, &bDumpRxPkt); switch (type) { - case WIFI_MGT_TYPE: /* mgnt */ + case IEEE80211_FTYPE_MGMT: validate_recv_mgnt_frame(adapter, precv_frame); retval = _FAIL; /* only data frame return _SUCCESS */ break; diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h index e7083d721dae..5b383c2e9880 100644 --- a/drivers/staging/r8188eu/include/wifi.h +++ b/drivers/staging/r8188eu/include/wifi.h @@ -18,7 +18,6 @@ #define WLAN_SSID_MAXLEN 32 enum WIFI_FRAME_TYPE { - WIFI_MGT_TYPE = (0), WIFI_CTRL_TYPE = (BIT(2)), WIFI_DATA_TYPE = (BIT(3)), WIFI_QOS_DATA_TYPE = (BIT(7)|BIT(3)), /* QoS Data */ @@ -26,18 +25,18 @@ enum WIFI_FRAME_TYPE { enum WIFI_FRAME_SUBTYPE { /* below is for mgt frame */ - WIFI_ASSOCREQ = (0 | WIFI_MGT_TYPE), - WIFI_ASSOCRSP = (BIT(4) | WIFI_MGT_TYPE), - WIFI_REASSOCREQ = (BIT(5) | WIFI_MGT_TYPE), - WIFI_REASSOCRSP = (BIT(5) | BIT(4) | WIFI_MGT_TYPE), - WIFI_PROBEREQ = (BIT(6) | WIFI_MGT_TYPE), - WIFI_PROBERSP = (BIT(6) | BIT(4) | WIFI_MGT_TYPE), - WIFI_BEACON = (BIT(7) | WIFI_MGT_TYPE), - WIFI_ATIM = (BIT(7) | BIT(4) | WIFI_MGT_TYPE), - WIFI_DISASSOC = (BIT(7) | BIT(5) | WIFI_MGT_TYPE), - WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | WIFI_MGT_TYPE), - WIFI_DEAUTH = (BIT(7) | BIT(6) | WIFI_MGT_TYPE), - WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | WIFI_MGT_TYPE), + WIFI_ASSOCREQ = (0 | IEEE80211_FTYPE_MGMT), + WIFI_ASSOCRSP = (BIT(4) | IEEE80211_FTYPE_MGMT), + WIFI_REASSOCREQ = (BIT(5) | IEEE80211_FTYPE_MGMT), + WIFI_REASSOCRSP = (BIT(5) | BIT(4) | IEEE80211_FTYPE_MGMT), + WIFI_PROBEREQ = (BIT(6) | IEEE80211_FTYPE_MGMT), + WIFI_PROBERSP = (BIT(6) | BIT(4) | IEEE80211_FTYPE_MGMT), + WIFI_BEACON = (BIT(7) | IEEE80211_FTYPE_MGMT), + WIFI_ATIM = (BIT(7) | BIT(4) | IEEE80211_FTYPE_MGMT), + WIFI_DISASSOC = (BIT(7) | BIT(5) | IEEE80211_FTYPE_MGMT), + WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | IEEE80211_FTYPE_MGMT), + WIFI_DEAUTH = (BIT(7) | BIT(6) | IEEE80211_FTYPE_MGMT), + WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | IEEE80211_FTYPE_MGMT), /* below is for control frame */ WIFI_PSPOLL = (BIT(7) | BIT(5) | WIFI_CTRL_TYPE), -- cgit From d7e168c76f16c280f7ad8a09b8ecddd53c208a3f Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 27 Feb 2022 17:41:41 +0100 Subject: staging: r8188eu: use ieee80211 helpers to check the frame type Use the ieee80211_is_... helper functions to check the frame type in the validate_recv_frame function. Add a temporary variable for the 16-bit frame control field. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220227164147.1168847-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 1133239f29bc..e95c9a47dcac 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -3,6 +3,7 @@ #define _RTW_RECV_C_ +#include #include "../include/osdep_service.h" #include "../include/drv_types.h" #include "../include/recv_osdep.h" @@ -1056,12 +1057,12 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv /* then call check if rx seq/frag. duplicated. */ - u8 type; u8 subtype; int retval = _SUCCESS; u8 bDumpRxPkt; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; u8 *ptr = precv_frame->rx_data; + __le16 fc = *(__le16 *)ptr; u8 ver = (unsigned char)(*ptr) & 0x3; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; @@ -1077,7 +1078,6 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv goto exit; } - type = GetFrameType(ptr); subtype = GetFrameSubType(ptr); /* bit(7)~bit(2) */ pattrib->to_fr_ds = get_tofr_ds(ptr); @@ -1093,16 +1093,14 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv /* Dump rx packets */ GetHalDefVar8188EUsb(adapter, HAL_DEF_DBG_DUMP_RXPKT, &bDumpRxPkt); - switch (type) { - case IEEE80211_FTYPE_MGMT: + + if (ieee80211_is_mgmt(fc)) { validate_recv_mgnt_frame(adapter, precv_frame); retval = _FAIL; /* only data frame return _SUCCESS */ - break; - case WIFI_CTRL_TYPE: /* ctrl */ + } else if (ieee80211_is_ctl(fc)) { validate_recv_ctrl_frame(adapter, precv_frame); retval = _FAIL; /* only data frame return _SUCCESS */ - break; - case WIFI_DATA_TYPE: /* data */ + } else if (ieee80211_is_data(fc)) { rtw_led_control(adapter, LED_CTL_RX); pattrib->qos = (subtype & BIT(7)) ? 1 : 0; retval = validate_recv_data_frame(adapter, precv_frame); @@ -1110,11 +1108,8 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv struct recv_priv *precvpriv = &adapter->recvpriv; precvpriv->rx_drop++; } - break; - default: + } else retval = _FAIL; - break; - } exit: -- cgit From aacd0400c7f3eccfba3df30d80f194abe1aa4111 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 27 Feb 2022 17:41:42 +0100 Subject: staging: r8188eu: refactor validate_recv_frame's error handling Refactor the error handling of validate_recv_frame. It's simpler to default to _FAIL. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220227164147.1168847-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index e95c9a47dcac..364bf78c36e9 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1058,7 +1058,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv /* then call check if rx seq/frag. duplicated. */ u8 subtype; - int retval = _SUCCESS; + int retval = _FAIL; u8 bDumpRxPkt; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; u8 *ptr = precv_frame->rx_data; @@ -1073,10 +1073,8 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv } /* add version chk */ - if (ver != 0) { - retval = _FAIL; - goto exit; - } + if (ver != 0) + return _FAIL; subtype = GetFrameSubType(ptr); /* bit(7)~bit(2) */ @@ -1094,13 +1092,12 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv /* Dump rx packets */ GetHalDefVar8188EUsb(adapter, HAL_DEF_DBG_DUMP_RXPKT, &bDumpRxPkt); - if (ieee80211_is_mgmt(fc)) { + /* We return _SUCCESS only for data frames. */ + if (ieee80211_is_mgmt(fc)) validate_recv_mgnt_frame(adapter, precv_frame); - retval = _FAIL; /* only data frame return _SUCCESS */ - } else if (ieee80211_is_ctl(fc)) { + else if (ieee80211_is_ctl(fc)) validate_recv_ctrl_frame(adapter, precv_frame); - retval = _FAIL; /* only data frame return _SUCCESS */ - } else if (ieee80211_is_data(fc)) { + else if (ieee80211_is_data(fc)) { rtw_led_control(adapter, LED_CTL_RX); pattrib->qos = (subtype & BIT(7)) ? 1 : 0; retval = validate_recv_data_frame(adapter, precv_frame); @@ -1108,10 +1105,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv struct recv_priv *precvpriv = &adapter->recvpriv; precvpriv->rx_drop++; } - } else - retval = _FAIL; - -exit: + } return retval; } -- cgit From 1c167e3b8304b0b9ec39a48d26c645185456aa93 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 27 Feb 2022 17:41:43 +0100 Subject: staging: r8188eu: use ieee80211 helper for qos bit Use the ieee80211_is_data_qos helper function to read the qos bit. This helper function returns a bool. Change the qos field in struct rx_pkt_attrib from u8 to bool and fix up the other places where it is used. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220227164147.1168847-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 9 +++------ drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 2 +- drivers/staging/r8188eu/include/rtw_recv.h | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 364bf78c36e9..3a92d261f7c3 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1012,7 +1012,7 @@ static int validate_recv_data_frame(struct adapter *adapter, pattrib->amsdu = 0; pattrib->ack_policy = 0; /* parsing QC field */ - if (pattrib->qos == 1) { + if (pattrib->qos) { pattrib->priority = GetPriority((ptr + 24)); pattrib->ack_policy = GetAckpolicy((ptr + 24)); pattrib->amsdu = GetAMsdu((ptr + 24)); @@ -1057,7 +1057,6 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv /* then call check if rx seq/frag. duplicated. */ - u8 subtype; int retval = _FAIL; u8 bDumpRxPkt; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; @@ -1076,8 +1075,6 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv if (ver != 0) return _FAIL; - subtype = GetFrameSubType(ptr); /* bit(7)~bit(2) */ - pattrib->to_fr_ds = get_tofr_ds(ptr); pattrib->frag_num = GetFragNum(ptr); @@ -1099,7 +1096,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv validate_recv_ctrl_frame(adapter, precv_frame); else if (ieee80211_is_data(fc)) { rtw_led_control(adapter, LED_CTL_RX); - pattrib->qos = (subtype & BIT(7)) ? 1 : 0; + pattrib->qos = ieee80211_is_data_qos(fc); retval = validate_recv_data_frame(adapter, precv_frame); if (retval == _FAIL) { struct recv_priv *precvpriv = &adapter->recvpriv; @@ -1599,7 +1596,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, struct recv_frame /* s1. */ wlanhdr_to_ethhdr(prframe); - if (pattrib->qos != 1) { + if (!pattrib->qos) { if (!padapter->bDriverStopped && !padapter->bSurpriseRemoved) { rtw_recv_indicatepkt(padapter, prframe); diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c index bf93ff3af140..101091342e4e 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c @@ -84,7 +84,7 @@ void update_recvframe_attrib_88e(struct recv_frame *precvframe, struct recv_stat pattrib->bdecrypted = (le32_to_cpu(report.rxdw0) & BIT(27)) ? 0 : 1;/* u8)(prxreport->swdec ? 0 : 1); */ pattrib->encrypt = (u8)((le32_to_cpu(report.rxdw0) >> 20) & 0x7);/* u8)prxreport->security; */ - pattrib->qos = (u8)((le32_to_cpu(report.rxdw0) >> 23) & 0x1);/* u8)prxreport->qos; */ + pattrib->qos = (le32_to_cpu(report.rxdw0) >> 23) & 0x1;/* prxreport->qos; */ pattrib->priority = (u8)((le32_to_cpu(report.rxdw1) >> 8) & 0xf);/* u8)prxreport->tid; */ pattrib->amsdu = (u8)((le32_to_cpu(report.rxdw1) >> 13) & 0x1);/* u8)prxreport->amsdu; */ diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index 6a6f6373467b..d2f1c71f2262 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -82,7 +82,7 @@ struct rx_pkt_attrib { u8 hdrlen; /* the WLAN Header Len */ u8 to_fr_ds; u8 amsdu; - u8 qos; + bool qos; u8 priority; u8 pw_save; u8 mdata; -- cgit From 7c22fd48fd4e9a89a8400828e77f169a604cfa3b Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 27 Feb 2022 17:41:44 +0100 Subject: staging: r8188eu: use ieee80211 helper to check for more fragments Use the ieee80211 helper to check the "more fragments" bit. Remove the internal GetMFrag macro. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220227164147.1168847-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 2 +- drivers/staging/r8188eu/include/wifi.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 3a92d261f7c3..e8da2e5bbc32 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1081,7 +1081,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv pattrib->seq_num = GetSequence(ptr); pattrib->pw_save = GetPwrMgt(ptr); - pattrib->mfrag = GetMFrag(ptr); + pattrib->mfrag = ieee80211_has_morefrags(fc); pattrib->mdata = GetMData(ptr); pattrib->privacy = GetPrivacy(ptr); pattrib->order = GetOrder(ptr); diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h index 5b383c2e9880..1d703bc94fca 100644 --- a/drivers/staging/r8188eu/include/wifi.h +++ b/drivers/staging/r8188eu/include/wifi.h @@ -183,8 +183,6 @@ enum WIFI_REG_DOMAIN { #define SetMFrag(pbuf) \ *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_) -#define GetMFrag(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_FRAG_)) != 0) - #define ClearMFrag(pbuf) \ *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)) -- cgit From 3371c86dc0546b7777ec574a3b713883dabb410d Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 27 Feb 2022 17:41:45 +0100 Subject: staging: r8188eu: use ieee80211 helper to read "more data" Use the ieee80211 helper to read the "more data" bit. The driver-specific macro GetMData can be removed. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220227164147.1168847-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 2 +- drivers/staging/r8188eu/include/wifi.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index e8da2e5bbc32..e7a1aa9457b7 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1082,7 +1082,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv pattrib->pw_save = GetPwrMgt(ptr); pattrib->mfrag = ieee80211_has_morefrags(fc); - pattrib->mdata = GetMData(ptr); + pattrib->mdata = ieee80211_has_moredata(fc); pattrib->privacy = GetPrivacy(ptr); pattrib->order = GetOrder(ptr); diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h index 1d703bc94fca..336c32470150 100644 --- a/drivers/staging/r8188eu/include/wifi.h +++ b/drivers/staging/r8188eu/include/wifi.h @@ -205,8 +205,6 @@ enum WIFI_REG_DOMAIN { #define SetMData(pbuf) \ *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_) -#define GetMData(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_DATA_)) != 0) - #define ClearMData(pbuf) \ *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)) -- cgit From 0beae891d3bae1161eaa2e48de4d68c0d5166afe Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 27 Feb 2022 17:41:46 +0100 Subject: staging: r8188eu: use ieee80211 helper to read the protected bit Use the ieee80211 helper to read the "protected" bit. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220227164147.1168847-8-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index e7a1aa9457b7..b245b0d54973 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1083,7 +1083,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv pattrib->pw_save = GetPwrMgt(ptr); pattrib->mfrag = ieee80211_has_morefrags(fc); pattrib->mdata = ieee80211_has_moredata(fc); - pattrib->privacy = GetPrivacy(ptr); + pattrib->privacy = ieee80211_has_protected(fc); pattrib->order = GetOrder(ptr); /* Dump rx packets */ -- cgit From 095f746502740d76a086ab127e11b3c4dba78141 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 27 Feb 2022 17:41:47 +0100 Subject: staging: r8188eu: use ieee80211 helper to read the "order" bit Use the ieee80211 helper to read the "order" bit. The driver-specific macro GetOrder can be removed. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220227164147.1168847-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 2 +- drivers/staging/r8188eu/include/wifi.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index b245b0d54973..d77d983510a0 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1084,7 +1084,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv pattrib->mfrag = ieee80211_has_morefrags(fc); pattrib->mdata = ieee80211_has_moredata(fc); pattrib->privacy = ieee80211_has_protected(fc); - pattrib->order = GetOrder(ptr); + pattrib->order = ieee80211_has_order(fc); /* Dump rx packets */ GetHalDefVar8188EUsb(adapter, HAL_DEF_DBG_DUMP_RXPKT, &bDumpRxPkt); diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h index 336c32470150..39b7a596e4c1 100644 --- a/drivers/staging/r8188eu/include/wifi.h +++ b/drivers/staging/r8188eu/include/wifi.h @@ -217,9 +217,6 @@ enum WIFI_REG_DOMAIN { #define ClearPrivacy(pbuf) \ *(__le16 *)(pbuf) &= (~cpu_to_le16(_PRIVACY_)) -#define GetOrder(pbuf) \ - (((*(__le16 *)(pbuf)) & cpu_to_le16(_ORDER_)) != 0) - #define GetFrameType(pbuf) \ (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2))) -- cgit From b497e06d2714b22200e0bad76111229c960debd5 Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Sat, 26 Feb 2022 17:25:31 +1300 Subject: staging: pi433: prevent uninitialized data from being printed out local_buffer is not initialised before data is passed to spi_sync_transfer. In case spi* function fails then the dev_dbg statement after that can potentially print out uninitialised data this patch initialises local_buffer array. Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/Yhmruyr2BUn0+3O3@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/rf69.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index e5b23ab39c69..3028018f0b45 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -782,7 +782,7 @@ int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) { int i; struct spi_transfer transfer; - u8 local_buffer[FIFO_SIZE + 1]; + u8 local_buffer[FIFO_SIZE + 1] = {}; int retval; if (size > FIFO_SIZE) { -- cgit From b25c7dc13fb8842e8634bd846a7a96f2176f0244 Mon Sep 17 00:00:00 2001 From: Samuel Sjöberg Date: Wed, 2 Mar 2022 16:03:28 +0100 Subject: staging: rts5208: fix Lines should not end with a '('. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the following check reported by checkpatch.pl: CHECK: Lines should not end with a '(' retval = ms_transfer_tpc( Signed-off-by: Samuel Sjöberg Link: https://lore.kernel.org/r/20220302150328.2722-1-info@samuelsjoberg.se Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/ms.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c index 2a6fab5c117a..14449f8afad5 100644 --- a/drivers/staging/rts5208/ms.c +++ b/drivers/staging/rts5208/ms.c @@ -1749,11 +1749,10 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, for (rty_cnt = 0; rty_cnt < MS_MAX_RETRY_COUNT; rty_cnt++) { - retval = ms_transfer_tpc( - chip, - MS_TM_NORMAL_WRITE, - WRITE_PAGE_DATA, - 0, NO_WAIT_INT); + retval = ms_transfer_tpc(chip, + MS_TM_NORMAL_WRITE, + WRITE_PAGE_DATA, + 0, NO_WAIT_INT); if (retval == STATUS_SUCCESS) break; } -- cgit From 46eb3ad789a43c3d4ffbd5ac97337d9b913bafe2 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Mon, 14 Mar 2022 12:53:31 +0100 Subject: staging: rtl8723bs: fix typos in comments Various spelling mistakes in comments. Detected with the help of Coccinelle. Signed-off-by: Julia Lawall Link: https://lore.kernel.org/r/20220314115354.144023-8-Julia.Lawall@inria.fr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 9202223ebc0c..ed2d3b7d44d9 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -24,7 +24,7 @@ int rtw_init_mlme_priv(struct adapter *padapter) pmlmepriv->fw_state = WIFI_STATION_STATE; /* Must sync with rtw_wdev_alloc() */ /* wdev->iftype = NL80211_IFTYPE_STATION */ pmlmepriv->cur_network.network.infrastructure_mode = Ndis802_11AutoUnknown; - pmlmepriv->scan_mode = SCAN_ACTIVE;/* 1: active, 0: pasive. Maybe someday we should rename this varable to "active_mode" (Jeff) */ + pmlmepriv->scan_mode = SCAN_ACTIVE;/* 1: active, 0: passive. Maybe someday we should rename this varable to "active_mode" (Jeff) */ spin_lock_init(&pmlmepriv->lock); INIT_LIST_HEAD(&pmlmepriv->free_bss_pool.queue); -- cgit From 6256e18686158fa49e019297f990f1c1817aabf1 Mon Sep 17 00:00:00 2001 From: Arınç ÜNAL Date: Fri, 11 Mar 2022 12:03:19 +0300 Subject: staging: mt7621-dts: fix LEDs and pinctrl on GB-PC1 devicetree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix LED and pinctrl definitions on the GB-PC1 devicetree. Refer to the schematics of the device for more information. LED fixes: - Change GPIO6 LED label from system to power as GPIO6 is connected to PLED. - Add default-on default-trigger to power LED. - Change GPIO8 LED label from status to system as GPIO8 is connected to SYS_LED. - Add disk-activity default-trigger to system LED. - Switch to the color:function naming scheme. - Remove lan1 and lan2 LEDs as they don't exist. Pinctrl fixes: - Claim state_default node under pinctrl node. - Change pinctrl0 node name to state-default. - Change gpio node name to gpio-pinmux to respect Documentation/devicetree/bindings/pinctrl/ralink,rt2880-pinmux.yaml. - Sort pin groups alphabetically. Misc fixes: - Fix formatting. - Use the status value "okay". - Define hexadecimal addresses in lower case. - Make hexadecimal addresses for memory easier to read. Link: https://github.com/ngiger/GnuBee_Docs/blob/master/GB-PCx/Documents/GB-PC1_V1.0_Schematic.pdf Tested-by: Sergio Paracuellos Signed-off-by: Arınç ÜNAL Link: https://lore.kernel.org/r/20220311090320.3068-1-arinc.unal@arinc9.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dts/gbpc1.dts | 40 ++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/drivers/staging/mt7621-dts/gbpc1.dts b/drivers/staging/mt7621-dts/gbpc1.dts index 1b5175e6ccf3..5892bcf71595 100644 --- a/drivers/staging/mt7621-dts/gbpc1.dts +++ b/drivers/staging/mt7621-dts/gbpc1.dts @@ -12,7 +12,8 @@ memory@0 { device_type = "memory"; - reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; + reg = <0x00000000 0x1c000000>, + <0x20000000 0x04000000>; }; chosen { @@ -38,24 +39,16 @@ gpio-leds { compatible = "gpio-leds"; - system { - label = "gb-pc1:green:system"; + power { + label = "green:power"; gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; }; - status { - label = "gb-pc1:green:status"; + system { + label = "green:system"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "gb-pc1:green:lan1"; - gpios = <&gpio 24 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "gb-pc1:green:lan2"; - gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + linux,default-trigger = "disk-activity"; }; }; }; @@ -95,9 +88,8 @@ partition@50000 { label = "firmware"; - reg = <0x50000 0x1FB0000>; + reg = <0x50000 0x1fb0000>; }; - }; }; @@ -106,9 +98,12 @@ }; &pinctrl { - state_default: pinctrl0 { - default_gpio: gpio { - groups = "wdt", "rgmii2", "uart3"; + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: state-default { + gpio-pinmux { + groups = "rgmii2", "uart3", "wdt"; function = "gpio"; }; }; @@ -121,12 +116,13 @@ &switch0 { ports { port@0 { + status = "okay"; label = "ethblack"; - status = "ok"; }; + port@4 { + status = "okay"; label = "ethblue"; - status = "ok"; }; }; }; -- cgit From 5bc148649cf358d0cccf525452a4efbd4bc89a0f Mon Sep 17 00:00:00 2001 From: Arınç ÜNAL Date: Fri, 11 Mar 2022 12:03:20 +0300 Subject: staging: mt7621-dts: fix GB-PC2 devicetree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the GB-PC2 devicetree. Refer to the schematics of the device for more information. GB-PC2 devicetree fixes: - Include mt7621.dtsi instead of gbpc1.dts. Add the missing definitions. - Remove gpio-leds node as the system LED is not wired to anywhere on the board and the power LED is directly wired to GND. - Remove uart3 pin group from gpio-pinmux node as it's not used as GPIO. - Use reg 7 for the external phy to be on par with Documentation/devicetree/bindings/net/dsa/mt7530.txt. - Use the status value "okay". Link: https://github.com/ngiger/GnuBee_Docs/blob/master/GB-PCx/Documents/GB-PC2_V1.1_schematic.pdf Reviewed-by: Sergio Paracuellos Signed-off-by: Arınç ÜNAL Link: https://lore.kernel.org/r/20220311090320.3068-2-arinc.unal@arinc9.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dts/gbpc2.dts | 110 ++++++++++++++++++++++++++++++++--- 1 file changed, 102 insertions(+), 8 deletions(-) diff --git a/drivers/staging/mt7621-dts/gbpc2.dts b/drivers/staging/mt7621-dts/gbpc2.dts index 03d6bb6735ac..a7fce8de6147 100644 --- a/drivers/staging/mt7621-dts/gbpc2.dts +++ b/drivers/staging/mt7621-dts/gbpc2.dts @@ -1,28 +1,122 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /dts-v1/; -#include "gbpc1.dts" +#include "mt7621.dtsi" + +#include +#include / { compatible = "gnubee,gb-pc2", "mediatek,mt7621-soc"; model = "GB-PC2"; + + memory@0 { + device_type = "memory"; + reg = <0x00000000 0x1c000000>, + <0x20000000 0x04000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + palmbus: palmbus@1e000000 { + i2c@900 { + status = "okay"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; }; -&default_gpio { - groups = "wdt", "uart3"; - function = "gpio"; +&sdhci { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + broken-flash-reset; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: state-default { + gpio-pinmux { + groups = "wdt"; + function = "gpio"; + }; + }; }; ðernet { gmac1: mac@1 { - status = "ok"; - phy-handle = <&phy_external>; + status = "okay"; + phy-handle = <ðphy7>; }; mdio-bus { - phy_external: ethernet-phy@5 { - reg = <5>; + ethphy7: ethernet-phy@7 { + reg = <7>; phy-mode = "rgmii-rxid"; }; }; }; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "ethblack"; + }; + + port@4 { + status = "okay"; + label = "ethblue"; + }; + }; +}; -- cgit From dcd520af4eacae8c9d2db1f50e7adc0ca050fc1a Mon Sep 17 00:00:00 2001 From: Arınç ÜNAL Date: Sat, 12 Mar 2022 12:18:32 +0300 Subject: staging: mt7621-dts: fix cpuintc and fixedregulator dtc warnings, fix xhci MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the cpuintc and fixedregulator dtc warnings: Warning (unit_address_vs_reg): /cpuintc@0: node has a unit name, but no reg property Warning (unit_address_vs_reg): /fixedregulator@0: node has a unit name, but no reg property Warning (unit_address_vs_reg): /fixedregulator@1: node has a unit name, but no reg property Warning (unique_unit_address): /cpuintc@0: duplicate unit-address (also used in node /fixedregulator@0) Remove the unnecessary status = "okay" property from the xhci node. Reviewed-by: Sergio Paracuellos Signed-off-by: Arınç ÜNAL Link: https://lore.kernel.org/r/20220312091832.6269-1-arinc.unal@arinc9.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dts/mt7621.dtsi | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index 4da20da243e6..3222684915ac 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -26,7 +26,7 @@ }; }; - cpuintc: cpuintc@0 { + cpuintc: cpuintc { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -38,7 +38,7 @@ }; - mmc_fixed_3v3: fixedregulator@0 { + mmc_fixed_3v3: regulator-3v3 { compatible = "regulator-fixed"; regulator-name = "mmc_power"; regulator-min-microvolt = <3300000>; @@ -47,7 +47,7 @@ regulator-always-on; }; - mmc_fixed_1v8_io: fixedregulator@1 { + mmc_fixed_1v8_io: regulator-1v8 { compatible = "regulator-fixed"; regulator-name = "mmc_io"; regulator-min-microvolt = <1800000>; @@ -263,8 +263,6 @@ }; xhci: xhci@1e1c0000 { - status = "okay"; - compatible = "mediatek,mt8173-xhci"; reg = <0x1e1c0000 0x1000 0x1e1d0700 0x0100>; -- cgit From 56955aae9fc2c59fa3c9b32f1f147cdbe05e5ac4 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Wed, 2 Mar 2022 18:36:36 -0300 Subject: staging: vchiq_arm: make vchiq_platform_get_arm_state() static Fix "no previous prototype" W=1 warning by making the function vchiq_platform_get_arm_state() static. While at it, realign the function declaration in one line and reposition the asterisk symbol to fulfill the 'foo *bar' syntax. Signed-off-by: Gaston Gonzalez Link: https://lore.kernel.org/r/216ad30d674b80e0051ecc233ac26ddb1d3e0e75.1646255044.git.gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 54ab6208ddae..f0bfacfdea80 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -593,8 +593,7 @@ vchiq_platform_init_state(struct vchiq_state *state) return 0; } -struct vchiq_arm_state* -vchiq_platform_get_arm_state(struct vchiq_state *state) +static struct vchiq_arm_state *vchiq_platform_get_arm_state(struct vchiq_state *state) { struct vchiq_2835_state *platform_state; -- cgit From 8d6319cdafadd9f68542cc21972c8c0c5d787ac5 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 7 Mar 2022 14:46:03 +0000 Subject: staging: gdm724x: remove redundant assignment of pointer w Pointer w is being assigned a value that is never read, it is being re-assigned a new value later. The assignment is redundant and can be removed. Cleans up clan scan build warning: drivers/staging/gdm724x/gdm_lte.c:198:2: warning: Value stored to 'w' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20220307144603.136846-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_lte.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index 0d8d8fed283d..d5bec53b0194 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -195,7 +195,6 @@ static __sum16 icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len) pseudo_header.ph.ph_len = be16_to_cpu(ipv6->payload_len); pseudo_header.ph.ph_nxt = ipv6->nexthdr; - w = (u16 *)&pseudo_header; for (i = 0; i < ARRAY_SIZE(pseudo_header.pa); i++) { pa = pseudo_header.pa[i]; sum = csum_add(sum, csum_unfold((__force __sum16)pa)); -- cgit From 4a51c297f8ffd1621828b856ab89f01d1a2eec81 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 7 Mar 2022 14:36:25 +0000 Subject: staging: vt6655: remove redundant assignment of pointer tx_key Pointer tx_key is being assigned a value that is never read, it is being re-assigned a new value later. The assignment is redundant and can be removed. Cleans up clan scan build warning: drivers/staging/vt6655/rxtx.c:1311:3: warning: Value stored to 'tx_key' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20220307143625.136189-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rxtx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 0de801b666da..53506e242a96 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -1308,8 +1308,6 @@ int vnt_generate_fifo_header(struct vnt_private *priv, u32 dma_idx, cpu_to_le16(ieee80211_get_hdrlen_from_skb(skb) << 10); if (info->control.hw_key) { - tx_key = info->control.hw_key; - switch (info->control.hw_key->cipher) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: -- cgit From 765b9808cd21708dd99fae31ccfb9045aba84b23 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:22 +0530 Subject: staging: r8188eu: mark rtw_is_cckrates_included as bool Mark rtw_is_cckrates_included as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-2-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_ieee80211.c | 2 +- drivers/staging/r8188eu/include/ieee80211.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_ieee80211.c b/drivers/staging/r8188eu/core/rtw_ieee80211.c index 62354c3194bd..a7b7b0f1407a 100644 --- a/drivers/staging/r8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/r8188eu/core/rtw_ieee80211.c @@ -68,7 +68,7 @@ int rtw_get_bit_value_from_ieee_value(u8 val) return 0; } -uint rtw_is_cckrates_included(u8 *rate) +bool rtw_is_cckrates_included(u8 *rate) { u32 i = 0; diff --git a/drivers/staging/r8188eu/include/ieee80211.h b/drivers/staging/r8188eu/include/ieee80211.h index 3a860e132cbd..1a15db09799d 100644 --- a/drivers/staging/r8188eu/include/ieee80211.h +++ b/drivers/staging/r8188eu/include/ieee80211.h @@ -872,7 +872,7 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv); int rtw_get_bit_value_from_ieee_value(u8 val); -uint rtw_is_cckrates_included(u8 *rate); +bool rtw_is_cckrates_included(u8 *rate); uint rtw_is_cckratesonly_included(u8 *rate); -- cgit From f11a0a1d028d49195165eed976454b888d466ae0 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:23 +0530 Subject: staging: r8188eu: mark rtw_is_cckratesonly_included as bool Mark rtw_is_cckratesonly_included as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-3-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_ieee80211.c | 2 +- drivers/staging/r8188eu/include/ieee80211.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_ieee80211.c b/drivers/staging/r8188eu/core/rtw_ieee80211.c index a7b7b0f1407a..5a0e42ed4a47 100644 --- a/drivers/staging/r8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/r8188eu/core/rtw_ieee80211.c @@ -81,7 +81,7 @@ bool rtw_is_cckrates_included(u8 *rate) return false; } -uint rtw_is_cckratesonly_included(u8 *rate) +bool rtw_is_cckratesonly_included(u8 *rate) { u32 i = 0; diff --git a/drivers/staging/r8188eu/include/ieee80211.h b/drivers/staging/r8188eu/include/ieee80211.h index 1a15db09799d..8c20363cdd31 100644 --- a/drivers/staging/r8188eu/include/ieee80211.h +++ b/drivers/staging/r8188eu/include/ieee80211.h @@ -874,7 +874,7 @@ int rtw_get_bit_value_from_ieee_value(u8 val); bool rtw_is_cckrates_included(u8 *rate); -uint rtw_is_cckratesonly_included(u8 *rate); +bool rtw_is_cckratesonly_included(u8 *rate); int rtw_check_network_type(unsigned char *rate, int ratelen, int channel); -- cgit From f85021269ab41f6752ca295ab7f58a803b77b9bc Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:24 +0530 Subject: staging: r8188eu: mark rtw_is_desired_network as bool Mark rtw_is_desired_network as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-4-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 4bb6edcc0b78..8d36ab955b96 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -571,7 +571,7 @@ static void rtw_add_network(struct adapter *adapter, /* (3) WMM */ /* (4) HT */ /* (5) others */ -static int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwork) +static bool rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwork) { struct security_priv *psecuritypriv = &adapter->securitypriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; -- cgit From 97115f5f0f96f4e5d5779acb5b1d76d1895f8134 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:25 +0530 Subject: staging: r8188eu: mark PS_RDY_CHECK as bool Mark PS_RDY_CHECK as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-5-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c index b20436f75459..7beabf82eb92 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -151,7 +151,7 @@ static void pwr_state_check_handler(struct timer_list *t) rtw_ps_cmd(padapter); } -static u8 PS_RDY_CHECK(struct adapter *padapter) +static bool PS_RDY_CHECK(struct adapter *padapter) { u32 curr_time, delta_time; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; -- cgit From 77a5ea010be8ed2a48a951a31b16407262b455cb Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:26 +0530 Subject: staging: r8188eu: mark check_indicate_seq as bool Mark check_indicate_seq as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-6-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index d77d983510a0..402b58a02182 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1466,7 +1466,7 @@ exit: return ret; } -static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num) +static bool check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num) { u8 wsize = preorder_ctrl->wsize_b; u16 wend = (preorder_ctrl->indicate_seq + wsize - 1) & 0xFFF;/* 4096; */ -- cgit From e21762181fb5d33ae95ee1bd58d4ca41a65129de Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:27 +0530 Subject: staging: r8188eu: mark enqueue_reorder_recvframe as bool Mark enqueue_reorder_recvframe as bool as it returns true/false. Also, make it static as it's only used in rtw_recv. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-7-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 402b58a02182..81ff22d0ed8c 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1496,8 +1496,7 @@ static bool check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_ return true; } -int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, struct recv_frame *prframe); -int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, struct recv_frame *prframe) +static bool enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, struct recv_frame *prframe) { struct rx_pkt_attrib *pattrib = &prframe->attrib; struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; -- cgit From 10b4f58f2ef209093a0a6a09d20a6f7fa05c9a74 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:28 +0530 Subject: staging: r8188eu: mark recv_indicatepkts_in_order as bool Mark recv_indicatepkts_in_order as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-8-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 81ff22d0ed8c..b6ab2db6d731 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1525,7 +1525,7 @@ static bool enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, s return true; } -static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctrl *preorder_ctrl, int bforced) +static bool recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctrl *preorder_ctrl, int bforced) { struct list_head *phead, *plist; struct recv_frame *prframe; -- cgit From fb706ede588a33942c7e489a8eb0b925bcf54f8c Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:29 +0530 Subject: staging: r8188eu: mark cckrates_included as bool Mark cckrates_included as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-9-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +- drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index 33c0228204ad..4f58c8970a35 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -45,7 +45,7 @@ static u8 rtw_basic_rate_mix[7] = { IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK }; -int cckrates_included(unsigned char *rate, int ratelen) +bool cckrates_included(unsigned char *rate, int ratelen) { int i; diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h index 26f31f20e428..21c7f020accc 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h @@ -632,7 +632,7 @@ void addba_timer_hdl(struct sta_info *psta); _set_timer(&(mlmeext)->link_timer, (ms)); \ } while (0) -int cckrates_included(unsigned char *rate, int ratelen); +bool cckrates_included(unsigned char *rate, int ratelen); int cckratesonly_included(unsigned char *rate, int ratelen); void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr); -- cgit From 2a603c8fac9d0a3d1d18e5e4eca157c2474b55b4 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:30 +0530 Subject: staging: r8188eu: mark cckratesonly_included as bool Mark cckratesonly_included as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-10-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +- drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index 4f58c8970a35..eef8523c3e04 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -57,7 +57,7 @@ bool cckrates_included(unsigned char *rate, int ratelen) return false; } -int cckratesonly_included(unsigned char *rate, int ratelen) +bool cckratesonly_included(unsigned char *rate, int ratelen) { int i; diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h index 21c7f020accc..cf397ac68f67 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h @@ -633,7 +633,7 @@ void addba_timer_hdl(struct sta_info *psta); } while (0) bool cckrates_included(unsigned char *rate, int ratelen); -int cckratesonly_included(unsigned char *rate, int ratelen); +bool cckratesonly_included(unsigned char *rate, int ratelen); void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr); -- cgit From 7167068ac69cafe13f4b022203d80c85e1f77868 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:31 +0530 Subject: staging: r8188eu: mark is_basicrate as bool Mark is_basicrate as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-11-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index eef8523c3e04..8e8a82a1e474 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -167,7 +167,7 @@ static unsigned char ratetbl_val_2wifirate(unsigned char rate) return val; } -static int is_basicrate(struct adapter *padapter, unsigned char rate) +static bool is_basicrate(struct adapter *padapter, unsigned char rate) { int i; unsigned char val; -- cgit From ad5213882e1f15a70ca47f137ef845ab9df9b7ea Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:32 +0530 Subject: staging: r8188eu: mark is_ap_in_tkip as bool Mark is_ap_in_tkip as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-12-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +- drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c index 8e8a82a1e474..665b077190bc 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -1013,7 +1013,7 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru } } -unsigned int is_ap_in_tkip(struct adapter *padapter) +bool is_ap_in_tkip(struct adapter *padapter) { u32 i; struct ndis_802_11_var_ie *pIE; diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h index cf397ac68f67..0c555ea6719b 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h @@ -508,7 +508,7 @@ unsigned int receive_disconnect(struct adapter *padapter, unsigned char get_highest_rate_idx(u32 mask); int support_short_GI(struct adapter *padapter, struct HT_caps_element *caps); -unsigned int is_ap_in_tkip(struct adapter *padapter); +bool is_ap_in_tkip(struct adapter *padapter); void report_join_res(struct adapter *padapter, int res); void report_survey_event(struct adapter *padapter, struct recv_frame *precv_frame); -- cgit From 34e21a9157e137779b70b454ae0ff219d550a27a Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:33 +0530 Subject: staging: r8188eu: mark rtl8188eu_xmitframe_complete as bool Mark rtl8188eu_xmitframe_complete as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-13-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +- drivers/staging/r8188eu/include/rtl8188e_xmit.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c index 69b66eb458b0..55032d7ae7e3 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c @@ -376,7 +376,7 @@ static u32 xmitframe_need_length(struct xmit_frame *pxmitframe) return len; } -s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) +bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) { struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapt); struct xmit_frame *pxmitframe = NULL; diff --git a/drivers/staging/r8188eu/include/rtl8188e_xmit.h b/drivers/staging/r8188eu/include/rtl8188e_xmit.h index 85eb0aad80d6..8adb672f7a07 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_xmit.h +++ b/drivers/staging/r8188eu/include/rtl8188e_xmit.h @@ -143,7 +143,7 @@ s32 rtl8188eu_mgnt_xmit(struct adapter *padapter, struct xmit_frame *frame); s32 rtl8188eu_xmit_buf_handler(struct adapter *padapter); #define hal_xmit_handler rtl8188eu_xmit_buf_handler void rtl8188eu_xmit_tasklet(unsigned long priv); -s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, +bool rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); -- cgit From b459e83949a51a45c7783b3774ebec6453cdfc45 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:34 +0530 Subject: staging: r8188eu: mark check_fwstate as bool Mark check_fwstate as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-14-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtw_mlme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/rtw_mlme.h b/drivers/staging/r8188eu/include/rtw_mlme.h index d418d57f99b6..42d850f9d777 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme.h +++ b/drivers/staging/r8188eu/include/rtw_mlme.h @@ -451,7 +451,7 @@ static inline u8 *get_bssid(struct mlme_priv *pmlmepriv) return pmlmepriv->cur_network.network.MacAddress; } -static inline int check_fwstate(struct mlme_priv *pmlmepriv, int state) +static inline bool check_fwstate(struct mlme_priv *pmlmepriv, int state) { if (pmlmepriv->fw_state & state) return true; -- cgit From a47807b864b0ea36696c1d60f477e4c4a36b6f0a Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:35 +0530 Subject: staging: r8188eu: mark IS_MCAST as bool Mark IS_MCAST as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-15-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/wifi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h index 39b7a596e4c1..df3331b130e5 100644 --- a/drivers/staging/r8188eu/include/wifi.h +++ b/drivers/staging/r8188eu/include/wifi.h @@ -295,7 +295,7 @@ enum WIFI_REG_DOMAIN { #define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24)) -static inline int IS_MCAST(unsigned char *da) +static inline bool IS_MCAST(unsigned char *da) { if ((*da) & 0x01) return true; -- cgit From 5a61d6b4f4a98875c87cc98d10c5923bf09cf272 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:36 +0530 Subject: staging: r8188eu: mark IsFrameTypeCtrl as bool Mark IsFrameTypeCtrl as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-16-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/wifi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h index df3331b130e5..c1c9bae58d6d 100644 --- a/drivers/staging/r8188eu/include/wifi.h +++ b/drivers/staging/r8188eu/include/wifi.h @@ -372,7 +372,7 @@ static inline unsigned char *get_hdr_bssid(unsigned char *pframe) return sa; } -static inline int IsFrameTypeCtrl(unsigned char *pframe) +static inline bool IsFrameTypeCtrl(unsigned char *pframe) { if (WIFI_CTRL_TYPE == GetFrameType(pframe)) return true; -- cgit From daed08de44e83c7a0f850f28de3b87984eecca32 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 3 Mar 2022 02:17:37 +0530 Subject: staging: r8188eu: mark rtw_endofpktfile as bool Mark rtw_endofpktfile as bool as it returns true/false. Reviewed-by: Dan Carpenter Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220302204737.49056-17-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/xmit_osdep.h | 2 +- drivers/staging/r8188eu/os_dep/xmit_linux.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/include/xmit_osdep.h b/drivers/staging/r8188eu/include/xmit_osdep.h index 3e778dff0ed8..00658681fef9 100644 --- a/drivers/staging/r8188eu/include/xmit_osdep.h +++ b/drivers/staging/r8188eu/include/xmit_osdep.h @@ -40,7 +40,7 @@ void rtw_os_xmit_resource_free(struct adapter *padapter, uint rtw_remainder_len(struct pkt_file *pfile); void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile); uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen); -int rtw_endofpktfile(struct pkt_file *pfile); +bool rtw_endofpktfile(struct pkt_file *pfile); void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt); void rtw_os_xmit_complete(struct adapter *padapter, diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c index 717b980a8c72..a6012cffd37e 100644 --- a/drivers/staging/r8188eu/os_dep/xmit_linux.c +++ b/drivers/staging/r8188eu/os_dep/xmit_linux.c @@ -54,7 +54,7 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen) return len; } -int rtw_endofpktfile(struct pkt_file *pfile) +bool rtw_endofpktfile(struct pkt_file *pfile) { if (pfile->pkt_len == 0) { -- cgit From b8cb97338d772135f2c5cb96880b8fa02c912c3c Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Thu, 3 Mar 2022 21:21:03 +0530 Subject: staging: r8188eu: remove unused field list The field list in struct recv_buf is initialized but not used. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/558177d9165792a99f6efb439f6f537e13da705b.1646321515.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 1 - drivers/staging/r8188eu/include/rtw_recv.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 6af72b3e7a7d..341605c67216 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -54,7 +54,6 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) precvbuf = (struct recv_buf *)precvpriv->precv_buf; for (i = 0; i < NR_RECVBUFF; i++) { - INIT_LIST_HEAD(&precvbuf->list); spin_lock_init(&precvbuf->recvbuf_lock); precvbuf->alloc_sz = MAX_RECVBUF_SZ; res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf); diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index d2f1c71f2262..90482cdd2236 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -207,7 +207,6 @@ struct sta_recv_priv { }; struct recv_buf { - struct list_head list; spinlock_t recvbuf_lock; u32 ref_cnt; struct adapter *adapter; -- cgit From 3770d651ce3c503a2eda932ad2794c884f4f6701 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Thu, 3 Mar 2022 21:21:04 +0530 Subject: staging: r8188eu: remove unused field recvbuf_lock The spinlock field recvbuf_lock in struct recv_buf is initialized but not used. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/24597a0cc19fa59139bf0a77ccd11a8229d7201f.1646321515.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 1 - drivers/staging/r8188eu/include/rtw_recv.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 341605c67216..19d22db56e7d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -54,7 +54,6 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) precvbuf = (struct recv_buf *)precvpriv->precv_buf; for (i = 0; i < NR_RECVBUFF; i++) { - spin_lock_init(&precvbuf->recvbuf_lock); precvbuf->alloc_sz = MAX_RECVBUF_SZ; res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf); if (res == _FAIL) diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index 90482cdd2236..7347ec162632 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -207,7 +207,6 @@ struct sta_recv_priv { }; struct recv_buf { - spinlock_t recvbuf_lock; u32 ref_cnt; struct adapter *adapter; u8 *pbuf; -- cgit From e9ef65f994d477fc993ca28020e98c0fddda9480 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Thu, 3 Mar 2022 21:21:05 +0530 Subject: staging: r8188eu: remove unused fields in struct recv_buf The fields len, ref_cnt and transfer_len in struct recv_buf are set but not used. Remove them. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/fe5565c02a01babf64469333dae73cbdd841d393.1646321515.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 7 ------- drivers/staging/r8188eu/hal/usb_ops_linux.c | 1 - drivers/staging/r8188eu/include/rtw_recv.h | 3 --- drivers/staging/r8188eu/os_dep/recv_linux.c | 2 -- 4 files changed, 13 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 19d22db56e7d..76bf57c52a7e 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -14,12 +14,6 @@ void rtl8188eu_init_recvbuf(struct recv_buf *precvbuf) { - precvbuf->transfer_len = 0; - - precvbuf->len = 0; - - precvbuf->ref_cnt = 0; - if (precvbuf->pbuf) { precvbuf->pdata = precvbuf->pbuf; precvbuf->phead = precvbuf->pbuf; @@ -58,7 +52,6 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf); if (res == _FAIL) break; - precvbuf->ref_cnt = 0; precvbuf->adapter = padapter; precvbuf++; } diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 6bd2164ce1fa..4953a431ffd7 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -364,7 +364,6 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) } else { rtw_reset_continual_urb_error(adapter_to_dvobj(adapt)); - precvbuf->transfer_len = purb->actual_length; skb_put(precvbuf->pskb, purb->actual_length); skb_queue_tail(&precvpriv->rx_skb_queue, precvbuf->pskb); diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index 7347ec162632..bafc10905bed 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -207,11 +207,9 @@ struct sta_recv_priv { }; struct recv_buf { - u32 ref_cnt; struct adapter *adapter; u8 *pbuf; u8 *pallocated_buf; - u32 len; u8 *phead; u8 *pdata; u8 *ptail; @@ -220,7 +218,6 @@ struct recv_buf { dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ u32 alloc_sz; u8 irp_pending; - int transfer_len; struct sk_buff *pskb; u8 reuse; }; diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index b205c50e9d75..d3b5fd83f926 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -30,8 +30,6 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, precvbuf->phead = NULL; precvbuf->ptail = NULL; precvbuf->pend = NULL; - precvbuf->transfer_len = 0; - precvbuf->len = 0; return res; } -- cgit From b711ae9a5573b1364f1f9c772904a948afd736c3 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Thu, 3 Mar 2022 21:21:06 +0530 Subject: staging: r8188eu: remove unused field phead The field phead in struct recv_buf is set but not used. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/7ff76536af7478a00b300af9a6cb666e53d22aac.1646321515.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 1 - drivers/staging/r8188eu/hal/usb_ops_linux.c | 2 -- drivers/staging/r8188eu/include/rtw_recv.h | 1 - drivers/staging/r8188eu/os_dep/recv_linux.c | 1 - 4 files changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 76bf57c52a7e..7db5cfaa251f 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -16,7 +16,6 @@ void rtl8188eu_init_recvbuf(struct recv_buf *precvbuf) { if (precvbuf->pbuf) { precvbuf->pdata = precvbuf->pbuf; - precvbuf->phead = precvbuf->pbuf; precvbuf->ptail = precvbuf->pbuf; precvbuf->pend = precvbuf->pdata + MAX_RECVBUF_SZ; } diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 4953a431ffd7..8f4c059e09c9 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -440,13 +440,11 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1); skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); - precvbuf->phead = precvbuf->pskb->head; precvbuf->pdata = precvbuf->pskb->data; precvbuf->ptail = skb_tail_pointer(precvbuf->pskb); precvbuf->pend = skb_end_pointer(precvbuf->pskb); precvbuf->pbuf = precvbuf->pskb->data; } else { /* reuse skb */ - precvbuf->phead = precvbuf->pskb->head; precvbuf->pdata = precvbuf->pskb->data; precvbuf->ptail = skb_tail_pointer(precvbuf->pskb); precvbuf->pend = skb_end_pointer(precvbuf->pskb); diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index bafc10905bed..e4f844507d17 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -210,7 +210,6 @@ struct recv_buf { struct adapter *adapter; u8 *pbuf; u8 *pallocated_buf; - u8 *phead; u8 *pdata; u8 *ptail; u8 *pend; diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index d3b5fd83f926..8832199b10ee 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -27,7 +27,6 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, precvbuf->pallocated_buf = NULL; precvbuf->pbuf = NULL; precvbuf->pdata = NULL; - precvbuf->phead = NULL; precvbuf->ptail = NULL; precvbuf->pend = NULL; return res; -- cgit From fffb719a6340ea78651fe48faaa80b97e0fc3d25 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Thu, 3 Mar 2022 21:21:07 +0530 Subject: staging: r8188eu: remove unused field ptail The field ptail in struct recv_buf is set but not used. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/9574ad2dfba0cc444ce1dea1268661ed32b84799.1646321515.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 1 - drivers/staging/r8188eu/hal/usb_ops_linux.c | 2 -- drivers/staging/r8188eu/include/rtw_recv.h | 1 - drivers/staging/r8188eu/os_dep/recv_linux.c | 1 - 4 files changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 7db5cfaa251f..7a787944064f 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -16,7 +16,6 @@ void rtl8188eu_init_recvbuf(struct recv_buf *precvbuf) { if (precvbuf->pbuf) { precvbuf->pdata = precvbuf->pbuf; - precvbuf->ptail = precvbuf->pbuf; precvbuf->pend = precvbuf->pdata + MAX_RECVBUF_SZ; } } diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 8f4c059e09c9..74a221db1c3d 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -441,12 +441,10 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); precvbuf->pdata = precvbuf->pskb->data; - precvbuf->ptail = skb_tail_pointer(precvbuf->pskb); precvbuf->pend = skb_end_pointer(precvbuf->pskb); precvbuf->pbuf = precvbuf->pskb->data; } else { /* reuse skb */ precvbuf->pdata = precvbuf->pskb->data; - precvbuf->ptail = skb_tail_pointer(precvbuf->pskb); precvbuf->pend = skb_end_pointer(precvbuf->pskb); precvbuf->pbuf = precvbuf->pskb->data; diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index e4f844507d17..c97ec9d0feed 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -211,7 +211,6 @@ struct recv_buf { u8 *pbuf; u8 *pallocated_buf; u8 *pdata; - u8 *ptail; u8 *pend; struct urb *purb; dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index 8832199b10ee..fd29f06b375a 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -27,7 +27,6 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, precvbuf->pallocated_buf = NULL; precvbuf->pbuf = NULL; precvbuf->pdata = NULL; - precvbuf->ptail = NULL; precvbuf->pend = NULL; return res; } -- cgit From cd71106689061428647b29e16c02329883e38056 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Thu, 3 Mar 2022 21:21:08 +0530 Subject: staging: r8188eu: remove unused field pend The field pend in struct recv_buf is set but not used. Remove it. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/2ccf7067c411716a05bb6fa0acc04d5a612b5f12.1646321515.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 1 - drivers/staging/r8188eu/hal/usb_ops_linux.c | 2 -- drivers/staging/r8188eu/include/rtw_recv.h | 1 - drivers/staging/r8188eu/os_dep/recv_linux.c | 1 - 4 files changed, 5 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 7a787944064f..9f772fc7d6c1 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -16,7 +16,6 @@ void rtl8188eu_init_recvbuf(struct recv_buf *precvbuf) { if (precvbuf->pbuf) { precvbuf->pdata = precvbuf->pbuf; - precvbuf->pend = precvbuf->pdata + MAX_RECVBUF_SZ; } } diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 74a221db1c3d..f16a6bb21ab4 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -441,11 +441,9 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); precvbuf->pdata = precvbuf->pskb->data; - precvbuf->pend = skb_end_pointer(precvbuf->pskb); precvbuf->pbuf = precvbuf->pskb->data; } else { /* reuse skb */ precvbuf->pdata = precvbuf->pskb->data; - precvbuf->pend = skb_end_pointer(precvbuf->pskb); precvbuf->pbuf = precvbuf->pskb->data; precvbuf->reuse = false; diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index c97ec9d0feed..f7bc1c9579fc 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -211,7 +211,6 @@ struct recv_buf { u8 *pbuf; u8 *pallocated_buf; u8 *pdata; - u8 *pend; struct urb *purb; dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ u32 alloc_sz; diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index fd29f06b375a..c8a0ac80df69 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -27,7 +27,6 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, precvbuf->pallocated_buf = NULL; precvbuf->pbuf = NULL; precvbuf->pdata = NULL; - precvbuf->pend = NULL; return res; } -- cgit From e3ffbcac9d8daa94cbcee79043d4839540ab2070 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Thu, 3 Mar 2022 21:21:09 +0530 Subject: staging: r8188eu: remove unused field pdata The field pdata in struct recv_buf is set but not used. Remove it. Also remove rtl8188eu_init_recvbuf function as it does nothing now. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/7fe9ed2c6eade65c118511228283ef9d92ea4b43.1646321515.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 7 ------- drivers/staging/r8188eu/hal/usb_ops_linux.c | 4 ---- drivers/staging/r8188eu/include/rtl8188e_recv.h | 1 - drivers/staging/r8188eu/include/rtw_recv.h | 1 - drivers/staging/r8188eu/os_dep/recv_linux.c | 1 - 5 files changed, 14 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 9f772fc7d6c1..2960e349638d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -12,13 +12,6 @@ #include "../include/rtl8188e_hal.h" -void rtl8188eu_init_recvbuf(struct recv_buf *precvbuf) -{ - if (precvbuf->pbuf) { - precvbuf->pdata = precvbuf->pbuf; - } -} - int rtl8188eu_init_recv_priv(struct adapter *padapter) { struct recv_priv *precvpriv = &padapter->recvpriv; diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index f16a6bb21ab4..063bec94fd7e 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -428,8 +428,6 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) precvbuf->reuse = true; } - rtl8188eu_init_recvbuf(precvbuf); - /* re-assign for linux based on skb */ if (!precvbuf->reuse || !precvbuf->pskb) { precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); @@ -440,10 +438,8 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1); skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); - precvbuf->pdata = precvbuf->pskb->data; precvbuf->pbuf = precvbuf->pskb->data; } else { /* reuse skb */ - precvbuf->pdata = precvbuf->pskb->data; precvbuf->pbuf = precvbuf->pskb->data; precvbuf->reuse = false; diff --git a/drivers/staging/r8188eu/include/rtl8188e_recv.h b/drivers/staging/r8188eu/include/rtl8188e_recv.h index 87dd4152082a..a2320af11216 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_recv.h +++ b/drivers/staging/r8188eu/include/rtl8188e_recv.h @@ -37,7 +37,6 @@ enum rx_packet_type { HIS_REPORT,/* USB HISR RPT */ }; -void rtl8188eu_init_recvbuf(struct recv_buf *buf); s32 rtl8188eu_init_recv_priv(struct adapter *padapter); void rtl8188eu_free_recv_priv(struct adapter * padapter); void rtl8188eu_recv_hdl(struct adapter * padapter, struct recv_buf *precvbuf); diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index f7bc1c9579fc..55b1bb7840c8 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -210,7 +210,6 @@ struct recv_buf { struct adapter *adapter; u8 *pbuf; u8 *pallocated_buf; - u8 *pdata; struct urb *purb; dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ u32 alloc_sz; diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index c8a0ac80df69..a35c78f9ae44 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -26,7 +26,6 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, precvbuf->reuse = false; precvbuf->pallocated_buf = NULL; precvbuf->pbuf = NULL; - precvbuf->pdata = NULL; return res; } -- cgit From 4e342a3c786ed37db1083b0c4ac9c9685e722cea Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Thu, 3 Mar 2022 21:21:10 +0530 Subject: staging: r8188eu: remove unneeded field pbuf The field pbuf in struct recv_buf can be removed as it can be replaced with pskb->data. Remove pbuf field. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/080a9269b9381089e4dc9117f35d0a2d1d0c0259.1646321515.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/usb_ops_linux.c | 6 +----- drivers/staging/r8188eu/include/rtw_recv.h | 1 - drivers/staging/r8188eu/os_dep/recv_linux.c | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 063bec94fd7e..673c30ed3cce 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -437,11 +437,7 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) tmpaddr = (size_t)precvbuf->pskb->data; alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1); skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); - - precvbuf->pbuf = precvbuf->pskb->data; } else { /* reuse skb */ - precvbuf->pbuf = precvbuf->pskb->data; - precvbuf->reuse = false; } @@ -453,7 +449,7 @@ u32 rtw_read_port(struct adapter *adapter, u8 *rmem) pipe = usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe); usb_fill_bulk_urb(purb, pusbd, pipe, - precvbuf->pbuf, + precvbuf->pskb->data, MAX_RECVBUF_SZ, usb_read_port_complete, precvbuf);/* context is precvbuf */ diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index 55b1bb7840c8..e62cda94bc90 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -208,7 +208,6 @@ struct sta_recv_priv { struct recv_buf { struct adapter *adapter; - u8 *pbuf; u8 *pallocated_buf; struct urb *purb; dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index a35c78f9ae44..898ae944bd7d 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -25,7 +25,6 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, precvbuf->pskb = NULL; precvbuf->reuse = false; precvbuf->pallocated_buf = NULL; - precvbuf->pbuf = NULL; return res; } -- cgit From 44aa511a6c383af3c9c858c38e078335d49d34f1 Mon Sep 17 00:00:00 2001 From: Abdun Nihaal Date: Thu, 3 Mar 2022 21:21:11 +0530 Subject: staging: r8188eu: remove unused fields in struct recv_buf The fields alloc_sz, irp_pending and pallocated_buf in struct recv_buf are set but not used. And the field dma_transfer_addr is not used. Remove them. Signed-off-by: Abdun Nihaal Link: https://lore.kernel.org/r/d731acb15f82c597de53ecce8fdf1bb82dc4c386.1646321515.git.abdun.nihaal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 1 - drivers/staging/r8188eu/include/rtw_recv.h | 4 ---- drivers/staging/r8188eu/os_dep/recv_linux.c | 2 -- 3 files changed, 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 2960e349638d..322b4549a92d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -38,7 +38,6 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) precvbuf = (struct recv_buf *)precvpriv->precv_buf; for (i = 0; i < NR_RECVBUFF; i++) { - precvbuf->alloc_sz = MAX_RECVBUF_SZ; res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf); if (res == _FAIL) break; diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h index e62cda94bc90..4ac4e6b3e177 100644 --- a/drivers/staging/r8188eu/include/rtw_recv.h +++ b/drivers/staging/r8188eu/include/rtw_recv.h @@ -208,11 +208,7 @@ struct sta_recv_priv { struct recv_buf { struct adapter *adapter; - u8 *pallocated_buf; struct urb *purb; - dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ - u32 alloc_sz; - u8 irp_pending; struct sk_buff *pskb; u8 reuse; }; diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c index 898ae944bd7d..1e14b6d49795 100644 --- a/drivers/staging/r8188eu/os_dep/recv_linux.c +++ b/drivers/staging/r8188eu/os_dep/recv_linux.c @@ -18,13 +18,11 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, { int res = _SUCCESS; - precvbuf->irp_pending = false; precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL); if (!precvbuf->purb) res = _FAIL; precvbuf->pskb = NULL; precvbuf->reuse = false; - precvbuf->pallocated_buf = NULL; return res; } -- cgit From 23a11ec550db4ad65dd42d68e8bf014e7df65b5f Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Mar 2022 15:41:13 +0100 Subject: staging: r8188eu: remove tmp variable in update_recvframe_attrib_88e Remove an unnecessary temporary variable in update_recvframe_attrib_88e. We can use the prxstat pointer directly to parse the input data. There's no need to store a local copy in "report". Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220305144117.1380534-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 52 ++++++++++++--------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c index 101091342e4e..ad5cbf0942fb 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c @@ -58,62 +58,54 @@ void rtl8188e_process_phy_info(struct adapter *padapter, void *prframe) void update_recvframe_attrib_88e(struct recv_frame *precvframe, struct recv_stat *prxstat) { struct rx_pkt_attrib *pattrib; - struct recv_stat report; - - report.rxdw0 = prxstat->rxdw0; - report.rxdw1 = prxstat->rxdw1; - report.rxdw2 = prxstat->rxdw2; - report.rxdw3 = prxstat->rxdw3; - report.rxdw4 = prxstat->rxdw4; - report.rxdw5 = prxstat->rxdw5; pattrib = &precvframe->attrib; memset(pattrib, 0, sizeof(struct rx_pkt_attrib)); - pattrib->crc_err = (u8)((le32_to_cpu(report.rxdw0) >> 14) & 0x1);/* u8)prxreport->crc32; */ + pattrib->crc_err = (u8)((le32_to_cpu(prxstat->rxdw0) >> 14) & 0x1);/* u8)prxreport->crc32; */ /* update rx report to recv_frame attribute */ - pattrib->pkt_rpt_type = (u8)((le32_to_cpu(report.rxdw3) >> 14) & 0x3);/* prxreport->rpt_sel; */ + pattrib->pkt_rpt_type = (u8)((le32_to_cpu(prxstat->rxdw3) >> 14) & 0x3);/* prxreport->rpt_sel; */ if (pattrib->pkt_rpt_type == NORMAL_RX) { /* Normal rx packet */ - pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) & 0x00003fff);/* u16)prxreport->pktlen; */ - pattrib->drvinfo_sz = (u8)((le32_to_cpu(report.rxdw0) >> 16) & 0xf) * 8;/* u8)(prxreport->drvinfosize << 3); */ + pattrib->pkt_len = (u16)(le32_to_cpu(prxstat->rxdw0) & 0x00003fff);/* u16)prxreport->pktlen; */ + pattrib->drvinfo_sz = (u8)((le32_to_cpu(prxstat->rxdw0) >> 16) & 0xf) * 8;/* u8)(prxreport->drvinfosize << 3); */ - pattrib->physt = (u8)((le32_to_cpu(report.rxdw0) >> 26) & 0x1);/* u8)prxreport->physt; */ + pattrib->physt = (u8)((le32_to_cpu(prxstat->rxdw0) >> 26) & 0x1);/* u8)prxreport->physt; */ - pattrib->bdecrypted = (le32_to_cpu(report.rxdw0) & BIT(27)) ? 0 : 1;/* u8)(prxreport->swdec ? 0 : 1); */ - pattrib->encrypt = (u8)((le32_to_cpu(report.rxdw0) >> 20) & 0x7);/* u8)prxreport->security; */ + pattrib->bdecrypted = (le32_to_cpu(prxstat->rxdw0) & BIT(27)) ? 0 : 1;/* u8)(prxreport->swdec ? 0 : 1); */ + pattrib->encrypt = (u8)((le32_to_cpu(prxstat->rxdw0) >> 20) & 0x7);/* u8)prxreport->security; */ - pattrib->qos = (le32_to_cpu(report.rxdw0) >> 23) & 0x1;/* prxreport->qos; */ - pattrib->priority = (u8)((le32_to_cpu(report.rxdw1) >> 8) & 0xf);/* u8)prxreport->tid; */ + pattrib->qos = (le32_to_cpu(prxstat->rxdw0) >> 23) & 0x1;/* prxreport->qos; */ + pattrib->priority = (u8)((le32_to_cpu(prxstat->rxdw1) >> 8) & 0xf);/* u8)prxreport->tid; */ - pattrib->amsdu = (u8)((le32_to_cpu(report.rxdw1) >> 13) & 0x1);/* u8)prxreport->amsdu; */ + pattrib->amsdu = (u8)((le32_to_cpu(prxstat->rxdw1) >> 13) & 0x1);/* u8)prxreport->amsdu; */ - pattrib->seq_num = (u16)(le32_to_cpu(report.rxdw2) & 0x00000fff);/* u16)prxreport->seq; */ - pattrib->frag_num = (u8)((le32_to_cpu(report.rxdw2) >> 12) & 0xf);/* u8)prxreport->frag; */ - pattrib->mfrag = (u8)((le32_to_cpu(report.rxdw1) >> 27) & 0x1);/* u8)prxreport->mf; */ - pattrib->mdata = (u8)((le32_to_cpu(report.rxdw1) >> 26) & 0x1);/* u8)prxreport->md; */ + pattrib->seq_num = (u16)(le32_to_cpu(prxstat->rxdw2) & 0x00000fff);/* u16)prxreport->seq; */ + pattrib->frag_num = (u8)((le32_to_cpu(prxstat->rxdw2) >> 12) & 0xf);/* u8)prxreport->frag; */ + pattrib->mfrag = (u8)((le32_to_cpu(prxstat->rxdw1) >> 27) & 0x1);/* u8)prxreport->mf; */ + pattrib->mdata = (u8)((le32_to_cpu(prxstat->rxdw1) >> 26) & 0x1);/* u8)prxreport->md; */ - pattrib->mcs_rate = (u8)(le32_to_cpu(report.rxdw3) & 0x3f);/* u8)prxreport->rxmcs; */ - pattrib->rxht = (u8)((le32_to_cpu(report.rxdw3) >> 6) & 0x1);/* u8)prxreport->rxht; */ + pattrib->mcs_rate = (u8)(le32_to_cpu(prxstat->rxdw3) & 0x3f);/* u8)prxreport->rxmcs; */ + pattrib->rxht = (u8)((le32_to_cpu(prxstat->rxdw3) >> 6) & 0x1);/* u8)prxreport->rxht; */ - pattrib->icv_err = (u8)((le32_to_cpu(report.rxdw0) >> 15) & 0x1);/* u8)prxreport->icverr; */ - pattrib->shift_sz = (u8)((le32_to_cpu(report.rxdw0) >> 24) & 0x3); + pattrib->icv_err = (u8)((le32_to_cpu(prxstat->rxdw0) >> 15) & 0x1);/* u8)prxreport->icverr; */ + pattrib->shift_sz = (u8)((le32_to_cpu(prxstat->rxdw0) >> 24) & 0x3); } else if (pattrib->pkt_rpt_type == TX_REPORT1) { /* CCX */ pattrib->pkt_len = TX_RPT1_PKT_LEN; pattrib->drvinfo_sz = 0; } else if (pattrib->pkt_rpt_type == TX_REPORT2) { /* TX RPT */ - pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) & 0x3FF);/* Rx length[9:0] */ + pattrib->pkt_len = (u16)(le32_to_cpu(prxstat->rxdw0) & 0x3FF);/* Rx length[9:0] */ pattrib->drvinfo_sz = 0; /* */ /* Get TX report MAC ID valid. */ /* */ - pattrib->MacIDValidEntry[0] = le32_to_cpu(report.rxdw4); - pattrib->MacIDValidEntry[1] = le32_to_cpu(report.rxdw5); + pattrib->MacIDValidEntry[0] = le32_to_cpu(prxstat->rxdw4); + pattrib->MacIDValidEntry[1] = le32_to_cpu(prxstat->rxdw5); } else if (pattrib->pkt_rpt_type == HIS_REPORT) { /* USB HISR RPT */ - pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) & 0x00003fff);/* u16)prxreport->pktlen; */ + pattrib->pkt_len = (u16)(le32_to_cpu(prxstat->rxdw0) & 0x00003fff);/* u16)prxreport->pktlen; */ } } -- cgit From 618a9b2719c383ec63782388f0fd04f72562d0ac Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Mar 2022 15:41:14 +0100 Subject: staging: r8188eu: summarize declaration and assignment Summarize the declaration of pattrib and the assignment in the following line. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220305144117.1380534-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c index ad5cbf0942fb..aee6b8c23811 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c @@ -57,9 +57,7 @@ void rtl8188e_process_phy_info(struct adapter *padapter, void *prframe) void update_recvframe_attrib_88e(struct recv_frame *precvframe, struct recv_stat *prxstat) { - struct rx_pkt_attrib *pattrib; - - pattrib = &precvframe->attrib; + struct rx_pkt_attrib *pattrib = &precvframe->attrib; memset(pattrib, 0, sizeof(struct rx_pkt_attrib)); pattrib->crc_err = (u8)((le32_to_cpu(prxstat->rxdw0) >> 14) & 0x1);/* u8)prxreport->crc32; */ -- cgit From 05a0a115aa04d6402a69964b23a989314cc53204 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Mar 2022 15:41:15 +0100 Subject: staging: r8188eu: don't initialize drvinfo_sz to 0 In update_recvframe_attrib_88e, there's an initial memset which sets all of pattrib to 0. There's no need to set pattrib->drvinfo_sz = 0 again later. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220305144117.1380534-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c index aee6b8c23811..6b83d7e80ad9 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c @@ -91,10 +91,8 @@ void update_recvframe_attrib_88e(struct recv_frame *precvframe, struct recv_stat pattrib->shift_sz = (u8)((le32_to_cpu(prxstat->rxdw0) >> 24) & 0x3); } else if (pattrib->pkt_rpt_type == TX_REPORT1) { /* CCX */ pattrib->pkt_len = TX_RPT1_PKT_LEN; - pattrib->drvinfo_sz = 0; } else if (pattrib->pkt_rpt_type == TX_REPORT2) { /* TX RPT */ pattrib->pkt_len = (u16)(le32_to_cpu(prxstat->rxdw0) & 0x3FF);/* Rx length[9:0] */ - pattrib->drvinfo_sz = 0; /* */ /* Get TX report MAC ID valid. */ -- cgit From 49571c57e21fbd0915bd50992c7dac3295f13d95 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Mar 2022 15:41:16 +0100 Subject: staging: r8188eu: remove unnecessary casts Remove unnecessary casts in update_recvframe_attrib_88e. The final bitwise-and limits the results to u8 or u16, respectively. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220305144117.1380534-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c index 6b83d7e80ad9..cbc3ce34a50d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c @@ -60,39 +60,39 @@ void update_recvframe_attrib_88e(struct recv_frame *precvframe, struct recv_stat struct rx_pkt_attrib *pattrib = &precvframe->attrib; memset(pattrib, 0, sizeof(struct rx_pkt_attrib)); - pattrib->crc_err = (u8)((le32_to_cpu(prxstat->rxdw0) >> 14) & 0x1);/* u8)prxreport->crc32; */ + pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) >> 14) & 0x1;/* u8)prxreport->crc32; */ /* update rx report to recv_frame attribute */ - pattrib->pkt_rpt_type = (u8)((le32_to_cpu(prxstat->rxdw3) >> 14) & 0x3);/* prxreport->rpt_sel; */ + pattrib->pkt_rpt_type = (le32_to_cpu(prxstat->rxdw3) >> 14) & 0x3;/* prxreport->rpt_sel; */ if (pattrib->pkt_rpt_type == NORMAL_RX) { /* Normal rx packet */ - pattrib->pkt_len = (u16)(le32_to_cpu(prxstat->rxdw0) & 0x00003fff);/* u16)prxreport->pktlen; */ - pattrib->drvinfo_sz = (u8)((le32_to_cpu(prxstat->rxdw0) >> 16) & 0xf) * 8;/* u8)(prxreport->drvinfosize << 3); */ + pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x00003fff;/* u16)prxreport->pktlen; */ + pattrib->drvinfo_sz = ((le32_to_cpu(prxstat->rxdw0) >> 16) & 0xf) * 8;/* u8)(prxreport->drvinfosize << 3); */ - pattrib->physt = (u8)((le32_to_cpu(prxstat->rxdw0) >> 26) & 0x1);/* u8)prxreport->physt; */ + pattrib->physt = (le32_to_cpu(prxstat->rxdw0) >> 26) & 0x1;/* u8)prxreport->physt; */ pattrib->bdecrypted = (le32_to_cpu(prxstat->rxdw0) & BIT(27)) ? 0 : 1;/* u8)(prxreport->swdec ? 0 : 1); */ - pattrib->encrypt = (u8)((le32_to_cpu(prxstat->rxdw0) >> 20) & 0x7);/* u8)prxreport->security; */ + pattrib->encrypt = (le32_to_cpu(prxstat->rxdw0) >> 20) & 0x7;/* u8)prxreport->security; */ pattrib->qos = (le32_to_cpu(prxstat->rxdw0) >> 23) & 0x1;/* prxreport->qos; */ - pattrib->priority = (u8)((le32_to_cpu(prxstat->rxdw1) >> 8) & 0xf);/* u8)prxreport->tid; */ + pattrib->priority = (le32_to_cpu(prxstat->rxdw1) >> 8) & 0xf;/* u8)prxreport->tid; */ - pattrib->amsdu = (u8)((le32_to_cpu(prxstat->rxdw1) >> 13) & 0x1);/* u8)prxreport->amsdu; */ + pattrib->amsdu = (le32_to_cpu(prxstat->rxdw1) >> 13) & 0x1;/* u8)prxreport->amsdu; */ - pattrib->seq_num = (u16)(le32_to_cpu(prxstat->rxdw2) & 0x00000fff);/* u16)prxreport->seq; */ - pattrib->frag_num = (u8)((le32_to_cpu(prxstat->rxdw2) >> 12) & 0xf);/* u8)prxreport->frag; */ - pattrib->mfrag = (u8)((le32_to_cpu(prxstat->rxdw1) >> 27) & 0x1);/* u8)prxreport->mf; */ - pattrib->mdata = (u8)((le32_to_cpu(prxstat->rxdw1) >> 26) & 0x1);/* u8)prxreport->md; */ + pattrib->seq_num = le32_to_cpu(prxstat->rxdw2) & 0x00000fff;/* u16)prxreport->seq; */ + pattrib->frag_num = (le32_to_cpu(prxstat->rxdw2) >> 12) & 0xf;/* u8)prxreport->frag; */ + pattrib->mfrag = (le32_to_cpu(prxstat->rxdw1) >> 27) & 0x1;/* u8)prxreport->mf; */ + pattrib->mdata = (le32_to_cpu(prxstat->rxdw1) >> 26) & 0x1;/* u8)prxreport->md; */ - pattrib->mcs_rate = (u8)(le32_to_cpu(prxstat->rxdw3) & 0x3f);/* u8)prxreport->rxmcs; */ - pattrib->rxht = (u8)((le32_to_cpu(prxstat->rxdw3) >> 6) & 0x1);/* u8)prxreport->rxht; */ + pattrib->mcs_rate = le32_to_cpu(prxstat->rxdw3) & 0x3f;/* u8)prxreport->rxmcs; */ + pattrib->rxht = (le32_to_cpu(prxstat->rxdw3) >> 6) & 0x1;/* u8)prxreport->rxht; */ - pattrib->icv_err = (u8)((le32_to_cpu(prxstat->rxdw0) >> 15) & 0x1);/* u8)prxreport->icverr; */ - pattrib->shift_sz = (u8)((le32_to_cpu(prxstat->rxdw0) >> 24) & 0x3); + pattrib->icv_err = (le32_to_cpu(prxstat->rxdw0) >> 15) & 0x1;/* u8)prxreport->icverr; */ + pattrib->shift_sz = (le32_to_cpu(prxstat->rxdw0) >> 24) & 0x3; } else if (pattrib->pkt_rpt_type == TX_REPORT1) { /* CCX */ pattrib->pkt_len = TX_RPT1_PKT_LEN; } else if (pattrib->pkt_rpt_type == TX_REPORT2) { /* TX RPT */ - pattrib->pkt_len = (u16)(le32_to_cpu(prxstat->rxdw0) & 0x3FF);/* Rx length[9:0] */ + pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x3FF;/* Rx length[9:0] */ /* */ /* Get TX report MAC ID valid. */ @@ -101,7 +101,7 @@ void update_recvframe_attrib_88e(struct recv_frame *precvframe, struct recv_stat pattrib->MacIDValidEntry[1] = le32_to_cpu(prxstat->rxdw5); } else if (pattrib->pkt_rpt_type == HIS_REPORT) { /* USB HISR RPT */ - pattrib->pkt_len = (u16)(le32_to_cpu(prxstat->rxdw0) & 0x00003fff);/* u16)prxreport->pktlen; */ + pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x00003fff;/* u16)prxreport->pktlen; */ } } -- cgit From cb9d439002263efbc99814cc8439fe65d805cfb2 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 5 Mar 2022 15:41:17 +0100 Subject: staging: r8188eu: remove comments in update_recvframe_attrib_88e Remove a couple of comments in update_recvframe_attrib_88e that provide no useful information. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220305144117.1380534-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 48 ++++++++++++--------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c index cbc3ce34a50d..b4c9738ed868 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c @@ -60,48 +60,44 @@ void update_recvframe_attrib_88e(struct recv_frame *precvframe, struct recv_stat struct rx_pkt_attrib *pattrib = &precvframe->attrib; memset(pattrib, 0, sizeof(struct rx_pkt_attrib)); - pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) >> 14) & 0x1;/* u8)prxreport->crc32; */ + pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) >> 14) & 0x1; - /* update rx report to recv_frame attribute */ - pattrib->pkt_rpt_type = (le32_to_cpu(prxstat->rxdw3) >> 14) & 0x3;/* prxreport->rpt_sel; */ + pattrib->pkt_rpt_type = (le32_to_cpu(prxstat->rxdw3) >> 14) & 0x3; - if (pattrib->pkt_rpt_type == NORMAL_RX) { /* Normal rx packet */ - pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x00003fff;/* u16)prxreport->pktlen; */ - pattrib->drvinfo_sz = ((le32_to_cpu(prxstat->rxdw0) >> 16) & 0xf) * 8;/* u8)(prxreport->drvinfosize << 3); */ + if (pattrib->pkt_rpt_type == NORMAL_RX) { + pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x00003fff; + pattrib->drvinfo_sz = ((le32_to_cpu(prxstat->rxdw0) >> 16) & 0xf) * 8; - pattrib->physt = (le32_to_cpu(prxstat->rxdw0) >> 26) & 0x1;/* u8)prxreport->physt; */ + pattrib->physt = (le32_to_cpu(prxstat->rxdw0) >> 26) & 0x1; - pattrib->bdecrypted = (le32_to_cpu(prxstat->rxdw0) & BIT(27)) ? 0 : 1;/* u8)(prxreport->swdec ? 0 : 1); */ - pattrib->encrypt = (le32_to_cpu(prxstat->rxdw0) >> 20) & 0x7;/* u8)prxreport->security; */ + pattrib->bdecrypted = (le32_to_cpu(prxstat->rxdw0) & BIT(27)) ? 0 : 1; + pattrib->encrypt = (le32_to_cpu(prxstat->rxdw0) >> 20) & 0x7; - pattrib->qos = (le32_to_cpu(prxstat->rxdw0) >> 23) & 0x1;/* prxreport->qos; */ - pattrib->priority = (le32_to_cpu(prxstat->rxdw1) >> 8) & 0xf;/* u8)prxreport->tid; */ + pattrib->qos = (le32_to_cpu(prxstat->rxdw0) >> 23) & 0x1; + pattrib->priority = (le32_to_cpu(prxstat->rxdw1) >> 8) & 0xf; - pattrib->amsdu = (le32_to_cpu(prxstat->rxdw1) >> 13) & 0x1;/* u8)prxreport->amsdu; */ + pattrib->amsdu = (le32_to_cpu(prxstat->rxdw1) >> 13) & 0x1; - pattrib->seq_num = le32_to_cpu(prxstat->rxdw2) & 0x00000fff;/* u16)prxreport->seq; */ - pattrib->frag_num = (le32_to_cpu(prxstat->rxdw2) >> 12) & 0xf;/* u8)prxreport->frag; */ - pattrib->mfrag = (le32_to_cpu(prxstat->rxdw1) >> 27) & 0x1;/* u8)prxreport->mf; */ - pattrib->mdata = (le32_to_cpu(prxstat->rxdw1) >> 26) & 0x1;/* u8)prxreport->md; */ + pattrib->seq_num = le32_to_cpu(prxstat->rxdw2) & 0x00000fff; + pattrib->frag_num = (le32_to_cpu(prxstat->rxdw2) >> 12) & 0xf; + pattrib->mfrag = (le32_to_cpu(prxstat->rxdw1) >> 27) & 0x1; + pattrib->mdata = (le32_to_cpu(prxstat->rxdw1) >> 26) & 0x1; - pattrib->mcs_rate = le32_to_cpu(prxstat->rxdw3) & 0x3f;/* u8)prxreport->rxmcs; */ - pattrib->rxht = (le32_to_cpu(prxstat->rxdw3) >> 6) & 0x1;/* u8)prxreport->rxht; */ + pattrib->mcs_rate = le32_to_cpu(prxstat->rxdw3) & 0x3f; + pattrib->rxht = (le32_to_cpu(prxstat->rxdw3) >> 6) & 0x1; - pattrib->icv_err = (le32_to_cpu(prxstat->rxdw0) >> 15) & 0x1;/* u8)prxreport->icverr; */ + pattrib->icv_err = (le32_to_cpu(prxstat->rxdw0) >> 15) & 0x1; pattrib->shift_sz = (le32_to_cpu(prxstat->rxdw0) >> 24) & 0x3; } else if (pattrib->pkt_rpt_type == TX_REPORT1) { /* CCX */ pattrib->pkt_len = TX_RPT1_PKT_LEN; - } else if (pattrib->pkt_rpt_type == TX_REPORT2) { /* TX RPT */ - pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x3FF;/* Rx length[9:0] */ + } else if (pattrib->pkt_rpt_type == TX_REPORT2) { + pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x3FF; - /* */ - /* Get TX report MAC ID valid. */ - /* */ pattrib->MacIDValidEntry[0] = le32_to_cpu(prxstat->rxdw4); pattrib->MacIDValidEntry[1] = le32_to_cpu(prxstat->rxdw5); - } else if (pattrib->pkt_rpt_type == HIS_REPORT) { /* USB HISR RPT */ - pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x00003fff;/* u16)prxreport->pktlen; */ + } else if (pattrib->pkt_rpt_type == HIS_REPORT) { + pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x00003fff; } } -- cgit From 378c64302afe543ba6cedcbc696c08395e75aba4 Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Tue, 8 Mar 2022 21:09:42 +1300 Subject: staging: pi433: remove hardcoded mask value for easier readability replace hardcoded value with the bitwise complement of the mask used to extract value sent to rf69 chip. Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/YicPRrH3HmpiTCxe@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/rf69.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index 3028018f0b45..659c8c1b38fd 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -741,7 +741,7 @@ int rf69_set_fifo_threshold(struct spi_device *spi, u8 threshold) int retval; /* check input value */ - if (threshold & 0x80) { + if (threshold & ~MASK_FIFO_THRESH_VALUE) { dev_dbg(&spi->dev, "set: illegal fifo threshold %u\n", threshold); return -EINVAL; } -- cgit From d7e2d1e88823c93f98ce241050a9cfc9b591d33a Mon Sep 17 00:00:00 2001 From: Paulo Miguel Almeida Date: Tue, 8 Mar 2022 21:19:50 +1300 Subject: staging: pi433: formatting improvement for multi-line bitwise statement Move bitwise & operator to the end of previous line for better readability Signed-off-by: Paulo Miguel Almeida Link: https://lore.kernel.org/r/YicRpmT2xMupVp4h@mail.google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/pi433/pi433_if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 3f3e863e6cc8..9a55fb29bd54 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -442,8 +442,8 @@ static int pi433_receive(void *data) /* wait for RSSI level to become high */ dev_dbg(dev->dev, "rx: going to wait for high RSSI level\n"); retval = wait_event_interruptible(dev->rx_wait_queue, - rf69_read_reg(spi, REG_IRQFLAGS1) - & MASK_IRQFLAGS1_RSSI); + rf69_read_reg(spi, REG_IRQFLAGS1) & + MASK_IRQFLAGS1_RSSI); if (retval) /* wait was interrupted */ goto abort; dev->interrupt_rx_allowed = false; -- cgit From 1ffba357301321b33c71e260d1549e98dae1c391 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 5 Mar 2022 22:32:03 +0100 Subject: staging: vt6655: Remove unused byRFType in channel.c Remove byRFType that support 5GHz band. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/3724590188e72e8f531fe03c2821c5d3d08e2e29.1646512837.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/channel.c | 85 +--------------------------------------- 1 file changed, 1 insertion(+), 84 deletions(-) diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c index e37c8e35a45b..abe867814dc8 100644 --- a/drivers/staging/vt6655/channel.c +++ b/drivers/staging/vt6655/channel.c @@ -25,17 +25,6 @@ static struct ieee80211_rate vnt_rates_bg[] = { { .bitrate = 540, .hw_value = RATE_54M }, }; -static struct ieee80211_rate vnt_rates_a[] = { - { .bitrate = 60, .hw_value = RATE_6M }, - { .bitrate = 90, .hw_value = RATE_9M }, - { .bitrate = 120, .hw_value = RATE_12M }, - { .bitrate = 180, .hw_value = RATE_18M }, - { .bitrate = 240, .hw_value = RATE_24M }, - { .bitrate = 360, .hw_value = RATE_36M }, - { .bitrate = 480, .hw_value = RATE_48M }, - { .bitrate = 540, .hw_value = RATE_54M }, -}; - static struct ieee80211_channel vnt_channels_2ghz[] = { { .center_freq = 2412, .hw_value = 1 }, { .center_freq = 2417, .hw_value = 2 }, @@ -53,51 +42,6 @@ static struct ieee80211_channel vnt_channels_2ghz[] = { { .center_freq = 2484, .hw_value = 14 } }; -static struct ieee80211_channel vnt_channels_5ghz[] = { - { .center_freq = 4915, .hw_value = 15 }, - { .center_freq = 4920, .hw_value = 16 }, - { .center_freq = 4925, .hw_value = 17 }, - { .center_freq = 4935, .hw_value = 18 }, - { .center_freq = 4940, .hw_value = 19 }, - { .center_freq = 4945, .hw_value = 20 }, - { .center_freq = 4960, .hw_value = 21 }, - { .center_freq = 4980, .hw_value = 22 }, - { .center_freq = 5035, .hw_value = 23 }, - { .center_freq = 5040, .hw_value = 24 }, - { .center_freq = 5045, .hw_value = 25 }, - { .center_freq = 5055, .hw_value = 26 }, - { .center_freq = 5060, .hw_value = 27 }, - { .center_freq = 5080, .hw_value = 28 }, - { .center_freq = 5170, .hw_value = 29 }, - { .center_freq = 5180, .hw_value = 30 }, - { .center_freq = 5190, .hw_value = 31 }, - { .center_freq = 5200, .hw_value = 32 }, - { .center_freq = 5210, .hw_value = 33 }, - { .center_freq = 5220, .hw_value = 34 }, - { .center_freq = 5230, .hw_value = 35 }, - { .center_freq = 5240, .hw_value = 36 }, - { .center_freq = 5260, .hw_value = 37 }, - { .center_freq = 5280, .hw_value = 38 }, - { .center_freq = 5300, .hw_value = 39 }, - { .center_freq = 5320, .hw_value = 40 }, - { .center_freq = 5500, .hw_value = 41 }, - { .center_freq = 5520, .hw_value = 42 }, - { .center_freq = 5540, .hw_value = 43 }, - { .center_freq = 5560, .hw_value = 44 }, - { .center_freq = 5580, .hw_value = 45 }, - { .center_freq = 5600, .hw_value = 46 }, - { .center_freq = 5620, .hw_value = 47 }, - { .center_freq = 5640, .hw_value = 48 }, - { .center_freq = 5660, .hw_value = 49 }, - { .center_freq = 5680, .hw_value = 50 }, - { .center_freq = 5700, .hw_value = 51 }, - { .center_freq = 5745, .hw_value = 52 }, - { .center_freq = 5765, .hw_value = 53 }, - { .center_freq = 5785, .hw_value = 54 }, - { .center_freq = 5805, .hw_value = 55 }, - { .center_freq = 5825, .hw_value = 56 } -}; - static struct ieee80211_supported_band vnt_supported_2ghz_band = { .channels = vnt_channels_2ghz, .n_channels = ARRAY_SIZE(vnt_channels_2ghz), @@ -105,13 +49,6 @@ static struct ieee80211_supported_band vnt_supported_2ghz_band = { .n_bitrates = ARRAY_SIZE(vnt_rates_bg), }; -static struct ieee80211_supported_band vnt_supported_5ghz_band = { - .channels = vnt_channels_5ghz, - .n_channels = ARRAY_SIZE(vnt_channels_5ghz), - .bitrates = vnt_rates_a, - .n_bitrates = ARRAY_SIZE(vnt_rates_a), -}; - static void vnt_init_band(struct vnt_private *priv, struct ieee80211_supported_band *supported_band, enum nl80211_band band) @@ -129,23 +66,7 @@ static void vnt_init_band(struct vnt_private *priv, void vnt_init_bands(struct vnt_private *priv) { - switch (priv->byRFType) { - case RF_AIROHA7230: - case RF_UW2452: - case RF_NOTHING: - default: - vnt_init_band(priv, &vnt_supported_5ghz_band, - NL80211_BAND_5GHZ); - fallthrough; - case RF_RFMD2959: - case RF_AIROHA: - case RF_AL2230S: - case RF_UW2451: - case RF_VT3226: - vnt_init_band(priv, &vnt_supported_2ghz_band, - NL80211_BAND_2GHZ); - break; - } + vnt_init_band(priv, &vnt_supported_2ghz_band, NL80211_BAND_2GHZ); } /** @@ -179,10 +100,6 @@ bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch) * it is for better TX throughput */ - if (priv->byRFType == RF_AIROHA7230) - RFbAL7230SelectChannelPostProcess(priv, priv->byCurrentCh, - ch->hw_value); - priv->byCurrentCh = ch->hw_value; ret &= RFbSelectChannel(priv, priv->byRFType, ch->hw_value); -- cgit From b7711a87061245fb8d8cc7947c43fadcbe932dc0 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 5 Mar 2022 22:32:08 +0100 Subject: staging: vt6655: Remove unused byRFType in baseband.c Remove byRFType that support 5GHz band. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/198341a249ea67acbf1be00b6465aa6a4eaef6e1.1646512837.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/baseband.c | 80 --------------------------------------- 1 file changed, 80 deletions(-) diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 84fa6ea3e2e6..dfdb0ebf43b5 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -2065,54 +2065,6 @@ bool bb_vt3253_init(struct vnt_private *priv) priv->dbm_threshold[1] = -50; priv->dbm_threshold[2] = 0; priv->dbm_threshold[3] = 0; - } else if (by_rf_type == RF_UW2452) { - for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++) - result &= bb_write_embedded(priv, - byVT3253B0_UW2451[ii][0], - byVT3253B0_UW2451[ii][1]); - - /* Init ANT B select, - * TX Config CR09 = 0x61->0x45, - * 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) - */ - - /*bResult &= bb_write_embedded(iobase,0x09,0x41);*/ - - /* Init ANT B select, - * RX Config CR10 = 0x28->0x2A, - * 0x2A->0x28(VC1/VC2 define, - * make the ANT_A, ANT_B inverted) - */ - - /*bResult &= bb_write_embedded(iobase,0x0a,0x28);*/ - /* Select VC1/VC2, CR215 = 0x02->0x06 */ - result &= bb_write_embedded(priv, 0xd7, 0x06); - - /* {{RobertYu:20050125, request by Jack */ - result &= bb_write_embedded(priv, 0x90, 0x20); - result &= bb_write_embedded(priv, 0x97, 0xeb); - /* }} */ - - /* {{RobertYu:20050221, request by Jack */ - result &= bb_write_embedded(priv, 0xa6, 0x00); - result &= bb_write_embedded(priv, 0xa8, 0x30); - /* }} */ - result &= bb_write_embedded(priv, 0xb0, 0x58); - - for (ii = 0; ii < CB_VT3253B0_AGC; ii++) - result &= bb_write_embedded(priv, - byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); - - priv->abyBBVGA[0] = 0x14; - priv->abyBBVGA[1] = 0x0A; - priv->abyBBVGA[2] = 0x0; - priv->abyBBVGA[3] = 0x0; - priv->dbm_threshold[0] = -60; - priv->dbm_threshold[1] = -50; - priv->dbm_threshold[2] = 0; - priv->dbm_threshold[3] = 0; - /* }} RobertYu */ - } else if (by_rf_type == RF_VT3226) { for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) result &= bb_write_embedded(priv, @@ -2134,38 +2086,6 @@ bool bb_vt3253_init(struct vnt_private *priv) /* Fix VT3226 DFC system timing issue */ MACvSetRFLE_LatchBase(iobase); /* {{ RobertYu: 20050104 */ - } else if (by_rf_type == RF_AIROHA7230) { - for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) - result &= bb_write_embedded(priv, - byVT3253B0_AIROHA2230[ii][0], - byVT3253B0_AIROHA2230[ii][1]); - - /* {{ RobertYu:20050223, request by JerryChung */ - /* Init ANT B select,TX Config CR09 = 0x61->0x45, - * 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) - */ - /* bResult &= bb_write_embedded(iobase,0x09,0x41);*/ - /* Init ANT B select,RX Config CR10 = 0x28->0x2A, - * 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) - */ - /* bResult &= BBbWriteEmbedded(iobase,0x0a,0x28);*/ - /* Select VC1/VC2, CR215 = 0x02->0x06 */ - result &= bb_write_embedded(priv, 0xd7, 0x06); - /* }} */ - - for (ii = 0; ii < CB_VT3253B0_AGC; ii++) - result &= bb_write_embedded(priv, - byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]); - - priv->abyBBVGA[0] = 0x1C; - priv->abyBBVGA[1] = 0x10; - priv->abyBBVGA[2] = 0x0; - priv->abyBBVGA[3] = 0x0; - priv->dbm_threshold[0] = -70; - priv->dbm_threshold[1] = -48; - priv->dbm_threshold[2] = 0; - priv->dbm_threshold[3] = 0; - /* }} RobertYu */ } else { /* No VGA Table now */ priv->bUpdateBBVGA = false; -- cgit From dd2837bdea0e92b3f0019d5db20bf753efc6d1d7 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 5 Mar 2022 22:32:14 +0100 Subject: staging: vt6655: Remove unused byRFType in rf.c Remove byRFType that support 5GHz band. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/640bdbc0ff135c6a63d6764fd81a8bb24d5053dd.1646512837.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rf.c | 404 +------------------------------------------- 1 file changed, 1 insertion(+), 403 deletions(-) diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c index ba7056f5a5da..4498c9d400f2 100644 --- a/drivers/staging/vt6655/rf.c +++ b/drivers/staging/vt6655/rf.c @@ -152,333 +152,6 @@ static unsigned long al2230_power_table[AL2230_PWR_IDX_LEN] = { 0x0407F900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW }; -/* 40MHz reference frequency - * Need to Pull PLLON(PE3) low when writing channel registers through 3-wire. - */ -static const unsigned long al7230_init_table[CB_AL7230_INIT_SEQ] = { - 0x00379000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Channel1 // Need modify for 11a */ - 0x13333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Channel1 // Need modify for 11a */ - 0x841FF200 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: 451FE2 */ - 0x3FDFA300 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: 5FDFA3 */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* 11b/g // Need modify for 11a */ - /* RoberYu:20050113, Rev0.47 Register Setting Guide */ - 0x802B5500 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: 8D1B55 */ - 0x56AF3600 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, - 0xCE020700 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: 860207 */ - 0x6EBC0800 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, - 0x221BB900 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, - 0xE0000A00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: E0600A */ - 0x08031B00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) */ - /* RoberYu:20050113, Rev0.47 Register Setting Guide */ - 0x000A3C00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: 00143C */ - 0xFFFFFD00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, - 0x00000E00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, - 0x1ABA8F00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW /* Need modify for 11a: 12BACF */ -}; - -static const unsigned long al7230_init_table_a_mode[CB_AL7230_INIT_SEQ] = { - 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Channel184 // Need modify for 11b/g */ - 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Channel184 // Need modify for 11b/g */ - 0x451FE200 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g */ - 0x5FDFA300 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g */ - 0x67F78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* 11a // Need modify for 11b/g */ - 0x853F5500 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g, RoberYu:20050113 */ - 0x56AF3600 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, - 0xCE020700 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g */ - 0x6EBC0800 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, - 0x221BB900 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, - 0xE0600A00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g */ - 0x08031B00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) */ - 0x00147C00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g */ - 0xFFFFFD00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, - 0x00000E00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, - 0x12BACF00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW /* Need modify for 11b/g */ -}; - -static const unsigned long al7230_channel_table0[CB_MAX_CHANNEL] = { - 0x00379000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */ - 0x00379000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */ - 0x00379000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */ - 0x00379000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */ - 0x0037A000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */ - 0x0037A000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */ - 0x0037A000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */ - 0x0037A000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz //RobertYu: 20050218, update for APNode 0.49 */ - 0x0037B000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz //RobertYu: 20050218, update for APNode 0.49 */ - 0x0037B000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz //RobertYu: 20050218, update for APNode 0.49 */ - 0x0037B000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz //RobertYu: 20050218, update for APNode 0.49 */ - 0x0037B000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz //RobertYu: 20050218, update for APNode 0.49 */ - 0x0037C000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz //RobertYu: 20050218, update for APNode 0.49 */ - 0x0037C000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 14, Tf = 2484MHz */ - - /* 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) */ - 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 183, Tf = 4915MHz (15) */ - 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 184, Tf = 4920MHz (16) */ - 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 185, Tf = 4925MHz (17) */ - 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 187, Tf = 4935MHz (18) */ - 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 188, Tf = 4940MHz (19) */ - 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 189, Tf = 4945MHz (20) */ - 0x0FF53000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 192, Tf = 4960MHz (21) */ - 0x0FF53000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 196, Tf = 4980MHz (22) */ - - /* 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, - * 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) - */ - - 0x0FF54000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 5035MHz (23) */ - 0x0FF54000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 5040MHz (24) */ - 0x0FF54000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 5045MHz (25) */ - 0x0FF54000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 5055MHz (26) */ - 0x0FF54000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 5060MHz (27) */ - 0x0FF55000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 16, Tf = 5080MHz (28) */ - 0x0FF56000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 34, Tf = 5170MHz (29) */ - 0x0FF56000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 36, Tf = 5180MHz (30) */ - 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 38, Tf = 5190MHz (31) //RobertYu: 20050218, update for APNode 0.49 */ - 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 40, Tf = 5200MHz (32) */ - 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 42, Tf = 5210MHz (33) */ - 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 44, Tf = 5220MHz (34) */ - 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 46, Tf = 5230MHz (35) */ - 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 48, Tf = 5240MHz (36) */ - 0x0FF58000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 52, Tf = 5260MHz (37) */ - 0x0FF58000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 56, Tf = 5280MHz (38) */ - 0x0FF58000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 60, Tf = 5300MHz (39) */ - 0x0FF59000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 64, Tf = 5320MHz (40) */ - - 0x0FF5C000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 100, Tf = 5500MHz (41) */ - 0x0FF5C000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 104, Tf = 5520MHz (42) */ - 0x0FF5C000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 108, Tf = 5540MHz (43) */ - 0x0FF5D000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 112, Tf = 5560MHz (44) */ - 0x0FF5D000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 116, Tf = 5580MHz (45) */ - 0x0FF5D000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 120, Tf = 5600MHz (46) */ - 0x0FF5E000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 124, Tf = 5620MHz (47) */ - 0x0FF5E000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 128, Tf = 5640MHz (48) */ - 0x0FF5E000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 132, Tf = 5660MHz (49) */ - 0x0FF5F000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 136, Tf = 5680MHz (50) */ - 0x0FF5F000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 140, Tf = 5700MHz (51) */ - 0x0FF60000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 149, Tf = 5745MHz (52) */ - 0x0FF60000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 153, Tf = 5765MHz (53) */ - 0x0FF60000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 157, Tf = 5785MHz (54) */ - 0x0FF61000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 161, Tf = 5805MHz (55) */ - 0x0FF61000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW /* channel = 165, Tf = 5825MHz (56) */ -}; - -static const unsigned long al7230_channel_table1[CB_MAX_CHANNEL] = { - 0x13333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */ - 0x1B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */ - 0x03333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */ - 0x0B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */ - 0x13333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */ - 0x1B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */ - 0x03333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */ - 0x0B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz */ - 0x13333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz */ - 0x1B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz */ - 0x03333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz */ - 0x0B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz */ - 0x13333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz */ - 0x06666100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 14, Tf = 2484MHz */ - - /* 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) */ - 0x1D555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 183, Tf = 4915MHz (15) */ - 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 184, Tf = 4920MHz (16) */ - 0x02AAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 185, Tf = 4925MHz (17) */ - 0x08000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 187, Tf = 4935MHz (18) */ - 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 188, Tf = 4940MHz (19) */ - 0x0D555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 189, Tf = 4945MHz (20) */ - 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 192, Tf = 4960MHz (21) */ - 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 196, Tf = 4980MHz (22) */ - - /* 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, - * 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) - */ - 0x1D555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 5035MHz (23) */ - 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 5040MHz (24) */ - 0x02AAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 5045MHz (25) */ - 0x08000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 5055MHz (26) */ - 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 5060MHz (27) */ - 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 16, Tf = 5080MHz (28) */ - 0x05555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 34, Tf = 5170MHz (29) */ - 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 36, Tf = 5180MHz (30) */ - 0x10000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 38, Tf = 5190MHz (31) */ - 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 40, Tf = 5200MHz (32) */ - 0x1AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 42, Tf = 5210MHz (33) */ - 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 44, Tf = 5220MHz (34) */ - 0x05555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 46, Tf = 5230MHz (35) */ - 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 48, Tf = 5240MHz (36) */ - 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 52, Tf = 5260MHz (37) */ - 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 56, Tf = 5280MHz (38) */ - 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 60, Tf = 5300MHz (39) */ - 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 64, Tf = 5320MHz (40) */ - 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 100, Tf = 5500MHz (41) */ - 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 104, Tf = 5520MHz (42) */ - 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 108, Tf = 5540MHz (43) */ - 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 112, Tf = 5560MHz (44) */ - 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 116, Tf = 5580MHz (45) */ - 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 120, Tf = 5600MHz (46) */ - 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 124, Tf = 5620MHz (47) */ - 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 128, Tf = 5640MHz (48) */ - 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 132, Tf = 5660MHz (49) */ - 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 136, Tf = 5680MHz (50) */ - 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 140, Tf = 5700MHz (51) */ - 0x18000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 149, Tf = 5745MHz (52) */ - 0x02AAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 153, Tf = 5765MHz (53) */ - 0x0D555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 157, Tf = 5785MHz (54) */ - 0x18000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 161, Tf = 5805MHz (55) */ - 0x02AAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW /* channel = 165, Tf = 5825MHz (56) */ -}; - -static const unsigned long al7230_channel_table2[CB_MAX_CHANNEL] = { - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz */ - 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 14, Tf = 2484MHz */ - - /* 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 183, Tf = 4915MHz (15) */ - 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 184, Tf = 4920MHz (16) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 185, Tf = 4925MHz (17) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 187, Tf = 4935MHz (18) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 188, Tf = 4940MHz (19) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 189, Tf = 4945MHz (20) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 192, Tf = 4960MHz (21) */ - 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 196, Tf = 4980MHz (22) */ - - /* 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, - * 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56) - */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 5035MHz (23) */ - 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 5040MHz (24) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 5045MHz (25) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 5055MHz (26) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 5060MHz (27) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 16, Tf = 5080MHz (28) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 34, Tf = 5170MHz (29) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 36, Tf = 5180MHz (30) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 38, Tf = 5190MHz (31) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 40, Tf = 5200MHz (32) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 42, Tf = 5210MHz (33) */ - 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 44, Tf = 5220MHz (34) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 46, Tf = 5230MHz (35) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 48, Tf = 5240MHz (36) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 52, Tf = 5260MHz (37) */ - 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 56, Tf = 5280MHz (38) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 60, Tf = 5300MHz (39) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 64, Tf = 5320MHz (40) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 100, Tf = 5500MHz (41) */ - 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 104, Tf = 5520MHz (42) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 108, Tf = 5540MHz (43) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 112, Tf = 5560MHz (44) */ - 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 116, Tf = 5580MHz (45) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 120, Tf = 5600MHz (46) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 124, Tf = 5620MHz (47) */ - 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 128, Tf = 5640MHz (48) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 132, Tf = 5660MHz (49) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 136, Tf = 5680MHz (50) */ - 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 140, Tf = 5700MHz (51) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 149, Tf = 5745MHz (52) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 153, Tf = 5765MHz (53) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 157, Tf = 5785MHz (54) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 161, Tf = 5805MHz (55) */ - 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW /* channel = 165, Tf = 5825MHz (56) */ -}; - -/* - * Description: AIROHA IFRF chip init function - * - * Parameters: - * In: - * iobase - I/O base address - * Out: - * none - * - * Return Value: true if succeeded; false if failed. - * - */ -static bool s_bAL7230Init(struct vnt_private *priv) -{ - void __iomem *iobase = priv->port_offset; - int ii; - bool ret; - - ret = true; - - /* 3-wire control for normal mode */ - VNSvOutPortB(iobase + MAC_REG_SOFTPWRCTL, 0); - - MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPECTI | - SOFTPWRCTL_TXPEINV)); - bb_power_save_mode_off(priv); /* RobertYu:20050106, have DC value for Calibration */ - - for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++) - ret &= IFRFbWriteEmbedded(priv, al7230_init_table[ii]); - - /* PLL On */ - MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3); - - /* Calibration */ - MACvTimer0MicroSDelay(priv, 150);/* 150us */ - /* TXDCOC:active, RCK:disable */ - ret &= IFRFbWriteEmbedded(priv, (0x9ABA8F00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW)); - MACvTimer0MicroSDelay(priv, 30);/* 30us */ - /* TXDCOC:disable, RCK:active */ - ret &= IFRFbWriteEmbedded(priv, (0x3ABA8F00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW)); - MACvTimer0MicroSDelay(priv, 30);/* 30us */ - /* TXDCOC:disable, RCK:disable */ - ret &= IFRFbWriteEmbedded(priv, al7230_init_table[CB_AL7230_INIT_SEQ - 1]); - - MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 | - SOFTPWRCTL_SWPE2 | - SOFTPWRCTL_SWPECTI | - SOFTPWRCTL_TXPEINV)); - - bb_power_save_mode_on(priv); /* RobertYu:20050106 */ - - /* PE1: TX_ON, PE2: RX_ON, PE3: PLLON */ - /* 3-wire control for power saving mode */ - VNSvOutPortB(iobase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); /* 1100 0000 */ - - return ret; -} - -/* Need to Pull PLLON low when writing channel registers through - * 3-wire interface - */ -static bool s_bAL7230SelectChannel(struct vnt_private *priv, unsigned char byChannel) -{ - void __iomem *iobase = priv->port_offset; - bool ret; - - ret = true; - - /* PLLON Off */ - MACvWordRegBitsOff(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3); - - ret &= IFRFbWriteEmbedded(priv, al7230_channel_table0[byChannel - 1]); - ret &= IFRFbWriteEmbedded(priv, al7230_channel_table1[byChannel - 1]); - ret &= IFRFbWriteEmbedded(priv, al7230_channel_table2[byChannel - 1]); - - /* PLLOn On */ - MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3); - - /* Set Channel[7] = 0 to tell H/W channel is changing now. */ - VNSvOutPortB(iobase + MAC_REG_CHANNEL, (byChannel & 0x7F)); - MACvTimer0MicroSDelay(priv, SWITCH_CHANNEL_DELAY_AL7230); - /* Set Channel[7] = 1 to tell H/W channel change is done. */ - VNSvOutPortB(iobase + MAC_REG_CHANNEL, (byChannel | 0x80)); - - return ret; -} - /* * Description: Write to IF/RF, by embedded programming * @@ -612,10 +285,6 @@ bool RFbInit(struct vnt_private *priv) priv->max_pwr_level = AL2230_PWR_IDX_LEN; ret = RFbAL2230Init(priv); break; - case RF_AIROHA7230: - priv->max_pwr_level = AL7230_PWR_IDX_LEN; - ret = s_bAL7230Init(priv); - break; case RF_NOTHING: ret = true; break; @@ -650,10 +319,6 @@ bool RFbSelectChannel(struct vnt_private *priv, unsigned char byRFType, ret = RFbAL2230SelectChannel(priv, byChannel); break; /*{{ RobertYu: 20050104 */ - case RF_AIROHA7230: - ret = s_bAL7230SelectChannel(priv, byChannel); - break; - /*}} RobertYu */ case RF_NOTHING: ret = true; break; @@ -684,7 +349,6 @@ bool rf_write_wake_prog_syn(struct vnt_private *priv, unsigned char rf_type, unsigned char init_count = 0; unsigned char sleep_count = 0; unsigned short idx = MISCFIFO_SYNDATA_IDX; - const unsigned long *init_table; VNSvOutPortW(iobase + MAC_REG_MISCFFNDEX, 0); switch (rf_type) { @@ -706,20 +370,6 @@ bool rf_write_wake_prog_syn(struct vnt_private *priv, unsigned char rf_type, break; /* Need to check, PLLON need to be low for channel setting */ - case RF_AIROHA7230: - /* Init Reg + Channel Reg (3) */ - init_count = CB_AL7230_INIT_SEQ + 3; - sleep_count = 0; - - init_table = (channel <= CB_MAX_CHANNEL_24G) ? - al7230_init_table : al7230_init_table_a_mode; - for (i = 0; i < CB_AL7230_INIT_SEQ; i++) - MACvSetMISCFifo(priv, idx++, init_table[i]); - - MACvSetMISCFifo(priv, idx++, al7230_channel_table0[channel - 1]); - MACvSetMISCFifo(priv, idx++, al7230_channel_table1[channel - 1]); - MACvSetMISCFifo(priv, idx++, al7230_channel_table2[channel - 1]); - break; case RF_NOTHING: return true; @@ -773,10 +423,7 @@ bool RFbSetPower(struct vnt_private *priv, unsigned int rate, u16 uCH) case RATE_12M: case RATE_18M: byPwr = priv->abyOFDMPwrTbl[uCH]; - if (priv->byRFType == RF_UW2452) - byDec = byPwr + 14; - else - byDec = byPwr + 10; + byDec = byPwr + 10; if (byDec >= priv->max_pwr_level) byDec = priv->max_pwr_level - 1; @@ -819,7 +466,6 @@ bool RFbRawSetPower(struct vnt_private *priv, unsigned char byPwr, unsigned int rate) { bool ret = true; - unsigned long dwMax7230Pwr = 0; if (byPwr >= priv->max_pwr_level) return false; @@ -846,16 +492,6 @@ bool RFbRawSetPower(struct vnt_private *priv, unsigned char byPwr, break; - case RF_AIROHA7230: - /* 0x080F1B00 for 3 wire control TxGain(D10) - * and 0x31 as TX Gain value - */ - dwMax7230Pwr = 0x080C0B00 | ((byPwr) << 12) | - (BY_AL7230_REG_LEN << 3) | IFREGCTL_REGW; - - ret &= IFRFbWriteEmbedded(priv, dwMax7230Pwr); - break; - default: break; } @@ -888,7 +524,6 @@ RFvRSSITodBm(struct vnt_private *priv, unsigned char byCurrRSSI, long *pldBm) switch (priv->byRFType) { case RF_AIROHA: case RF_AL2230S: - case RF_AIROHA7230: a = abyAIROHARF[byIdx]; break; default: @@ -898,40 +533,3 @@ RFvRSSITodBm(struct vnt_private *priv, unsigned char byCurrRSSI, long *pldBm) *pldBm = -1 * (a + b * 2); } -/* Post processing for the 11b/g and 11a. - * for save time on changing Reg2,3,5,7,10,12,15 - */ -bool RFbAL7230SelectChannelPostProcess(struct vnt_private *priv, - u16 byOldChannel, - u16 byNewChannel) -{ - bool ret; - - ret = true; - - /* if change between 11 b/g and 11a need to update the following - * register - * Channel Index 1~14 - */ - if ((byOldChannel <= CB_MAX_CHANNEL_24G) && (byNewChannel > CB_MAX_CHANNEL_24G)) { - /* Change from 2.4G to 5G [Reg] */ - ret &= IFRFbWriteEmbedded(priv, al7230_init_table_a_mode[2]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table_a_mode[3]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table_a_mode[5]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table_a_mode[7]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table_a_mode[10]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table_a_mode[12]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table_a_mode[15]); - } else if ((byOldChannel > CB_MAX_CHANNEL_24G) && (byNewChannel <= CB_MAX_CHANNEL_24G)) { - /* Change from 5G to 2.4G [Reg] */ - ret &= IFRFbWriteEmbedded(priv, al7230_init_table[2]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table[3]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table[5]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table[7]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table[10]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table[12]); - ret &= IFRFbWriteEmbedded(priv, al7230_init_table[15]); - } - - return ret; -} -- cgit From 65c873c37ec36bbecd1b7da753061d214f23474b Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 5 Mar 2022 22:32:20 +0100 Subject: staging: vt6655: Remove unused byRFType in card.c Remove byRFType that support 5GHz band. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/5554b243ae285e3274d9968575aadd1a79806b01.1646512837.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/card.c | 56 +------------------------------------------ 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index ee2d145778ed..1110366fc415 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -183,32 +183,11 @@ bool CARDbSetPhyParameter(struct vnt_private *priv, u8 bb_type) unsigned char bySlot = 0; unsigned char bySIFS = 0; unsigned char byDIFS = 0; - unsigned char data; int i; /* Set SIFS, DIFS, EIFS, SlotTime, CwMin */ if (bb_type == BB_TYPE_11A) { - if (priv->byRFType == RF_AIROHA7230) { - /* AL7230 use single PAPE and connect to PAPE_2.4G */ - MACvSetBBType(priv->port_offset, BB_TYPE_11G); - priv->abyBBVGA[0] = 0x20; - priv->abyBBVGA[2] = 0x10; - priv->abyBBVGA[3] = 0x10; - bb_read_embedded(priv, 0xE7, &data); - if (data == 0x1C) - bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); - - } else if (priv->byRFType == RF_UW2452) { - MACvSetBBType(priv->port_offset, BB_TYPE_11A); - priv->abyBBVGA[0] = 0x18; - bb_read_embedded(priv, 0xE7, &data); - if (data == 0x14) { - bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); - bb_write_embedded(priv, 0xE1, 0x57); - } - } else { - MACvSetBBType(priv->port_offset, BB_TYPE_11A); - } + MACvSetBBType(priv->port_offset, BB_TYPE_11A); bb_write_embedded(priv, 0x88, 0x03); bySlot = C_SLOT_SHORT; bySIFS = C_SIFS_A; @@ -216,22 +195,6 @@ bool CARDbSetPhyParameter(struct vnt_private *priv, u8 bb_type) byCWMaxMin = 0xA4; } else if (bb_type == BB_TYPE_11B) { MACvSetBBType(priv->port_offset, BB_TYPE_11B); - if (priv->byRFType == RF_AIROHA7230) { - priv->abyBBVGA[0] = 0x1C; - priv->abyBBVGA[2] = 0x00; - priv->abyBBVGA[3] = 0x00; - bb_read_embedded(priv, 0xE7, &data); - if (data == 0x20) - bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); - - } else if (priv->byRFType == RF_UW2452) { - priv->abyBBVGA[0] = 0x14; - bb_read_embedded(priv, 0xE7, &data); - if (data == 0x18) { - bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); - bb_write_embedded(priv, 0xE1, 0xD3); - } - } bb_write_embedded(priv, 0x88, 0x02); bySlot = C_SLOT_LONG; bySIFS = C_SIFS_BG; @@ -239,22 +202,6 @@ bool CARDbSetPhyParameter(struct vnt_private *priv, u8 bb_type) byCWMaxMin = 0xA5; } else { /* PK_TYPE_11GA & PK_TYPE_11GB */ MACvSetBBType(priv->port_offset, BB_TYPE_11G); - if (priv->byRFType == RF_AIROHA7230) { - priv->abyBBVGA[0] = 0x1C; - priv->abyBBVGA[2] = 0x00; - priv->abyBBVGA[3] = 0x00; - bb_read_embedded(priv, 0xE7, &data); - if (data == 0x20) - bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); - - } else if (priv->byRFType == RF_UW2452) { - priv->abyBBVGA[0] = 0x14; - bb_read_embedded(priv, 0xE7, &data); - if (data == 0x18) { - bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); - bb_write_embedded(priv, 0xE1, 0xD3); - } - } bb_write_embedded(priv, 0x88, 0x08); bySIFS = C_SIFS_BG; @@ -417,7 +364,6 @@ void CARDbRadioPowerOff(struct vnt_private *priv) case RF_AIROHA: case RF_AL2230S: - case RF_AIROHA7230: MACvWordRegBitsOff(priv->port_offset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE2); MACvWordRegBitsOff(priv->port_offset, MAC_REG_SOFTPWRCTL, -- cgit From 6413489354f1c67f56f64625d648b9adf4463795 Mon Sep 17 00:00:00 2001 From: Haowen Bai Date: Fri, 11 Mar 2022 15:17:32 +0800 Subject: staging: rtl8723bs: Use min() instead of doing it manually Fix following coccicheck warning: drivers/staging/rtl8723bs/core/rtw_xmit.c:452:25-26: WARNING opportunity for min() Signed-off-by: Haowen Bai Link: https://lore.kernel.org/r/1646983052-16390-1-git-send-email-baihaowen@meizu.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_xmit.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c index f466bfd248fb..a22512633d1b 100644 --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c @@ -449,10 +449,7 @@ static void update_attrib_phy_info(struct adapter *padapter, struct pkt_attrib * pattrib->raid = psta->raid; - if (mlmeext->cur_bwmode < psta->bw_mode) - pattrib->bwmode = mlmeext->cur_bwmode; - else - pattrib->bwmode = psta->bw_mode; + pattrib->bwmode = min(mlmeext->cur_bwmode, psta->bw_mode); pattrib->sgi = query_ra_short_GI(psta); -- cgit From c93338804239bed55fd1e73a3b2f65566bfa0c88 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Thu, 10 Mar 2022 19:54:07 +0100 Subject: staging: vt6656: Remove unused rf_type in channel.c Remove rf_type that supports 5GHz band. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/99af8605af8d348c6b60553c54149ad55da0e3b6.1646935331.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/channel.c | 96 +++------------------------------------- 1 file changed, 6 insertions(+), 90 deletions(-) diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index eb2d52e6420b..aca003031995 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -38,17 +38,6 @@ static struct ieee80211_rate vnt_rates_bg[] = { { .bitrate = 540, .hw_value = RATE_54M }, }; -static struct ieee80211_rate vnt_rates_a[] = { - { .bitrate = 60, .hw_value = RATE_6M }, - { .bitrate = 90, .hw_value = RATE_9M }, - { .bitrate = 120, .hw_value = RATE_12M }, - { .bitrate = 180, .hw_value = RATE_18M }, - { .bitrate = 240, .hw_value = RATE_24M }, - { .bitrate = 360, .hw_value = RATE_36M }, - { .bitrate = 480, .hw_value = RATE_48M }, - { .bitrate = 540, .hw_value = RATE_54M }, -}; - static struct ieee80211_channel vnt_channels_2ghz[] = { { .center_freq = 2412, .hw_value = 1 }, { .center_freq = 2417, .hw_value = 2 }, @@ -66,50 +55,6 @@ static struct ieee80211_channel vnt_channels_2ghz[] = { { .center_freq = 2484, .hw_value = 14 } }; -static struct ieee80211_channel vnt_channels_5ghz[] = { - { .center_freq = 4915, .hw_value = 15 }, - { .center_freq = 4920, .hw_value = 16 }, - { .center_freq = 4925, .hw_value = 17 }, - { .center_freq = 4935, .hw_value = 18 }, - { .center_freq = 4940, .hw_value = 19 }, - { .center_freq = 4945, .hw_value = 20 }, - { .center_freq = 4960, .hw_value = 21 }, - { .center_freq = 4980, .hw_value = 22 }, - { .center_freq = 5035, .hw_value = 23 }, - { .center_freq = 5040, .hw_value = 24 }, - { .center_freq = 5045, .hw_value = 25 }, - { .center_freq = 5055, .hw_value = 26 }, - { .center_freq = 5060, .hw_value = 27 }, - { .center_freq = 5080, .hw_value = 28 }, - { .center_freq = 5170, .hw_value = 29 }, - { .center_freq = 5180, .hw_value = 30 }, - { .center_freq = 5190, .hw_value = 31 }, - { .center_freq = 5200, .hw_value = 32 }, - { .center_freq = 5210, .hw_value = 33 }, - { .center_freq = 5220, .hw_value = 34 }, - { .center_freq = 5230, .hw_value = 35 }, - { .center_freq = 5240, .hw_value = 36 }, - { .center_freq = 5260, .hw_value = 37 }, - { .center_freq = 5280, .hw_value = 38 }, - { .center_freq = 5300, .hw_value = 39 }, - { .center_freq = 5320, .hw_value = 40 }, - { .center_freq = 5500, .hw_value = 41 }, - { .center_freq = 5520, .hw_value = 42 }, - { .center_freq = 5540, .hw_value = 43 }, - { .center_freq = 5560, .hw_value = 44 }, - { .center_freq = 5580, .hw_value = 45 }, - { .center_freq = 5600, .hw_value = 46 }, - { .center_freq = 5620, .hw_value = 47 }, - { .center_freq = 5640, .hw_value = 48 }, - { .center_freq = 5660, .hw_value = 49 }, - { .center_freq = 5680, .hw_value = 50 }, - { .center_freq = 5700, .hw_value = 51 }, - { .center_freq = 5745, .hw_value = 52 }, - { .center_freq = 5765, .hw_value = 53 }, - { .center_freq = 5785, .hw_value = 54 }, - { .center_freq = 5805, .hw_value = 55 }, - { .center_freq = 5825, .hw_value = 56 } -}; static struct ieee80211_supported_band vnt_supported_2ghz_band = { .channels = vnt_channels_2ghz, @@ -118,45 +63,16 @@ static struct ieee80211_supported_band vnt_supported_2ghz_band = { .n_bitrates = ARRAY_SIZE(vnt_rates_bg), }; -static struct ieee80211_supported_band vnt_supported_5ghz_band = { - .channels = vnt_channels_5ghz, - .n_channels = ARRAY_SIZE(vnt_channels_5ghz), - .bitrates = vnt_rates_a, - .n_bitrates = ARRAY_SIZE(vnt_rates_a), -}; - void vnt_init_bands(struct vnt_private *priv) { struct ieee80211_channel *ch; int i; - switch (priv->rf_type) { - case RF_AIROHA7230: - case RF_VT3342A0: - default: - ch = vnt_channels_5ghz; - - for (i = 0; i < ARRAY_SIZE(vnt_channels_5ghz); i++) { - ch[i].max_power = VNT_RF_MAX_POWER; - ch[i].flags = IEEE80211_CHAN_NO_HT40; - } - - priv->hw->wiphy->bands[NL80211_BAND_5GHZ] = - &vnt_supported_5ghz_band; - fallthrough; - case RF_AL2230: - case RF_AL2230S: - case RF_VT3226: - case RF_VT3226D0: - ch = vnt_channels_2ghz; - - for (i = 0; i < ARRAY_SIZE(vnt_channels_2ghz); i++) { - ch[i].max_power = VNT_RF_MAX_POWER; - ch[i].flags = IEEE80211_CHAN_NO_HT40; - } - - priv->hw->wiphy->bands[NL80211_BAND_2GHZ] = - &vnt_supported_2ghz_band; - break; + ch = vnt_channels_2ghz; + for (i = 0; i < ARRAY_SIZE(vnt_channels_2ghz); i++) { + ch[i].max_power = VNT_RF_MAX_POWER; + ch[i].flags = IEEE80211_CHAN_NO_HT40; } + priv->hw->wiphy->bands[NL80211_BAND_2GHZ] = + &vnt_supported_2ghz_band; } -- cgit From 10c8968968454a97f11bc70498f9cf89ecf4f697 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Thu, 10 Mar 2022 19:54:17 +0100 Subject: staging: vt6656: Remove unused rf_type in baseband.c Remove rf_type that supports 5GHz band. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/77dcff8602084484532fcbd734aafd138087c5ee.1646935331.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/baseband.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 1e1c5a7d8968..c04fd052e467 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -255,23 +255,18 @@ int vnt_vt3184_init(struct vnt_private *priv) dev_dbg(&priv->usb->dev, "RF Type %d\n", priv->rf_type); if ((priv->rf_type == RF_AL2230) || - (priv->rf_type == RF_AL2230S) || - (priv->rf_type == RF_AIROHA7230)) { + (priv->rf_type == RF_AL2230S)) { priv->bb_rx_conf = vnt_vt3184_al2230[10]; length = sizeof(vnt_vt3184_al2230); addr = vnt_vt3184_al2230; - if (priv->rf_type == RF_AIROHA7230) - addr[0xd7] = 0x06; - priv->bb_vga[0] = 0x1c; priv->bb_vga[1] = 0x10; priv->bb_vga[2] = 0x0; priv->bb_vga[3] = 0x0; } else if ((priv->rf_type == RF_VT3226) || - (priv->rf_type == RF_VT3226D0) || - (priv->rf_type == RF_VT3342A0)) { + (priv->rf_type == RF_VT3226D0)) { priv->bb_rx_conf = vnt_vt3184_vt3226d0[10]; length = sizeof(vnt_vt3184_vt3226d0); c_addr = vnt_vt3184_vt3226d0; @@ -305,7 +300,6 @@ int vnt_vt3184_init(struct vnt_private *priv) goto end; if ((priv->rf_type == RF_VT3226) || - (priv->rf_type == RF_VT3342A0) || (priv->rf_type == RF_VT3226D0)) { data = (priv->rf_type == RF_VT3226D0) ? 0x11 : 0x23; @@ -446,7 +440,6 @@ int vnt_update_pre_ed_threshold(struct vnt_private *priv, int scanning) switch (priv->rf_type) { case RF_AL2230: case RF_AL2230S: - case RF_AIROHA7230: threshold = al2230_vnt_threshold; length = ARRAY_SIZE(al2230_vnt_threshold); break; @@ -456,11 +449,6 @@ int vnt_update_pre_ed_threshold(struct vnt_private *priv, int scanning) threshold = vt3226_vnt_threshold; length = ARRAY_SIZE(vt3226_vnt_threshold); break; - - case RF_VT3342A0: - threshold = vt3342_vnt_threshold; - length = ARRAY_SIZE(vt3342_vnt_threshold); - break; } if (!threshold) -- cgit From ee9a0fc17f0c5662307ac614fa33b38522747bad Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Thu, 10 Mar 2022 19:54:29 +0100 Subject: staging: vt6656: Remove unused rf_type in rf.c; top level Remove rf_type that supports 5GHz band. To keep a better overview this is only the first part of the patch. Compiler Warings about unused variables will be removed with the following patch. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/e111923dffc4781cf9d4e7966c9f365beb93c5ee.1646935331.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/rf.c | 65 ++------------------------------------------- 1 file changed, 2 insertions(+), 63 deletions(-) diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index b9c06b312ae1..6f57f7af1aed 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -528,10 +528,6 @@ static const struct vnt_table_info vnt_table_seq[][3] = { {&al2230_init_table[0][0], CB_AL2230_INIT_SEQ * 3}, {&al2230_channel_table0[0][0], CB_MAX_CHANNEL_24G * 3}, {&al2230_channel_table1[0][0], CB_MAX_CHANNEL_24G * 3} - }, { /* RF_AIROHA7230 init table, channel table 0 and 1 */ - {&al7230_init_table[0][0], CB_AL7230_INIT_SEQ * 3}, - {&al7230_channel_table0[0][0], CB_MAX_CHANNEL * 3}, - {&al7230_channel_table1[0][0], CB_MAX_CHANNEL * 3} }, { /* RF_VT3226 init table, channel table 0 and 1 */ {&vt3226_init_table[0][0], CB_VT3226_INIT_SEQ * 3}, {&vt3226_channel_table0[0][0], CB_MAX_CHANNEL_24G * 3}, @@ -540,14 +536,6 @@ static const struct vnt_table_info vnt_table_seq[][3] = { {&vt3226d0_init_table[0][0], CB_VT3226_INIT_SEQ * 3}, {&vt3226_channel_table0[0][0], CB_MAX_CHANNEL_24G * 3}, {&vt3226_channel_table1[0][0], CB_MAX_CHANNEL_24G * 3} - }, { /* RF_VT3342A0 init table, channel table 0 and 1 */ - {&vt3342a0_init_table[0][0], CB_VT3342_INIT_SEQ * 3}, - {&vt3342_channel_table0[0][0], CB_MAX_CHANNEL * 3}, - {&vt3342_channel_table1[0][0], CB_MAX_CHANNEL * 3} - }, { /* RF_AIROHA7230 init table 2 and channel table 2 */ - {&al7230_init_table_amode[0][0], CB_AL7230_INIT_SEQ * 3}, - {&al7230_channel_table2[0][0], CB_MAX_CHANNEL * 3}, - {NULL, 0} } }; @@ -641,24 +629,6 @@ static int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, break; - case RF_AIROHA7230: - if (ch->flags & IEEE80211_CHAN_NO_OFDM) - ret = vnt_rf_write_embedded(priv, 0x111bb900); - else - ret = vnt_rf_write_embedded(priv, 0x221bb900); - - if (ret) - return ret; - - /* - * 0x080F1B00 for 3 wire control TxGain(D10) - * and 0x31 as TX Gain value - */ - power_setting = 0x080c0b00 | (power << 12); - - ret = vnt_rf_write_embedded(priv, power_setting); - break; - case RF_VT3226: power_setting = ((0x3f - power) << 20) | (0x17 << 8); @@ -714,11 +684,6 @@ static int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, break; - case RF_VT3342A0: - power_setting = ((0x3f - power) << 20) | (0x27 << 8); - - ret = vnt_rf_write_embedded(priv, power_setting); - break; default: break; } @@ -766,10 +731,8 @@ void vnt_rf_rssi_to_dbm(struct vnt_private *priv, u8 rssi, long *dbm) switch (priv->rf_type) { case RF_AL2230: case RF_AL2230S: - case RF_AIROHA7230: case RF_VT3226: case RF_VT3226D0: - case RF_VT3342A0: a = airoharf[idx]; break; default: @@ -790,17 +753,11 @@ int vnt_rf_table_download(struct vnt_private *priv) case RF_AL2230S: idx = 0; break; - case RF_AIROHA7230: - idx = 1; - break; case RF_VT3226: - idx = 2; + idx = 1; break; case RF_VT3226D0: - idx = 3; - break; - case RF_VT3342A0: - idx = 4; + idx = 2; break; } @@ -831,23 +788,5 @@ int vnt_rf_table_download(struct vnt_private *priv) table_seq[VNT_TABLE_1].length, table_seq[VNT_TABLE_1].addr); - if (priv->rf_type == RF_AIROHA7230) { - table_seq = &vnt_table_seq[5][0]; - - /* Init Table 2 */ - ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, - MESSAGE_REQUEST_RF_INIT2, - table_seq[VNT_TABLE_INIT_2].length, - table_seq[VNT_TABLE_INIT_2].addr); - if (ret) - return ret; - - /* Channel Table 2 */ - ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE, - MESSAGE_REQUEST_RF_CH2, - table_seq[VNT_TABLE_2].length, - table_seq[VNT_TABLE_2].addr); - } - return ret; } -- cgit From 8b0f74a8cfe57af5bb9d70fa53a1d1b98c9ee1af Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Thu, 10 Mar 2022 19:54:36 +0100 Subject: staging: vt6656: Remove unused rf_type in rf.c; unused variables Remove rf_type that supports 5GHz band. Follow up of previous patch. Remove unused tables. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/25e03c91ad7da064b69f3ac7eec265af70829aec.1646935331.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/rf.c | 348 -------------------------------------------- 1 file changed, 348 deletions(-) diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index 6f57f7af1aed..acbbf8acdf1b 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -82,220 +82,6 @@ static u8 al2230_channel_table1[CB_MAX_CHANNEL_24G][3] = { {0x06, 0x66, 0x61} }; -static u8 al7230_init_table[CB_AL7230_INIT_SEQ][3] = { - {0x20, 0x37, 0x90}, - {0x13, 0x33, 0x31}, - {0x84, 0x1f, 0xf2}, - {0x3f, 0xdf, 0xa3}, - {0x7f, 0xd7, 0x84}, - {0x80, 0x2b, 0x55}, - {0x56, 0xaf, 0x36}, - {0xce, 0x02, 0x07}, - {0x6e, 0xbc, 0x98}, - {0x22, 0x1b, 0xb9}, - {0xe0, 0x00, 0x0a}, - {0x08, 0x03, 0x1b}, - {0x00, 0x0a, 0x3c}, - {0xff, 0xff, 0xfd}, - {0x00, 0x00, 0x0e}, - {0x1a, 0xba, 0x8f} -}; - -static u8 al7230_init_table_amode[CB_AL7230_INIT_SEQ][3] = { - {0x2f, 0xf5, 0x20}, - {0x00, 0x00, 0x01}, - {0x45, 0x1f, 0xe2}, - {0x5f, 0xdf, 0xa3}, - {0x6f, 0xd7, 0x84}, - {0x85, 0x3f, 0x55}, - {0x56, 0xaf, 0x36}, - {0xce, 0x02, 0x07}, - {0x6e, 0xbc, 0x98}, - {0x22, 0x1b, 0xb9}, - {0xe0, 0x60, 0x0a}, - {0x08, 0x03, 0x1b}, - {0x00, 0x14, 0x7c}, - {0xff, 0xff, 0xfd}, - {0x00, 0x00, 0x0e}, - {0x12, 0xba, 0xcf} -}; - -static u8 al7230_channel_table0[CB_MAX_CHANNEL][3] = { - {0x20, 0x37, 0x90}, - {0x20, 0x37, 0x90}, - {0x20, 0x37, 0x90}, - {0x20, 0x37, 0x90}, - {0x20, 0x37, 0xa0}, - {0x20, 0x37, 0xa0}, - {0x20, 0x37, 0xa0}, - {0x20, 0x37, 0xa0}, - {0x20, 0x37, 0xb0}, - {0x20, 0x37, 0xb0}, - {0x20, 0x37, 0xb0}, - {0x20, 0x37, 0xb0}, - {0x20, 0x37, 0xc0}, - {0x20, 0x37, 0xc0}, - {0x0f, 0xf5, 0x20}, /* channel 15 Tf = 4915MHz */ - {0x2f, 0xf5, 0x20}, - {0x0f, 0xf5, 0x20}, - {0x0f, 0xf5, 0x20}, - {0x2f, 0xf5, 0x20}, - {0x0f, 0xf5, 0x20}, - {0x2f, 0xf5, 0x30}, - {0x2f, 0xf5, 0x30}, - {0x0f, 0xf5, 0x40}, - {0x2f, 0xf5, 0x40}, - {0x0f, 0xf5, 0x40}, - {0x0f, 0xf5, 0x40}, - {0x2f, 0xf5, 0x40}, - {0x2f, 0xf5, 0x50}, - {0x2f, 0xf5, 0x60}, - {0x2f, 0xf5, 0x60}, - {0x2f, 0xf5, 0x70}, - {0x2f, 0xf5, 0x70}, - {0x2f, 0xf5, 0x70}, - {0x2f, 0xf5, 0x70}, - {0x2f, 0xf5, 0x70}, - {0x2f, 0xf5, 0x70}, - {0x2f, 0xf5, 0x80}, - {0x2f, 0xf5, 0x80}, - {0x2f, 0xf5, 0x80}, - {0x2f, 0xf5, 0x90}, - {0x2f, 0xf5, 0xc0}, - {0x2f, 0xf5, 0xc0}, - {0x2f, 0xf5, 0xc0}, - {0x2f, 0xf5, 0xd0}, - {0x2f, 0xf5, 0xd0}, - {0x2f, 0xf5, 0xd0}, - {0x2f, 0xf5, 0xe0}, - {0x2f, 0xf5, 0xe0}, - {0x2f, 0xf5, 0xe0}, - {0x2f, 0xf5, 0xf0}, - {0x2f, 0xf5, 0xf0}, - {0x2f, 0xf6, 0x00}, - {0x2f, 0xf6, 0x00}, - {0x2f, 0xf6, 0x00}, - {0x2f, 0xf6, 0x10}, - {0x2f, 0xf6, 0x10} -}; - -static u8 al7230_channel_table1[CB_MAX_CHANNEL][3] = { - {0x13, 0x33, 0x31}, - {0x1b, 0x33, 0x31}, - {0x03, 0x33, 0x31}, - {0x0b, 0x33, 0x31}, - {0x13, 0x33, 0x31}, - {0x1b, 0x33, 0x31}, - {0x03, 0x33, 0x31}, - {0x0b, 0x33, 0x31}, - {0x13, 0x33, 0x31}, - {0x1b, 0x33, 0x31}, - {0x03, 0x33, 0x31}, - {0x0b, 0x33, 0x31}, - {0x13, 0x33, 0x31}, - {0x06, 0x66, 0x61}, - {0x1d, 0x55, 0x51}, /* channel = 15, Tf = 4915MHz */ - {0x00, 0x00, 0x01}, - {0x02, 0xaa, 0xa1}, - {0x08, 0x00, 0x01}, - {0x0a, 0xaa, 0xa1}, - {0x0d, 0x55, 0x51}, - {0x15, 0x55, 0x51}, - {0x00, 0x00, 0x01}, - {0x1d, 0x55, 0x51}, - {0x00, 0x00, 0x01}, - {0x02, 0xaa, 0xa1}, - {0x08, 0x00, 0x01}, - {0x0a, 0xaa, 0xa1}, - {0x15, 0x55, 0x51}, - {0x05, 0x55, 0x51}, - {0x0a, 0xaa, 0xa1}, - {0x10, 0x00, 0x01}, - {0x15, 0x55, 0x51}, - {0x1a, 0xaa, 0xa1}, - {0x00, 0x00, 0x01}, - {0x05, 0x55, 0x51}, - {0x0a, 0xaa, 0xa1}, - {0x15, 0x55, 0x51}, - {0x00, 0x00, 0x01}, - {0x0a, 0xaa, 0xa1}, - {0x15, 0x55, 0x51}, - {0x15, 0x55, 0x51}, - {0x00, 0x00, 0x01}, - {0x0a, 0xaa, 0xa1}, - {0x15, 0x55, 0x51}, - {0x00, 0x00, 0x01}, - {0x0a, 0xaa, 0xa1}, - {0x15, 0x55, 0x51}, - {0x00, 0x00, 0x01}, - {0x0a, 0xaa, 0xa1}, - {0x15, 0x55, 0x51}, - {0x00, 0x00, 0x01}, - {0x18, 0x00, 0x01}, - {0x02, 0xaa, 0xa1}, - {0x0d, 0x55, 0x51}, - {0x18, 0x00, 0x01}, - {0x02, 0xaa, 0xb1} -}; - -static u8 al7230_channel_table2[CB_MAX_CHANNEL][3] = { - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, /* channel = 15 Tf = 4915MHz */ - {0x6f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x6f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x6f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x6f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x6f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x6f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x6f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x6f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x6f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84}, - {0x7f, 0xd7, 0x84} -}; static u8 vt3226_init_table[CB_VT3226_INIT_SEQ][3] = { {0x03, 0xff, 0x80}, @@ -376,140 +162,6 @@ static const u32 vt3226d0_lo_current_table[CB_MAX_CHANNEL_24G] = { 0x0135c600 }; -static u8 vt3342a0_init_table[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */ - {0x03, 0xff, 0x80}, - {0x02, 0x08, 0x81}, - {0x00, 0xc6, 0x02}, - {0x03, 0xc5, 0x13}, - {0x00, 0xee, 0xe4}, - {0x00, 0x71, 0xa5}, - {0x01, 0x75, 0x46}, - {0x01, 0x40, 0x27}, - {0x01, 0x54, 0x08}, - {0x00, 0x01, 0x69}, - {0x02, 0x00, 0xaa}, - {0x00, 0x08, 0xcb}, - {0x01, 0x70, 0x0c} -}; - -static u8 vt3342_channel_table0[CB_MAX_CHANNEL][3] = { - {0x02, 0x05, 0x03}, - {0x01, 0x15, 0x03}, - {0x03, 0xc5, 0x03}, - {0x02, 0x65, 0x03}, - {0x01, 0x15, 0x13}, - {0x03, 0xc5, 0x13}, - {0x02, 0x05, 0x13}, - {0x01, 0x15, 0x13}, - {0x03, 0xc5, 0x13}, - {0x02, 0x65, 0x13}, - {0x01, 0x15, 0x23}, - {0x03, 0xc5, 0x23}, - {0x02, 0x05, 0x23}, - {0x00, 0xd5, 0x23}, - {0x01, 0x15, 0x13}, /* channel = 15 Tf = 4915MHz */ - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x15, 0x13}, - {0x01, 0x55, 0x63}, - {0x01, 0x55, 0x63}, - {0x02, 0xa5, 0x63}, - {0x02, 0xa5, 0x63}, - {0x00, 0x05, 0x73}, - {0x00, 0x05, 0x73}, - {0x01, 0x55, 0x73}, - {0x02, 0xa5, 0x73}, - {0x00, 0x05, 0x83}, - {0x01, 0x55, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x02, 0xa5, 0x83}, - {0x00, 0x05, 0xF3}, - {0x01, 0x56, 0x03}, - {0x02, 0xa6, 0x03}, - {0x00, 0x06, 0x03}, - {0x00, 0x06, 0x03} -}; - -static u8 vt3342_channel_table1[CB_MAX_CHANNEL][3] = { - {0x01, 0x99, 0x94}, - {0x02, 0x44, 0x44}, - {0x02, 0xee, 0xe4}, - {0x03, 0x99, 0x94}, - {0x00, 0x44, 0x44}, - {0x00, 0xee, 0xe4}, - {0x01, 0x99, 0x94}, - {0x02, 0x44, 0x44}, - {0x02, 0xee, 0xe4}, - {0x03, 0x99, 0x94}, - {0x00, 0x44, 0x44}, - {0x00, 0xee, 0xe4}, - {0x01, 0x99, 0x94}, - {0x03, 0x33, 0x34}, - {0x00, 0x44, 0x44}, /* channel = 15 Tf = 4915MHz */ - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x00, 0x44, 0x44}, - {0x01, 0x55, 0x54}, - {0x01, 0x55, 0x54}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x00, 0x00, 0x04}, - {0x00, 0x00, 0x04}, - {0x01, 0x55, 0x54}, - {0x02, 0xaa, 0xa4}, - {0x00, 0x00, 0x04}, - {0x01, 0x55, 0x54}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x02, 0xaa, 0xa4}, - {0x03, 0x00, 0x04}, - {0x00, 0x55, 0x54}, - {0x01, 0xaa, 0xa4}, - {0x03, 0x00, 0x04}, - {0x03, 0x00, 0x04} -}; - enum { VNT_TABLE_INIT = 0, VNT_TABLE_INIT_2 = 0, -- cgit From 78b33c600486e97c9b61c25a37b283c211be8560 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Thu, 10 Mar 2022 19:54:49 +0100 Subject: staging: vt6656: Remove unused rf_type in card.c Remove rf_type that supports 5GHz band. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/e768dbb116e79349aa083747729213d2d1ca7af9.1646935331.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/card.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index e92ecfad26d2..d74165d0d3bb 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -369,10 +369,8 @@ int vnt_radio_power_off(struct vnt_private *priv) switch (priv->rf_type) { case RF_AL2230: case RF_AL2230S: - case RF_AIROHA7230: case RF_VT3226: case RF_VT3226D0: - case RF_VT3342A0: ret = vnt_mac_reg_bits_off(priv, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3)); @@ -423,10 +421,8 @@ int vnt_radio_power_on(struct vnt_private *priv) switch (priv->rf_type) { case RF_AL2230: case RF_AL2230S: - case RF_AIROHA7230: case RF_VT3226: case RF_VT3226D0: - case RF_VT3342A0: ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3)); @@ -445,9 +441,6 @@ int vnt_set_bss_mode(struct vnt_private *priv) unsigned char bb_vga_0 = 0x1c; unsigned char bb_vga_2_3 = 0x00; - if (priv->rf_type == RF_AIROHA7230 && priv->bb_type == BB_TYPE_11A) - type = BB_TYPE_11G; - ret = vnt_mac_set_bb_type(priv, type); if (ret) return ret; @@ -479,15 +472,6 @@ int vnt_set_bss_mode(struct vnt_private *priv) if (ret) return ret; - if (priv->rf_type == RF_AIROHA7230) { - priv->bb_vga[0] = bb_vga_0; - - ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, - 0xe7, priv->bb_vga[0]); - if (ret) - return ret; - } - priv->bb_vga[2] = bb_vga_2_3; priv->bb_vga[3] = bb_vga_2_3; -- cgit From 721412ed3d819e767cac2b06646bf03aa158aaec Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 15 Mar 2022 13:34:57 +0100 Subject: staging: remove ashmem The mainline replacement for ashmem is memfd, so remove the legacy code from drivers/staging/ Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220315123457.2354812-1-hch@lst.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/android/Kconfig | 19 - drivers/staging/android/Makefile | 4 - drivers/staging/android/TODO | 8 - drivers/staging/android/ashmem.c | 970 ---------------------------------- drivers/staging/android/ashmem.h | 24 - drivers/staging/android/uapi/ashmem.h | 43 -- 8 files changed, 1071 deletions(-) delete mode 100644 drivers/staging/android/Kconfig delete mode 100644 drivers/staging/android/Makefile delete mode 100644 drivers/staging/android/TODO delete mode 100644 drivers/staging/android/ashmem.c delete mode 100644 drivers/staging/android/ashmem.h delete mode 100644 drivers/staging/android/uapi/ashmem.h diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index d1ce500c0319..af60ca591c99 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -58,8 +58,6 @@ source "drivers/staging/nvec/Kconfig" source "drivers/staging/media/Kconfig" -source "drivers/staging/android/Kconfig" - source "drivers/staging/board/Kconfig" source "drivers/staging/gdm724x/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 82e912a7586f..ad59134e97ad 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -19,7 +19,6 @@ obj-$(CONFIG_IIO) += iio/ obj-$(CONFIG_FB_SM750) += sm750fb/ obj-$(CONFIG_USB_EMXX) += emxx_udc/ obj-$(CONFIG_MFD_NVEC) += nvec/ -obj-$(CONFIG_ANDROID) += android/ obj-$(CONFIG_STAGING_BOARD) += board/ obj-$(CONFIG_LTE_GDM724X) += gdm724x/ obj-$(CONFIG_FIREWIRE_SERIAL) += fwserial/ diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig deleted file mode 100644 index 70498adb1575..000000000000 --- a/drivers/staging/android/Kconfig +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -menu "Android" - -if ANDROID - -config ASHMEM - bool "Enable the Anonymous Shared Memory Subsystem" - depends on SHMEM - help - The ashmem subsystem is a new shared memory allocator, similar to - POSIX SHM but with different behavior and sporting a simpler - file-based API. - - It is, in theory, a good memory allocator for low-memory devices, - because it can discard shared memory units when under memory pressure. - -endif # if ANDROID - -endmenu diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile deleted file mode 100644 index e9a55a5e6529..000000000000 --- a/drivers/staging/android/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -ccflags-y += -I$(src) # needed for trace events - -obj-$(CONFIG_ASHMEM) += ashmem.o diff --git a/drivers/staging/android/TODO b/drivers/staging/android/TODO deleted file mode 100644 index f74eb44d8e45..000000000000 --- a/drivers/staging/android/TODO +++ /dev/null @@ -1,8 +0,0 @@ -TODO: - - sparse fixes - - rename files to be not so "generic" - - add proper arch dependencies as needed - - audit userspace interfaces to make sure they are sane - -Please send patches to Greg Kroah-Hartman and Cc: -Arve Hjønnevåg and Riley Andrews diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c deleted file mode 100644 index ddbde3f8430e..000000000000 --- a/drivers/staging/android/ashmem.c +++ /dev/null @@ -1,970 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* mm/ashmem.c - * - * Anonymous Shared Memory Subsystem, ashmem - * - * Copyright (C) 2008 Google, Inc. - * - * Robert Love - */ - -#define pr_fmt(fmt) "ashmem: " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ashmem.h" - -#define ASHMEM_NAME_PREFIX "dev/ashmem/" -#define ASHMEM_NAME_PREFIX_LEN (sizeof(ASHMEM_NAME_PREFIX) - 1) -#define ASHMEM_FULL_NAME_LEN (ASHMEM_NAME_LEN + ASHMEM_NAME_PREFIX_LEN) - -/** - * struct ashmem_area - The anonymous shared memory area - * @name: The optional name in /proc/pid/maps - * @unpinned_list: The list of all ashmem areas - * @file: The shmem-based backing file - * @size: The size of the mapping, in bytes - * @prot_mask: The allowed protection bits, as vm_flags - * - * The lifecycle of this structure is from our parent file's open() until - * its release(). It is also protected by 'ashmem_mutex' - * - * Warning: Mappings do NOT pin this structure; It dies on close() - */ -struct ashmem_area { - char name[ASHMEM_FULL_NAME_LEN]; - struct list_head unpinned_list; - struct file *file; - size_t size; - unsigned long prot_mask; -}; - -/** - * struct ashmem_range - A range of unpinned/evictable pages - * @lru: The entry in the LRU list - * @unpinned: The entry in its area's unpinned list - * @asma: The associated anonymous shared memory area. - * @pgstart: The starting page (inclusive) - * @pgend: The ending page (inclusive) - * @purged: The purge status (ASHMEM_NOT or ASHMEM_WAS_PURGED) - * - * The lifecycle of this structure is from unpin to pin. - * It is protected by 'ashmem_mutex' - */ -struct ashmem_range { - struct list_head lru; - struct list_head unpinned; - struct ashmem_area *asma; - size_t pgstart; - size_t pgend; - unsigned int purged; -}; - -/* LRU list of unpinned pages, protected by ashmem_mutex */ -static LIST_HEAD(ashmem_lru_list); - -static atomic_t ashmem_shrink_inflight = ATOMIC_INIT(0); -static DECLARE_WAIT_QUEUE_HEAD(ashmem_shrink_wait); - -/* - * long lru_count - The count of pages on our LRU list. - * - * This is protected by ashmem_mutex. - */ -static unsigned long lru_count; - -/* - * ashmem_mutex - protects the list of and each individual ashmem_area - * - * Lock Ordering: ashmex_mutex -> i_mutex -> i_alloc_sem - */ -static DEFINE_MUTEX(ashmem_mutex); - -static struct kmem_cache *ashmem_area_cachep __read_mostly; -static struct kmem_cache *ashmem_range_cachep __read_mostly; - -/* - * A separate lockdep class for the backing shmem inodes to resolve the lockdep - * warning about the race between kswapd taking fs_reclaim before inode_lock - * and write syscall taking inode_lock and then fs_reclaim. - * Note that such race is impossible because ashmem does not support write - * syscalls operating on the backing shmem. - */ -static struct lock_class_key backing_shmem_inode_class; - -static inline unsigned long range_size(struct ashmem_range *range) -{ - return range->pgend - range->pgstart + 1; -} - -static inline bool range_on_lru(struct ashmem_range *range) -{ - return range->purged == ASHMEM_NOT_PURGED; -} - -static inline bool page_range_subsumes_range(struct ashmem_range *range, - size_t start, size_t end) -{ - return (range->pgstart >= start) && (range->pgend <= end); -} - -static inline bool page_range_subsumed_by_range(struct ashmem_range *range, - size_t start, size_t end) -{ - return (range->pgstart <= start) && (range->pgend >= end); -} - -static inline bool page_in_range(struct ashmem_range *range, size_t page) -{ - return (range->pgstart <= page) && (range->pgend >= page); -} - -static inline bool page_range_in_range(struct ashmem_range *range, - size_t start, size_t end) -{ - return page_in_range(range, start) || page_in_range(range, end) || - page_range_subsumes_range(range, start, end); -} - -static inline bool range_before_page(struct ashmem_range *range, - size_t page) -{ - return range->pgend < page; -} - -#define PROT_MASK (PROT_EXEC | PROT_READ | PROT_WRITE) - -/** - * lru_add() - Adds a range of memory to the LRU list - * @range: The memory range being added. - * - * The range is first added to the end (tail) of the LRU list. - * After this, the size of the range is added to @lru_count - */ -static inline void lru_add(struct ashmem_range *range) -{ - list_add_tail(&range->lru, &ashmem_lru_list); - lru_count += range_size(range); -} - -/** - * lru_del() - Removes a range of memory from the LRU list - * @range: The memory range being removed - * - * The range is first deleted from the LRU list. - * After this, the size of the range is removed from @lru_count - */ -static inline void lru_del(struct ashmem_range *range) -{ - list_del(&range->lru); - lru_count -= range_size(range); -} - -/** - * range_alloc() - Allocates and initializes a new ashmem_range structure - * @asma: The associated ashmem_area - * @prev_range: The previous ashmem_range in the sorted asma->unpinned list - * @purged: Initial purge status (ASMEM_NOT_PURGED or ASHMEM_WAS_PURGED) - * @start: The starting page (inclusive) - * @end: The ending page (inclusive) - * @new_range: The placeholder for the new range - * - * This function is protected by ashmem_mutex. - */ -static void range_alloc(struct ashmem_area *asma, - struct ashmem_range *prev_range, unsigned int purged, - size_t start, size_t end, - struct ashmem_range **new_range) -{ - struct ashmem_range *range = *new_range; - - *new_range = NULL; - range->asma = asma; - range->pgstart = start; - range->pgend = end; - range->purged = purged; - - list_add_tail(&range->unpinned, &prev_range->unpinned); - - if (range_on_lru(range)) - lru_add(range); -} - -/** - * range_del() - Deletes and deallocates an ashmem_range structure - * @range: The associated ashmem_range that has previously been allocated - */ -static void range_del(struct ashmem_range *range) -{ - list_del(&range->unpinned); - if (range_on_lru(range)) - lru_del(range); - kmem_cache_free(ashmem_range_cachep, range); -} - -/** - * range_shrink() - Shrinks an ashmem_range - * @range: The associated ashmem_range being shrunk - * @start: The starting byte of the new range - * @end: The ending byte of the new range - * - * This does not modify the data inside the existing range in any way - It - * simply shrinks the boundaries of the range. - * - * Theoretically, with a little tweaking, this could eventually be changed - * to range_resize, and expand the lru_count if the new range is larger. - */ -static inline void range_shrink(struct ashmem_range *range, - size_t start, size_t end) -{ - size_t pre = range_size(range); - - range->pgstart = start; - range->pgend = end; - - if (range_on_lru(range)) - lru_count -= pre - range_size(range); -} - -/** - * ashmem_open() - Opens an Anonymous Shared Memory structure - * @inode: The backing file's index node(?) - * @file: The backing file - * - * Please note that the ashmem_area is not returned by this function - It is - * instead written to "file->private_data". - * - * Return: 0 if successful, or another code if unsuccessful. - */ -static int ashmem_open(struct inode *inode, struct file *file) -{ - struct ashmem_area *asma; - int ret; - - ret = generic_file_open(inode, file); - if (ret) - return ret; - - asma = kmem_cache_zalloc(ashmem_area_cachep, GFP_KERNEL); - if (!asma) - return -ENOMEM; - - INIT_LIST_HEAD(&asma->unpinned_list); - memcpy(asma->name, ASHMEM_NAME_PREFIX, ASHMEM_NAME_PREFIX_LEN); - asma->prot_mask = PROT_MASK; - file->private_data = asma; - - return 0; -} - -/** - * ashmem_release() - Releases an Anonymous Shared Memory structure - * @ignored: The backing file's Index Node(?) - It is ignored here. - * @file: The backing file - * - * Return: 0 if successful. If it is anything else, go have a coffee and - * try again. - */ -static int ashmem_release(struct inode *ignored, struct file *file) -{ - struct ashmem_area *asma = file->private_data; - struct ashmem_range *range, *next; - - mutex_lock(&ashmem_mutex); - list_for_each_entry_safe(range, next, &asma->unpinned_list, unpinned) - range_del(range); - mutex_unlock(&ashmem_mutex); - - if (asma->file) - fput(asma->file); - kmem_cache_free(ashmem_area_cachep, asma); - - return 0; -} - -static ssize_t ashmem_read_iter(struct kiocb *iocb, struct iov_iter *iter) -{ - struct ashmem_area *asma = iocb->ki_filp->private_data; - int ret = 0; - - mutex_lock(&ashmem_mutex); - - /* If size is not set, or set to 0, always return EOF. */ - if (asma->size == 0) - goto out_unlock; - - if (!asma->file) { - ret = -EBADF; - goto out_unlock; - } - - /* - * asma and asma->file are used outside the lock here. We assume - * once asma->file is set it will never be changed, and will not - * be destroyed until all references to the file are dropped and - * ashmem_release is called. - */ - mutex_unlock(&ashmem_mutex); - ret = vfs_iter_read(asma->file, iter, &iocb->ki_pos, 0); - mutex_lock(&ashmem_mutex); - if (ret > 0) - asma->file->f_pos = iocb->ki_pos; -out_unlock: - mutex_unlock(&ashmem_mutex); - return ret; -} - -static loff_t ashmem_llseek(struct file *file, loff_t offset, int origin) -{ - struct ashmem_area *asma = file->private_data; - loff_t ret; - - mutex_lock(&ashmem_mutex); - - if (asma->size == 0) { - mutex_unlock(&ashmem_mutex); - return -EINVAL; - } - - if (!asma->file) { - mutex_unlock(&ashmem_mutex); - return -EBADF; - } - - mutex_unlock(&ashmem_mutex); - - ret = vfs_llseek(asma->file, offset, origin); - if (ret < 0) - return ret; - - /** Copy f_pos from backing file, since f_ops->llseek() sets it */ - file->f_pos = asma->file->f_pos; - return ret; -} - -static inline vm_flags_t calc_vm_may_flags(unsigned long prot) -{ - return _calc_vm_trans(prot, PROT_READ, VM_MAYREAD) | - _calc_vm_trans(prot, PROT_WRITE, VM_MAYWRITE) | - _calc_vm_trans(prot, PROT_EXEC, VM_MAYEXEC); -} - -static int ashmem_vmfile_mmap(struct file *file, struct vm_area_struct *vma) -{ - /* do not allow to mmap ashmem backing shmem file directly */ - return -EPERM; -} - -static unsigned long -ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags) -{ - return current->mm->get_unmapped_area(file, addr, len, pgoff, flags); -} - -static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) -{ - static struct file_operations vmfile_fops; - struct ashmem_area *asma = file->private_data; - int ret = 0; - - mutex_lock(&ashmem_mutex); - - /* user needs to SET_SIZE before mapping */ - if (!asma->size) { - ret = -EINVAL; - goto out; - } - - /* requested mapping size larger than object size */ - if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) { - ret = -EINVAL; - goto out; - } - - /* requested protection bits must match our allowed protection mask */ - if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) & - calc_vm_prot_bits(PROT_MASK, 0)) { - ret = -EPERM; - goto out; - } - vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask); - - if (!asma->file) { - char *name = ASHMEM_NAME_DEF; - struct file *vmfile; - struct inode *inode; - - if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0') - name = asma->name; - - /* ... and allocate the backing shmem file */ - vmfile = shmem_file_setup(name, asma->size, vma->vm_flags); - if (IS_ERR(vmfile)) { - ret = PTR_ERR(vmfile); - goto out; - } - vmfile->f_mode |= FMODE_LSEEK; - inode = file_inode(vmfile); - lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class); - asma->file = vmfile; - /* - * override mmap operation of the vmfile so that it can't be - * remapped which would lead to creation of a new vma with no - * asma permission checks. Have to override get_unmapped_area - * as well to prevent VM_BUG_ON check for f_ops modification. - */ - if (!vmfile_fops.mmap) { - vmfile_fops = *vmfile->f_op; - vmfile_fops.mmap = ashmem_vmfile_mmap; - vmfile_fops.get_unmapped_area = - ashmem_vmfile_get_unmapped_area; - } - vmfile->f_op = &vmfile_fops; - } - get_file(asma->file); - - /* - * XXX - Reworked to use shmem_zero_setup() instead of - * shmem_set_file while we're in staging. -jstultz - */ - if (vma->vm_flags & VM_SHARED) { - ret = shmem_zero_setup(vma); - if (ret) { - fput(asma->file); - goto out; - } - } else { - vma_set_anonymous(vma); - } - - vma_set_file(vma, asma->file); - /* XXX: merge this with the get_file() above if possible */ - fput(asma->file); - -out: - mutex_unlock(&ashmem_mutex); - return ret; -} - -/* - * ashmem_shrink - our cache shrinker, called from mm/vmscan.c - * - * 'nr_to_scan' is the number of objects to scan for freeing. - * - * 'gfp_mask' is the mask of the allocation that got us into this mess. - * - * Return value is the number of objects freed or -1 if we cannot - * proceed without risk of deadlock (due to gfp_mask). - * - * We approximate LRU via least-recently-unpinned, jettisoning unpinned partial - * chunks of ashmem regions LRU-wise one-at-a-time until we hit 'nr_to_scan' - * pages freed. - */ -static unsigned long -ashmem_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) -{ - unsigned long freed = 0; - - /* We might recurse into filesystem code, so bail out if necessary */ - if (!(sc->gfp_mask & __GFP_FS)) - return SHRINK_STOP; - - if (!mutex_trylock(&ashmem_mutex)) - return -1; - - while (!list_empty(&ashmem_lru_list)) { - struct ashmem_range *range = - list_first_entry(&ashmem_lru_list, typeof(*range), lru); - loff_t start = range->pgstart * PAGE_SIZE; - loff_t end = (range->pgend + 1) * PAGE_SIZE; - struct file *f = range->asma->file; - - get_file(f); - atomic_inc(&ashmem_shrink_inflight); - range->purged = ASHMEM_WAS_PURGED; - lru_del(range); - - freed += range_size(range); - mutex_unlock(&ashmem_mutex); - f->f_op->fallocate(f, - FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, - start, end - start); - fput(f); - if (atomic_dec_and_test(&ashmem_shrink_inflight)) - wake_up_all(&ashmem_shrink_wait); - if (!mutex_trylock(&ashmem_mutex)) - goto out; - if (--sc->nr_to_scan <= 0) - break; - } - mutex_unlock(&ashmem_mutex); -out: - return freed; -} - -static unsigned long -ashmem_shrink_count(struct shrinker *shrink, struct shrink_control *sc) -{ - /* - * note that lru_count is count of pages on the lru, not a count of - * objects on the list. This means the scan function needs to return the - * number of pages freed, not the number of objects scanned. - */ - return lru_count; -} - -static struct shrinker ashmem_shrinker = { - .count_objects = ashmem_shrink_count, - .scan_objects = ashmem_shrink_scan, - /* - * XXX (dchinner): I wish people would comment on why they need on - * significant changes to the default value here - */ - .seeks = DEFAULT_SEEKS * 4, -}; - -static int set_prot_mask(struct ashmem_area *asma, unsigned long prot) -{ - int ret = 0; - - mutex_lock(&ashmem_mutex); - - /* the user can only remove, not add, protection bits */ - if ((asma->prot_mask & prot) != prot) { - ret = -EINVAL; - goto out; - } - - /* does the application expect PROT_READ to imply PROT_EXEC? */ - if ((prot & PROT_READ) && (current->personality & READ_IMPLIES_EXEC)) - prot |= PROT_EXEC; - - asma->prot_mask = prot; - -out: - mutex_unlock(&ashmem_mutex); - return ret; -} - -static int set_name(struct ashmem_area *asma, void __user *name) -{ - int len; - int ret = 0; - char local_name[ASHMEM_NAME_LEN]; - - /* - * Holding the ashmem_mutex while doing a copy_from_user might cause - * an data abort which would try to access mmap_lock. If another - * thread has invoked ashmem_mmap then it will be holding the - * semaphore and will be waiting for ashmem_mutex, there by leading to - * deadlock. We'll release the mutex and take the name to a local - * variable that does not need protection and later copy the local - * variable to the structure member with lock held. - */ - len = strncpy_from_user(local_name, name, ASHMEM_NAME_LEN); - if (len < 0) - return len; - - mutex_lock(&ashmem_mutex); - /* cannot change an existing mapping's name */ - if (asma->file) - ret = -EINVAL; - else - strscpy(asma->name + ASHMEM_NAME_PREFIX_LEN, local_name, - ASHMEM_NAME_LEN); - - mutex_unlock(&ashmem_mutex); - return ret; -} - -static int get_name(struct ashmem_area *asma, void __user *name) -{ - int ret = 0; - size_t len; - /* - * Have a local variable to which we'll copy the content - * from asma with the lock held. Later we can copy this to the user - * space safely without holding any locks. So even if we proceed to - * wait for mmap_lock, it won't lead to deadlock. - */ - char local_name[ASHMEM_NAME_LEN]; - - mutex_lock(&ashmem_mutex); - if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0') { - /* - * Copying only `len', instead of ASHMEM_NAME_LEN, bytes - * prevents us from revealing one user's stack to another. - */ - len = strlen(asma->name + ASHMEM_NAME_PREFIX_LEN) + 1; - memcpy(local_name, asma->name + ASHMEM_NAME_PREFIX_LEN, len); - } else { - len = sizeof(ASHMEM_NAME_DEF); - memcpy(local_name, ASHMEM_NAME_DEF, len); - } - mutex_unlock(&ashmem_mutex); - - /* - * Now we are just copying from the stack variable to userland - * No lock held - */ - if (copy_to_user(name, local_name, len)) - ret = -EFAULT; - return ret; -} - -/* - * ashmem_pin - pin the given ashmem region, returning whether it was - * previously purged (ASHMEM_WAS_PURGED) or not (ASHMEM_NOT_PURGED). - * - * Caller must hold ashmem_mutex. - */ -static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend, - struct ashmem_range **new_range) -{ - struct ashmem_range *range, *next; - int ret = ASHMEM_NOT_PURGED; - - list_for_each_entry_safe(range, next, &asma->unpinned_list, unpinned) { - /* moved past last applicable page; we can short circuit */ - if (range_before_page(range, pgstart)) - break; - - /* - * The user can ask us to pin pages that span multiple ranges, - * or to pin pages that aren't even unpinned, so this is messy. - * - * Four cases: - * 1. The requested range subsumes an existing range, so we - * just remove the entire matching range. - * 2. The requested range overlaps the start of an existing - * range, so we just update that range. - * 3. The requested range overlaps the end of an existing - * range, so we just update that range. - * 4. The requested range punches a hole in an existing range, - * so we have to update one side of the range and then - * create a new range for the other side. - */ - if (page_range_in_range(range, pgstart, pgend)) { - ret |= range->purged; - - /* Case #1: Easy. Just nuke the whole thing. */ - if (page_range_subsumes_range(range, pgstart, pgend)) { - range_del(range); - continue; - } - - /* Case #2: We overlap from the start, so adjust it */ - if (range->pgstart >= pgstart) { - range_shrink(range, pgend + 1, range->pgend); - continue; - } - - /* Case #3: We overlap from the rear, so adjust it */ - if (range->pgend <= pgend) { - range_shrink(range, range->pgstart, - pgstart - 1); - continue; - } - - /* - * Case #4: We eat a chunk out of the middle. A bit - * more complicated, we allocate a new range for the - * second half and adjust the first chunk's endpoint. - */ - range_alloc(asma, range, range->purged, - pgend + 1, range->pgend, new_range); - range_shrink(range, range->pgstart, pgstart - 1); - break; - } - } - - return ret; -} - -/* - * ashmem_unpin - unpin the given range of pages. Returns zero on success. - * - * Caller must hold ashmem_mutex. - */ -static int ashmem_unpin(struct ashmem_area *asma, size_t pgstart, size_t pgend, - struct ashmem_range **new_range) -{ - struct ashmem_range *range, *next; - unsigned int purged = ASHMEM_NOT_PURGED; - -restart: - list_for_each_entry_safe(range, next, &asma->unpinned_list, unpinned) { - /* short circuit: this is our insertion point */ - if (range_before_page(range, pgstart)) - break; - - /* - * The user can ask us to unpin pages that are already entirely - * or partially pinned. We handle those two cases here. - */ - if (page_range_subsumed_by_range(range, pgstart, pgend)) - return 0; - if (page_range_in_range(range, pgstart, pgend)) { - pgstart = min(range->pgstart, pgstart); - pgend = max(range->pgend, pgend); - purged |= range->purged; - range_del(range); - goto restart; - } - } - - range_alloc(asma, range, purged, pgstart, pgend, new_range); - return 0; -} - -/* - * ashmem_get_pin_status - Returns ASHMEM_IS_UNPINNED if _any_ pages in the - * given interval are unpinned and ASHMEM_IS_PINNED otherwise. - * - * Caller must hold ashmem_mutex. - */ -static int ashmem_get_pin_status(struct ashmem_area *asma, size_t pgstart, - size_t pgend) -{ - struct ashmem_range *range; - int ret = ASHMEM_IS_PINNED; - - list_for_each_entry(range, &asma->unpinned_list, unpinned) { - if (range_before_page(range, pgstart)) - break; - if (page_range_in_range(range, pgstart, pgend)) { - ret = ASHMEM_IS_UNPINNED; - break; - } - } - - return ret; -} - -static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, - void __user *p) -{ - struct ashmem_pin pin; - size_t pgstart, pgend; - int ret = -EINVAL; - struct ashmem_range *range = NULL; - - if (copy_from_user(&pin, p, sizeof(pin))) - return -EFAULT; - - if (cmd == ASHMEM_PIN || cmd == ASHMEM_UNPIN) { - range = kmem_cache_zalloc(ashmem_range_cachep, GFP_KERNEL); - if (!range) - return -ENOMEM; - } - - mutex_lock(&ashmem_mutex); - wait_event(ashmem_shrink_wait, !atomic_read(&ashmem_shrink_inflight)); - - if (!asma->file) - goto out_unlock; - - /* per custom, you can pass zero for len to mean "everything onward" */ - if (!pin.len) - pin.len = PAGE_ALIGN(asma->size) - pin.offset; - - if ((pin.offset | pin.len) & ~PAGE_MASK) - goto out_unlock; - - if (((__u32)-1) - pin.offset < pin.len) - goto out_unlock; - - if (PAGE_ALIGN(asma->size) < pin.offset + pin.len) - goto out_unlock; - - pgstart = pin.offset / PAGE_SIZE; - pgend = pgstart + (pin.len / PAGE_SIZE) - 1; - - switch (cmd) { - case ASHMEM_PIN: - ret = ashmem_pin(asma, pgstart, pgend, &range); - break; - case ASHMEM_UNPIN: - ret = ashmem_unpin(asma, pgstart, pgend, &range); - break; - case ASHMEM_GET_PIN_STATUS: - ret = ashmem_get_pin_status(asma, pgstart, pgend); - break; - } - -out_unlock: - mutex_unlock(&ashmem_mutex); - if (range) - kmem_cache_free(ashmem_range_cachep, range); - - return ret; -} - -static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - struct ashmem_area *asma = file->private_data; - long ret = -ENOTTY; - - switch (cmd) { - case ASHMEM_SET_NAME: - ret = set_name(asma, (void __user *)arg); - break; - case ASHMEM_GET_NAME: - ret = get_name(asma, (void __user *)arg); - break; - case ASHMEM_SET_SIZE: - ret = -EINVAL; - mutex_lock(&ashmem_mutex); - if (!asma->file) { - ret = 0; - asma->size = (size_t)arg; - } - mutex_unlock(&ashmem_mutex); - break; - case ASHMEM_GET_SIZE: - ret = asma->size; - break; - case ASHMEM_SET_PROT_MASK: - ret = set_prot_mask(asma, arg); - break; - case ASHMEM_GET_PROT_MASK: - ret = asma->prot_mask; - break; - case ASHMEM_PIN: - case ASHMEM_UNPIN: - case ASHMEM_GET_PIN_STATUS: - ret = ashmem_pin_unpin(asma, cmd, (void __user *)arg); - break; - case ASHMEM_PURGE_ALL_CACHES: - ret = -EPERM; - if (capable(CAP_SYS_ADMIN)) { - struct shrink_control sc = { - .gfp_mask = GFP_KERNEL, - .nr_to_scan = LONG_MAX, - }; - ret = ashmem_shrink_count(&ashmem_shrinker, &sc); - ashmem_shrink_scan(&ashmem_shrinker, &sc); - } - break; - } - - return ret; -} - -/* support of 32bit userspace on 64bit platforms */ -#ifdef CONFIG_COMPAT -static long compat_ashmem_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - switch (cmd) { - case COMPAT_ASHMEM_SET_SIZE: - cmd = ASHMEM_SET_SIZE; - break; - case COMPAT_ASHMEM_SET_PROT_MASK: - cmd = ASHMEM_SET_PROT_MASK; - break; - } - return ashmem_ioctl(file, cmd, arg); -} -#endif -#ifdef CONFIG_PROC_FS -static void ashmem_show_fdinfo(struct seq_file *m, struct file *file) -{ - struct ashmem_area *asma = file->private_data; - - mutex_lock(&ashmem_mutex); - - if (asma->file) - seq_printf(m, "inode:\t%ld\n", file_inode(asma->file)->i_ino); - - if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0') - seq_printf(m, "name:\t%s\n", - asma->name + ASHMEM_NAME_PREFIX_LEN); - - seq_printf(m, "size:\t%zu\n", asma->size); - - mutex_unlock(&ashmem_mutex); -} -#endif -static const struct file_operations ashmem_fops = { - .owner = THIS_MODULE, - .open = ashmem_open, - .release = ashmem_release, - .read_iter = ashmem_read_iter, - .llseek = ashmem_llseek, - .mmap = ashmem_mmap, - .unlocked_ioctl = ashmem_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = compat_ashmem_ioctl, -#endif -#ifdef CONFIG_PROC_FS - .show_fdinfo = ashmem_show_fdinfo, -#endif -}; - -static struct miscdevice ashmem_misc = { - .minor = MISC_DYNAMIC_MINOR, - .name = "ashmem", - .fops = &ashmem_fops, -}; - -static int __init ashmem_init(void) -{ - int ret = -ENOMEM; - - ashmem_area_cachep = kmem_cache_create("ashmem_area_cache", - sizeof(struct ashmem_area), - 0, 0, NULL); - if (!ashmem_area_cachep) { - pr_err("failed to create slab cache\n"); - goto out; - } - - ashmem_range_cachep = kmem_cache_create("ashmem_range_cache", - sizeof(struct ashmem_range), - 0, SLAB_RECLAIM_ACCOUNT, NULL); - if (!ashmem_range_cachep) { - pr_err("failed to create slab cache\n"); - goto out_free1; - } - - ret = misc_register(&ashmem_misc); - if (ret) { - pr_err("failed to register misc device!\n"); - goto out_free2; - } - - ret = register_shrinker(&ashmem_shrinker); - if (ret) { - pr_err("failed to register shrinker!\n"); - goto out_demisc; - } - - pr_info("initialized\n"); - - return 0; - -out_demisc: - misc_deregister(&ashmem_misc); -out_free2: - kmem_cache_destroy(ashmem_range_cachep); -out_free1: - kmem_cache_destroy(ashmem_area_cachep); -out: - return ret; -} -device_initcall(ashmem_init); diff --git a/drivers/staging/android/ashmem.h b/drivers/staging/android/ashmem.h deleted file mode 100644 index 1a478173cd21..000000000000 --- a/drivers/staging/android/ashmem.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 */ -/* - * include/linux/ashmem.h - * - * Copyright 2008 Google Inc. - * Author: Robert Love - */ - -#ifndef _LINUX_ASHMEM_H -#define _LINUX_ASHMEM_H - -#include -#include -#include - -#include "uapi/ashmem.h" - -/* support of 32bit userspace on 64bit platforms */ -#ifdef CONFIG_COMPAT -#define COMPAT_ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, compat_size_t) -#define COMPAT_ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned int) -#endif - -#endif /* _LINUX_ASHMEM_H */ diff --git a/drivers/staging/android/uapi/ashmem.h b/drivers/staging/android/uapi/ashmem.h deleted file mode 100644 index 134efacb3219..000000000000 --- a/drivers/staging/android/uapi/ashmem.h +++ /dev/null @@ -1,43 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 */ -/* - * Copyright 2008 Google Inc. - * Author: Robert Love - */ - -#ifndef _UAPI_LINUX_ASHMEM_H -#define _UAPI_LINUX_ASHMEM_H - -#include -#include - -#define ASHMEM_NAME_LEN 256 - -#define ASHMEM_NAME_DEF "dev/ashmem" - -/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */ -#define ASHMEM_NOT_PURGED 0 -#define ASHMEM_WAS_PURGED 1 - -/* Return values from ASHMEM_GET_PIN_STATUS: Is the mapping pinned? */ -#define ASHMEM_IS_UNPINNED 0 -#define ASHMEM_IS_PINNED 1 - -struct ashmem_pin { - __u32 offset; /* offset into region, in bytes, page-aligned */ - __u32 len; /* length forward from offset, in bytes, page-aligned */ -}; - -#define __ASHMEMIOC 0x77 - -#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN]) -#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN]) -#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t) -#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4) -#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long) -#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6) -#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin) -#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin) -#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9) -#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10) - -#endif /* _UAPI_LINUX_ASHMEM_H */ -- cgit From 203b43db788b25c256fa55410deecd2ebfe0a8c2 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 14 Mar 2022 20:31:05 +0100 Subject: staging: vt6656: Removed unused variable bb_vga_0 Missing part of staging: vt6656: Remove unused rf_type in card.c Reported-by: kernel test robot Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/09f65cf4839b089ad38f28ff691d5146e6095e58.1647284830.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/card.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index d74165d0d3bb..7827e579ef3d 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -438,7 +438,6 @@ int vnt_set_bss_mode(struct vnt_private *priv) int ret; unsigned char type = priv->bb_type; unsigned char data = 0; - unsigned char bb_vga_0 = 0x1c; unsigned char bb_vga_2_3 = 0x00; ret = vnt_mac_set_bb_type(priv, type); @@ -449,7 +448,6 @@ int vnt_set_bss_mode(struct vnt_private *priv) if (priv->bb_type == BB_TYPE_11A) { data = 0x03; - bb_vga_0 = 0x20; bb_vga_2_3 = 0x10; } else if (priv->bb_type == BB_TYPE_11B) { data = 0x02; -- cgit From cff7326792f78815c20f33e509959682157a609a Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 14 Mar 2022 20:31:11 +0100 Subject: staging: vt6656: Removed unused variable vt3342_vnt_threshold Missing part of staging: vt6656: Remove unused rf_type in baseband.c Reported-by: kernel test robot Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/6e1ef287e66039f9013435f8fa1266de7387df2e.1647284830.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/baseband.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index c04fd052e467..ad7b963f0d98 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -167,30 +167,6 @@ static const struct vnt_threshold vt3226_vnt_threshold[] = { {41, 0xff, 0x00} }; -static const struct vnt_threshold vt3342_vnt_threshold[] = { - {0, 0x00, 0x38}, /* Max sensitivity */ - {66, 0x00, 0x43}, - {65, 0x00, 0x52}, - {64, 0x00, 0x68}, - {63, 0x00, 0x80}, - {62, 0x00, 0x9c}, - {61, 0x00, 0xc0}, - {60, 0x00, 0xea}, - {59, 0x01, 0x30}, - {58, 0x01, 0x70}, - {57, 0x01, 0xb0}, - {56, 0x02, 0x30}, - {55, 0x02, 0xc0}, - {53, 0x04, 0x00}, - {51, 0x07, 0x00}, - {49, 0x0a, 0x00}, - {47, 0x11, 0x00}, - {45, 0x18, 0x00}, - {43, 0x26, 0x00}, - {42, 0x36, 0x00}, - {41, 0xff, 0x00} -}; - /* * Description: Set Antenna mode * -- cgit From 57a42b4d73f9d6f6fbe8b11f22453e1bc3183648 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 10 Mar 2022 02:20:46 +0530 Subject: staging: r8188eu: call _cancel_timer_ex from _rtw_free_recv_priv The _rtw_init_recv_priv() initializes precvpriv->signal_stat_timer and sets it's timeout interval to 1000 ms. But _rtw_free_recv_priv() doesn't cancel the timer and we need to explicitly call _cancel_timer_ex() after we call _rtw_free_recv_priv() to cancel the timer. Call _cancel_timer_ex() from inside _rtw_free_recv_priv() as every init function needs a matching free function. Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220309205047.45981-2-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_recv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index b6ab2db6d731..8800ea4825ff 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -103,6 +103,7 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv) vfree(precvpriv->pallocated_frame_buf); rtl8188eu_free_recv_priv(padapter); + _cancel_timer_ex(&precvpriv->signal_stat_timer); } struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue) -- cgit From 1868755c9078cda1a3a4abd866edd42f9a46b1ed Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 10 Mar 2022 02:20:47 +0530 Subject: staging: r8188eu: proper error handling in rtw_init_drv_sw The code inside rtw_init_drv_sw() calls various init functions to populate the padapter structure and checks for their return values respectively. But if one of the functions in middle fails then it simply returns _FAIL instead of proper logging and calling freeing counterparts of previous init functions. This leads to various memory leaks and can be found in /sys/kernel/debug/kmemleak if kernel is compiled with DEBUG_KMEMLEAK=y. Fix this and keep the success and error separate. Fixes: 2b42bd58b321 ("staging: r8188eu: introduce new os_dep dir for RTL8188eu driver") Reviewed-by: Dan Carpenter Reviewed-by: Pavel Skripkin Signed-off-by: Vihas Makwana Link: https://lore.kernel.org/r/20220309205047.45981-3-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/os_dep/os_intfs.c | 60 ++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c index 197568422ece..550721eef681 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -469,32 +469,46 @@ u8 rtw_reset_drv_sw(struct adapter *padapter) u8 rtw_init_drv_sw(struct adapter *padapter) { - if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) + if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) { + dev_err(dvobj_to_dev(padapter->dvobj), "rtw_init_cmd_priv failed\n"); return _FAIL; + } padapter->cmdpriv.padapter = padapter; - if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) - return _FAIL; + if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) { + dev_err(dvobj_to_dev(padapter->dvobj), "rtw_init_evt_priv failed\n"); + goto free_cmd_priv; + } - if (rtw_init_mlme_priv(padapter) == _FAIL) - return _FAIL; + if (rtw_init_mlme_priv(padapter) == _FAIL) { + dev_err(dvobj_to_dev(padapter->dvobj), "rtw_init_mlme_priv failed\n"); + goto free_evt_priv; + } rtw_init_wifidirect_timers(padapter); init_wifidirect_info(padapter, P2P_ROLE_DISABLE); reset_global_wifidirect_info(padapter); - if (init_mlme_ext_priv(padapter) == _FAIL) - return _FAIL; + if (init_mlme_ext_priv(padapter) == _FAIL) { + dev_err(dvobj_to_dev(padapter->dvobj), "init_mlme_ext_priv failed\n"); + goto free_mlme_priv; + } - if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) - return _FAIL; + if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { + dev_err(dvobj_to_dev(padapter->dvobj), "_rtw_init_xmit_priv failed\n"); + goto free_mlme_ext; + } - if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) - return _FAIL; + if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { + dev_err(dvobj_to_dev(padapter->dvobj), "_rtw_init_recv_priv failed\n"); + goto free_xmit_priv; + } - if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) - return _FAIL; + if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) { + dev_err(dvobj_to_dev(padapter->dvobj), "_rtw_init_sta_priv failed\n"); + goto free_recv_priv; + } padapter->stapriv.padapter = padapter; @@ -510,6 +524,26 @@ u8 rtw_init_drv_sw(struct adapter *padapter) spin_lock_init(&padapter->br_ext_lock); return _SUCCESS; + +free_recv_priv: + _rtw_free_recv_priv(&padapter->recvpriv); + +free_xmit_priv: + _rtw_free_xmit_priv(&padapter->xmitpriv); + +free_mlme_ext: + free_mlme_ext_priv(&padapter->mlmeextpriv); + +free_mlme_priv: + rtw_free_mlme_priv(&padapter->mlmepriv); + +free_evt_priv: + rtw_free_evt_priv(&padapter->evtpriv); + +free_cmd_priv: + rtw_free_cmd_priv(&padapter->cmdpriv); + + return _FAIL; } void rtw_cancel_all_timer(struct adapter *padapter) -- cgit From ca7918f21466545250033b5bd077c2fbab0247a3 Mon Sep 17 00:00:00 2001 From: Lukas Bulwahn Date: Wed, 16 Mar 2022 13:48:02 +0100 Subject: MAINTAINERS: remove the obsolete file entry for staging in ANDROID DRIVERS Commit 721412ed3d81 ("staging: remove ashmem") removes the last android driver from staging, but misses to adjust MAINTAINERS. Hence, ./scripts/get_maintainer.pl --self-test=patterns complains about a broken reference. Remove the obsolete file entry in ANDROID DRIVERS. Signed-off-by: Lukas Bulwahn Link: https://lore.kernel.org/r/20220316124802.372-1-lukas.bulwahn@gmail.com Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a53ef77ffd2b..bf58c6c4f812 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1259,7 +1259,6 @@ L: linux-kernel@vger.kernel.org S: Supported T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git F: drivers/android/ -F: drivers/staging/android/ ANDROID GOLDFISH PIC DRIVER M: Miodrag Dinic -- cgit From 02d838dec8a0401bebe266f3e7af11b73c4f5b10 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 15 Mar 2022 22:40:37 +0000 Subject: staging: rtl8192e: Fix spelling mistake "RESQUEST" -> "REQUEST" There is a spelling mistake in a netdev_dbg message. Fix it. Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20220315224037.2962063-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index e3d0a361d370..eb904b42f9c6 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -2732,7 +2732,7 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee, (struct rtllib_probe_response *)header, stats); break; case RTLLIB_STYPE_PROBE_REQ: - netdev_dbg(ieee->dev, "received PROBE RESQUEST (%d)\n", + netdev_dbg(ieee->dev, "received PROBE REQUEST (%d)\n", WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))); if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && ((ieee->iw_mode == IW_MODE_ADHOC || -- cgit From a39a6b330be423897cc1a69c57ee45d5fd3f6aa8 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Tue, 15 Mar 2022 21:50:36 +0100 Subject: staging: r8188eu: remove unnecessary initializations Do not initialise bPacketMatchBSSID, bPacketToSelf and bPacketBeacon to false at the start of update_recvframe_phyinfo_88e. All of them are set to their actual values before they're used. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220315205041.2714168-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c index b4c9738ed868..387af789797d 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c @@ -118,10 +118,6 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, struct phy_stat struct sta_priv *pstapriv; struct sta_info *psta; - pkt_info.bPacketMatchBSSID = false; - pkt_info.bPacketToSelf = false; - pkt_info.bPacketBeacon = false; - pkt_info.bPacketMatchBSSID = ((!IsFrameTypeCtrl(wlanhdr)) && !pattrib->icv_err && !pattrib->crc_err && !memcmp(get_hdr_bssid(wlanhdr), -- cgit From 432c80a379b31bdb31e6fabed5db37be4eccebd3 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Tue, 15 Mar 2022 21:50:37 +0100 Subject: staging: r8188eu: remove three unused receive defines Remove three unused defines from rtl8188e_recv.h. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220315205041.2714168-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtl8188e_recv.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtl8188e_recv.h b/drivers/staging/r8188eu/include/rtl8188e_recv.h index a2320af11216..09adffd756de 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_recv.h +++ b/drivers/staging/r8188eu/include/rtl8188e_recv.h @@ -6,10 +6,6 @@ #define TX_RPT1_PKT_LEN 8 -#define RECV_BLK_SZ 512 -#define RECV_BLK_CNT 16 -#define RECV_BLK_TH RECV_BLK_CNT - #define NR_PREALLOC_RECV_SKB (8) #define NR_RECVBUFF (4) -- cgit From e85176ffa54a02707036319e87d59d64fb332f82 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Tue, 15 Mar 2022 21:50:38 +0100 Subject: staging: r8188eu: remove unused function prototype Remove the prototype for rtl8188eu_recv_hdl. This function does not exist in the r8188eu driver. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220315205041.2714168-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/rtl8188e_recv.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/r8188eu/include/rtl8188e_recv.h b/drivers/staging/r8188eu/include/rtl8188e_recv.h index 09adffd756de..8d06815d0374 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_recv.h +++ b/drivers/staging/r8188eu/include/rtl8188e_recv.h @@ -35,7 +35,6 @@ enum rx_packet_type { s32 rtl8188eu_init_recv_priv(struct adapter *padapter); void rtl8188eu_free_recv_priv(struct adapter * padapter); -void rtl8188eu_recv_hdl(struct adapter * padapter, struct recv_buf *precvbuf); void rtl8188eu_recv_tasklet(unsigned long priv); void rtl8188e_process_phy_info(struct adapter * padapter, void *prframe); void update_recvframe_phyinfo_88e(struct recv_frame *fra, struct phy_stat *phy); -- cgit From 3524c88e334b7d215a1c4ddf44c986f12ed55e45 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Tue, 15 Mar 2022 21:50:39 +0100 Subject: staging: r8188eu: make rtl8188e_process_phy_info static rtl8188e_process_phy_info is used only in rtl8188e_rxdesc.c. Make the function static and remove its prototype from rtl8188e_recv.h. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220315205041.2714168-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 2 +- drivers/staging/r8188eu/include/rtl8188e_recv.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c index 387af789797d..9bf7a9248026 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c @@ -45,7 +45,7 @@ static void process_link_qual(struct adapter *padapter, struct recv_frame *prfra signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num; } -void rtl8188e_process_phy_info(struct adapter *padapter, void *prframe) +static void rtl8188e_process_phy_info(struct adapter *padapter, void *prframe) { struct recv_frame *precvframe = (struct recv_frame *)prframe; diff --git a/drivers/staging/r8188eu/include/rtl8188e_recv.h b/drivers/staging/r8188eu/include/rtl8188e_recv.h index 8d06815d0374..b752c5c06309 100644 --- a/drivers/staging/r8188eu/include/rtl8188e_recv.h +++ b/drivers/staging/r8188eu/include/rtl8188e_recv.h @@ -36,7 +36,6 @@ enum rx_packet_type { s32 rtl8188eu_init_recv_priv(struct adapter *padapter); void rtl8188eu_free_recv_priv(struct adapter * padapter); void rtl8188eu_recv_tasklet(unsigned long priv); -void rtl8188e_process_phy_info(struct adapter * padapter, void *prframe); void update_recvframe_phyinfo_88e(struct recv_frame *fra, struct phy_stat *phy); void update_recvframe_attrib_88e(struct recv_frame *fra, struct recv_stat *stat); -- cgit From 5aaec657369cb94e6d94ad1c66a264070e78e2b2 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Tue, 15 Mar 2022 21:50:40 +0100 Subject: staging: r8188eu: remove some unused local ieee80211 macros Remove some macros from wifi.h which are not used by this driver. Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220315205041.2714168-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/wifi.h | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h index c1c9bae58d6d..c331be19ff83 100644 --- a/drivers/staging/r8188eu/include/wifi.h +++ b/drivers/staging/r8188eu/include/wifi.h @@ -167,17 +167,11 @@ enum WIFI_REG_DOMAIN { #define GetToDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0) -#define ClearToDs(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_)) - #define SetFrDs(pbuf) \ *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_) #define GetFrDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0) -#define ClearFrDs(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)) - #define get_tofr_ds(pframe) ((GetToDs(pframe) << 1) | GetFrDs(pframe)) #define SetMFrag(pbuf) \ @@ -186,46 +180,25 @@ enum WIFI_REG_DOMAIN { #define ClearMFrag(pbuf) \ *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)) -#define SetRetry(pbuf) \ - *(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_) - #define GetRetry(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0) -#define ClearRetry(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_)) - #define SetPwrMgt(pbuf) \ *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_) #define GetPwrMgt(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_PWRMGT_)) != 0) -#define ClearPwrMgt(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_)) - #define SetMData(pbuf) \ *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_) -#define ClearMData(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)) - #define SetPrivacy(pbuf) \ *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_) #define GetPrivacy(pbuf) \ (((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0) -#define ClearPrivacy(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_PRIVACY_)) - #define GetFrameType(pbuf) \ (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2))) -#define SetFrameType(pbuf, type) \ - do { \ - *(unsigned short *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | BIT(2))); \ - *(unsigned short *)(pbuf) |= __constant_cpu_to_le16(type); \ - } while (0) - #define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(7) |\ BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))) -- cgit From 7a6ee0bbab2551d7189ce0f5e625fef4d612ebea Mon Sep 17 00:00:00 2001 From: Arınç ÜNAL Date: Tue, 15 Mar 2022 19:01:50 +0300 Subject: mips: dts: ralink: add MT7621 SoC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MT7621 system-on-a-chip includes an 880 MHz MIPS1004Kc dual-core CPU, a 5-port 10/100/1000 switch/PHY and one RGMII. Add the devicetrees for GB-PC1 and GB-PC2 devices which use MT7621 SoC. Acked-by: Sergio Paracuellos Acked-by: Thomas Bogendoerfer Signed-off-by: Arınç ÜNAL Link: https://lore.kernel.org/r/20220315160149.3617-1-arinc.unal@arinc9.com Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 7 + arch/mips/boot/dts/ralink/Makefile | 4 + arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc1.dts | 128 ++++++ arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts | 122 +++++ arch/mips/boot/dts/ralink/mt7621.dtsi | 497 +++++++++++++++++++++ arch/mips/ralink/Kconfig | 5 + drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/mt7621-dts/Kconfig | 11 - drivers/staging/mt7621-dts/Makefile | 5 - drivers/staging/mt7621-dts/TODO | 5 - drivers/staging/mt7621-dts/gbpc1.dts | 128 ------ drivers/staging/mt7621-dts/gbpc2.dts | 122 ----- drivers/staging/mt7621-dts/mt7621.dtsi | 497 --------------------- 14 files changed, 763 insertions(+), 771 deletions(-) create mode 100644 arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc1.dts create mode 100644 arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts create mode 100644 arch/mips/boot/dts/ralink/mt7621.dtsi delete mode 100644 drivers/staging/mt7621-dts/Kconfig delete mode 100644 drivers/staging/mt7621-dts/Makefile delete mode 100644 drivers/staging/mt7621-dts/TODO delete mode 100644 drivers/staging/mt7621-dts/gbpc1.dts delete mode 100644 drivers/staging/mt7621-dts/gbpc2.dts delete mode 100644 drivers/staging/mt7621-dts/mt7621.dtsi diff --git a/MAINTAINERS b/MAINTAINERS index bf58c6c4f812..fd140717854d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16180,6 +16180,13 @@ L: linux-mips@vger.kernel.org S: Maintained F: arch/mips/ralink +RALINK MT7621 MIPS ARCHITECTURE +M: Arınç ÜNAL +M: Sergio Paracuellos +L: linux-mips@vger.kernel.org +S: Maintained +F: arch/mips/boot/dts/ralink/mt7621* + RALINK RT2X00 WIRELESS LAN DRIVER M: Stanislaw Gruszka M: Helmut Schaa diff --git a/arch/mips/boot/dts/ralink/Makefile b/arch/mips/boot/dts/ralink/Makefile index 6c26dfa0a903..11732b8c8163 100644 --- a/arch/mips/boot/dts/ralink/Makefile +++ b/arch/mips/boot/dts/ralink/Makefile @@ -6,4 +6,8 @@ dtb-$(CONFIG_DTB_MT7620A_EVAL) += mt7620a_eval.dtb dtb-$(CONFIG_DTB_OMEGA2P) += omega2p.dtb dtb-$(CONFIG_DTB_VOCORE2) += vocore2.dtb +dtb-$(CONFIG_SOC_MT7621) += \ + mt7621-gnubee-gb-pc1.dtb \ + mt7621-gnubee-gb-pc2.dtb + obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y)) diff --git a/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc1.dts b/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc1.dts new file mode 100644 index 000000000000..5892bcf71595 --- /dev/null +++ b/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc1.dts @@ -0,0 +1,128 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/dts-v1/; + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "gnubee,gb-pc1", "mediatek,mt7621-soc"; + model = "GB-PC1"; + + memory@0 { + device_type = "memory"; + reg = <0x00000000 0x1c000000>, + <0x20000000 0x04000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + palmbus: palmbus@1e000000 { + i2c@900 { + status = "okay"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "green:power"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; + }; + + system { + label = "green:system"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,default-trigger = "disk-activity"; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + broken-flash-reset; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: state-default { + gpio-pinmux { + groups = "rgmii2", "uart3", "wdt"; + function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "ethblack"; + }; + + port@4 { + status = "okay"; + label = "ethblue"; + }; + }; +}; diff --git a/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts b/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts new file mode 100644 index 000000000000..a7fce8de6147 --- /dev/null +++ b/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/dts-v1/; + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "gnubee,gb-pc2", "mediatek,mt7621-soc"; + model = "GB-PC2"; + + memory@0 { + device_type = "memory"; + reg = <0x00000000 0x1c000000>, + <0x20000000 0x04000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + palmbus: palmbus@1e000000 { + i2c@900 { + status = "okay"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + broken-flash-reset; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: state-default { + gpio-pinmux { + groups = "wdt"; + function = "gpio"; + }; + }; +}; + +ðernet { + gmac1: mac@1 { + status = "okay"; + phy-handle = <ðphy7>; + }; + + mdio-bus { + ethphy7: ethernet-phy@7 { + reg = <7>; + phy-mode = "rgmii-rxid"; + }; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "ethblack"; + }; + + port@4 { + status = "okay"; + label = "ethblue"; + }; + }; +}; diff --git a/arch/mips/boot/dts/ralink/mt7621.dtsi b/arch/mips/boot/dts/ralink/mt7621.dtsi new file mode 100644 index 000000000000..3222684915ac --- /dev/null +++ b/arch/mips/boot/dts/ralink/mt7621.dtsi @@ -0,0 +1,497 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +#include +#include +#include +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "mediatek,mt7621-soc"; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + cpuintc: cpuintc { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + aliases { + serial0 = &uartlite; + }; + + + mmc_fixed_3v3: regulator-3v3 { + compatible = "regulator-fixed"; + regulator-name = "mmc_power"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + enable-active-high; + regulator-always-on; + }; + + mmc_fixed_1v8_io: regulator-1v8 { + compatible = "regulator-fixed"; + regulator-name = "mmc_io"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + enable-active-high; + regulator-always-on; + }; + + palmbus: palmbus@1e000000 { + compatible = "palmbus"; + reg = <0x1e000000 0x100000>; + ranges = <0x0 0x1e000000 0x0fffff>; + + #address-cells = <1>; + #size-cells = <1>; + + sysc: syscon@0 { + compatible = "mediatek,mt7621-sysc", "syscon"; + reg = <0x0 0x100>; + #clock-cells = <1>; + #reset-cells = <1>; + ralink,memctl = <&memc>; + clock-output-names = "xtal", "cpu", "bus", + "50m", "125m", "150m", + "250m", "270m"; + }; + + wdt: wdt@100 { + compatible = "mediatek,mt7621-wdt"; + reg = <0x100 0x100>; + }; + + gpio: gpio@600 { + #gpio-cells = <2>; + #interrupt-cells = <2>; + compatible = "mediatek,mt7621-gpio"; + gpio-controller; + gpio-ranges = <&pinctrl 0 0 95>; + interrupt-controller; + reg = <0x600 0x100>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + i2c: i2c@900 { + compatible = "mediatek,mt7621-i2c"; + reg = <0x900 0x100>; + + clocks = <&sysc MT7621_CLK_I2C>; + clock-names = "i2c"; + resets = <&sysc MT7621_RST_I2C>; + reset-names = "i2c"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + }; + + memc: syscon@5000 { + compatible = "mediatek,mt7621-memc", "syscon"; + reg = <0x5000 0x1000>; + }; + + uartlite: uartlite@c00 { + compatible = "ns16550a"; + reg = <0xc00 0x100>; + + clocks = <&sysc MT7621_CLK_UART1>; + clock-names = "uart1"; + + interrupt-parent = <&gic>; + interrupts = ; + + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test; + }; + + spi0: spi@b00 { + status = "disabled"; + + compatible = "ralink,mt7621-spi"; + reg = <0xb00 0x100>; + + clocks = <&sysc MT7621_CLK_SPI>; + clock-names = "spi"; + + resets = <&sysc MT7621_RST_SPI>; + reset-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>; + }; + }; + + pinctrl: pinctrl { + compatible = "ralink,rt2880-pinmux"; + + i2c_pins: i2c0-pins { + pinmux { + groups = "i2c"; + function = "i2c"; + }; + }; + + spi_pins: spi0-pins { + pinmux { + groups = "spi"; + function = "spi"; + }; + }; + + uart1_pins: uart1-pins { + pinmux { + groups = "uart1"; + function = "uart1"; + }; + }; + + uart2_pins: uart2-pins { + pinmux { + groups = "uart2"; + function = "uart2"; + }; + }; + + uart3_pins: uart3-pins { + pinmux { + groups = "uart3"; + function = "uart3"; + }; + }; + + rgmii1_pins: rgmii1-pins { + pinmux { + groups = "rgmii1"; + function = "rgmii1"; + }; + }; + + rgmii2_pins: rgmii2-pins { + pinmux { + groups = "rgmii2"; + function = "rgmii2"; + }; + }; + + mdio_pins: mdio0-pins { + pinmux { + groups = "mdio"; + function = "mdio"; + }; + }; + + pcie_pins: pcie0-pins { + pinmux { + groups = "pcie"; + function = "gpio"; + }; + }; + + nand_pins: nand0-pins { + spi-pinmux { + groups = "spi"; + function = "nand1"; + }; + + sdhci-pinmux { + groups = "sdhci"; + function = "nand2"; + }; + }; + + sdhci_pins: sdhci0-pins { + pinmux { + groups = "sdhci"; + function = "sdhci"; + }; + }; + }; + + sdhci: sdhci@1e130000 { + status = "disabled"; + + compatible = "mediatek,mt7620-mmc"; + reg = <0x1e130000 0x4000>; + + bus-width = <4>; + max-frequency = <48000000>; + cap-sd-highspeed; + cap-mmc-highspeed; + vmmc-supply = <&mmc_fixed_3v3>; + vqmmc-supply = <&mmc_fixed_1v8_io>; + disable-wp; + + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&sdhci_pins>; + pinctrl-1 = <&sdhci_pins>; + + clocks = <&sysc MT7621_CLK_SHXC>, + <&sysc MT7621_CLK_50M>; + clock-names = "source", "hclk"; + + interrupt-parent = <&gic>; + interrupts = ; + }; + + xhci: xhci@1e1c0000 { + compatible = "mediatek,mt8173-xhci"; + reg = <0x1e1c0000 0x1000 + 0x1e1d0700 0x0100>; + reg-names = "mac", "ippc"; + + clocks = <&sysc MT7621_CLK_XTAL>; + clock-names = "sys_ck"; + + interrupt-parent = <&gic>; + interrupts = ; + }; + + gic: interrupt-controller@1fbc0000 { + compatible = "mti,gic"; + reg = <0x1fbc0000 0x2000>; + + interrupt-controller; + #interrupt-cells = <3>; + + mti,reserved-cpu-vectors = <7>; + + timer { + compatible = "mti,gic-timer"; + interrupts = ; + clocks = <&sysc MT7621_CLK_CPU>; + }; + }; + + cpc: cpc@1fbf0000 { + compatible = "mti,mips-cpc"; + reg = <0x1fbf0000 0x8000>; + }; + + cdmm: cdmm@1fbf8000 { + compatible = "mti,mips-cdmm"; + reg = <0x1fbf8000 0x8000>; + }; + + ethernet: ethernet@1e100000 { + compatible = "mediatek,mt7621-eth"; + reg = <0x1e100000 0x10000>; + + clocks = <&sysc MT7621_CLK_FE>, + <&sysc MT7621_CLK_ETH>; + clock-names = "fe", "ethif"; + + #address-cells = <1>; + #size-cells = <0>; + + resets = <&sysc MT7621_RST_FE &sysc MT7621_RST_ETH>; + reset-names = "fe", "eth"; + + interrupt-parent = <&gic>; + interrupts = ; + + mediatek,ethsys = <&sysc>; + + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>, <&rgmii2_pins>; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "trgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + status = "off"; + phy-mode = "rgmii-rxid"; + }; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch0: switch0@0 { + compatible = "mediatek,mt7621"; + reg = <0>; + mediatek,mcm; + resets = <&sysc MT7621_RST_MCM>; + reset-names = "mcm"; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + interrupts = ; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + status = "off"; + reg = <0>; + label = "lan0"; + }; + + port@1 { + status = "off"; + reg = <1>; + label = "lan1"; + }; + + port@2 { + status = "off"; + reg = <2>; + label = "lan2"; + }; + + port@3 { + status = "off"; + reg = <3>; + label = "lan3"; + }; + + port@4 { + status = "off"; + reg = <4>; + label = "lan4"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "trgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; + }; + }; + }; + }; + }; + + pcie: pcie@1e140000 { + compatible = "mediatek,mt7621-pci"; + reg = <0x1e140000 0x100>, /* host-pci bridge registers */ + <0x1e142000 0x100>, /* pcie port 0 RC control registers */ + <0x1e143000 0x100>, /* pcie port 1 RC control registers */ + <0x1e144000 0x100>; /* pcie port 2 RC control registers */ + #address-cells = <3>; + #size-cells = <2>; + + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + + device_type = "pci"; + + ranges = <0x02000000 0 0x60000000 0x60000000 0 0x10000000>, /* pci memory */ + <0x01000000 0 0x00000000 0x1e160000 0 0x00010000>; /* io space */ + + #interrupt-cells = <1>; + interrupt-map-mask = <0xF800 0 0 0>; + interrupt-map = <0x0000 0 0 0 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>, + <0x0800 0 0 0 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>, + <0x1000 0 0 0 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; + + status = "disabled"; + + reset-gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + + pcie@0,0 { + reg = <0x0000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0>; + interrupt-map = <0 0 0 0 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>; + resets = <&sysc MT7621_RST_PCIE0>; + clocks = <&sysc MT7621_CLK_PCIE0>; + phys = <&pcie0_phy 1>; + phy-names = "pcie-phy0"; + ranges; + }; + + pcie@1,0 { + reg = <0x0800 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0>; + interrupt-map = <0 0 0 0 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>; + resets = <&sysc MT7621_RST_PCIE1>; + clocks = <&sysc MT7621_CLK_PCIE1>; + phys = <&pcie0_phy 1>; + phy-names = "pcie-phy1"; + ranges; + }; + + pcie@2,0 { + reg = <0x1000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0>; + interrupt-map = <0 0 0 0 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; + resets = <&sysc MT7621_RST_PCIE2>; + clocks = <&sysc MT7621_CLK_PCIE2>; + phys = <&pcie2_phy 0>; + phy-names = "pcie-phy2"; + ranges; + }; + }; + + pcie0_phy: pcie-phy@1e149000 { + compatible = "mediatek,mt7621-pci-phy"; + reg = <0x1e149000 0x0700>; + clocks = <&sysc MT7621_CLK_XTAL>; + #phy-cells = <1>; + }; + + pcie2_phy: pcie-phy@1e14a000 { + compatible = "mediatek,mt7621-pci-phy"; + reg = <0x1e14a000 0x0700>; + clocks = <&sysc MT7621_CLK_XTAL>; + #phy-cells = <1>; + }; +}; diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig index 120adad51d6a..f9fe15630abb 100644 --- a/arch/mips/ralink/Kconfig +++ b/arch/mips/ralink/Kconfig @@ -54,10 +54,15 @@ choice select HAVE_PCI select PCI_DRIVERS_GENERIC select SOC_BUS + + help + The MT7621 system-on-a-chip includes an 880 MHz MIPS1004Kc dual-core CPU, + a 5-port 10/100/1000 switch/PHY and one RGMII. endchoice choice prompt "Devicetree selection" + depends on !SOC_MT7621 default DTB_RT_NONE help Select the devicetree. diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index af60ca591c99..932acb4e8cbc 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -80,8 +80,6 @@ source "drivers/staging/vc04_services/Kconfig" source "drivers/staging/pi433/Kconfig" -source "drivers/staging/mt7621-dts/Kconfig" - source "drivers/staging/axis-fifo/Kconfig" source "drivers/staging/fieldbus/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index ad59134e97ad..3ffb35ccfae2 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -30,7 +30,6 @@ obj-$(CONFIG_KS7010) += ks7010/ obj-$(CONFIG_GREYBUS) += greybus/ obj-$(CONFIG_BCM2835_VCHIQ) += vc04_services/ obj-$(CONFIG_PI433) += pi433/ -obj-$(CONFIG_SOC_MT7621) += mt7621-dts/ obj-$(CONFIG_XIL_AXIS_FIFO) += axis-fifo/ obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/ obj-$(CONFIG_QLGE) += qlge/ diff --git a/drivers/staging/mt7621-dts/Kconfig b/drivers/staging/mt7621-dts/Kconfig deleted file mode 100644 index 6932ab7acadf..000000000000 --- a/drivers/staging/mt7621-dts/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -config DTB_GNUBEE1 - bool "GnuBee1 2.5inch NAS" - depends on SOC_MT7621 && DTB_RT_NONE - select BUILTIN_DTB - -config DTB_GNUBEE2 - bool "GnuBee2 3.5inch NAS" - depends on SOC_MT7621 && DTB_RT_NONE - select BUILTIN_DTB - diff --git a/drivers/staging/mt7621-dts/Makefile b/drivers/staging/mt7621-dts/Makefile deleted file mode 100644 index b4ab99fed932..000000000000 --- a/drivers/staging/mt7621-dts/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -dtb-$(CONFIG_DTB_GNUBEE1) += gbpc1.dtb -dtb-$(CONFIG_DTB_GNUBEE2) += gbpc2.dtb - -obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) diff --git a/drivers/staging/mt7621-dts/TODO b/drivers/staging/mt7621-dts/TODO deleted file mode 100644 index 1b758e5c84e0..000000000000 --- a/drivers/staging/mt7621-dts/TODO +++ /dev/null @@ -1,5 +0,0 @@ - -- ensure all usage matches code -- ensure all features used are documented - -Cc: NeilBrown diff --git a/drivers/staging/mt7621-dts/gbpc1.dts b/drivers/staging/mt7621-dts/gbpc1.dts deleted file mode 100644 index 5892bcf71595..000000000000 --- a/drivers/staging/mt7621-dts/gbpc1.dts +++ /dev/null @@ -1,128 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -/dts-v1/; - -#include "mt7621.dtsi" - -#include -#include - -/ { - compatible = "gnubee,gb-pc1", "mediatek,mt7621-soc"; - model = "GB-PC1"; - - memory@0 { - device_type = "memory"; - reg = <0x00000000 0x1c000000>, - <0x20000000 0x04000000>; - }; - - chosen { - bootargs = "console=ttyS0,57600"; - }; - - palmbus: palmbus@1e000000 { - i2c@900 { - status = "okay"; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power { - label = "green:power"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - linux,default-trigger = "default-on"; - }; - - system { - label = "green:system"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - linux,default-trigger = "disk-activity"; - }; - }; -}; - -&sdhci { - status = "okay"; -}; - -&spi0 { - status = "okay"; - - m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <50000000>; - broken-flash-reset; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; - }; - }; -}; - -&pcie { - status = "okay"; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: state-default { - gpio-pinmux { - groups = "rgmii2", "uart3", "wdt"; - function = "gpio"; - }; - }; -}; - -ðernet { - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; -}; - -&switch0 { - ports { - port@0 { - status = "okay"; - label = "ethblack"; - }; - - port@4 { - status = "okay"; - label = "ethblue"; - }; - }; -}; diff --git a/drivers/staging/mt7621-dts/gbpc2.dts b/drivers/staging/mt7621-dts/gbpc2.dts deleted file mode 100644 index a7fce8de6147..000000000000 --- a/drivers/staging/mt7621-dts/gbpc2.dts +++ /dev/null @@ -1,122 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -/dts-v1/; - -#include "mt7621.dtsi" - -#include -#include - -/ { - compatible = "gnubee,gb-pc2", "mediatek,mt7621-soc"; - model = "GB-PC2"; - - memory@0 { - device_type = "memory"; - reg = <0x00000000 0x1c000000>, - <0x20000000 0x04000000>; - }; - - chosen { - bootargs = "console=ttyS0,57600"; - }; - - palmbus: palmbus@1e000000 { - i2c@900 { - status = "okay"; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; - linux,code = ; - }; - }; -}; - -&sdhci { - status = "okay"; -}; - -&spi0 { - status = "okay"; - - m25p80@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <50000000>; - broken-flash-reset; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - label = "firmware"; - reg = <0x50000 0x1fb0000>; - }; - }; -}; - -&pcie { - status = "okay"; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: state-default { - gpio-pinmux { - groups = "wdt"; - function = "gpio"; - }; - }; -}; - -ðernet { - gmac1: mac@1 { - status = "okay"; - phy-handle = <ðphy7>; - }; - - mdio-bus { - ethphy7: ethernet-phy@7 { - reg = <7>; - phy-mode = "rgmii-rxid"; - }; - }; -}; - -&switch0 { - ports { - port@0 { - status = "okay"; - label = "ethblack"; - }; - - port@4 { - status = "okay"; - label = "ethblue"; - }; - }; -}; diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi deleted file mode 100644 index 3222684915ac..000000000000 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ /dev/null @@ -1,497 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -#include -#include -#include -#include - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "mediatek,mt7621-soc"; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "mips,mips1004Kc"; - reg = <0>; - }; - - cpu@1 { - device_type = "cpu"; - compatible = "mips,mips1004Kc"; - reg = <1>; - }; - }; - - cpuintc: cpuintc { - #address-cells = <0>; - #interrupt-cells = <1>; - interrupt-controller; - compatible = "mti,cpu-interrupt-controller"; - }; - - aliases { - serial0 = &uartlite; - }; - - - mmc_fixed_3v3: regulator-3v3 { - compatible = "regulator-fixed"; - regulator-name = "mmc_power"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - enable-active-high; - regulator-always-on; - }; - - mmc_fixed_1v8_io: regulator-1v8 { - compatible = "regulator-fixed"; - regulator-name = "mmc_io"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - enable-active-high; - regulator-always-on; - }; - - palmbus: palmbus@1e000000 { - compatible = "palmbus"; - reg = <0x1e000000 0x100000>; - ranges = <0x0 0x1e000000 0x0fffff>; - - #address-cells = <1>; - #size-cells = <1>; - - sysc: syscon@0 { - compatible = "mediatek,mt7621-sysc", "syscon"; - reg = <0x0 0x100>; - #clock-cells = <1>; - #reset-cells = <1>; - ralink,memctl = <&memc>; - clock-output-names = "xtal", "cpu", "bus", - "50m", "125m", "150m", - "250m", "270m"; - }; - - wdt: wdt@100 { - compatible = "mediatek,mt7621-wdt"; - reg = <0x100 0x100>; - }; - - gpio: gpio@600 { - #gpio-cells = <2>; - #interrupt-cells = <2>; - compatible = "mediatek,mt7621-gpio"; - gpio-controller; - gpio-ranges = <&pinctrl 0 0 95>; - interrupt-controller; - reg = <0x600 0x100>; - interrupt-parent = <&gic>; - interrupts = ; - }; - - i2c: i2c@900 { - compatible = "mediatek,mt7621-i2c"; - reg = <0x900 0x100>; - - clocks = <&sysc MT7621_CLK_I2C>; - clock-names = "i2c"; - resets = <&sysc MT7621_RST_I2C>; - reset-names = "i2c"; - - #address-cells = <1>; - #size-cells = <0>; - - status = "disabled"; - - pinctrl-names = "default"; - pinctrl-0 = <&i2c_pins>; - }; - - memc: syscon@5000 { - compatible = "mediatek,mt7621-memc", "syscon"; - reg = <0x5000 0x1000>; - }; - - uartlite: uartlite@c00 { - compatible = "ns16550a"; - reg = <0xc00 0x100>; - - clocks = <&sysc MT7621_CLK_UART1>; - clock-names = "uart1"; - - interrupt-parent = <&gic>; - interrupts = ; - - reg-shift = <2>; - reg-io-width = <4>; - no-loopback-test; - }; - - spi0: spi@b00 { - status = "disabled"; - - compatible = "ralink,mt7621-spi"; - reg = <0xb00 0x100>; - - clocks = <&sysc MT7621_CLK_SPI>; - clock-names = "spi"; - - resets = <&sysc MT7621_RST_SPI>; - reset-names = "spi"; - - #address-cells = <1>; - #size-cells = <0>; - - pinctrl-names = "default"; - pinctrl-0 = <&spi_pins>; - }; - }; - - pinctrl: pinctrl { - compatible = "ralink,rt2880-pinmux"; - - i2c_pins: i2c0-pins { - pinmux { - groups = "i2c"; - function = "i2c"; - }; - }; - - spi_pins: spi0-pins { - pinmux { - groups = "spi"; - function = "spi"; - }; - }; - - uart1_pins: uart1-pins { - pinmux { - groups = "uart1"; - function = "uart1"; - }; - }; - - uart2_pins: uart2-pins { - pinmux { - groups = "uart2"; - function = "uart2"; - }; - }; - - uart3_pins: uart3-pins { - pinmux { - groups = "uart3"; - function = "uart3"; - }; - }; - - rgmii1_pins: rgmii1-pins { - pinmux { - groups = "rgmii1"; - function = "rgmii1"; - }; - }; - - rgmii2_pins: rgmii2-pins { - pinmux { - groups = "rgmii2"; - function = "rgmii2"; - }; - }; - - mdio_pins: mdio0-pins { - pinmux { - groups = "mdio"; - function = "mdio"; - }; - }; - - pcie_pins: pcie0-pins { - pinmux { - groups = "pcie"; - function = "gpio"; - }; - }; - - nand_pins: nand0-pins { - spi-pinmux { - groups = "spi"; - function = "nand1"; - }; - - sdhci-pinmux { - groups = "sdhci"; - function = "nand2"; - }; - }; - - sdhci_pins: sdhci0-pins { - pinmux { - groups = "sdhci"; - function = "sdhci"; - }; - }; - }; - - sdhci: sdhci@1e130000 { - status = "disabled"; - - compatible = "mediatek,mt7620-mmc"; - reg = <0x1e130000 0x4000>; - - bus-width = <4>; - max-frequency = <48000000>; - cap-sd-highspeed; - cap-mmc-highspeed; - vmmc-supply = <&mmc_fixed_3v3>; - vqmmc-supply = <&mmc_fixed_1v8_io>; - disable-wp; - - pinctrl-names = "default", "state_uhs"; - pinctrl-0 = <&sdhci_pins>; - pinctrl-1 = <&sdhci_pins>; - - clocks = <&sysc MT7621_CLK_SHXC>, - <&sysc MT7621_CLK_50M>; - clock-names = "source", "hclk"; - - interrupt-parent = <&gic>; - interrupts = ; - }; - - xhci: xhci@1e1c0000 { - compatible = "mediatek,mt8173-xhci"; - reg = <0x1e1c0000 0x1000 - 0x1e1d0700 0x0100>; - reg-names = "mac", "ippc"; - - clocks = <&sysc MT7621_CLK_XTAL>; - clock-names = "sys_ck"; - - interrupt-parent = <&gic>; - interrupts = ; - }; - - gic: interrupt-controller@1fbc0000 { - compatible = "mti,gic"; - reg = <0x1fbc0000 0x2000>; - - interrupt-controller; - #interrupt-cells = <3>; - - mti,reserved-cpu-vectors = <7>; - - timer { - compatible = "mti,gic-timer"; - interrupts = ; - clocks = <&sysc MT7621_CLK_CPU>; - }; - }; - - cpc: cpc@1fbf0000 { - compatible = "mti,mips-cpc"; - reg = <0x1fbf0000 0x8000>; - }; - - cdmm: cdmm@1fbf8000 { - compatible = "mti,mips-cdmm"; - reg = <0x1fbf8000 0x8000>; - }; - - ethernet: ethernet@1e100000 { - compatible = "mediatek,mt7621-eth"; - reg = <0x1e100000 0x10000>; - - clocks = <&sysc MT7621_CLK_FE>, - <&sysc MT7621_CLK_ETH>; - clock-names = "fe", "ethif"; - - #address-cells = <1>; - #size-cells = <0>; - - resets = <&sysc MT7621_RST_FE &sysc MT7621_RST_ETH>; - reset-names = "fe", "eth"; - - interrupt-parent = <&gic>; - interrupts = ; - - mediatek,ethsys = <&sysc>; - - pinctrl-names = "default"; - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>, <&rgmii2_pins>; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "trgmii"; - - fixed-link { - speed = <1000>; - full-duplex; - pause; - }; - }; - - gmac1: mac@1 { - compatible = "mediatek,eth-mac"; - reg = <1>; - status = "off"; - phy-mode = "rgmii-rxid"; - }; - - mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - - switch0: switch0@0 { - compatible = "mediatek,mt7621"; - reg = <0>; - mediatek,mcm; - resets = <&sysc MT7621_RST_MCM>; - reset-names = "mcm"; - interrupt-controller; - #interrupt-cells = <1>; - interrupt-parent = <&gic>; - interrupts = ; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - status = "off"; - reg = <0>; - label = "lan0"; - }; - - port@1 { - status = "off"; - reg = <1>; - label = "lan1"; - }; - - port@2 { - status = "off"; - reg = <2>; - label = "lan2"; - }; - - port@3 { - status = "off"; - reg = <3>; - label = "lan3"; - }; - - port@4 { - status = "off"; - reg = <4>; - label = "lan4"; - }; - - port@6 { - reg = <6>; - label = "cpu"; - ethernet = <&gmac0>; - phy-mode = "trgmii"; - - fixed-link { - speed = <1000>; - full-duplex; - pause; - }; - }; - }; - }; - }; - }; - - pcie: pcie@1e140000 { - compatible = "mediatek,mt7621-pci"; - reg = <0x1e140000 0x100>, /* host-pci bridge registers */ - <0x1e142000 0x100>, /* pcie port 0 RC control registers */ - <0x1e143000 0x100>, /* pcie port 1 RC control registers */ - <0x1e144000 0x100>; /* pcie port 2 RC control registers */ - #address-cells = <3>; - #size-cells = <2>; - - pinctrl-names = "default"; - pinctrl-0 = <&pcie_pins>; - - device_type = "pci"; - - ranges = <0x02000000 0 0x60000000 0x60000000 0 0x10000000>, /* pci memory */ - <0x01000000 0 0x00000000 0x1e160000 0 0x00010000>; /* io space */ - - #interrupt-cells = <1>; - interrupt-map-mask = <0xF800 0 0 0>; - interrupt-map = <0x0000 0 0 0 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>, - <0x0800 0 0 0 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>, - <0x1000 0 0 0 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; - - status = "disabled"; - - reset-gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - - pcie@0,0 { - reg = <0x0000 0 0 0 0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - #interrupt-cells = <1>; - interrupt-map-mask = <0 0 0 0>; - interrupt-map = <0 0 0 0 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>; - resets = <&sysc MT7621_RST_PCIE0>; - clocks = <&sysc MT7621_CLK_PCIE0>; - phys = <&pcie0_phy 1>; - phy-names = "pcie-phy0"; - ranges; - }; - - pcie@1,0 { - reg = <0x0800 0 0 0 0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - #interrupt-cells = <1>; - interrupt-map-mask = <0 0 0 0>; - interrupt-map = <0 0 0 0 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>; - resets = <&sysc MT7621_RST_PCIE1>; - clocks = <&sysc MT7621_CLK_PCIE1>; - phys = <&pcie0_phy 1>; - phy-names = "pcie-phy1"; - ranges; - }; - - pcie@2,0 { - reg = <0x1000 0 0 0 0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - #interrupt-cells = <1>; - interrupt-map-mask = <0 0 0 0>; - interrupt-map = <0 0 0 0 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; - resets = <&sysc MT7621_RST_PCIE2>; - clocks = <&sysc MT7621_CLK_PCIE2>; - phys = <&pcie2_phy 0>; - phy-names = "pcie-phy2"; - ranges; - }; - }; - - pcie0_phy: pcie-phy@1e149000 { - compatible = "mediatek,mt7621-pci-phy"; - reg = <0x1e149000 0x0700>; - clocks = <&sysc MT7621_CLK_XTAL>; - #phy-cells = <1>; - }; - - pcie2_phy: pcie-phy@1e14a000 { - compatible = "mediatek,mt7621-pci-phy"; - reg = <0x1e14a000 0x0700>; - clocks = <&sysc MT7621_CLK_XTAL>; - #phy-cells = <1>; - }; -}; -- cgit From 9b63000010a0ec3196bd6ecac5b828ba6e6b65dd Mon Sep 17 00:00:00 2001 From: Xiaoke Wang Date: Wed, 16 Mar 2022 01:24:12 +0800 Subject: staging: mmal-vchiq: clear redundant item named bulk_scratch bulk_scratch is not used anywhere and the original allocation of it does not have proper check. Deleting it directly seems to be a good choice. Reviewed-by: Dan Carpenter Signed-off-by: Xiaoke Wang Link: https://lore.kernel.org/r/tencent_F721901366AB5C720E008AF7F02DA5D3FF07@qq.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index cb6cdbfaf6ec..70c9d5544b56 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -168,9 +168,6 @@ struct vchiq_mmal_instance { /* ensure serialised access to service */ struct mutex vchiq_mutex; - /* vmalloc page to receive scratch bulk xfers into */ - void *bulk_scratch; - struct idr context_map; /* protect accesses to context_map */ struct mutex context_map_lock; @@ -1847,8 +1844,6 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) flush_workqueue(instance->bulk_wq); destroy_workqueue(instance->bulk_wq); - vfree(instance->bulk_scratch); - idr_destroy(&instance->context_map); kfree(instance); @@ -1908,7 +1903,6 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) mutex_init(&instance->vchiq_mutex); - instance->bulk_scratch = vmalloc(PAGE_SIZE); instance->vchiq_instance = vchiq_instance; mutex_init(&instance->context_map_lock); @@ -1939,7 +1933,6 @@ err_close_services: vchiq_close_service(instance->service_handle); destroy_workqueue(instance->bulk_wq); err_free: - vfree(instance->bulk_scratch); kfree(instance); err_shutdown_vchiq: vchiq_shutdown(vchiq_instance); -- cgit From 0e8cf2be5c0a324809389c81e5555e8ccb6ba123 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Wed, 16 Mar 2022 18:53:50 +0200 Subject: staging: fbtft: Constify buf parameter in fbtft_dbg_hex() It's obvious that we don't and shouldn't modify buffer that is about to be dumped. Constify parameter in fbtft_dbg_hex() to make it clear. Fixes: c296d5f9957c ("staging: fbtft: core support") Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220316165351.58107-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 2 +- drivers/staging/fbtft/fbtft.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index f2684d2d6851..6dc77895a87c 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -49,7 +49,7 @@ int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc) EXPORT_SYMBOL(fbtft_write_buf_dc); void fbtft_dbg_hex(const struct device *dev, int groupsize, - void *buf, size_t len, const char *fmt, ...) + const void *buf, size_t len, const char *fmt, ...) { va_list args; static char textbuf[512]; diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 6a7545b5bcd2..473523dea838 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -240,7 +240,7 @@ struct fbtft_par { int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc); __printf(5, 6) void fbtft_dbg_hex(const struct device *dev, int groupsize, - void *buf, size_t len, const char *fmt, ...); + const void *buf, size_t len, const char *fmt, ...); struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, struct device *dev, struct fbtft_platform_data *pdata); -- cgit From 362e54e48b783d6f6ef4b9793903d02d449508aa Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Wed, 16 Mar 2022 18:53:51 +0200 Subject: staging: fbtft: Consider type of init sequence values in fbtft_init_display() In the fbtft_init_display() the init sequence is printed for the debug purposes. Unfortunately the current code doesn't take into account that values in the buffer are of the s16 type. Consider that and replace the printing code with fbtft_par_dbg_hex() call. Fixes: b888897014a9 ("staging/fbtft: Remove all strcpy() uses") Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220316165351.58107-2-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 6dc77895a87c..3b182115bd6e 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -1034,10 +1034,9 @@ int fbtft_init_display(struct fbtft_par *par) for (j = 0; par->init_sequence[i + 1 + j] >= 0; j++) ; - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, - "init: write(0x%02X) %*ph\n", - par->init_sequence[i], j, - &par->init_sequence[i + 1]); + fbtft_par_dbg_hex(DEBUG_INIT_DISPLAY, par, par->info->device, + s16, &par->init_sequence[i + 1], j, + "init: write(0x%02X)", par->init_sequence[i]); /* Write */ j = 0; -- cgit From 9314a822e56422f419e2b514ba1f355843ce3063 Mon Sep 17 00:00:00 2001 From: Nam Cao Date: Wed, 16 Mar 2022 22:49:41 +0000 Subject: staging: sm750fb: fix naming style Fix CamelCase names defined in ddk750_dvi.c and ddk750_dvi.h, as reported by checkpatch.pl. Remove name suffixes such as pfn_ and g_. Signed-off-by: Nam Cao Link: https://lore.kernel.org/r/20220316224940.70107-1-cvn249@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/ddk750_dvi.c | 68 ++++++++++++++++++------------------ drivers/staging/sm750fb/ddk750_dvi.h | 64 ++++++++++++++++----------------- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index cd564ea40779..029d9acec47d 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -11,50 +11,50 @@ * function API. Please set the function pointer to NULL whenever the function * is not supported. */ -static struct dvi_ctrl_device g_dcftSupportedDviController[] = { +static struct dvi_ctrl_device dcft_supported_dvi_controller[] = { #ifdef DVI_CTRL_SII164 { - .pfnInit = sii164InitChip, - .pfnGetVendorId = sii164GetVendorID, - .pfnGetDeviceId = sii164GetDeviceID, + .init = sii164InitChip, + .get_vendor_id = sii164GetVendorID, + .get_device_id = sii164GetDeviceID, #ifdef SII164_FULL_FUNCTIONS - .pfnResetChip = sii164ResetChip, - .pfnGetChipString = sii164GetChipString, - .pfnSetPower = sii164SetPower, - .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection, - .pfnIsConnected = sii164IsConnected, - .pfnCheckInterrupt = sii164CheckInterrupt, - .pfnClearInterrupt = sii164ClearInterrupt, + .reset_chip = sii164ResetChip, + .get_chip_string = sii164GetChipString, + .set_power = sii164SetPower, + .enable_hot_plug_detection = sii164EnableHotPlugDetection, + .is_connected = sii164IsConnected, + .check_interrupt = sii164CheckInterrupt, + .clear_interrupt = sii164ClearInterrupt, #endif }, #endif }; -int dviInit(unsigned char edge_select, - unsigned char bus_select, - unsigned char dual_edge_clk_select, - unsigned char hsync_enable, - unsigned char vsync_enable, - unsigned char deskew_enable, - unsigned char deskew_setting, - unsigned char continuous_sync_enable, - unsigned char pll_filter_enable, - unsigned char pll_filter_value) +int dvi_init(unsigned char edge_select, + unsigned char bus_select, + unsigned char dual_edge_clk_select, + unsigned char hsync_enable, + unsigned char vsync_enable, + unsigned char deskew_enable, + unsigned char deskew_setting, + unsigned char continuous_sync_enable, + unsigned char pll_filter_enable, + unsigned char pll_filter_value) { - struct dvi_ctrl_device *pCurrentDviCtrl; + struct dvi_ctrl_device *current_dvi_ctrl; - pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl->pfnInit) { - return pCurrentDviCtrl->pfnInit(edge_select, - bus_select, - dual_edge_clk_select, - hsync_enable, - vsync_enable, - deskew_enable, - deskew_setting, - continuous_sync_enable, - pll_filter_enable, - pll_filter_value); + current_dvi_ctrl = dcft_supported_dvi_controller; + if (current_dvi_ctrl->init) { + return current_dvi_ctrl->init(edge_select, + bus_select, + dual_edge_clk_select, + hsync_enable, + vsync_enable, + deskew_enable, + deskew_setting, + continuous_sync_enable, + pll_filter_enable, + pll_filter_value); } return -1; /* error */ } diff --git a/drivers/staging/sm750fb/ddk750_dvi.h b/drivers/staging/sm750fb/ddk750_dvi.h index 1c7a565b617a..c2518b73bdbd 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.h +++ b/drivers/staging/sm750fb/ddk750_dvi.h @@ -4,54 +4,54 @@ /* dvi chip stuffs structros */ -typedef long (*PFN_DVICTRL_INIT)(unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue); +typedef long (*PFN_DVICTRL_INIT)(unsigned char edge_select, + unsigned char bus_select, + unsigned char dual_edge_clk_select, + unsigned char hsync_enable, + unsigned char vsync_enable, + unsigned char deskew_enable, + unsigned char deskew_setting, + unsigned char continuous_sync_enable, + unsigned char pll_filter_enable, + unsigned char pll_filter_value); typedef void (*PFN_DVICTRL_RESETCHIP)(void); typedef char* (*PFN_DVICTRL_GETCHIPSTRING)(void); typedef unsigned short (*PFN_DVICTRL_GETVENDORID)(void); typedef unsigned short (*PFN_DVICTRL_GETDEVICEID)(void); -typedef void (*PFN_DVICTRL_SETPOWER)(unsigned char powerUp); -typedef void (*PFN_DVICTRL_HOTPLUGDETECTION)(unsigned char enableHotPlug); +typedef void (*PFN_DVICTRL_SETPOWER)(unsigned char power_up); +typedef void (*PFN_DVICTRL_HOTPLUGDETECTION)(unsigned char enable_hot_plug); typedef unsigned char (*PFN_DVICTRL_ISCONNECTED)(void); typedef unsigned char (*PFN_DVICTRL_CHECKINTERRUPT)(void); typedef void (*PFN_DVICTRL_CLEARINTERRUPT)(void); /* Structure to hold all the function pointer to the DVI Controller. */ struct dvi_ctrl_device { - PFN_DVICTRL_INIT pfnInit; - PFN_DVICTRL_RESETCHIP pfnResetChip; - PFN_DVICTRL_GETCHIPSTRING pfnGetChipString; - PFN_DVICTRL_GETVENDORID pfnGetVendorId; - PFN_DVICTRL_GETDEVICEID pfnGetDeviceId; - PFN_DVICTRL_SETPOWER pfnSetPower; - PFN_DVICTRL_HOTPLUGDETECTION pfnEnableHotPlugDetection; - PFN_DVICTRL_ISCONNECTED pfnIsConnected; - PFN_DVICTRL_CHECKINTERRUPT pfnCheckInterrupt; - PFN_DVICTRL_CLEARINTERRUPT pfnClearInterrupt; + PFN_DVICTRL_INIT init; + PFN_DVICTRL_RESETCHIP reset_chip; + PFN_DVICTRL_GETCHIPSTRING get_chip_string; + PFN_DVICTRL_GETVENDORID get_vendor_id; + PFN_DVICTRL_GETDEVICEID get_device_id; + PFN_DVICTRL_SETPOWER set_power; + PFN_DVICTRL_HOTPLUGDETECTION enable_hot_plug_detection; + PFN_DVICTRL_ISCONNECTED is_connected; + PFN_DVICTRL_CHECKINTERRUPT check_interrupt; + PFN_DVICTRL_CLEARINTERRUPT clear_interrupt; }; #define DVI_CTRL_SII164 /* dvi functions prototype */ -int dviInit(unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue); +int dvi_init(unsigned char edge_select, + unsigned char bus_select, + unsigned char dual_edge_clk_select, + unsigned char hsync_enable, + unsigned char vsync_enable, + unsigned char deskew_enable, + unsigned char deskew_setting, + unsigned char continuous_sync_enable, + unsigned char pll_filter_enable, + unsigned char pll_filter_value); #endif -- cgit From 56bd392be52eec994a6d191ce3d798cf83c34133 Mon Sep 17 00:00:00 2001 From: Charlie Sands Date: Wed, 16 Mar 2022 22:53:12 -0400 Subject: staging: rts5208: Resolve checkpatch.pl issues. This patch removes unwanted use of dev_info for ftrace-like functionality as suggested by checkpatch.pl. Signed-off-by: Charlie Sands Link: https://lore.kernel.org/r/YjKimAdiRfRVfGl8@sckzor-linux.localdomain Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/rtsx.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c index 5a58dac76c88..2284a96abcff 100644 --- a/drivers/staging/rts5208/rtsx.c +++ b/drivers/staging/rts5208/rtsx.c @@ -159,8 +159,6 @@ static int command_abort(struct scsi_cmnd *srb) struct rtsx_dev *dev = host_to_rtsx(host); struct rtsx_chip *chip = dev->chip; - dev_info(&dev->pci->dev, "%s called\n", __func__); - scsi_lock(host); /* Is this command still active? */ @@ -186,10 +184,6 @@ static int command_abort(struct scsi_cmnd *srb) */ static int device_reset(struct scsi_cmnd *srb) { - struct rtsx_dev *dev = host_to_rtsx(srb->device->host); - - dev_info(&dev->pci->dev, "%s called\n", __func__); - return SUCCESS; } @@ -968,8 +962,6 @@ static void rtsx_remove(struct pci_dev *pci) { struct rtsx_dev *dev = pci_get_drvdata(pci); - dev_info(&pci->dev, "%s called\n", __func__); - quiesce_and_remove_host(dev); release_everything(dev); pci_release_regions(pci); -- cgit From 832ce36f44a2c5dd3cb6be6dfb9003715f8dca2a Mon Sep 17 00:00:00 2001 From: Song Chen Date: Fri, 18 Mar 2022 17:57:12 +0800 Subject: staging: greybus: introduce pwm_ops::apply Introduce newer .apply function in pwm_ops to replace legacy operations including enable, disable, config and set_polarity. This guarantees atomic changes of the pwm controller configuration. Reviewed-by: Alex Elder Signed-off-by: Song Chen Link: https://lore.kernel.org/r/1647597432-27586-1-git-send-email-chensong_2000@189.cn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/pwm.c | 64 +++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c index 891a6a672378..ad20ec24031e 100644 --- a/drivers/staging/greybus/pwm.c +++ b/drivers/staging/greybus/pwm.c @@ -204,43 +204,59 @@ static void gb_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) gb_pwm_deactivate_operation(pwmc, pwm->hwpwm); } -static int gb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, - int duty_ns, int period_ns) +static int gb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + const struct pwm_state *state) { + int err; + bool enabled = pwm->state.enabled; + u64 period = state->period; + u64 duty_cycle = state->duty_cycle; struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip); - return gb_pwm_config_operation(pwmc, pwm->hwpwm, duty_ns, period_ns); -}; + /* Set polarity */ + if (state->polarity != pwm->state.polarity) { + if (enabled) { + gb_pwm_disable_operation(pwmc, pwm->hwpwm); + enabled = false; + } + err = gb_pwm_set_polarity_operation(pwmc, pwm->hwpwm, state->polarity); + if (err) + return err; + } -static int gb_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) -{ - struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip); + if (!state->enabled) { + if (enabled) + gb_pwm_disable_operation(pwmc, pwm->hwpwm); + return 0; + } - return gb_pwm_set_polarity_operation(pwmc, pwm->hwpwm, polarity); -}; + /* + * Set period and duty cycle + * + * PWM privodes 64-bit period and duty_cycle, but greybus only accepts + * 32-bit, so their values have to be limited to U32_MAX. + */ + if (period > U32_MAX) + period = U32_MAX; -static int gb_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) -{ - struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip); + if (duty_cycle > period) + duty_cycle = period; - return gb_pwm_enable_operation(pwmc, pwm->hwpwm); -}; + err = gb_pwm_config_operation(pwmc, pwm->hwpwm, duty_cycle, period); + if (err) + return err; -static void gb_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) -{ - struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip); + /* enable/disable */ + if (!enabled) + return gb_pwm_enable_operation(pwmc, pwm->hwpwm); - gb_pwm_disable_operation(pwmc, pwm->hwpwm); -}; + return 0; +} static const struct pwm_ops gb_pwm_ops = { .request = gb_pwm_request, .free = gb_pwm_free, - .config = gb_pwm_config, - .set_polarity = gb_pwm_set_polarity, - .enable = gb_pwm_enable, - .disable = gb_pwm_disable, + .apply = gb_pwm_apply, .owner = THIS_MODULE, }; -- cgit From 41197a5f11a4b2d11ac19bc62552022153032811 Mon Sep 17 00:00:00 2001 From: Wan Jiabing Date: Fri, 18 Mar 2022 17:24:48 +0800 Subject: staging: r8188eu: remove unnecessary memset in r8188eu psetauthparm and precvpriv->pallocated_recv_buf are allocated by kzalloc(). It is unnecessary to call memset again. Signed-off-by: Wan Jiabing Link: https://lore.kernel.org/r/20220318092459.519225-1-wanjiabing@vivo.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_mlme.c | 1 - drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 8d36ab955b96..6f0bff186477 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -1521,7 +1521,6 @@ int rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv) res = _FAIL; goto exit; } - memset(psetauthparm, 0, sizeof(struct setauth_parm)); psetauthparm->mode = (unsigned char)psecuritypriv->dot11AuthAlgrthm; pcmd->cmdcode = _SetAuth_CMD_; pcmd->parmbuf = (unsigned char *)psetauthparm; diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c index 322b4549a92d..727e1adce1dc 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c @@ -31,7 +31,6 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) res = _FAIL; goto exit; } - memset(precvpriv->pallocated_recv_buf, 0, NR_RECVBUFF * sizeof(struct recv_buf) + 4); precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(precvpriv->pallocated_recv_buf), 4); -- cgit