summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml12
-rw-r--r--Documentation/devicetree/bindings/staging/net/wireless/silabs,wfx.yaml (renamed from drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml)82
-rw-r--r--MAINTAINERS9
-rw-r--r--arch/mips/boot/dts/ralink/Makefile4
-rw-r--r--arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc1.dts (renamed from drivers/staging/mt7621-dts/gbpc1.dts)44
-rw-r--r--arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts122
-rw-r--r--arch/mips/boot/dts/ralink/mt7621.dtsi (renamed from drivers/staging/mt7621-dts/mt7621.dtsi)59
-rw-r--r--arch/mips/ralink/Kconfig5
-rw-r--r--drivers/clk/ralink/clk-mt7621.c92
-rw-r--r--drivers/mmc/core/quirks.h5
-rw-r--r--drivers/staging/Kconfig6
-rw-r--r--drivers/staging/Makefile3
-rw-r--r--drivers/staging/android/Kconfig19
-rw-r--r--drivers/staging/android/Makefile4
-rw-r--r--drivers/staging/android/TODO8
-rw-r--r--drivers/staging/android/ashmem.c970
-rw-r--r--drivers/staging/android/ashmem.h24
-rw-r--r--drivers/staging/android/uapi/ashmem.h43
-rw-r--r--drivers/staging/fbtft/fbtft-core.c9
-rw-r--r--drivers/staging/fbtft/fbtft.h2
-rw-r--r--drivers/staging/gdm724x/gdm_lte.c1
-rw-r--r--drivers/staging/gdm724x/hci_packet.h2
-rw-r--r--drivers/staging/greybus/pwm.c64
-rw-r--r--drivers/staging/greybus/sdio.c1
-rw-r--r--drivers/staging/gs_fpgaboot/Kconfig8
-rw-r--r--drivers/staging/gs_fpgaboot/Makefile3
-rw-r--r--drivers/staging/gs_fpgaboot/README70
-rw-r--r--drivers/staging/gs_fpgaboot/TODO7
-rw-r--r--drivers/staging/gs_fpgaboot/gs_fpgaboot.c394
-rw-r--r--drivers/staging/gs_fpgaboot/gs_fpgaboot.h41
-rw-r--r--drivers/staging/gs_fpgaboot/io.c105
-rw-r--r--drivers/staging/gs_fpgaboot/io.h73
-rw-r--r--drivers/staging/ks7010/ks7010_sdio.c4
-rw-r--r--drivers/staging/most/net/net.c2
-rw-r--r--drivers/staging/most/video/video.c2
-rw-r--r--drivers/staging/mt7621-dts/Kconfig11
-rw-r--r--drivers/staging/mt7621-dts/Makefile5
-rw-r--r--drivers/staging/mt7621-dts/TODO5
-rw-r--r--drivers/staging/mt7621-dts/gbpc2.dts22
-rw-r--r--drivers/staging/nvec/nvec.c4
-rw-r--r--drivers/staging/pi433/TODO4
-rw-r--r--drivers/staging/pi433/pi433_if.c176
-rw-r--r--drivers/staging/pi433/pi433_if.h2
-rw-r--r--drivers/staging/pi433/rf69.c169
-rw-r--r--drivers/staging/pi433/rf69.h3
-rw-r--r--drivers/staging/pi433/rf69_enum.h20
-rw-r--r--drivers/staging/pi433/rf69_registers.h2
-rw-r--r--drivers/staging/qlge/qlge_main.c11
-rw-r--r--drivers/staging/r8188eu/Makefile2
-rw-r--r--drivers/staging/r8188eu/core/rtw_ap.c240
-rw-r--r--drivers/staging/r8188eu/core/rtw_br_ext.c82
-rw-r--r--drivers/staging/r8188eu/core/rtw_cmd.c49
-rw-r--r--drivers/staging/r8188eu/core/rtw_fw.c314
-rw-r--r--drivers/staging/r8188eu/core/rtw_ieee80211.c41
-rw-r--r--drivers/staging/r8188eu/core/rtw_ioctl_set.c10
-rw-r--r--drivers/staging/r8188eu/core/rtw_iol.c14
-rw-r--r--drivers/staging/r8188eu/core/rtw_mlme.c106
-rw-r--r--drivers/staging/r8188eu/core/rtw_mlme_ext.c439
-rw-r--r--drivers/staging/r8188eu/core/rtw_p2p.c73
-rw-r--r--drivers/staging/r8188eu/core/rtw_pwrctrl.c47
-rw-r--r--drivers/staging/r8188eu/core/rtw_recv.c146
-rw-r--r--drivers/staging/r8188eu/core/rtw_rf.c62
-rw-r--r--drivers/staging/r8188eu/core/rtw_security.c193
-rw-r--r--drivers/staging/r8188eu/core/rtw_sta_mgt.c14
-rw-r--r--drivers/staging/r8188eu/core/rtw_wlan_util.c129
-rw-r--r--drivers/staging/r8188eu/core/rtw_xmit.c99
-rw-r--r--drivers/staging/r8188eu/hal/HalPhyRf_8188e.c185
-rw-r--r--drivers/staging/r8188eu/hal/HalPwrSeqCmd.c4
-rw-r--r--drivers/staging/r8188eu/hal/hal_com.c36
-rw-r--r--drivers/staging/r8188eu/hal/hal_intf.c3
-rw-r--r--drivers/staging/r8188eu/hal/odm.c118
-rw-r--r--drivers/staging/r8188eu/hal/odm_HWConfig.c44
-rw-r--r--drivers/staging/r8188eu/hal/odm_RegConfig8188E.c7
-rw-r--r--drivers/staging/r8188eu/hal/odm_debug.c6
-rw-r--r--drivers/staging/r8188eu/hal/rtl8188e_cmd.c46
-rw-r--r--drivers/staging/r8188eu/hal/rtl8188e_dm.c52
-rw-r--r--drivers/staging/r8188eu/hal/rtl8188e_hal_init.c403
-rw-r--r--drivers/staging/r8188eu/hal/rtl8188e_phycfg.c150
-rw-r--r--drivers/staging/r8188eu/hal/rtl8188e_rf6052.c24
-rw-r--r--drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c82
-rw-r--r--drivers/staging/r8188eu/hal/rtl8188eu_recv.c26
-rw-r--r--drivers/staging/r8188eu/hal/rtl8188eu_xmit.c22
-rw-r--r--drivers/staging/r8188eu/hal/usb_halinit.c432
-rw-r--r--drivers/staging/r8188eu/hal/usb_ops_linux.c60
-rw-r--r--drivers/staging/r8188eu/include/Hal8188EPhyCfg.h6
-rw-r--r--drivers/staging/r8188eu/include/HalVerDef.h23
-rw-r--r--drivers/staging/r8188eu/include/drv_types.h46
-rw-r--r--drivers/staging/r8188eu/include/hal_com.h3
-rw-r--r--drivers/staging/r8188eu/include/hal_intf.h48
-rw-r--r--drivers/staging/r8188eu/include/ieee80211.h271
-rw-r--r--drivers/staging/r8188eu/include/odm.h50
-rw-r--r--drivers/staging/r8188eu/include/odm_HWConfig.h39
-rw-r--r--drivers/staging/r8188eu/include/osdep_service.h50
-rw-r--r--drivers/staging/r8188eu/include/recv_osdep.h5
-rw-r--r--drivers/staging/r8188eu/include/rtl8188e_dm.h3
-rw-r--r--drivers/staging/r8188eu/include/rtl8188e_hal.h97
-rw-r--r--drivers/staging/r8188eu/include/rtl8188e_recv.h8
-rw-r--r--drivers/staging/r8188eu/include/rtl8188e_spec.h2
-rw-r--r--drivers/staging/r8188eu/include/rtl8188e_xmit.h4
-rw-r--r--drivers/staging/r8188eu/include/rtw_br_ext.h5
-rw-r--r--drivers/staging/r8188eu/include/rtw_cmd.h16
-rw-r--r--drivers/staging/r8188eu/include/rtw_debug.h8
-rw-r--r--drivers/staging/r8188eu/include/rtw_fw.h12
-rw-r--r--drivers/staging/r8188eu/include/rtw_mlme.h11
-rw-r--r--drivers/staging/r8188eu/include/rtw_mlme_ext.h6
-rw-r--r--drivers/staging/r8188eu/include/rtw_pwrctrl.h2
-rw-r--r--drivers/staging/r8188eu/include/rtw_recv.h61
-rw-r--r--drivers/staging/r8188eu/include/rtw_security.h112
-rw-r--r--drivers/staging/r8188eu/include/sta_info.h48
-rw-r--r--drivers/staging/r8188eu/include/usb_ops.h8
-rw-r--r--drivers/staging/r8188eu/include/wifi.h70
-rw-r--r--drivers/staging/r8188eu/include/wlan_bssdef.h2
-rw-r--r--drivers/staging/r8188eu/include/xmit_osdep.h2
-rw-r--r--drivers/staging/r8188eu/os_dep/ioctl_linux.c558
-rw-r--r--drivers/staging/r8188eu/os_dep/mlme_linux.c4
-rw-r--r--drivers/staging/r8188eu/os_dep/os_intfs.c91
-rw-r--r--drivers/staging/r8188eu/os_dep/osdep_service.c2
-rw-r--r--drivers/staging/r8188eu/os_dep/recv_linux.c35
-rw-r--r--drivers/staging/r8188eu/os_dep/usb_intf.c125
-rw-r--r--drivers/staging/r8188eu/os_dep/usb_ops_linux.c24
-rw-r--r--drivers/staging/r8188eu/os_dep/xmit_linux.c8
-rw-r--r--drivers/staging/rtl8192e/rtllib_debug.h54
-rw-r--r--drivers/staging/rtl8192e/rtllib_rx.c2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211.h9
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_module.c2
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c45
-rw-r--r--drivers/staging/rtl8712/rtl871x_recv.c4
-rw-r--r--drivers/staging/rtl8712/rtl871x_recv.h8
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_cmd.c54
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_mlme.c2
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_recv.c11
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_xmit.c5
-rw-r--r--drivers/staging/rtl8723bs/hal/hal_intf.c5
-rw-r--r--drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c3
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_recv.h11
-rw-r--r--drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c98
-rw-r--r--drivers/staging/rtl8723bs/os_dep/os_intfs.c6
-rw-r--r--drivers/staging/rts5208/ms.c9
-rw-r--r--drivers/staging/rts5208/rtsx.c8
-rw-r--r--drivers/staging/sm750fb/ddk750_dvi.c68
-rw-r--r--drivers/staging/sm750fb/ddk750_dvi.h64
-rw-r--r--drivers/staging/unisys/visorhba/visorhba_main.c2
-rw-r--r--drivers/staging/unisys/visorinput/visorinput.c3
-rw-r--r--drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c10
-rw-r--r--drivers/staging/vc04_services/interface/TODO56
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c37
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c137
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h2
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c4
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c7
-rw-r--r--drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c7
-rw-r--r--drivers/staging/vt6655/baseband.c80
-rw-r--r--drivers/staging/vt6655/card.c56
-rw-r--r--drivers/staging/vt6655/channel.c85
-rw-r--r--drivers/staging/vt6655/rf.c404
-rw-r--r--drivers/staging/vt6655/rxtx.c2
-rw-r--r--drivers/staging/vt6656/baseband.c40
-rw-r--r--drivers/staging/vt6656/card.c18
-rw-r--r--drivers/staging/vt6656/channel.c96
-rw-r--r--drivers/staging/vt6656/device.h11
-rw-r--r--drivers/staging/vt6656/mac.c14
-rw-r--r--drivers/staging/vt6656/mac.h22
-rw-r--r--drivers/staging/vt6656/rf.c413
-rw-r--r--drivers/staging/vt6656/rxtx.c8
-rw-r--r--drivers/staging/vt6656/usbpipe.c4
-rw-r--r--drivers/staging/vt6656/wcmd.c13
-rw-r--r--drivers/staging/wfx/Kconfig5
-rw-r--r--drivers/staging/wfx/Makefile4
-rw-r--r--drivers/staging/wfx/bh.c68
-rw-r--r--drivers/staging/wfx/bh.h1
-rw-r--r--drivers/staging/wfx/bus.h8
-rw-r--r--drivers/staging/wfx/bus_sdio.c105
-rw-r--r--drivers/staging/wfx/bus_spi.c126
-rw-r--r--drivers/staging/wfx/data_rx.c10
-rw-r--r--drivers/staging/wfx/data_rx.h5
-rw-r--r--drivers/staging/wfx/data_tx.c152
-rw-r--r--drivers/staging/wfx/data_tx.h20
-rw-r--r--drivers/staging/wfx/debug.c80
-rw-r--r--drivers/staging/wfx/debug.h6
-rw-r--r--drivers/staging/wfx/fwio.c116
-rw-r--r--drivers/staging/wfx/hif_api_cmd.h152
-rw-r--r--drivers/staging/wfx/hif_api_general.h64
-rw-r--r--drivers/staging/wfx/hif_api_mib.h68
-rw-r--r--drivers/staging/wfx/hif_rx.c171
-rw-r--r--drivers/staging/wfx/hif_tx.c201
-rw-r--r--drivers/staging/wfx/hif_tx.h67
-rw-r--r--drivers/staging/wfx/hif_tx_mib.c201
-rw-r--r--drivers/staging/wfx/hif_tx_mib.h67
-rw-r--r--drivers/staging/wfx/hwio.c168
-rw-r--r--drivers/staging/wfx/hwio.h35
-rw-r--r--drivers/staging/wfx/key.c84
-rw-r--r--drivers/staging/wfx/key.h5
-rw-r--r--drivers/staging/wfx/main.c267
-rw-r--r--drivers/staging/wfx/main.h12
-rw-r--r--drivers/staging/wfx/queue.c60
-rw-r--r--drivers/staging/wfx/queue.h13
-rw-r--r--drivers/staging/wfx/scan.c27
-rw-r--r--drivers/staging/wfx/sta.c201
-rw-r--r--drivers/staging/wfx/sta.h21
-rw-r--r--drivers/staging/wfx/traces.h33
-rw-r--r--drivers/staging/wfx/wfx.h102
-rw-r--r--include/dt-bindings/reset/mt7621-reset.h37
206 files changed, 3335 insertions, 9792 deletions
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]: <include/dt-bindings/reset/mt7621-reset.h>.
+
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",
diff --git a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml b/Documentation/devicetree/bindings/staging/net/wireless/silabs,wfx.yaml
index 510edd12ed19..105725a127ab 100644
--- a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml
+++ b/Documentation/devicetree/bindings/staging/net/wireless/silabs,wfx.yaml
@@ -3,7 +3,7 @@
%YAML 1.2
---
-$id: http://devicetree.org/schemas/net/wireless/silabs,wfx.yaml#
+$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
@@ -11,67 +11,79 @@ title: Silicon Labs WFxxx devicetree bindings
maintainers:
- Jérôme Pouiller <jerome.pouiller@silabs.com>
-description:
- The WFxxx chip series can be connected via SPI or via SDIO.
+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
- For SDIO':'
+ The WF200 can be connected via SPI or via 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).
+ For SDIO:
- 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
+ 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':'
+ 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:
- 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, <reg> 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
+
+ spi-max-frequency: true
+
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"
+ 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 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
+
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
- 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'.
+
+ local-mac-address: true
+
+ mac-address: true
+
+additionalProperties: false
required:
- compatible
@@ -82,12 +94,12 @@ examples:
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
- spi0 {
+ spi {
#address-cells = <1>;
#size-cells = <0>;
- wfx@0 {
- compatible = "silabs,wf200";
+ wifi@0 {
+ compatible = "silabs,brd8022a", "silabs,wf200";
pinctrl-names = "default";
pinctrl-0 = <&wfx_irq &wfx_gpios>;
reg = <0>;
@@ -109,13 +121,13 @@ examples:
reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
};
- mmc0 {
+ mmc {
mmc-pwrseq = <&wfx_pwrseq>;
#address-cells = <1>;
#size-cells = <0>;
- mmc@1 {
- compatible = "silabs,wf200";
+ wifi@1 {
+ compatible = "silabs,brd8022a", "silabs,wf200";
pinctrl-names = "default";
pinctrl-0 = <&wfx_wakeup>;
reg = <1>;
diff --git a/MAINTAINERS b/MAINTAINERS
index 1eb8cb996ed1..d42587c78d80 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1325,7 +1325,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 <miodrag.dinic@mips.com>
@@ -16460,6 +16459,13 @@ L: linux-mips@vger.kernel.org
S: Maintained
F: arch/mips/ralink
+RALINK MT7621 MIPS ARCHITECTURE
+M: Arınç ÜNAL <arinc.unal@arinc9.com>
+M: Sergio Paracuellos <sergio.paracuellos@gmail.com>
+L: linux-mips@vger.kernel.org
+S: Maintained
+F: arch/mips/boot/dts/ralink/mt7621*
+
RALINK RT2X00 WIRELESS LAN DRIVER
M: Stanislaw Gruszka <stf_xl@wp.pl>
M: Helmut Schaa <helmut.schaa@googlemail.com>
@@ -17940,6 +17946,7 @@ F: drivers/platform/x86/touchscreen_dmi.c
SILICON LABS WIRELESS DRIVERS (for WFxxx series)
M: Jérôme Pouiller <jerome.pouiller@silabs.com>
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/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/drivers/staging/mt7621-dts/gbpc1.dts b/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc1.dts
index e38a083811e5..5892bcf71595 100644
--- a/drivers/staging/mt7621-dts/gbpc1.dts
+++ b/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc1.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,23 +98,31 @@
};
&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";
};
};
};
+&ethernet {
+ pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>;
+};
+
&switch0 {
ports {
port@0 {
+ status = "okay";
label = "ethblack";
- status = "ok";
};
+
port@4 {
+ status = "okay";
label = "ethblue";
- status = "ok";
};
};
};
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 <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ 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 = <KEY_RESTART>;
+ };
+ };
+};
+
+&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";
+ };
+ };
+};
+
+&ethernet {
+ gmac1: mac@1 {
+ status = "okay";
+ phy-handle = <&ethphy7>;
+ };
+
+ 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/arch/mips/boot/dts/ralink/mt7621.dtsi
index 644a65d1a6a1..3222684915ac 100644
--- a/drivers/staging/mt7621-dts/mt7621.dtsi
+++ b/arch/mips/boot/dts/ralink/mt7621.dtsi
@@ -2,6 +2,7 @@
#include <dt-bindings/interrupt-controller/mips-gic.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/clock/mt7621-clk.h>
+#include <dt-bindings/reset/mt7621-reset.h>
/ {
#address-cells = <1>;
@@ -25,7 +26,7 @@
};
};
- cpuintc: cpuintc@0 {
+ cpuintc: cpuintc {
#address-cells = <0>;
#interrupt-cells = <1>;
interrupt-controller;
@@ -37,16 +38,16 @@
};
- mmc_fixed_3v3: fixedregulator@0 {
+ 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: fixedregulator@1 {
+ mmc_fixed_1v8_io: regulator-1v8 {
compatible = "regulator-fixed";
regulator-name = "mmc_io";
regulator-min-microvolt = <1800000>;
@@ -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";
@@ -266,8 +263,6 @@
};
xhci: xhci@1e1c0000 {
- status = "okay";
-
compatible = "mediatek,mt8173-xhci";
reg = <0x1e1c0000 0x1000
0x1e1d0700 0x0100>;
@@ -317,7 +312,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>;
@@ -325,44 +320,37 @@
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 = "rgmii";
+ 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";
- 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";
- #address-cells = <1>;
- #size-cells = <0>;
reg = <0>;
mediatek,mcm;
- resets = <&rstctrl 2>;
+ resets = <&sysc MT7621_RST_MCM>;
reset-names = "mcm";
interrupt-controller;
#interrupt-cells = <1>;
@@ -372,40 +360,47 @@
ports {
#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;
+ pause;
};
};
};
@@ -448,7 +443,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 +458,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 +473,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";
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/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 <linux/mfd/syscon.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
+#include <linux/reset-controller.h>
#include <linux/slab.h>
#include <dt-bindings/clock/mt7621-clk.h>
+#include <dt-bindings/reset/mt7621-reset.h>
/* 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);
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/Kconfig b/drivers/staging/Kconfig
index 8d41fdd40657..932acb4e8cbc 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -58,16 +58,12 @@ 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"
source "drivers/staging/fwserial/Kconfig"
-source "drivers/staging/gs_fpgaboot/Kconfig"
-
source "drivers/staging/unisys/Kconfig"
source "drivers/staging/clocking-wizard/Kconfig"
@@ -84,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 02b01949b94e..3ffb35ccfae2 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -19,11 +19,9 @@ 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/
-obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/
obj-$(CONFIG_UNISYSSPAR) += unisys/
obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/
obj-$(CONFIG_FB_TFT) += fbtft/
@@ -32,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/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 <greg@kroah.com> and Cc:
-Arve Hjønnevåg <arve@android.com> and Riley Andrews <riandrews@android.com>
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 <rlove@google.com>
- */
-
-#define pr_fmt(fmt) "ashmem: " fmt
-
-#include <linux/init.h>
-#include <linux/export.h>
-#include <linux/file.h>
-#include <linux/fs.h>
-#include <linux/falloc.h>
-#include <linux/miscdevice.h>
-#include <linux/security.h>
-#include <linux/mm.h>
-#include <linux/mman.h>
-#include <linux/uaccess.h>
-#include <linux/personality.h>
-#include <linux/bitops.h>
-#include <linux/mutex.h>
-#include <linux/shmem_fs.h>
-#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 <linux/limits.h>
-#include <linux/ioctl.h>
-#include <linux/compat.h>
-
-#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 <linux/ioctl.h>
-#include <linux/types.h>
-
-#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 */
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 4a35347b3020..9c4d797e7ae4 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];
@@ -1035,10 +1035,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;
diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index b68f5f9b7c78..2c2b5f1c1df3 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);
diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c
index 8ebb21d4b24b..671ee8843c88 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));
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 {
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,
};
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);
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<insop.song@gainspeed.com>
-and Greg Kroah-Hartman <gregkh@linuxfoundation.org>.
-And please CC to "Staging subsystem" mail list <devel@driverdev.osuosl.org> 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 <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/device.h>
-#include <linux/string.h>
-#include <linux/slab.h>
-#include <linux/fs.h>
-#include <linux/platform_device.h>
-#include <linux/of.h>
-#include <linux/delay.h>
-#include <linux/io.h>
-#include <linux/firmware.h>
-#include <asm/unaligned.h>
-
-#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 <linux/firmware.h>
-
-#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 <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/device.h>
-#include <linux/string.h>
-#include <linux/slab.h>
-#include <linux/fs.h>
-#include <linux/platform_device.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-#include <linux/firmware.h>
-#include <linux/io.h>
-
-#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);
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);
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;
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)
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 <neil@brown.name>
diff --git a/drivers/staging/mt7621-dts/gbpc2.dts b/drivers/staging/mt7621-dts/gbpc2.dts
deleted file mode 100644
index 6fe603c7711d..000000000000
--- a/drivers/staging/mt7621-dts/gbpc2.dts
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
-/dts-v1/;
-
-#include "gbpc1.dts"
-
-/ {
- compatible = "gnubee,gb-pc2", "mediatek,mt7621-soc";
- model = "GB-PC2";
-};
-
-&default_gpio {
- groups = "wdt", "uart3";
- function = "gpio";
-};
-
-&gmac1 {
- status = "ok";
-};
-
-&phy_external {
- status = "ok";
-};
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");
diff --git a/drivers/staging/pi433/TODO b/drivers/staging/pi433/TODO
index 63a40bfcc67e..5cf3fd99d521 100644
--- a/drivers/staging/pi433/TODO
+++ b/drivers/staging/pi433/TODO
@@ -1,5 +1,5 @@
-* 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!
* 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/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 1d31c35875e3..941aaa7eab2e 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -41,6 +41,8 @@
#ifdef CONFIG_COMPAT
#include <linux/compat.h>
#endif
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
#include "pi433_if.h"
#include "rf69.h"
@@ -108,6 +110,9 @@ struct pi433_device {
struct pi433_instance {
struct pi433_device *device;
struct pi433_tx_cfg tx_cfg;
+
+ /* control flags */
+ bool tx_cfg_initialized;
};
/*-------------------------------------------------------------------------*/
@@ -164,10 +169,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 +292,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);
@@ -359,8 +364,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;
@@ -400,8 +404,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;
@@ -411,7 +414,7 @@ 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 */
@@ -431,16 +434,16 @@ 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);
/* 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));
+ rf69_read_reg(spi, REG_IRQFLAGS1) &
+ MASK_IRQFLAGS1_RSSI);
if (retval) /* wait was interrupted */
goto abort;
dev->interrupt_rx_allowed = false;
@@ -464,11 +467,11 @@ 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);
}
@@ -485,7 +488,7 @@ 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);
}
@@ -502,12 +505,12 @@ 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 */
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 */
@@ -552,8 +555,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;
@@ -565,7 +567,7 @@ 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()));
@@ -581,7 +583,7 @@ 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;
}
@@ -589,7 +591,7 @@ 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;
}
@@ -626,7 +628,7 @@ 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
@@ -731,7 +733,7 @@ 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());
@@ -739,7 +741,7 @@ 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;
@@ -824,6 +826,16 @@ pi433_write(struct file *filp, const char __user *buf,
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)\n");
+ return -EINVAL;
+ }
+
+ /*
* write the following sequence into fifo:
* - tx_cfg
* - size of message
@@ -834,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;
@@ -857,19 +869,18 @@ 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;
}
-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;
@@ -897,6 +908,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 +961,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;
@@ -990,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]);
@@ -1028,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;
@@ -1090,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;
@@ -1112,20 +1186,20 @@ 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);
- /* 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;
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;
}
@@ -1162,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;
}
@@ -1192,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;
}
@@ -1221,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;
}
@@ -1229,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;
}
@@ -1237,13 +1311,17 @@ 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;
}
/* 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:
@@ -1267,6 +1345,9 @@ RX_failed:
static void 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);
@@ -1339,6 +1420,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);
@@ -1356,6 +1439,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/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.
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index d64df072d8e8..659c8c1b38fd 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -6,13 +6,6 @@
* Marcus Wolf <linux@wolf-entwicklungen.de>
*/
-/* 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
-
#include <linux/types.h>
#include <linux/spi/spi.h>
@@ -24,50 +17,19 @@
/*-------------------------------------------------------------------------*/
-static u8 rf69_read_reg(struct spi_device *spi, u8 addr)
+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));
}
/*-------------------------------------------------------------------------*/
@@ -102,6 +64,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[] = {
@@ -113,7 +80,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;
}
@@ -143,7 +110,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;
}
@@ -191,7 +158,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:
@@ -209,11 +176,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;
}
}
@@ -221,15 +188,21 @@ 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;
+ enum modulation mod;
+
+ // check if modulation is configured
+ mod = rf69_get_modulation(spi);
+ if (mod == UNDEF) {
+ dev_dbg(&spi->dev, "setBitRate: modulation is undefined\n");
+ return -EINVAL;
+ }
// check input value
- bit_rate_min = F_OSC / 8388608; // 8388608 = 2^23;
- if (bit_rate < bit_rate_min) {
- dev_dbg(&spi->dev, "setBitRate: illegal input param");
+ if (bit_rate < 1200 || (mod == OOK && bit_rate > 32768)) {
+ dev_dbg(&spi->dev, "setBitRate: illegal input param\n");
return -EINVAL;
}
@@ -273,7 +246,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;
}
@@ -290,7 +263,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;
}
@@ -323,7 +296,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;
}
@@ -404,7 +377,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;
}
@@ -429,7 +402,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;
}
@@ -445,7 +418,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;
}
}
@@ -463,7 +436,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;
}
@@ -478,14 +451,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;
}
@@ -543,7 +516,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;
}
@@ -590,7 +564,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;
}
@@ -604,49 +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 */
@@ -693,7 +624,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;
}
}
@@ -702,7 +633,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;
}
@@ -739,7 +670,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;
}
}
@@ -765,7 +696,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;
}
@@ -800,7 +731,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;
}
}
@@ -810,8 +741,8 @@ int rf69_set_fifo_threshold(struct spi_device *spi, u8 threshold)
int retval;
/* check input value */
- if (threshold & 0x80) {
- dev_dbg(&spi->dev, "set: illegal fifo threshold %u", threshold);
+ if (threshold & ~MASK_FIFO_THRESH_VALUE) {
+ dev_dbg(&spi->dev, "set: illegal fifo threshold %u\n", threshold);
return -EINVAL;
}
@@ -838,7 +769,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;
}
@@ -849,11 +780,9 @@ 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];
+ u8 local_buffer[FIFO_SIZE + 1] = {};
int retval;
if (size > FIFO_SIZE) {
@@ -871,10 +800,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);
@@ -883,9 +811,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) {
@@ -897,10 +823,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
+ dev_dbg(&spi->dev, "%d - 0x%x\n", i, buffer[i]);
return spi_write(spi, local_buffer, size + 1);
}
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index b648ba5fff89..78fa0b8bab8b 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -17,6 +17,8 @@
#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);
int rf69_set_modulation(struct spi_device *spi, enum modulation modulation);
@@ -40,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
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 */
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:
diff --git a/drivers/staging/r8188eu/Makefile b/drivers/staging/r8188eu/Makefile
index a7a486cc16dd..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 \
@@ -37,6 +36,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_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c
index 1675e2e8439c..2ff78ed1faab 100644
--- a/drivers/staging/r8188eu/core/rtw_ap.c
+++ b/drivers/staging/r8188eu/core/rtw_ap.c
@@ -55,86 +55,86 @@ 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);
}
@@ -179,9 +179,6 @@ 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);
-
spin_unlock_bh(&pstapriv->auth_list_lock);
spin_lock_bh(&pstapriv->sta_hash_lock);
@@ -249,16 +246,11 @@ 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);
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);
wakeup_sta_to_xmit(padapter, psta);
}
}
@@ -288,19 +280,16 @@ 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));
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);
psta->expire_to = 1;
continue;
}
psta->keep_alive_trycnt = 0;
- DBG_88E("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,9 +369,6 @@ 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);
-
/* bitmap[0:27] = tx_rate_bitmap */
/* bitmap[28:31]= Rate Adaptive id */
/* arg[0:4] = macid */
@@ -396,8 +382,6 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
psta->raid = raid;
psta->init_rate = init_rate;
- } else {
- DBG_88E("station aid %d exceed the max number\n", psta->aid);
}
}
@@ -455,7 +439,6 @@ 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);
/* bitmap[0:27] = tx_rate_bitmap */
/* bitmap[28:31]= Rate Adaptive id */
@@ -473,8 +456,6 @@ void update_bmc_sta(struct adapter *padapter)
psta->state = _FW_LINKED;
spin_unlock_bh(&psta->lock);
- } else {
- DBG_88E("add_RATid_bmc_sta error!\n");
}
}
@@ -496,7 +477,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 +532,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,8 +541,6 @@ 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);
-
if (!pmlmeinfo->ERP_enable)
return;
@@ -591,31 +564,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 +576,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)
@@ -667,24 +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)
{
- 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");
}
void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
@@ -704,24 +636,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,9 +679,6 @@ 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);
-
if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) &&
pmlmepriv->num_sta_ht_no_gf) {
pmlmepriv->ht_op_mode |=
@@ -811,15 +728,12 @@ 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);
-
return op_mode_changes;
}
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;
@@ -928,9 +842,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);
- DBG_88E("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--;
@@ -941,9 +852,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++;
}
- DBG_88E("%s STA %pM - no greenfield, num of non-gf stations %d\n",
- __func__, (psta->hwaddr),
- pmlmepriv->num_sta_ht_no_gf);
}
if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH_20_40) == 0) {
@@ -951,20 +859,12 @@ 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);
}
} else {
if (!psta->no_ht_set) {
psta->no_ht_set = 1;
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);
- }
}
if (rtw_ht_operation_update(padapter) > 0) {
@@ -972,10 +872,8 @@ 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);
-
- DBG_88E("%s, updated =%d\n", __func__, beacon_updated);
}
u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
@@ -1036,9 +934,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. */
-
- DBG_88E("%s, updated =%d\n", __func__, beacon_updated);
+ /* update associated stations cap. */
return beacon_updated;
}
@@ -1093,8 +989,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,8 +1130,6 @@ 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);
-
rtw_sta_flush(padapter);
/* free_assoc_sta_resources */
diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index 4951f835feaf..d68611ef22f8 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -71,10 +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) {
- _DEBUG_ERR("skb_tailroom() failed in add SID tag!\n");
+ if (skb_tailroom(skb) < data_len)
return -1;
- }
skb_put(skb, data_len);
/* have a room for new tag */
@@ -105,8 +103,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;
@@ -163,9 +160,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;
}
@@ -174,9 +168,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;
}
@@ -185,9 +176,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;
}
@@ -196,9 +184,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;
}
@@ -207,9 +192,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;
}
@@ -319,10 +301,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
*/
@@ -367,7 +345,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);
@@ -404,10 +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)) {
- DEBUG_WARN("NAT25: malformed IP packet !\n");
+ if (((unsigned char *)(iph) + (iph->ihl << 2)) >= (skb->data + ETH_HLEN + skb->len))
return -1;
- }
switch (method) {
case NAT25_CHECK:
@@ -418,12 +394,9 @@ 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);
-
- __nat25_db_print(priv);
return 0;
default:
return -1;
@@ -436,25 +409,19 @@ 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)) {
- DEBUG_WARN("NAT25: arp protocol unknown (%4x)!\n", be16_to_cpu(arp->ar_pro));
+ if (arp->ar_pro != htons(ETH_P_IP))
return -1;
- }
switch (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;
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;
@@ -484,18 +451,19 @@ 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)) {
- DEBUG_ERR("SID tag length too long!\n");
+ 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) {
- DEBUG_ERR("call skb_pull_and_merge() failed in PADI/R packet!\n");
+ 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);
}
@@ -510,15 +478,12 @@ 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");
+ 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);
@@ -529,14 +494,10 @@ 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);
- __nat25_db_print(priv);
-
if (!priv->ethBrExtInfo.addPPPoETag &&
priv->pppoe_connection_in_progress &&
!memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN))
@@ -576,10 +537,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)) {
- DEBUG_WARN("NAT25: malformed IPv6 packet !\n");
+ if (sizeof(*iph) >= (skb->len - ETH_HLEN))
return -1;
- }
switch (method) {
case NAT25_CHECK:
@@ -587,17 +546,9 @@ 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);
- __nat25_db_print(priv);
if (iph->nexthdr == IPPROTO_ICMPV6 &&
skb->len > (ETH_HLEN + sizeof(*iph) + 4)) {
@@ -669,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_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index 8bfb01c2ebb5..6eca30124ee8 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;
@@ -133,7 +132,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);
@@ -252,12 +251,8 @@ 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);
+ padapter->bSurpriseRemoved)
break;
- }
pcmd = rtw_dequeue_cmd(pcmdpriv);
if (!pcmd)
@@ -574,8 +569,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);
@@ -836,7 +829,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 +852,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;
@@ -951,10 +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) {
- DBG_88E("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status);
+ if (txdma_status != 0x00)
rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status);
- }
/* total xmit irp = 4 */
}
@@ -1335,9 +1318,10 @@ 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 */
- c2h_evt_clear(adapter);
+ rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE);
} else {
c2h_evt = kmalloc(16, GFP_KERNEL);
if (c2h_evt) {
@@ -1466,7 +1450,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;
@@ -1476,7 +1459,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_fw.c b/drivers/staging/r8188eu/core/rtw_fw.c
new file mode 100644
index 000000000000..625d186c3647
--- /dev/null
+++ b/drivers/staging/r8188eu/core/rtw_fw.c
@@ -0,0 +1,314 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright(c) 2007 - 2011 Realtek Corporation. */
+
+#include <linux/firmware.h>
+#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;
+
+ 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)
+ return _FAIL;
+
+ 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)
+ return _SUCCESS;
+ udelay(5);
+ } while (counter++ < POLLING_READY_TIMEOUT_COUNT);
+
+ 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;
+
+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;
+ }
+ fw_download_enable(padapter, false);
+ if (ret != _SUCCESS)
+ goto exit;
+
+ ret = fw_free_to_go(padapter);
+ 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 ad87954bdeb4..5a0e42ed4a47 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;
@@ -81,7 +81,7 @@ uint 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;
@@ -653,13 +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) {
- DBG_88E("short vendor specific information element ignored (len=%lu)\n",
- (unsigned long)elen);
- }
+ if (elen < 4)
return -1;
- }
oui = RTW_GET_BE24(pos);
switch (oui) {
@@ -674,11 +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) {
- DBG_88E("short WME information element ignored (len=%lu)\n",
- (unsigned long)elen);
+ if (elen < 5)
return -1;
- }
switch (pos[4]) {
case WME_OUI_SUBTYPE_INFORMATION_ELEMENT:
case WME_OUI_SUBTYPE_PARAMETER_ELEMENT:
@@ -690,8 +682,6 @@ 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);
return -1;
}
break;
@@ -701,8 +691,6 @@ 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);
return -1;
}
break;
@@ -714,14 +702,10 @@ 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);
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);
return -1;
}
return 0;
@@ -752,13 +736,8 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len,
elen = *pos++;
left -= 2;
- 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);
- }
+ if (elen > left)
return ParseFailed;
- }
switch (id) {
case WLAN_EID_SSID:
@@ -839,10 +818,6 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len,
break;
default:
unknown++;
- if (!show_errors)
- break;
- DBG_88E("IEEE 802.11 element parse ignored unknown element (id=%d elen=%d)\n",
- id, elen);
break;
}
left -= elen;
@@ -890,12 +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);
- DBG_88E("MAC Address from efuse error, assign random one !!!\n");
- }
-
- DBG_88E("rtw_macaddr_cfg 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 eadfbdb94dd5..4b78e42d180d 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 &&
@@ -122,7 +120,6 @@ 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));
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
goto handle_tkip_countermeasure;
else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
@@ -185,9 +182,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;
@@ -195,7 +189,6 @@ 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));
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
goto handle_tkip_countermeasure;
} else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
@@ -280,8 +273,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 +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)) {
- DBG_88E(FUNC_ADPT_FMT": scan deny\n", FUNC_ADPT_ARG(padapter));
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 7e78b47c1284..e14e3746efdd 100644
--- a/drivers/staging/r8188eu/core/rtw_iol.c
+++ b/drivers/staging/r8188eu/core/rtw_iol.c
@@ -11,14 +11,11 @@ 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) {
- DBG_88E("%s rtw_alloc_xmitframe return null\n", __func__);
+ if (!xmit_frame)
return NULL;
- }
xmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
if (!xmitbuf) {
- DBG_88E("%s rtw_alloc_xmitbuf return null\n", __func__);
rtw_free_xmitframe(pxmitpriv, xmit_frame);
return NULL;
}
@@ -48,11 +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) {
- 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);
+ 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;
@@ -66,8 +60,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/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index 394e8a5ce03c..6f0bff186477 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);
}
@@ -577,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;
@@ -616,10 +610,8 @@ 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);
+ 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)
@@ -674,7 +666,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);
@@ -684,16 +675,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);
@@ -734,8 +721,6 @@ 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);
if (rtw_to_roaming(adapter) != 0) {
if (--pmlmepriv->to_roaming == 0 ||
_SUCCESS != rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) {
@@ -909,7 +894,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 +953,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 */
@@ -1017,7 +999,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;
@@ -1026,8 +1007,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);
@@ -1092,8 +1071,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;
@@ -1196,7 +1175,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,8 +1218,6 @@ 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);
-
if (mac_id >= 0) {
u16 media_status;
media_status = (mac_id << 8) | 0; /* MACID|OPMODE:0 means disconnect */
@@ -1330,8 +1307,6 @@ 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));
-
if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
return;
@@ -1341,15 +1316,11 @@ 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__);
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);
+ if (do_join_r != _SUCCESS)
continue;
- }
break;
} else {
- DBG_88E("%s We've try roaming but fail\n", __func__);
rtw_indicate_disconnect(adapter);
break;
}
@@ -1370,7 +1341,6 @@ 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));
spin_lock_bh(&pmlmepriv->lock);
_clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
spin_unlock_bh(&pmlmepriv->lock);
@@ -1385,7 +1355,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 */
}
@@ -1409,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);
}
@@ -1423,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();
@@ -1475,15 +1441,6 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
*candidate = competitor;
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));
- }
exit:
return updated;
@@ -1520,19 +1477,12 @@ 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__);
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);
}
/* check for situation of _FW_LINKED */
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
- DBG_88E("%s: _FW_LINKED while ask_for_joinbss!!!\n", __func__);
-
rtw_disassoc_cmd(adapter, 0, true);
rtw_indicate_disconnect(adapter);
rtw_free_assoc_resources(adapter, 0);
@@ -1542,10 +1492,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);
- DBG_88E("#### Opt_Ant_(%s), cur_Ant(%s)\n",
- (2 == candidate->network.PhyInfo.Optimum_antenna) ? "A" : "B",
- (2 == cur_ant) ? "A" : "B"
- );
}
ret = rtw_joinbss_cmd(adapter, candidate);
@@ -1575,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;
@@ -1598,12 +1543,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;
@@ -1617,8 +1562,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);
- DBG_88E("==> rtw_set_key algorithm(%x), keyid(%x), key_mask(%x)\n",
- psetkeyparm->algorithm, psetkeyparm->keyid, pmlmepriv->key_mask);
switch (psetkeyparm->algorithm) {
case _WEP40_:
@@ -1853,11 +1796,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)
{
@@ -1890,14 +1828,12 @@ 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};
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;
@@ -1922,16 +1858,12 @@ 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
*/
- 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));
@@ -1970,8 +1902,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)
@@ -2021,8 +1951,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)
- DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __func__);
/* Config current HT Protection mode. */
pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3;
@@ -2057,7 +1985,6 @@ 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);
psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority);
rtw_addbareq_cmd(padapter, (u8)priority, pattrib->ra);
}
@@ -2085,9 +2012,6 @@ 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);
memcpy(&pmlmepriv->assoc_ssid, &pnetwork->network.Ssid, sizeof(struct ndis_802_11_ssid));
pmlmepriv->assoc_by_bssid = false;
@@ -2097,13 +2021,11 @@ 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);
pmlmepriv->to_roaming--;
if (0 < pmlmepriv->to_roaming) {
continue;
} else {
- DBG_88E("%s(%d) -to roaming fail, indicate_disconnect\n", __func__, __LINE__);
rtw_indicate_disconnect(padapter);
break;
}
diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index a9141ab1690e..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 <linux/ieee80211.h>
#include "../include/osdep_service.h"
#include "../include/drv_types.h"
#include "../include/wifi.h"
@@ -314,10 +315,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) {
- DBG_88E("ChannelPlan ID %x error !!!!!\n", ChannelPlan);
+ 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;
@@ -416,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. */
@@ -434,35 +433,20 @@ 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 */
- DBG_88E("Drop duplicate management frame with seq_num=%d.\n", precv_frame->attrib.seq_num);
return;
- }
}
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);
- if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
- rtw_hostapd_mlme_rx(padapter, precv_frame);
- break;
}
+ _mgt_dispatcher(padapter, ptable, precv_frame);
}
static u32 p2p_listen_state_process(struct adapter *padapter, unsigned char *da)
@@ -586,7 +570,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) {
- DBG_88E("[%s] P2P State is GONEGO ING!\n", __func__);
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);
@@ -594,7 +577,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) {
- DBG_88E("[%s] P2P_STATE_TX_INVITE_REQ!\n", __func__);
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);
@@ -656,8 +638,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;
@@ -720,24 +700,18 @@ 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);
-
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 */
- 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]);
status = _STATS_NO_SUPP_ALG_;
@@ -752,10 +726,8 @@ 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);
pstat = rtw_alloc_stainfo(pstapriv, sa);
if (!pstat) {
- DBG_88E(" Exceed the upper limit of supported clients...\n");
status = _STATS_UNABLE_HANDLE_STA_;
goto auth_fail;
}
@@ -786,8 +758,6 @@ 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);
status = _STATS_OUT_OF_AUTH_SEQ_;
goto auth_fail;
}
@@ -799,8 +769,6 @@ 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);
status = _STATS_OUT_OF_AUTH_SEQ_;
goto auth_fail;
}
@@ -814,13 +782,11 @@ 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");
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");
status = _STATS_CHALLENGE_FAIL_;
goto auth_fail;
}
@@ -831,13 +797,10 @@ 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");
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);
status = _STATS_OUT_OF_AUTH_SEQ_;
goto auth_fail;
}
@@ -877,8 +840,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;
@@ -892,7 +853,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) {
- DBG_88E("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;
@@ -934,7 +894,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;
}
@@ -947,7 +906,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];
@@ -971,19 +930,13 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame
return _FAIL;
frame_type = GetFrameSubType(pframe);
- if (frame_type == WIFI_ASSOCREQ) {
- reassoc = 0;
+ if (frame_type == WIFI_ASSOCREQ)
ie_offset = _ASOCREQ_IE_OFFSET_;
- } else { /* WIFI_REASSOCREQ */
- reassoc = 1;
+ else /* WIFI_REASSOCREQ */
ie_offset = _REASOCREQ_IE_OFFSET_;
- }
- 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);
+ if (pkt_len < IEEE80211_3ADDR_LEN + ie_offset)
return _FAIL;
- }
pstat = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe));
if (pstat == (struct sta_info *)NULL) {
@@ -996,8 +949,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)) {
@@ -1015,8 +966,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) {
- DBG_88E("STA %pM sent invalid association request\n",
- pstat->hwaddr);
status = _STATS_FAILURE_;
goto OnAssocReqFail;
}
@@ -1045,7 +994,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) {
- DBG_88E("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; */
@@ -1134,20 +1082,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) {
- DBG_88E("STA included WPS IE in "
- "(Re)Association Request - assume WPS is "
- "used\n");
+ 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 {
- DBG_88E("STA did not include WPA/RSN IE "
- "in (Re)Association Request - possible WPS "
- "use\n");
+ 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 */
@@ -1158,7 +1099,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) {
- DBG_88E("selected_registrar is false , or AP is not ready to do WPS\n");
status = _STATS_UNABLE_HANDLE_STA_;
@@ -1170,8 +1110,6 @@ 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);
status = WLAN_STATUS_INVALID_IE;
@@ -1179,9 +1117,6 @@ 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");
pstat->flags |= WLAN_STA_WPS;
copy_len = 0;
} else {
@@ -1263,16 +1198,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))) {
- DBG_88E("HT: %pM tried to "
- "use TKIP with HT association\n", pstat->hwaddr);
-
- /* 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) {
@@ -1311,9 +1236,7 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame
/* Customer proprietary IE */
/* get a unique AID */
- if (pstat->aid > 0) {
- DBG_88E(" old AID %d\n", pstat->aid);
- } else {
+ if (pstat->aid == 0) {
for (pstat->aid = 1; pstat->aid <= NUM_STA; pstat->aid++)
if (!pstapriv->sta_aid[pstat->aid - 1])
break;
@@ -1322,14 +1245,11 @@ 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");
-
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);
}
}
@@ -1364,7 +1284,6 @@ 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");
rtw_indicate_sta_assoc_event(padapter, pstat);
/* 3-(1) report sta add event */
@@ -1403,8 +1322,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;
@@ -1420,7 +1337,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) {
- DBG_88E("assoc reject, status code: %d\n", status);
pmlmeinfo->state = WIFI_FW_NULL_STATE;
res = -4;
goto report_assoc_result;
@@ -1500,16 +1416,10 @@ 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);
-
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
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;
@@ -1544,10 +1454,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);
}
@@ -1575,16 +1481,10 @@ 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);
-
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
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;
@@ -1602,10 +1502,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;
@@ -1614,7 +1510,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;
}
@@ -1628,8 +1523,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)
@@ -1673,7 +1566,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;
@@ -1682,8 +1575,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;
@@ -1701,7 +1592,6 @@ 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);
switch (action) {
case RTW_WLAN_ACTION_ADDBA_REQ: /* ADDBA request */
memcpy(&pmlmeinfo->ADDBA_req, &frame_body[2], sizeof(struct ADDBA_request));
@@ -1716,7 +1606,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 */
- DBG_88E("agg_enable for TID=%d\n", tid);
psta->htpriv.agg_enable_bitmap |= 1 << tid;
psta->htpriv.candidate_tid_bitmap &= ~BIT(tid);
} else {
@@ -1727,14 +1616,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;
}
- DBG_88E("%s(): DELBA: %x(%x)\n", __func__, pmlmeinfo->agg_enable_bitmap, reason_code);
/* todo: how to notify the host while receiving DELETE BA */
break;
default:
@@ -1778,7 +1665,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);
@@ -2114,7 +2000,6 @@ 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);
/* update attribute */
pattrib = &pmgntframe->attrib;
update_mgntframe_attrib(padapter, pattrib);
@@ -2472,7 +2357,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);
@@ -3072,7 +2956,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);
@@ -3148,16 +3031,9 @@ 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]);
-
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]);
if (!memcmp(peermacaddr, profileinfo->peermac, ETH_ALEN)) {
match_result = 1;
- DBG_88E("[%s] Match!\n", __func__);
break;
}
}
@@ -3708,17 +3584,12 @@ 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);
+ if ((seq_ctrl == mlmeext->action_public_rxseq) &&
+ (token == mlmeext->action_public_dialog_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);
+ if (seq_ctrl == mlmeext->action_public_rxseq)
return _FAIL;
- }
}
}
@@ -3759,7 +3630,6 @@ 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__);
memset(&pwdinfo->groupid_info, 0x00, sizeof(struct group_id_info));
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ))
@@ -3771,7 +3641,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));
- DBG_88E("[%s] Restore the previous p2p state to %d\n", __func__, rtw_p2p_state(pwdinfo));
}
/* Commented by Kurt 20110902 */
@@ -3792,8 +3661,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:
- DBG_88E("[%s] Got GO Nego Resp Frame\n", __func__);
-
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. */
@@ -3812,12 +3679,9 @@ 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 {
- DBG_88E("[%s] Skipped GO Nego Resp Frame (p2p_state != P2P_STATE_GONEGO_ING)\n", __func__);
}
break;
case P2P_GO_NEGO_CONF:
- DBG_88E("[%s] Got GO Nego Confirm Frame\n", __func__);
result = process_p2p_group_negotation_confirm(pwdinfo, frame_body, len);
if (P2P_STATUS_SUCCESS == result) {
if (rtw_p2p_role(pwdinfo) == P2P_ROLE_CLIENT) {
@@ -3831,7 +3695,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. */
- DBG_88E("[%s] Got invite request frame!\n", __func__);
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. */
@@ -3850,13 +3713,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) {
- 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]);
- }
-
if (invitation_flag & P2P_INVITATION_FLAGS_PERSISTENT) {
/* Re-invoke the persistent group. */
@@ -3902,7 +3758,6 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame)
}
}
} else {
- DBG_88E("[%s] P2P Group ID Attribute NOT FOUND!\n", __func__);
status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE;
}
} else {
@@ -3928,17 +3783,13 @@ 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__);
status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE;
}
}
} else {
- DBG_88E("[%s] P2P Invitation Flags Attribute NOT FOUND!\n", __func__);
status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE;
}
- DBG_88E("[%s] status_code = %d\n", __func__, status_code);
-
pwdinfo->inviteresp_info.token = frame_body[7];
issue_p2p_invitation_response(padapter, GetAddr2Ptr(pframe), pwdinfo->inviteresp_info.token, status_code);
}
@@ -3947,14 +3798,12 @@ 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__);
_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);
pwdinfo->invitereq_info.benable = false;
if (attr_content == P2P_STATUS_SUCCESS) {
@@ -3988,7 +3837,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:
- DBG_88E("[%s] Got Provisioning Discovery Request Frame\n", __func__);
process_p2p_provdisc_req(pwdinfo, pframe, len);
memcpy(pwdinfo->rx_prov_disc_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN);
@@ -4003,7 +3851,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?? */
- DBG_88E("[%s] Got Provisioning Discovery Response Frame\n", __func__);
/* 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);
@@ -4029,7 +3876,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;
@@ -4068,7 +3915,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;
}
@@ -4094,8 +3941,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;
@@ -4159,14 +4004,11 @@ struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv)
struct xmit_buf *pxmitbuf;
pmgntframe = rtw_alloc_xmitframe(pxmitpriv);
- if (!pmgntframe) {
- DBG_88E("%s, alloc xmitframe fail\n", __func__);
+ if (!pmgntframe)
return NULL;
- }
pxmitbuf = rtw_alloc_xmitbuf_ext(pxmitpriv);
if (!pxmitbuf) {
- DBG_88E("%s, alloc xmitbuf fail\n", __func__);
rtw_free_xmitframe(pxmitpriv, pmgntframe);
return NULL;
}
@@ -4188,7 +4030,6 @@ 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);
}
void update_mgntframe_attrib(struct adapter *padapter, struct pkt_attrib *pattrib)
@@ -4324,10 +4165,8 @@ void issue_beacon(struct adapter *padapter, int timeout_ms)
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
- if (!pmgntframe) {
- DBG_88E("%s, alloc mgnt frame fail\n", __func__);
+ if (!pmgntframe)
return;
- }
spin_lock_bh(&pmlmepriv->bcn_update_lock);
/* update attribute */
@@ -4507,14 +4346,11 @@ _issue_bcn:
spin_unlock_bh(&pmlmepriv->bcn_update_lock);
- if ((pattrib->pktlen + TXDESC_SIZE) > 512) {
- DBG_88E("beacon frame too large\n");
+ if ((pattrib->pktlen + TXDESC_SIZE) > 512)
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
@@ -4540,10 +4376,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) {
- DBG_88E("%s, alloc mgnt frame fail\n", __func__);
+ if (!pmgntframe)
return;
- }
/* update attribute */
pattrib = &pmgntframe->attrib;
@@ -4767,7 +4601,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);
@@ -4786,17 +4619,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)
- 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));
- 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));
- }
exit:
return ret;
}
@@ -4925,7 +4747,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);
}
@@ -4946,8 +4767,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;
@@ -5134,12 +4953,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;
- DBG_88E("network.SupportedRates[%d]=%02X\n", i, pmlmeinfo->network.SupportedRates[i]);
- }
-
- for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) {
- if (pmlmeinfo->network.SupportedRates[i] == 0)
- break;
/* Check if the AP's supported rates are also supported by STA. */
for (j = 0; j < sta_bssrate_len; j++) {
@@ -5149,17 +4962,12 @@ void issue_assocreq(struct adapter *padapter)
break;
}
- 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]);
- } else {
+ if (j != sta_bssrate_len)
/* the rate is supported by STA */
bssrate[index++] = pmlmeinfo->network.SupportedRates[i];
- }
}
bssrate_len = index;
- DBG_88E("bssrate_len=%d\n", bssrate_len);
if (bssrate_len == 0) {
rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
@@ -5444,7 +5252,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;
@@ -5468,17 +5275,6 @@ int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int pow
ret = _SUCCESS;
goto exit;
}
-
- 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));
- 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));
- }
exit:
return ret;
}
@@ -5497,8 +5293,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;
@@ -5564,7 +5358,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;
@@ -5588,17 +5381,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)
- 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));
- 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));
- }
exit:
return ret;
}
@@ -5668,7 +5450,6 @@ exit:
int issue_deauth(struct adapter *padapter, unsigned char *da, unsigned short reason)
{
- DBG_88E("%s to %pM\n", __func__, da);
return _issue_deauth(padapter, da, reason, false);
}
@@ -5677,7 +5458,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);
@@ -5695,17 +5475,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)
- 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));
- 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));
- }
exit:
return ret;
}
@@ -5719,7 +5488,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;
@@ -5732,8 +5500,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;
- DBG_88E("%s, category=%d, action=%d, status=%d\n", __func__, category, action, status);
-
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
if (!pmgntframe)
return;
@@ -5785,8 +5551,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;
- DBG_88E("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;
@@ -5798,24 +5562,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);
@@ -5868,8 +5615,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;
@@ -5994,7 +5739,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) {
- DBG_88E("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;
@@ -6003,7 +5747,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)) {
- DBG_88E("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);
@@ -6036,13 +5779,10 @@ 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));
return _FAIL;
} else {
- u32 passing_time = rtw_get_passing_time_ms(start);
+ 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));
return _SUCCESS;
}
}
@@ -6250,16 +5990,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) {
- DBG_88E("marc: cannot find SSID for survey event\n");
+ if (!p)
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);
+ if (len > NDIS_802_11_LENGTH_SSID)
return _FAIL;
- }
memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1));
bssid->Ssid.SsidLength = *(p + 1);
} else {
@@ -6272,20 +6008,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) {
- DBG_88E("%s()-%d: IE too long (%d) for survey event\n", __func__, __LINE__, len);
+ 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)) {
- DBG_88E("%s()-%d: IE too long (%d) for survey event\n", __func__, __LINE__, len);
+ if (len > (NDIS_802_11_LENGTH_RATES_EX - i))
return _FAIL;
- }
memcpy(bssid->SupportedRates + i, (p + 2), len);
}
@@ -6358,7 +6090,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;
@@ -6373,8 +6104,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); */
@@ -6400,7 +6130,6 @@ void start_create_ibss(struct adapter *padapter)
rtw_indicate_connect(padapter);
}
} else {
- DBG_88E("start_create_ibss, invalid cap:%x\n", caps);
return;
}
/* update bc/mc sta_info */
@@ -6430,7 +6159,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);
@@ -6446,8 +6175,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);
@@ -6485,7 +6213,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);
@@ -6515,8 +6242,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;
@@ -6774,8 +6499,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;
- DBG_88E("survey done event(%x)\n", psurveydone_evt->bss_cnt);
-
rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
}
@@ -6820,8 +6543,6 @@ 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);
-
rtw_joinbss_event_prehandle(padapter, (u8 *)&pjoinbss_evt->network);
rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
@@ -6876,8 +6597,6 @@ 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);
-
rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
}
@@ -6920,8 +6639,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;
- DBG_88E("report_add_sta_event: add STA\n");
-
rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
}
@@ -6990,7 +6707,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) {
@@ -7012,7 +6729,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);
@@ -7046,10 +6763,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)
@@ -7058,8 +6771,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 */
@@ -7124,25 +6835,7 @@ 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);
- DBG_88E("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;
@@ -7161,18 +6854,11 @@ static u8 chk_ap_is_alive(struct adapter *padapter, 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) {
- DBG_88E("%s REG_RXDMA_STATUS:0x%08x\n", __func__, rx_dma_status);
+ 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)
- DBG_88E("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !!\n", __func__, fw_status);
- else if (fw_status == 2)
- DBG_88E("%s REG_FW_STATUS (0x%02x), Condition_No_Match !!\n", __func__, fw_status);
+ rtw_read8(padapter, REG_FMETHR);
}
void linked_status_chk(struct adapter *padapter)
@@ -7184,9 +6870,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)) {
@@ -7201,7 +6884,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)
@@ -7246,8 +6929,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;
@@ -7308,15 +6989,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;
- DBG_88E("%s idx:%d, cnt:%u\n", __func__
- , 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
- );
}
pmlmeext->scan_abort = false;/* reset */
@@ -7346,7 +7020,6 @@ 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");
pmlmeinfo->state = WIFI_FW_NULL_STATE;
report_join_res(padapter, -3);
} else if (pmlmeinfo->state & WIFI_FW_AUTH_STATE) {
@@ -7357,7 +7030,6 @@ void link_timer_hdl(struct adapter *padapter)
return;
}
- DBG_88E("link_timer_hdl: auth timeout and try again\n");
pmlmeinfo->auth_seq = 1;
issue_auth(padapter, NULL, 0);
set_link_timer(pmlmeext, REAUTH_TO);
@@ -7369,7 +7041,6 @@ void link_timer_hdl(struct adapter *padapter)
return;
}
- DBG_88E("link_timer_hdl: assoc timeout and try again\n");
issue_assocreq(padapter);
set_link_timer(pmlmeext, REASSOC_TO);
}
@@ -7558,9 +7229,7 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf)
default:
pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
break;
- }
-
- DBG_88E("set ch/bw before connected\n");
+ }
}
}
break;
@@ -7605,8 +7274,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 */
@@ -7772,9 +7441,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;
@@ -7803,9 +7469,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;
@@ -7819,24 +7482,15 @@ 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);
-
- 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);
+ 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; */
- 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);
-
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");
return H2C_REJECTED;
}
}
@@ -7941,8 +7595,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_:
@@ -7960,7 +7612,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) {
- DBG_88E("issue_beacon, fail!\n");
return H2C_PARAMETERS_ERROR;
} else {
/* tx bc/mc frames after update TIM */
@@ -8019,10 +7670,6 @@ 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);
-
pmlmeext->cur_channel = set_ch_parm->ch;
pmlmeext->cur_ch_offset = set_ch_parm->ch_offset;
pmlmeext->cur_bwmode = set_ch_parm->bw;
diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c
index 7b30b9b64b41..48500fb82250 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;
@@ -826,17 +818,12 @@ 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__);
+ if (!p2p_ie)
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 +832,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 +990,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 +1068,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 +1085,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 +1102,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 +1139,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;
@@ -1173,17 +1154,15 @@ 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;
- DBG_88E("[%s] Change op ch to %02x as peer's\n", __func__, pwdinfo->operating_channel);
- } else {
+ 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);
- }
}
}
}
@@ -1208,9 +1187,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 {
- DBG_88E("[%s] WPS IE not Found!!\n", __func__);
+ 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);
}
@@ -1233,7 +1210,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 +1235,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)) {
@@ -1296,20 +1271,20 @@ 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)) {
- DBG_88E("[%s] Peer's operating channel = %d\n", __func__, operatingch_info[4]);
+ 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)) {
- 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;
@@ -1325,21 +1300,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;
- DBG_88E("[%s] Change op ch to %02x as peer's\n", __func__, pwdinfo->operating_channel);
- } else {
+ 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,13 +1346,10 @@ 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) {
- 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. */
@@ -1410,16 +1377,17 @@ 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]);
+ 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);
@@ -1655,7 +1623,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));
}
}
@@ -1725,7 +1692,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;
@@ -1739,7 +1705,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;
@@ -1779,8 +1744,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 {
- 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 46e44aee587f..7beabf82eb92 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -14,15 +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) {
- 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);
+ pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF)
return;
- }
mutex_lock(&pwrpriv->lock);
@@ -32,10 +25,8 @@ 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;
- netdev_dbg(padapter->pnetdev, "nolinked power save enter\n");
if (pwrpriv->ips_mode == IPS_LEVEL_2)
pwrpriv->bkeepfwalive = true;
@@ -62,16 +53,13 @@ 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) {
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);
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)) {
@@ -83,7 +71,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;
@@ -134,7 +121,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;
@@ -148,7 +134,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);
@@ -166,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;
@@ -186,10 +171,9 @@ static u8 PS_RDY_CHECK(struct adapter *padapter)
return false;
if (pwrpriv->bInSuspend)
return false;
- if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && !padapter->securitypriv.binstallGrpkey) {
- DBG_88E("Group handshake still in progress !!!\n");
+ if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X &&
+ !padapter->securitypriv.binstallGrpkey)
return false;
- }
return true;
}
@@ -213,14 +197,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;
@@ -255,13 +237,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);
@@ -286,7 +266,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);
@@ -385,13 +364,8 @@ 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 */
@@ -400,10 +374,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)
- 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... */
@@ -412,9 +382,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;
}
@@ -423,11 +391,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;
}
@@ -465,11 +428,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 51a13262a226..8800ea4825ff 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 <linux/ieee80211.h>
#include "../include/osdep_service.h"
#include "../include/drv_types.h"
#include "../include/recv_osdep.h"
@@ -54,8 +55,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) {
@@ -72,7 +71,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;
@@ -100,11 +100,10 @@ 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);
+ _cancel_timer_ex(&precvpriv->signal_stat_timer);
}
struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue)
@@ -243,7 +242,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++;
}
@@ -275,7 +273,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 {
@@ -304,12 +301,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));
- DBG_88E(" mic error :prxattrib->bdecrypted=%d\n", prxattrib->bdecrypted);
- } else {
- DBG_88E(" mic error :prxattrib->bdecrypted=%d\n", prxattrib->bdecrypted);
- }
+
res = _FAIL;
} else {
/* mic checked ok */
@@ -339,8 +333,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_:
@@ -688,10 +680,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) {
- DBG_88E("issue_deauth to the nonassociated ap=%pM for the reason(7)\n", (pattrib->bssid));
+ if (!bmcast)
issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
- }
ret = _FAIL;
goto exit;
@@ -739,11 +729,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) {
- DBG_88E("issue_deauth to the ap =%pM for the reason(7)\n", (pattrib->bssid));
-
+ if (!*psta)
issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
- }
}
ret = _FAIL;
@@ -774,8 +761,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;
@@ -800,7 +785,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;
@@ -865,7 +849,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;
}
@@ -905,15 +888,11 @@ 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");
-
+ 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 {
- DBG_88E("error!psta->sleepq_len=%d\n", psta->sleepq_len);
+ else
psta->sleepq_len = 0;
- }
pstapriv->tim_bitmap &= ~BIT(psta->aid);
@@ -1034,7 +1013,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));
@@ -1079,12 +1058,11 @@ 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;
+ int retval = _FAIL;
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;
@@ -1095,13 +1073,8 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv
}
/* add version chk */
- if (ver != 0) {
- retval = _FAIL;
- goto exit;
- }
-
- type = GetFrameType(ptr);
- subtype = GetFrameSubType(ptr); /* bit(7)~bit(2) */
+ if (ver != 0)
+ return _FAIL;
pattrib->to_fr_ds = get_tofr_ds(ptr);
@@ -1109,67 +1082,29 @@ 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->mdata = GetMData(ptr);
- pattrib->privacy = GetPrivacy(ptr);
- pattrib->order = GetOrder(ptr);
+ pattrib->mfrag = ieee80211_has_morefrags(fc);
+ pattrib->mdata = ieee80211_has_moredata(fc);
+ pattrib->privacy = ieee80211_has_protected(fc);
+ pattrib->order = ieee80211_has_order(fc);
/* Dump rx packets */
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) {
- case WIFI_MGT_TYPE: /* mgnt */
+
+ /* 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 */
- 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;
+ pattrib->qos = ieee80211_is_data_qos(fc);
retval = validate_recv_data_frame(adapter, precv_frame);
if (retval == _FAIL) {
struct recv_priv *precvpriv = &adapter->recvpriv;
precvpriv->rx_drop++;
}
- break;
- default:
- retval = _FAIL;
- break;
}
-exit:
-
return retval;
}
@@ -1188,7 +1123,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)
@@ -1223,10 +1158,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);
@@ -1444,10 +1383,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) {
- DBG_88E("nRemain_Length is %d and nSubframe_Length is : %d\n", a_len, nSubframe_Length);
+ if (a_len < ETH_HLEN + nSubframe_Length)
goto exit;
- }
/* move the data point to data content */
pdata += ETH_HLEN;
@@ -1466,17 +1403,14 @@ 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;
}
}
subframes[nr_subframes++] = sub_skb;
- if (nr_subframes >= MAX_SUBFRAME_COUNT) {
- DBG_88E("ParseSubframe(): Too many Subframes! Packets dropped!\n");
+ if (nr_subframes >= MAX_SUBFRAME_COUNT)
break;
- }
pdata += nSubframe_Length;
a_len -= nSubframe_Length;
@@ -1533,7 +1467,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; */
@@ -1563,8 +1497,7 @@ static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_n
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;
@@ -1593,7 +1526,7 @@ int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, struct re
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;
@@ -1663,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);
@@ -1851,13 +1784,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;
- pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue);
- while (pending_frame) {
- 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);
@@ -1870,7 +1799,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_rf.c b/drivers/staging/r8188eu/core/rtw_rf.c
index e704092d31d0..2d2f0fc4c942 100644
--- a/drivers/staging/r8188eu/core/rtw_rf.c
+++ b/drivers/staging/r8188eu/core/rtw_rf.c
@@ -1,55 +1,29 @@
// 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"
-
-struct ch_freq {
- u32 channel;
- u32 frequency;
-};
-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 const u32 ch_freq_map[] = {
+ 2412,
+ 2417,
+ 2422,
+ 2427,
+ 2432,
+ 2437,
+ 2442,
+ 2447,
+ 2452,
+ 2457,
+ 2462,
+ 2467,
+ 2472,
+ 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];
}
diff --git a/drivers/staging/r8188eu/core/rtw_security.c b/drivers/staging/r8188eu/core/rtw_security.c
index 4e93c720c1b6..2cdcdfd5ca5c 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;
@@ -1146,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];
@@ -1329,13 +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]) {
- 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]);
+ if (pframe[hdrlen + 8 + plen - 8 + i] != message[hdrlen + 8 + plen - 8 + i])
res = _FAIL;
- }
}
return res;
@@ -1361,16 +1354,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;
}
@@ -1378,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;
}
@@ -1387,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/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
index 54561ff239a0..91ff82f24f1f 100644
--- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
@@ -101,23 +101,15 @@ 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))
- DBG_88E("%s invalid offset(%d), out of range!!!", __func__, 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))
- DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
-
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 +139,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/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c
index d40669c21fc1..665b077190bc 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;
@@ -57,7 +57,7 @@ int 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;
@@ -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;
@@ -284,14 +284,13 @@ 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)
-{
- SetHwReg8188EU(padapter, HW_VAR_MEDIA_STATUS, (u8 *)(&type));
-}
-
void Set_MSR(struct adapter *padapter, u8 type)
{
- Set_NETYPE0_MSR(padapter, type);
+ u8 val8;
+
+ val8 = rtw_read8(padapter, MSR) & 0x0c;
+ val8 |= type;
+ rtw_write8(padapter, MSR, val8);
}
inline u8 rtw_get_oper_ch(struct adapter *adapter)
@@ -335,9 +334,6 @@ 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)) {
/* SelectChannel(padapter, channel); */
@@ -429,7 +425,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)
@@ -457,7 +453,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]);
}
}
@@ -492,7 +489,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));
}
@@ -558,22 +555,20 @@ 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:
- 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;
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;
}
-
- DBG_88E("WMM(%x): %x, %x\n", ACI, ACM, acParm);
}
if (padapter->registrypriv.acm_method == 1)
@@ -608,10 +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];
- DBG_88E("wmm_para_seq(%d): %d\n", i, pxmitpriv->wmm_para_seq[i]);
- }
}
static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
@@ -758,8 +751,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 {
@@ -857,16 +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) {
- DBG_88E("%s IE too long for survey event\n", __func__);
+ if (len > MAX_IE_SZ)
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));
+ if (memcmp(cur_network->network.MacAddress, pbssid, 6))
return true;
- }
bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC);
if (!bssid)
@@ -902,11 +888,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;
@@ -920,27 +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 */
- 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;
+ 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) {
- DBG_88E("%s marc: cannot find SSID for survey event\n", __func__);
+ 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));
@@ -952,10 +926,9 @@ 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__);
+ /* not hidden ssid */
+ if (bssid->Ssid.Ssid[0] != '\0' && bssid->Ssid.SsidLength != 0)
goto _mismatch;
- }
}
/* check encryption info */
@@ -966,10 +939,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) {
- DBG_88E("%s(), privacy is not match return FAIL\n", __func__);
+ if (cur_network->network.Privacy != bssid->Privacy)
goto _mismatch;
- }
rtw_get_sec_ie(bssid->IEs, bssid->IELength, NULL, &rsn_len, NULL, &wpa_len);
@@ -982,10 +953,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) {
- DBG_88E("%s(): enctyp is not match , return FAIL\n", __func__);
+ 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);
@@ -998,17 +967,12 @@ 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) {
- 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);
+ 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) {
- DBG_88E("%s authentication is not match , return FAIL\n", __func__);
+ if (is_8021x != cur_network->BcnInfo.is_8021x)
goto _mismatch;
- }
}
kfree(bssid);
@@ -1049,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;
@@ -1257,39 +1221,28 @@ 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");
+ if (ralink_vendor_flag)
return HT_IOT_PEER_TENDA;
- } else {
- DBG_88E("Capture EPIGRAM_OUI\n");
- }
} else {
break;
}
@@ -1301,16 +1254,12 @@ unsigned char check_assoc_AP(u8 *pframe, uint len)
i += (pIE->Length + 2);
}
- if (ralink_vendor_flag && !epigram_vendor_flag) {
- DBG_88E("link to Ralink AP\n");
+ if (ralink_vendor_flag && !epigram_vendor_flag)
return HT_IOT_PEER_RALINK;
- } else if (ralink_vendor_flag && epigram_vendor_flag) {
- DBG_88E("link to Tenda W311R AP\n");
+ else if (ralink_vendor_flag && epigram_vendor_flag)
return HT_IOT_PEER_TENDA;
- } else {
- DBG_88E("link to new AP\n");
+ else
return HT_IOT_PEER_UNKNOWN;
- }
}
void update_IOT_info(struct adapter *padapter)
@@ -1518,13 +1467,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;
diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 8503059edc46..c2a550e7250e 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;
@@ -372,7 +371,6 @@ u8 qos_acm(u8 acm_mask, u8 priority)
change_priority = 5;
break;
default:
- DBG_88E("qos_acm(): invalid pattrib->priority: %d!!!\n", priority);
break;
}
@@ -460,8 +458,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))
@@ -489,7 +485,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 */
@@ -711,15 +706,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);
@@ -894,10 +886,8 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
if (!psta)
return _FAIL;
- if (!pxmitframe->buf_addr) {
- DBG_88E("==> %s buf_addr == NULL\n", __func__);
+ if (!pxmitframe->buf_addr)
return _FAIL;
- }
pbuf_start = pxmitframe->buf_addr;
@@ -906,7 +896,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) {
- DBG_88E("rtw_xmitframe_coalesce: rtw_make_wlanhdr fail; drop pkt\n");
res = _FAIL;
goto exit;
}
@@ -1003,7 +992,6 @@ 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");
res = _FAIL;
goto exit;
}
@@ -1133,10 +1121,8 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv)
pxmitbuf->priv_data = NULL;
/* pxmitbuf->ext_tag = true; */
- if (pxmitbuf->sctx) {
- DBG_88E("%s pxmitbuf->sctx is not NULL\n", __func__);
+ if (pxmitbuf->sctx)
rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC);
- }
}
spin_unlock_irqrestore(&pfree_queue->lock, flags);
@@ -1171,8 +1157,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)) {
@@ -1190,10 +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) {
- DBG_88E("%s pxmitbuf->sctx is not NULL\n", __func__);
+ if (pxmitbuf->sctx)
rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC);
- }
}
spin_unlock_irqrestore(&pfree_xmitbuf_queue->lock, flags);
@@ -1208,10 +1190,8 @@ s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
if (!pxmitbuf)
return _FAIL;
- if (pxmitbuf->sctx) {
- DBG_88E("%s pxmitbuf->sctx is not NULL\n", __func__);
+ if (pxmitbuf->sctx)
rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_FREE);
- }
if (pxmitbuf->ext_tag) {
rtw_free_xmitbuf_ext(pxmitpriv, pxmitbuf);
@@ -1471,15 +1451,13 @@ 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;
- DBG_88E("rtw_xmit_classifier: psta == NULL\n");
goto exit;
}
@@ -1605,10 +1583,8 @@ 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");
+ if (!newskb)
return -1;
- }
dev_kfree_skb_any(skb);
*pskb = skb = newskb;
@@ -1620,21 +1596,15 @@ 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;
- }
+ if (res < 0)
+ 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");
+ if (res == -2)
return -1;
- }
+
return 0;
}
}
@@ -1653,11 +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)) {
- 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]);
+ if (memcmp(skb->data + ETH_ALEN, GET_MY_HWADDR(padapter), ETH_ALEN))
return -1;
- }
+
return 0;
}
@@ -1724,10 +1692,8 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt)
s32 res;
pxmitframe = rtw_alloc_xmitframe(pxmitpriv);
- if (!pxmitframe) {
- DBG_88E("DBG_TX_DROP_FRAME %s no more pxmitframe\n", __func__);
+ if (!pxmitframe)
return -1;
- }
rcu_read_lock();
br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
@@ -2147,13 +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;
- DBG_88E("%s timeout\n", __func__);
- } else {
+ else
status = sctx->status;
- }
if (status == RTW_SCTX_DONE_SUCCESS)
ret = _SUCCESS;
@@ -2161,26 +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) {
- if (rtw_sctx_chk_waring_status(status))
- DBG_88E("%s status:%d\n", __func__, status);
(*sctx)->status = status;
complete(&((*sctx)->done));
*sctx = NULL;
@@ -2204,6 +2151,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
- DBG_88E("%s ack_tx not set\n", __func__);
}
diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
index 21ecc90a558c..b944c8071a3b 100644
--- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
+++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
@@ -102,14 +102,12 @@ 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;
- s8 OFDM_index[2], CCK_index = 0;
- s8 OFDM_index_old[2] = {0, 0}, CCK_index_old = 0;
+ s32 ele_D, TempCCk;
+ s8 OFDM_index, CCK_index = 0;
+ s8 OFDM_index_old = 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 */
+ 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,
@@ -131,57 +129,30 @@ 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;
-
/* <Kordan> 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 */
-
- if (is2t)
- rf = 2;
- else
- rf = 1;
+ 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 */
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;
}
}
- /* 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;
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 *)&cck_swing_table[i][2], 4)) {
+ CCK_index_old = (u8)i;
+ dm_odm->BbSwingIdxCckBase = (u8)i;
+ break;
}
}
@@ -190,8 +161,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 = OFDM_index_old;
dm_odm->RFCalibrateInfo.CCK_index = CCK_index_old;
}
@@ -256,16 +226,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 = dm_odm->RFCalibrateInfo.OFDM_index + 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 > 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;
@@ -277,13 +244,8 @@ 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->BbSwingIdxOfdm = (u8)OFDM_index;
dm_odm->BbSwingIdxCck = (u8)CCK_index;
if (dm_odm->BbSwingIdxOfdmCurrent != dm_odm->BbSwingIdxOfdm) {
@@ -295,53 +257,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);
- }
- }
}
}
@@ -353,7 +268,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
if (dm_odm->RFCalibrateInfo.TxPowerTrackControl)
dm_odm->RFCalibrateInfo.ThermalValue = ThermalValue;
}
- dm_odm->RFCalibrateInfo.TXPowercount = 0;
}
/* 1 7. IQK */
@@ -405,14 +319,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);
@@ -454,10 +368,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 */
@@ -488,7 +402,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) &&
@@ -821,10 +735,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);
@@ -837,26 +751,18 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t)
if ((tmpreg & 0x70) != 0) {
/* 1. Read original RF mode */
/* 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);
+ RF_Amode = rtl8188e_PHY_QueryRFReg(adapt, 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);
+ 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);
+ LC_Cal = rtl8188e_PHY_QueryRFReg(adapt, 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);
@@ -865,11 +771,7 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t)
/* Deal with continuous TX case */
/* 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);
+ rtl8188e_PHY_SetRFReg(adapt, RF_AC, bMask12Bits, RF_Amode);
} else {
/* Deal with Packet TX case */
rtw_write8(adapt, REG_TXPAUSE, 0x00);
@@ -885,7 +787,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,
@@ -893,13 +794,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<Kordan> 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;
@@ -988,21 +882,14 @@ 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;
- if (!(dm_odm->SupportAbility & ODM_RF_CALIBRATION))
- return;
- /* 20120213<Kordan> 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;
}
- phy_LCCalibrate_8188E(adapt, false);
+ phy_LCCalibrate_8188E(adapt);
}
diff --git a/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c b/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c
index 47ad4ea273cc..5b91aec6a7e3 100644
--- a/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c
+++ b/drivers/staging/r8188eu/hal/HalPwrSeqCmd.c
@@ -63,10 +63,8 @@ u8 HalPwrSeqCmdParsing(struct adapter *padapter, struct wl_pwr_cfg pwrseqcmd[])
else
udelay(10);
- if (poll_count++ > max_poll_count) {
- DBG_88E("Fail to polling Offset[%#x]\n", offset);
+ if (poll_count++ > max_poll_count)
return false;
- }
} while (!poll_bit);
break;
case PWR_CMD_DELAY:
diff --git a/drivers/staging/r8188eu/hal/hal_com.c b/drivers/staging/r8188eu/hal/hal_com.c
index ba5d027d765f..06f2a9083056 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_");
@@ -279,22 +287,12 @@ 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
* 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;
@@ -332,7 +330,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/hal/hal_intf.c b/drivers/staging/r8188eu/hal/hal_intf.c
index fee3a598b59d..37935aef71ea 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;
@@ -35,8 +34,6 @@ 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/odm.c b/drivers/staging/r8188eu/hal/odm.c
index d8fa587ff286..94f9b125d860 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 */
@@ -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
@@ -169,9 +133,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;
@@ -305,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)
@@ -367,9 +328,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,8 +380,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 | ODM_BB_FA_CNT)))
- return;
if (pDM_Odm->bLinked) {
if (pDM_Odm->RSSI_Min > 25) {
CurCCK_CCAThres = 0xcd;
@@ -502,25 +458,17 @@ 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
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)
{
- pDM_Odm->RFCalibrateInfo.bTXPowerTracking = true;
- pDM_Odm->RFCalibrateInfo.TXPowercount = 0;
- pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = false;
pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = true;
}
@@ -563,9 +511,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;
@@ -694,56 +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)
-{
- /* */
- /* 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;
@@ -852,7 +747,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;
@@ -914,11 +809,8 @@ 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);
+ 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_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index d5212a166dd2..87e9a5270be0 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))
@@ -71,13 +67,9 @@ 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;
- dm_odm->PhyDbgInfo.NumQryPhyStatusCCK++;
/* (1)Hardware does not provide RSSI for CCK */
/* (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) */
@@ -154,12 +146,8 @@ 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++;
-
/* (1)Get RSSI for HT rate */
for (i = RF_PATH_A; i < RF_PATH_MAX; i++) {
@@ -180,7 +168,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) */
@@ -207,7 +194,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);
}
}
}
@@ -362,33 +348,7 @@ 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 content,
- enum rf_radio_path rfpath)
-{
- if (rfpath == RF_PATH_A)
- READ_AND_CONFIG(8188E, _RadioA_1T_);
-
- return HAL_STATUS_SUCCESS;
-}
-
-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_);
- }
-
- return HAL_STATUS_SUCCESS;
-}
-
-enum HAL_STATUS ODM_ConfigMACWithHeaderFile(struct odm_dm_struct *dm_odm)
+enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm)
{
- u8 result = HAL_STATUS_SUCCESS;
- result = READ_AND_CONFIG(8188E, _MAC_REG_);
- return result;
+ return ODM_ReadAndConfig_RadioA_1T_8188E(dm_odm);
}
diff --git a/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c b/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c
index 5fb5a88314ed..0fa17a99f9e9 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, 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)
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/hal/rtl8188e_cmd.c b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
index a491c37777df..f1464e4ba429 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
@@ -54,10 +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) {
- DBG_88E("FillH2CCmd_88E(): return H2C cmd because fw is not ready\n");
+ if (!adapt->bFWReady)
return _FAIL;
- }
if (!pCmdBuffer || CmdLen > RTL88E_MAX_CMD_LEN || adapt->bSurpriseRemoved)
return _FAIL;
@@ -66,10 +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)) {
- DBG_88E(" fw read cmd failed...\n");
+ if (!_is_fw_read_cmd_down(adapt, h2c_box_num))
return _FAIL;
- }
*(u8 *)(&h2c_cmd) = ElementID;
@@ -115,7 +111,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 +152,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 +192,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);
}
@@ -285,10 +273,8 @@ static void ConstructBeacon(struct adapter *adapt, u8 *pframe, u32 *pLength)
_ConstructBeacon:
- if ((pktlen + TXDESC_SIZE) > 512) {
- DBG_88E("beacon frame too large\n");
+ if ((pktlen + TXDESC_SIZE) > 512)
return;
- }
*pLength = pktlen;
}
@@ -453,12 +439,9 @@ 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__);
+ if (!ReservedPagePacket)
return;
- }
pxmitpriv = &adapt->xmitpriv;
pmlmeext = &adapt->mlmeextpriv;
@@ -535,7 +518,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 +534,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. */
@@ -570,10 +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)) {
- DBG_88E("HalDownloadRSVDPage(): There is an Adapter is sending beacon.\n");
+ 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))));
@@ -596,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)
- 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. */
@@ -624,10 +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);
- 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. */
/* Clear CR[8] or beacon packet will not be send to TxBuf anymore. */
@@ -646,11 +616,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 +658,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_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c
index bd6eb3878060..6d28e3dc0d26 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c
@@ -22,27 +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 dm_priv *pdmpriv = &hal_data->dmpriv;
- 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);
-
- pdmpriv->InitODMFlag = ODM_RF_CALIBRATION |
- ODM_RF_TX_PWR_TRACK;
-
- ODM_CmnInfoUpdate(dm_odm, ODM_CMNINFO_ABILITY, pdmpriv->InitODMFlag);
-}
-
static void Update_ODM_ComInfo_88E(struct adapter *Adapter)
{
struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
@@ -53,23 +32,19 @@ 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 |
- ODM_BB_CCK_PD |
- ODM_MAC_EDCA_TURBO |
- ODM_RF_CALIBRATION |
- ODM_RF_TX_PWR_TRACK;
+ pdmpriv->InitODMFlag = ODM_BB_RSSI_MONITOR;
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;
+ dm_odm->pBandWidth = &hal_data->CurrentChannelBW;
+ dm_odm->pChannel = &hal_data->CurrentChannel;
+ dm_odm->pbScanInProcess = &pmlmepriv->bScanInProcess;
+ dm_odm->pbPowerSaving = &pwrctrlpriv->bpower_saving;
- 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);
ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_RF_ANTENNA_TYPE, hal_data->TRxAntDivType);
for (i = 0; i < NUM_STA; i++)
@@ -105,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);
}
@@ -113,9 +88,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. */
diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
index b818872e0d19..6811be95da9a 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)
{
@@ -19,10 +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) {
- DBG_88E("bFWReady == false call reset 8051...\n");
- _8051Reset88E(padapter);
- }
+ if (!padapter->bFWReady)
+ rtw_reset_8051(padapter);
} else {
/* disable initial offload */
@@ -77,16 +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) {
- DBG_88E("%s: alloc efuseTbl fail!\n", __func__);
+ if (!efuseTbl)
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__);
+ if (!eFuseWord)
goto exit;
- }
/* 0. Refresh efuse init map as all oxFF. */
for (i = 0; i < EFUSE_MAX_SECTION_88E; i++)
@@ -102,7 +96,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;
}
@@ -196,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;
@@ -207,8 +199,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 */
@@ -218,11 +208,9 @@ 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) {
- DBG_88E("%s polling reg_0x143:0x%02x, reg_0x106:0x%02x\n", __func__, reg_0x143, rtw_read8(adapter, 0x106));
+ while (!rtw_read8(adapter, REG_TXPKTBUF_DBG) &&
+ (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));
@@ -233,14 +221,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 +247,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 +270,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);
@@ -336,313 +320,6 @@ exit:
return ret;
}
-static void _FWDownloadEnable(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 _BlockWrite(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 _PageWrite(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 _BlockWrite(padapter, buffer, size);
-}
-
-static int _WriteFW(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 = _PageWrite(padapter, page, bufferPtr + offset, MAX_PAGE_SIZE);
-
- if (ret == _FAIL)
- goto exit;
- }
- if (remainSize) {
- offset = pageNums * MAX_PAGE_SIZE;
- page = pageNums;
- ret = _PageWrite(padapter, page, bufferPtr + offset, remainSize);
-
- if (ret == _FAIL)
- goto exit;
- }
-exit:
- return ret;
-}
-
-void _8051Reset88E(struct adapter *padapter)
-{
- u8 u1bTmp;
-
- 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");
-}
-
-static s32 _FWFreeToGo(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);
-
- _8051Reset88E(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 *pFirmware, struct device *device)
-{
- s32 rtStatus = _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;
- goto Exit;
- }
- if (!fw) {
- pr_err("Firmware %s not available\n", fw_name);
- rtStatus = _FAIL;
- goto Exit;
- }
- if (fw->size > FW_8188E_SIZE) {
- rtStatus = _FAIL;
- 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;
- }
- memcpy(pFirmware->szFwBuffer, fw->data, fw->size);
- pFirmware->ulFwLength = fw->size;
- release_firmware(fw);
- dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", pFirmware->ulFwLength);
-
-Exit:
- return rtStatus;
-}
-
-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;
- u8 *pFirmwareBuf;
- u32 FirmwareLen;
- static int log_version;
-
- if (!dvobj->firmware.szFwBuffer)
- rtStatus = load_firmware(&dvobj->firmware, device);
- if (rtStatus == _FAIL) {
- dvobj->firmware.szFwBuffer = NULL;
- goto Exit;
- }
- pFirmwareBuf = dvobj->firmware.szFwBuffer;
- FirmwareLen = dvobj->firmware.ulFwLength;
-
- /* 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);
-
- if (!log_version++)
- pr_info("%sFirmware Version %d, SubVersion %d, Signature 0x%x\n",
- DRIVER_PREFIX, pHalData->FirmwareVersion,
- pHalData->FirmwareSubVersion, pHalData->FirmwareSignature);
-
- if (IS_FW_HEADER_EXIST(pFwHdr)) {
- /* Shift 32 bytes for FW header */
- pFirmwareBuf = pFirmwareBuf + 32;
- FirmwareLen = FirmwareLen - 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);
- _8051Reset88E(padapter);
- }
-
- _FWDownloadEnable(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);
-
- if (rtStatus == _SUCCESS ||
- (rtw_get_passing_time_ms(fwdl_start_time) > 500 && writeFW_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)
- );
- }
- _FWDownloadEnable(padapter, false);
- if (_SUCCESS != rtStatus) {
- DBG_88E("DL Firmware failed!\n");
- goto Exit;
- }
-
- rtStatus = _FWFreeToGo(padapter);
- if (_SUCCESS != rtStatus) {
- DBG_88E("DL Firmware failed!\n");
- goto Exit;
- }
-
-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 */
-/* */
-enum{
- VOLTAGE_V25 = 0x03,
- LDOE25_SHIFT = 28,
- };
-
void rtl8188e_EfusePowerSwitch(struct adapter *pAdapter, u8 PwrState)
{
u16 tmpV16;
@@ -691,22 +368,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);
+ 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) {
- DBG_88E("%s: alloc efuseTbl fail!\n", __func__);
+ if (!efuseTbl)
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__);
+ if (!eFuseWord)
goto exit;
- }
/* 0. Refresh efuse init map as all oxFF. */
for (i = 0; i < EFUSE_MAX_SECTION_88E; i++)
@@ -722,7 +393,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;
}
@@ -797,9 +467,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);
@@ -852,39 +519,19 @@ 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;
}
}
void hal_notch_filter_8188e(struct adapter *adapter, bool enable)
{
- if (enable) {
- DBG_88E("Enable notch filter\n");
+ if (enable)
rtw_write8(adapter, rOFDM0_RxDSP + 1, rtw_read8(adapter, rOFDM0_RxDSP + 1) | BIT(1));
- } else {
- DBG_88E("Disable notch filter\n");
+ else
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;
}
/* */
@@ -1093,20 +740,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;
-
- 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);
- }
}
void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool AutoLoadFail)
@@ -1126,17 +767,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. */
@@ -1147,7 +781,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)
@@ -1161,7 +794,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)
@@ -1171,8 +803,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)
@@ -1204,7 +834,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)
@@ -1219,6 +848,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 302b15b2874d..ea75ff11ad17 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 */
/* */
@@ -123,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
@@ -138,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;
u32 NewOffset;
u32 tmplong, tmplong2;
u8 RfPiEnable = 0;
@@ -162,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 */
@@ -177,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);
@@ -236,14 +209,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;
u32 NewOffset;
/* 2009/06/17 MH We can not execute IO for power save or other accident mode. */
@@ -273,7 +245,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
@@ -282,12 +253,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, RegAddr);
BitShift = phy_CalculateBitShift(BitMask);
Readback_Value = (Original_Value & BitMask) >> BitShift;
@@ -301,7 +271,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
@@ -315,7 +284,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
@@ -325,12 +293,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, RegAddr);
BitShift = phy_CalculateBitShift(BitMask);
Data = ((Original_Value & (~BitMask)) | (Data << BitShift));
}
- phy_RFSerialWrite(Adapter, eRFPath, RegAddr, Data);
+ phy_RFSerialWrite(Adapter, RegAddr, Data);
}
/* */
@@ -361,7 +329,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 */
@@ -390,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)
@@ -506,38 +456,25 @@ 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_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG))
- rtStatus = _FAIL;
- if (rtStatus != _SUCCESS)
- goto phy_BB8190_Config_ParaFile_Fail;
+ if (HAL_STATUS_FAILURE == ODM_ReadAndConfig_PHY_REG_1T_8188E(&pHalData->odmpriv))
+ return _FAIL;
/* 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))
- rtStatus = _FAIL;
-
- if (rtStatus != _SUCCESS)
- goto phy_BB8190_Config_ParaFile_Fail;
+ if (HAL_STATUS_FAILURE == ODM_ReadAndConfig_AGC_TAB_1T_8188E(&pHalData->odmpriv))
+ return _FAIL;
-phy_BB8190_Config_ParaFile_Fail:
-
- return rtStatus;
+ return _SUCCESS;
}
int
@@ -600,17 +537,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];
- pHalData->CurrentOfdm24GTxPwrIdx = ofdmPowerLevel[0];
- pHalData->CurrentBW2024GTxPwrIdx = BW20PowerLevel[0];
- pHalData->CurrentBW4024GTxPwrIdx = BW40PowerLevel[0];
-}
-
/*-----------------------------------------------------------------------------
* Function: SetTxPowerLevel8190()
*
@@ -641,8 +567,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);
}
@@ -757,21 +681,17 @@ 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;
- if (Adapter->bNotifyChannelChange)
- DBG_88E("[%s] ch = %d\n", __func__, channel);
-
/* s1. pre common command - CmdID_SetTxPowerLevel */
PHY_SetTxPowerLevel8188E(Adapter, 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 = ((pHalData->RfRegChnlVal & 0xfffffc00) | param2);
+ 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 6e0231099986..d043b7bc4142 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_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_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal);
break;
default:
break;
@@ -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++) {
@@ -203,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 */
@@ -374,12 +371,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;
/*----Store original RFENV control type----*/
u4RegValue = rtl8188e_PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV);
@@ -400,18 +396,12 @@ 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))
rtStatus = _FAIL;
/*----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;
}
diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
index 90d426199f52..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;
@@ -57,63 +57,47 @@ 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;
+ struct rx_pkt_attrib *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 = (le32_to_cpu(prxstat->rxdw0) >> 14) & 0x1;
- /* 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 = (le32_to_cpu(prxstat->rxdw3) >> 14) & 0x3;
- 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); */
+ 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 = (u8)((le32_to_cpu(report.rxdw0) >> 26) & 0x1);/* u8)prxreport->physt; */
+ pattrib->physt = (le32_to_cpu(prxstat->rxdw0) >> 26) & 0x1;
- 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;
+ pattrib->encrypt = (le32_to_cpu(prxstat->rxdw0) >> 20) & 0x7;
- pattrib->qos = (u8)((le32_to_cpu(report.rxdw0) >> 23) & 0x1);/* u8)prxreport->qos; */
- pattrib->priority = (u8)((le32_to_cpu(report.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 = (u8)((le32_to_cpu(report.rxdw1) >> 13) & 0x1);/* u8)prxreport->amsdu; */
+ pattrib->amsdu = (le32_to_cpu(prxstat->rxdw1) >> 13) & 0x1;
- 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 = 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 = (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 = le32_to_cpu(prxstat->rxdw3) & 0x3f;
+ pattrib->rxht = (le32_to_cpu(prxstat->rxdw3) >> 6) & 0x1;
- 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 = (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;
- 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->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);
-
- } else if (pattrib->pkt_rpt_type == HIS_REPORT) { /* USB HISR RPT */
- pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) & 0x00003fff);/* u16)prxreport->pktlen; */
+ } else if (pattrib->pkt_rpt_type == TX_REPORT2) {
+ pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x3FF;
+
+ pattrib->MacIDValidEntry[0] = le32_to_cpu(prxstat->rxdw4);
+ pattrib->MacIDValidEntry[1] = le32_to_cpu(prxstat->rxdw5);
+
+ } else if (pattrib->pkt_rpt_type == HIS_REPORT) {
+ pattrib->pkt_len = le32_to_cpu(prxstat->rxdw0) & 0x00003fff;
}
}
@@ -128,18 +112,12 @@ 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;
struct sta_info *psta;
- pkt_info.bPacketMatchBSSID = false;
- 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/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c
index 8031ac9f9d43..727e1adce1dc 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c
@@ -12,22 +12,6 @@
#include "../include/rtl8188e_hal.h"
-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;
- precvbuf->ptail = precvbuf->pbuf;
- precvbuf->pend = precvbuf->pdata + MAX_RECVBUF_SZ;
- }
-}
-
int rtl8188eu_init_recv_priv(struct adapter *padapter)
{
struct recv_priv *precvpriv = &padapter->recvpriv;
@@ -47,20 +31,15 @@ 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);
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);
if (res == _FAIL)
break;
- precvbuf->ref_cnt = 0;
precvbuf->adapter = padapter;
precvbuf++;
}
@@ -106,12 +85,7 @@ 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 293541db597d..55032d7ae7e3 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -264,11 +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) {
- DBG_88E("pxmitframe->frame_tag == TXAGG_FRAMETAG\n");
- } else {
- DBG_88E("pxmitframe->frame_tag = %d\n", pxmitframe->frame_tag);
-
+ } else if ((pxmitframe->frame_tag & 0x0f) != TXAGG_FRAMETAG) {
/* offset 4 */
ptxdesc->txdw1 |= cpu_to_le32((4) & 0x3f);/* CAM_ID(MAC_ID) */
@@ -380,9 +376,9 @@ 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 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 +392,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->pusbdev->speed == USB_SPEED_HIGH)
+ bulksize = USB_HIGH_SPEED_BULK_SIZE;
+ else
+ bulksize = USB_FULL_SPEED_BULK_SIZE;
+
/* check xmitbuffer is ok */
if (!pxmitbuf) {
pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
@@ -518,7 +519,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;
@@ -567,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
- 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 96db9a8e7667..a92774352d2d 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -6,17 +6,13 @@
#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"
#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;
@@ -37,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)
@@ -49,22 +44,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 */
-
- haldata->UsbTxAggMode = 1;
- haldata->UsbTxAggDescNum = 0x6; /* only 4 bits */
-
- 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 */
- haldata->UsbRxAggPageTimeout = 0x4; /* 6, absolute time = 34ms/(2^6) */
+ struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapt);
HalUsbSetQueuePipeMapping8188EUsb(adapt, pdvobjpriv->RtNumOutPipes);
}
@@ -77,10 +57,8 @@ u32 rtl8188eu_InitPowerOn(struct adapter *adapt)
if (haldata->bMacPwrCtrlOn)
return _SUCCESS;
- if (!HalPwrSeqCmdParsing(adapt, Rtl8188E_NIC_PWR_ON_FLOW)) {
- DBG_88E(KERN_ERR "%s: run power on flow fail\n", __func__);
+ 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. */
@@ -118,10 +96,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);
}
@@ -328,15 +306,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);
@@ -413,20 +389,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 |= ((haldata->UsbTxAggDescNum & 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()
@@ -448,57 +421,21 @@ usb_AggSettingRxUpdate(
struct adapter *Adapter
)
{
- struct hal_data_8188e *haldata = &Adapter->haldata;
u8 valueDMA;
u8 valueUSB;
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, USB_RXAGG_PAGE_COUNT);
+ rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH + 1, USB_RXAGG_PAGE_TIMEOUT);
+}
static void InitUsbAggregationSetting(struct adapter *Adapter)
{
@@ -509,10 +446,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;
@@ -548,18 +481,12 @@ 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;
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);
@@ -568,7 +495,17 @@ 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)
+{
+ 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)
@@ -580,7 +517,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) {
@@ -625,10 +561,9 @@ 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__);
Adapter->bFWReady = false;
haldata->fw_ractrl = false;
return status;
@@ -636,40 +571,28 @@ 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);
- if (status == _FAIL) {
- DBG_88E(" ### Failed to init MAC ......\n ");
+ if (status == _FAIL)
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 ");
+ if (status == _FAIL)
goto exit;
- }
-#endif
-#if (HAL_RF_ENABLE == 1)
status = PHY_RFConfig8188E(Adapter);
- if (status == _FAIL) {
- DBG_88E(" ### Failed to init RF ......\n ");
+ if (status == _FAIL)
goto exit;
- }
-#endif
status = rtl8188e_iol_efuse_patch(Adapter);
- if (status == _FAIL) {
- DBG_88E("%s rtl8188e_iol_efuse_patch failed\n", __func__);
+ if (status == _FAIL)
goto exit;
- }
_InitTxBufferBoundary(Adapter, txpktbuf_bndy);
@@ -681,14 +604,13 @@ 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);
_InitEDCA(Adapter);
_InitRetryFunction(Adapter);
InitUsbAggregationSetting(Adapter);
- _InitOperationMode(Adapter);/* todo */
_InitBeaconParameters(Adapter);
/* */
@@ -715,8 +637,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, RF_CHNLBW, bRFRegOffsetMask);
_BBTurnOnBlock(Adapter);
@@ -790,8 +711,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;
}
@@ -853,13 +772,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);
@@ -920,17 +835,11 @@ 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);
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);
@@ -978,7 +887,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);
@@ -991,8 +900,6 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, 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);
@@ -1035,18 +942,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)
-{
- 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 variable, u8 *val)
+static void hw_var_set_bssid(struct adapter *Adapter, u8 *val)
{
u8 idx = 0;
u32 reg_bssid;
@@ -1057,18 +953,6 @@ 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)
-{
- 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;
@@ -1076,32 +960,11 @@ 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_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;
- case HW_VAR_MAC_ADDR:
- hw_var_set_macaddr(Adapter, variable, val);
+ hw_var_set_opmode(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:
{
@@ -1113,7 +976,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 */
@@ -1121,7 +983,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. */
@@ -1138,12 +999,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;
case HW_VAR_CORRECT_TSF:
{
u64 tsf;
@@ -1169,19 +1024,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 */
@@ -1220,17 +1062,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 {
- 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;
case HW_VAR_MLME_JOIN:
@@ -1243,13 +1075,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;
@@ -1269,9 +1095,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;
@@ -1316,9 +1139,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;
@@ -1338,55 +1158,10 @@ 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_CAM_INVALID_ALL:
- rtw_write32(Adapter, RWCAM, BIT(31) | BIT(30));
- 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_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;
case HW_VAR_AC_PARAM_BE:
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);
@@ -1410,7 +1185,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;
@@ -1472,7 +1246,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;
@@ -1531,9 +1305,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;
@@ -1552,8 +1323,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)
- DBG_88E("Stop RX DMA failed......\n");
/* RQPN Load 0 */
rtw_write16(Adapter, REG_RQPN_NPQ, 0x0);
@@ -1562,14 +1331,9 @@ 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;
- 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;
@@ -1592,12 +1356,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;
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;
@@ -1623,15 +1381,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;
- 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;
@@ -1642,76 +1391,20 @@ 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:
- {
- 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;
case HAL_DEF_CURRENT_ANTENNA:
*((u8 *)pValue) = haldata->CurAntenna;
break;
- 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;
- 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;
- 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;
case HAL_DEF_DBG_DUMP_RXPKT:
*((u8 *)pValue) = haldata->bDumpRxPkt;
break;
@@ -1719,18 +1412,14 @@ 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. */
-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:
@@ -1740,15 +1429,12 @@ u8 SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable
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 */
@@ -1757,7 +1443,6 @@ u8 SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariable
pDigTable->CurIGValue = rtw_read8(Adapter, 0xc50);
}
podmpriv->SupportAbility = DYNAMIC_ALL_FUNC_ENABLE;
- DBG_88E("==> Turn on all dynamic function...\n");
}
}
break;
@@ -1768,11 +1453,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)
@@ -1824,22 +1506,13 @@ 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;
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);
- DBG_88E("update raid entry, mask=0x%x, arg=0x%x\n", mask, arg);
psta->ra_mask = mask;
mask |= ((raid << 28) & 0xf0000000);
@@ -1909,7 +1582,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/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
index 4a0ab4053e90..673c30ed3cce 100644
--- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
@@ -209,10 +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) {
- DBG_88E("%s()-%d: rtw_alloc_recvframe() failed! RX Drop!\n", __func__, __LINE__);
+ if (!precvframe)
goto _exit_recvbuf2recvframe;
- }
INIT_LIST_HEAD(&precvframe->list);
precvframe->precvbuf = NULL; /* can't access the precvbuf for new arch. */
@@ -223,8 +221,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 +231,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 +271,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 +281,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;
}
@@ -295,18 +288,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);
@@ -351,7 +334,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;
}
@@ -372,9 +354,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;
}
@@ -382,11 +361,9 @@ 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));
- precvbuf->transfer_len = purb->actual_length;
skb_put(precvbuf->pskb, purb->actual_length);
skb_queue_tail(&precvpriv->rx_skb_queue, precvbuf->pskb);
@@ -398,7 +375,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;
@@ -419,7 +395,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;
@@ -453,32 +428,16 @@ 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);
- if (!precvbuf->pskb) {
- DBG_88E("#### usb_read_port() alloc_skb fail!#####\n");
+ if (!precvbuf->pskb)
return _FAIL;
- }
tmpaddr = (size_t)precvbuf->pskb->data;
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);
- precvbuf->pbuf = precvbuf->pskb->data;
-
precvbuf->reuse = false;
}
@@ -490,17 +449,14 @@ 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 */
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);
+ if ((err) && (err != (-EPERM)))
ret = _FAIL;
- }
return ret;
}
@@ -517,10 +473,8 @@ void rtl8188eu_xmit_tasklet(unsigned long priv)
while (1) {
if ((adapt->bDriverStopped) ||
(adapt->bSurpriseRemoved) ||
- (adapt->bWritePortCancel)) {
- DBG_88E("xmit_tasklet => bDriverStopped or bSurpriseRemoved or bWritePortCancel\n");
+ (adapt->bWritePortCancel))
break;
- }
ret = rtl8188eu_xmitframe_complete(adapt, pxmitpriv, NULL);
diff --git a/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h b/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h
index 2517a08bc95a..9e6f2361b090 100644
--- a/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h
+++ b/drivers/staging/r8188eu/include/Hal8188EPhyCfg.h
@@ -73,10 +73,8 @@ 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);
-void rtl8188e_PHY_SetRFReg(struct adapter *adapter, enum rf_radio_path rfpath,
- u32 regaddr, u32 mask, u32 data);
+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 */
/* MAC/BB/RF HAL config */
diff --git a/drivers/staging/r8188eu/include/HalVerDef.h b/drivers/staging/r8188eu/include/HalVerDef.h
index 62b94c993f0d..2bc18eabb55d 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 {
@@ -15,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 {
@@ -34,33 +31,13 @@ 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_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)
-/* 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)
-#define IS_CHIP_VENDOR_UMC(version) \
- ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false)
#endif
diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h
index 2dd5ebaaa921..09fc27082f7c 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 {
@@ -133,23 +133,16 @@ 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 --------*/
- u8 ishighspeed;
u8 RtNumOutPipes;
- int RegUsbSS;
- struct semaphore usb_suspend_sema;
- struct mutex usb_vendor_req_mutex;
struct usb_interface *pusbintf;
struct usb_device *pusbdev;
atomic_t continual_urb_error;
- u8 signal_strength;
};
static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
@@ -159,29 +152,8 @@ 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,
- MAX_ADAPTER,
-};
-
-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 */
struct dvobj_priv *dvobj;
struct mlme_priv mlmepriv;
@@ -197,7 +169,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;
@@ -206,20 +177,10 @@ 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;
@@ -239,7 +200,6 @@ struct adapter {
int net_closed;
u8 bFWReady;
- u8 bBTFWReady;
u8 bReadPortCancel;
u8 bWritePortCancel;
u8 bRxRSSIDisplay;
@@ -263,8 +223,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)
diff --git a/drivers/staging/r8188eu/include/hal_com.h b/drivers/staging/r8188eu/include/hal_com.h
index 95167f0b327f..56ba356b5371 100644
--- a/drivers/staging/r8188eu/include/hal_com.h
+++ b/drivers/staging/r8188eu/include/hal_com.h
@@ -148,9 +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);
-
-void c2h_evt_clear(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 b4a7e0ce3116..3cededa4dcfc 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -9,38 +9,22 @@
#include "Hal8188EPhyCfg.h"
enum hw_variables {
- HW_VAR_MEDIA_STATUS,
- HW_VAR_MEDIA_STATUS1,
HW_VAR_SET_OPMODE,
- HW_VAR_MAC_ADDR,
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,
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,
- HW_VAR_SEC_CFG,
HW_VAR_BCN_VALID,
HW_VAR_DM_FLAG,
HW_VAR_DM_FUNC_OP,
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,
- HW_VAR_AC_PARAM_VI,
HW_VAR_AC_PARAM_BE,
- HW_VAR_AC_PARAM_BK,
HW_VAR_ACM_CTRL,
HW_VAR_AMPDU_MIN_SPACE,
HW_VAR_AMPDU_FACTOR,
@@ -49,28 +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_CURRENT_ANTENNA,
- HW_VAR_ANTENNA_DIVERSITY_LINK,
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,
- 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. */
- HW_VAR_NAV_UPPER,
HW_VAR_RPT_TIMER_SETTING,
HW_VAR_TX_RPT_MAX_MACID,
HW_VAR_H2C_MEDIA_STATUS_RPT,
@@ -78,19 +43,10 @@ enum hw_variables {
};
enum hal_def_variable {
- HAL_DEF_UNDERCORATEDSMOOTHEDPWDB,
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,
- 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,
};
@@ -114,8 +70,8 @@ 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);
-u8 GetHalDefVar8188EUsb(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);
diff --git a/drivers/staging/r8188eu/include/ieee80211.h b/drivers/staging/r8188eu/include/ieee80211.h
index 3a23d5299314..8c20363cdd31 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
@@ -182,28 +181,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 +196,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 +215,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,22 +225,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,
- EAPOL_LOGOFF,
- EAPOL_KEY,
- EAPOL_ENCAP_ASF_ALERT
-};
-
#define IEEE80211_3ADDR_LEN 24
#define IEEE80211_4ADDR_LEN 30
#define IEEE80211_FCS_LEN 4
@@ -557,83 +499,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 +524,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 +539,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 +555,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 +575,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
@@ -821,44 +617,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
@@ -876,11 +634,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)
@@ -941,26 +694,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
@@ -1139,9 +872,9 @@ 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);
+bool rtw_is_cckratesonly_included(u8 *rate);
int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);
diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
index 23a151c558dc..1902aa48a255 100644
--- a/drivers/staging/r8188eu/include/odm.h
+++ b/drivers/staging/r8188eu/include/odm.h
@@ -86,8 +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];
};
@@ -122,44 +120,19 @@ 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----------- */
- /* 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,
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_FA_CNT = BIT(3),
ODM_BB_RSSI_MONITOR = BIT(4),
- ODM_BB_CCK_PD = BIT(5),
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),
};
# define ODM_ITRF_USB 0x2
@@ -186,12 +159,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;
@@ -238,9 +205,6 @@ struct odm_rf_cal {
s32 RegEB4;
s32 RegEBC;
- u8 TXPowercount;
- bool bTXPowerTrackingInit;
- bool bTXPowerTracking;
u8 TxPowerTrackControl; /* for mp mode, turn off txpwrtracking
* as default */
u8 TM_Trigger;
@@ -263,11 +227,9 @@ struct odm_rf_cal {
bool bReloadtxpowerindex;
u8 bRfPiEnable;
- u32 TXPowerTrackingCallbackCnt; /* cosa add for debug */
- u8 bCCKinCH14;
u8 CCK_index;
- u8 OFDM_index[2];
+ u8 OFDM_index;
bool bDoneTxpower;
u8 ThermalValue_HP[HP_THERMAL_NUM];
@@ -355,7 +317,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 */
@@ -461,8 +423,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 CCKSwingTable_Ch14 [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)
@@ -487,9 +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_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
diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h
index 3ed265e00ac1..b37962edb2ed 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 */
@@ -95,13 +66,5 @@ 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 Content,
- enum rf_radio_path eRFPath);
-
-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);
-
+enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *pDM_Odm);
#endif
diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h
index 6c8241372a06..fca8f3d116c2 100644
--- a/drivers/staging/r8188eu/include/osdep_service.h
+++ b/drivers/staging/r8188eu/include/osdep_service.h
@@ -54,26 +54,11 @@ 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)));
-}
-
-static inline void _cancel_timer(struct timer_list *ptimer,u8 *bcancelled)
-{
- del_timer_sync(ptimer);
- *bcancelled= true;/* true ==1; false==0 */
+ mod_timer(ptimer, jiffies + msecs_to_jiffies(delay_time));
}
-#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)) &&
@@ -82,29 +67,8 @@ 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);
-}
-
-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);
-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) \
@@ -173,18 +137,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
-
struct rtw_netdev_priv_indicator {
void *priv;
u32 sizeof_priv;
diff --git a/drivers/staging/r8188eu/include/recv_osdep.h b/drivers/staging/r8188eu/include/recv_osdep.h
index e87467022b39..ca8a613508fd 100644
--- a/drivers/staging/r8188eu/include/recv_osdep.h
+++ b/drivers/staging/r8188eu/include/recv_osdep.h
@@ -14,16 +14,11 @@ 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);
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/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;
};
diff --git a/drivers/staging/r8188eu/include/rtl8188e_hal.h b/drivers/staging/r8188eu/include/rtl8188e_hal.h
index 8134a173ea07..82cb4f7f4d3e 100644
--- a/drivers/staging/r8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/r8188eu/include/rtl8188e_hal.h
@@ -34,63 +34,9 @@
#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_SIZE 0x4000 /* 16384,16k */
-#define FW_8188E_START_ADDRESS 0x1000
-
-#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)
-
-/* 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
-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)) */
@@ -160,21 +106,16 @@ 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;
- u16 FirmwareVersion;
- u16 FirmwareVersionRev;
- u16 FirmwareSubVersion;
- u16 FirmwareSignature;
- u8 PGMaxGroup;
/* current WIFI_PHY values */
- u32 ReceiveConfig;
enum ht_channel_width CurrentChannelBW;
u8 CurrentChannel;
u8 nCur40MhzPrimeSC;/* Control channel sub-carrier */
- u16 BasicRateSet;
-
u8 EEPROMRegulatory;
u8 EEPROMThermalMeter;
@@ -192,24 +133,17 @@ 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;
- u8 CurrentOfdm24GTxPwrIdx;
- u8 CurrentBW2024GTxPwrIdx;
- u8 CurrentBW4024GTxPwrIdx;
-
/* Read/write are allow for following hardware information variables */
u8 pwrGroupCnt;
u32 MCSTxPowerLevelOriginalOffset[MAX_PG_GROUP][16];
u8 CrystalCap;
- u8 ExternalPA;
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[2];
+ u32 RfRegChnlVal;
/* for host message to fw */
u8 LastHMEBoxNum;
@@ -232,37 +166,16 @@ 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
* for MAC only */
u8 bMacPwrCtrlOn;
-
- u32 UsbBulkOutSize;
-
- u8 UsbTxAggMode;
- u8 UsbTxAggDescNum;
-
- 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 */
- u8 UsbRxAggBlockTimeout;
- u8 UsbRxAggPageCount; /* 8192C DMA page count */
- u8 UsbRxAggPageTimeout;
};
-/* 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);
/* EFuse */
-u8 GetEEPROMSize8188E(struct adapter *padapter);
void Hal_EfuseParseIDCode88E(struct adapter *padapter, u8 *hwinfo);
void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *hwinfo,
bool AutoLoadFail);
diff --git a/drivers/staging/r8188eu/include/rtl8188e_recv.h b/drivers/staging/r8188eu/include/rtl8188e_recv.h
index 0be9896eaf0f..b752c5c06309 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)
@@ -37,13 +33,9 @@ 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);
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);
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)
diff --git a/drivers/staging/r8188eu/include/rtl8188e_xmit.h b/drivers/staging/r8188eu/include/rtl8188e_xmit.h
index f1f2ccfc765e..8adb672f7a07 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); \
@@ -141,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);
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
diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8188eu/include/rtw_cmd.h
index f8991a0493d0..6b6d560d7143 100644
--- a/drivers/staging/r8188eu/include/rtw_cmd.h
+++ b/drivers/staging/r8188eu/include/rtw_cmd.h
@@ -55,8 +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;
};
#define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
@@ -125,18 +123,6 @@ enum RFINTFS {
};
/*
-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
Notes: To join a known BSS.
@@ -772,7 +758,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/include/rtw_debug.h b/drivers/staging/r8188eu/include/rtw_debug.h
index 311051757715..01a7d987d6cc 100644
--- a/drivers/staging/r8188eu/include/rtw_debug.h
+++ b/drivers/staging/r8188eu/include/rtw_debug.h
@@ -52,12 +52,4 @@
#define DRIVER_PREFIX "R8188EU: "
-extern u32 GlobalDebugLevel;
-
-#define DBG_88E(...) \
- do { \
- if (_drv_err_ <= GlobalDebugLevel) \
- pr_info(DRIVER_PREFIX __VA_ARGS__); \
- } while (0)
-
#endif /* __RTW_DEBUG_H__ */
diff --git a/drivers/staging/r8188eu/include/rtw_fw.h b/drivers/staging/r8188eu/include/rtw_fw.h
new file mode 100644
index 000000000000..c4b1a8370b4a
--- /dev/null
+++ b/drivers/staging/r8188eu/include/rtw_fw.h
@@ -0,0 +1,12 @@
+/* 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"
+
+int rtl8188e_firmware_download(struct adapter *padapter);
+void rtw_reset_8051(struct adapter *padapter);
+
+#endif
diff --git a/drivers/staging/r8188eu/include/rtw_mlme.h b/drivers/staging/r8188eu/include/rtw_mlme.h
index 77169c15080a..42d850f9d777 100644
--- a/drivers/staging/r8188eu/include/rtw_mlme.h
+++ b/drivers/staging/r8188eu/include/rtw_mlme.h
@@ -310,13 +310,12 @@ 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 */
u8 *nic_hdl;
- u8 not_indic_disco;
struct list_head *pscanned;
struct __queue free_bss_pool;
struct __queue scanned_queue;
@@ -417,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);
@@ -456,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;
@@ -554,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);
diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h
index 26f31f20e428..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);
@@ -632,8 +632,8 @@ void addba_timer_hdl(struct sta_info *psta);
_set_timer(&(mlmeext)->link_timer, (ms)); \
} while (0)
-int cckrates_included(unsigned char *rate, int ratelen);
-int cckratesonly_included(unsigned char *rate, int ratelen);
+bool cckrates_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);
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 */
diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
index b43a46887343..4ac4e6b3e177 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 */
@@ -72,7 +65,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.
@@ -80,7 +72,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 {
@@ -91,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;
@@ -179,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;
@@ -217,22 +207,8 @@ struct sta_recv_priv {
};
struct recv_buf {
- struct list_head list;
- spinlock_t recvbuf_lock;
- u32 ref_cnt;
struct adapter *adapter;
- u8 *pbuf;
- u8 *pallocated_buf;
- u32 len;
- u8 *phead;
- u8 *pdata;
- u8 *ptail;
- u8 *pend;
struct urb *purb;
- 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;
};
@@ -274,7 +250,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,
@@ -291,40 +266,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 *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 */
-
- /* 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 */
diff --git a/drivers/staging/r8188eu/include/rtw_security.h b/drivers/staging/r8188eu/include/rtw_security.h
index 9231201f1009..783ae18a122a 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 */
@@ -222,111 +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];
-
-#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);
diff --git a/drivers/staging/r8188eu/include/sta_info.h b/drivers/staging/r8188eu/include/sta_info.h
index 24b1254310b2..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;
@@ -344,7 +298,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);
diff --git a/drivers/staging/r8188eu/include/usb_ops.h b/drivers/staging/r8188eu/include/usb_ops.h
index 0a1155bbc7b8..14526fcff4ae 100644
--- a/drivers/staging/r8188eu/include/usb_ops.h
+++ b/drivers/staging/r8188eu/include/usb_ops.h
@@ -30,11 +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) {
- DBG_88E("[dvobj:%p][ERROR] continual_urb_error:%d > %d\n",
- dvobj, value, MAX_CONTINUAL_URB_ERR);
+ if (value > MAX_CONTINUAL_URB_ERR)
ret = true;
- }
+
return ret;
}
@@ -55,7 +53,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/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h
index 0b0bd39a257f..c331be19ff83 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),
@@ -168,72 +167,38 @@ 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) \
*(__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_))
-#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 GetMData(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_DATA_)) != 0)
-
-#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 GetOrder(pbuf) \
- (((*(__le16 *)(pbuf)) & cpu_to_le16(_ORDER_)) != 0)
-
#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)))
@@ -303,7 +268,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;
@@ -380,7 +345,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;
@@ -569,12 +534,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
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[];
};
/*
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/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 41b457838a5b..eb9375b0c660 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);
}
@@ -344,26 +342,20 @@ 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");
+ } else if (!(value & AUTH_ALG_LEAP)) {
ret = -EINVAL;
}
return ret;
@@ -400,8 +392,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_;
@@ -409,8 +399,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;
@@ -435,11 +423,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;
@@ -476,15 +462,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, &param->u.crypt.key[16], 8);
memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, &param->u.crypt.key[24], 8);
padapter->securitypriv.binstallGrpkey = true;
- DBG_88E(" ~~~~set sta key:groupkey\n");
padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx;
@@ -537,14 +520,6 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
goto exit;
}
- /* 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) {
ret = -1;
goto exit;
@@ -616,8 +591,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);
@@ -730,19 +703,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;
@@ -793,7 +762,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
@@ -804,7 +772,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;
@@ -815,9 +782,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);
@@ -827,7 +791,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)) {
@@ -838,7 +801,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;
@@ -1057,19 +1019,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))
@@ -1101,7 +1056,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;
}
@@ -1151,15 +1105,11 @@ 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 &&
@@ -1322,13 +1272,9 @@ 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;
memcpy(ndis_ssid.Ssid, extra, len);
@@ -1371,11 +1317,6 @@ static int rtw_wx_set_essid(struct net_device *dev,
}
exit:
-
- DBG_88E("<=%s, ret %d\n", __func__, ret);
-
-
-
return ret;
}
@@ -1383,7 +1324,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 +1340,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,
@@ -1515,10 +1456,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;
}
@@ -1530,8 +1467,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); */
@@ -1559,10 +1494,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;
}
@@ -1574,8 +1505,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 */
@@ -1607,7 +1536,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));
@@ -1616,7 +1544,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_;
@@ -1635,12 +1562,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_;
@@ -1648,7 +1573,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_;
@@ -1656,8 +1580,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_;
@@ -1678,8 +1600,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_;
@@ -1717,7 +1637,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 +1698,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,
@@ -1867,7 +1787,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);
}
@@ -2005,11 +1924,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;
@@ -2037,18 +1954,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;
}
@@ -2063,8 +1976,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, addr, 0xFFFFF);
/*
* IMPORTANT!!
* Only when wireless private ioctl is at odd order,
@@ -2083,9 +1999,12 @@ 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);
+ rtl8188e_PHY_SetRFReg(padapter, addr, 0xFFFFF, data32);
return 0;
}
@@ -2095,12 +2014,9 @@ 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, 1))
- DBG_88E("%s set channel_plan = 0x%02X\n", __func__, pmlmepriv->ChannelPlan);
- else
+ if (rtw_set_chplan_cmd(padapter, channel_plan_req) != _SUCCESS)
return -EPERM;
return 0;
@@ -2122,8 +2038,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;
@@ -2155,15 +2069,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;
@@ -2212,9 +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);
- 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;
@@ -2245,8 +2153,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 */
@@ -2308,19 +2214,15 @@ 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,
@@ -2344,7 +2246,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;
}
@@ -2373,8 +2274,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;
}
@@ -2404,8 +2303,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;
}
@@ -2427,8 +2324,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') {
@@ -2456,42 +2351,30 @@ 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;
- 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;
-
- return ret;
}
-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;
- 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. */
/* 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 */
@@ -2499,95 +2382,72 @@ static int 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,
- 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;
- 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);
- return ret;
}
-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;
- 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);
- return ret;
}
-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;
- 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);
- return ret;
}
-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;
- 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);
- return ret;
}
-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;
@@ -2597,30 +2457,24 @@ 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,
- 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;
- 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);
- return ret;
}
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;
@@ -2640,7 +2494,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;
@@ -2681,14 +2534,13 @@ 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,
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;
@@ -2709,7 +2561,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;
@@ -2764,14 +2615,13 @@ 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,
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;
@@ -2790,7 +2640,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;
@@ -2840,14 +2689,13 @@ 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,
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;
@@ -2866,7 +2714,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;
@@ -2906,14 +2753,13 @@ 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,
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;
@@ -2934,7 +2780,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;
@@ -2982,7 +2827,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,
@@ -3007,12 +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 */
- DBG_88E("[%s] data = %s\n", __func__, extra);
-
- if (pwdinfo->p2p_state == P2P_STATE_NONE) {
- DBG_88E("[%s] WiFi Direct is disable!\n", __func__);
+ if (pwdinfo->p2p_state == P2P_STATE_NONE)
return ret;
- }
if (pwdinfo->ui_got_wps_info == P2P_NO_WPSINFO)
return -1;
@@ -3054,21 +2895,18 @@ 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;
}
-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;
@@ -3088,16 +2926,11 @@ static int 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 ret;
- }
+ if (wrqu->data.length <= 37)
+ 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;
@@ -3167,17 +3000,13 @@ static int 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 {
- DBG_88E("[%s] NOT Found in the Scanning Queue!\n", __func__);
}
- return ret;
}
-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;
@@ -3185,11 +3014,8 @@ static int 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 ret;
+ return;
} else {
if (extra[0] == '0') /* Disable the persistent group function. */
pwdinfo->persistent_supported = false;
@@ -3199,14 +3025,12 @@ 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,
- 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};
@@ -3228,11 +3052,8 @@ static int 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 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);
@@ -3246,18 +3067,16 @@ static int 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 {
- DBG_88E("[%s] Unknown WPS config methodn", __func__);
- return ret;
- }
+ else
+ return;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
@@ -3305,7 +3124,6 @@ static int 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;
@@ -3325,24 +3143,19 @@ static int 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 {
- 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 */
/* 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;
- 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. */
@@ -3359,7 +3172,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,
@@ -3368,7 +3180,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)) {
@@ -3422,12 +3233,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)
- 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)) {
@@ -3447,7 +3252,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,
@@ -3456,22 +3261,21 @@ 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;
- 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;
@@ -3503,7 +3307,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;
@@ -3518,7 +3321,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);
@@ -3572,13 +3374,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, i, 0xffffffff);
if (j % 4 == 1)
pr_info("0x%02x ", i);
pr_info(" 0x%08x ", value);
@@ -3596,12 +3398,10 @@ 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;
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;
@@ -3618,13 +3418,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;
@@ -3632,31 +3429,32 @@ 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 */
- 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;
+ }
break;
case 0x75:/* write_rf */
- rtl8188e_PHY_SetRFReg(padapter, minor_cmd, 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));
+ if (minor_cmd != RF_PATH_A) {
+ ret = -EINVAL;
+ break;
+ }
+ rtl8188e_PHY_SetRFReg(padapter, arg, 0xffffffff, extra_arg);
break;
case 0x76:
@@ -3719,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);
@@ -3733,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)
- 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);
+ rtw_read8(padapter, reg);
}
break;
@@ -3748,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);
@@ -3762,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)
- 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);
+ rtw_read16(padapter, reg);
}
break;
case 0x08: /* continuous write dword test */
@@ -3776,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);
@@ -3790,13 +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)
- 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);
+ rtw_read32(padapter, reg);
}
break;
}
@@ -3811,8 +3592,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;
@@ -3827,139 +3606,44 @@ 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);
- if (psta) {
- 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));
- }
+ rtw_get_stainfo(pstapriv, 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:
- {
- int i, j;
- 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++) {
- 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) {
- 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);
- }
- }
- }
- }
- spin_unlock_bh(&pstapriv->sta_hash_lock);
- }
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 */
@@ -3970,38 +3654,24 @@ 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;
- DBG_88E("set rx_stbc =%d\n", pregpriv->rx_stbc);
- } else {
- DBG_88E("get rx_stbc =%d\n", pregpriv->rx_stbc);
- }
}
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;
- 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 */
@@ -4018,14 +3688,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
@@ -4034,51 +3696,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;
@@ -4155,8 +3787,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);
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 b65e44f97826..550721eef681 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;
@@ -362,7 +358,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;
@@ -474,37 +469,45 @@ 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) {
- DBG_88E("Can't _rtw_init_xmit_priv\n");
- return _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) {
- DBG_88E("Can't _rtw_init_recv_priv\n");
- return _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) {
- DBG_88E("Can't _rtw_init_sta_priv\n");
- return _FAIL;
+ dev_err(dvobj_to_dev(padapter->dvobj), "_rtw_init_sta_priv failed\n");
+ goto free_recv_priv;
}
padapter->stapriv.padapter = padapter;
@@ -521,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)
@@ -611,8 +634,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;
@@ -654,21 +675,19 @@ 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
- rtw_netif_wake_queue(pnetdev);
+ netif_tx_wake_all_queues(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);
- rtw_netif_stop_queue(pnetdev);
- DBG_88E("-88eu_drv - drv_open fail, bup =%d\n", padapter->bup);
+ netif_tx_stop_all_queues(pnetdev);
return -1;
}
@@ -687,7 +706,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 +724,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 +748,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,13 +770,10 @@ 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))
- rtw_netif_stop_queue(pnetdev);
+ netif_tx_stop_all_queues(pnetdev);
}
/* s2. */
@@ -789,9 +793,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;
}
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;
diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c
index 5a7fb94e21c1..1e14b6d49795 100644
--- a/drivers/staging/r8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/r8188eu/os_dep/recv_linux.c
@@ -12,47 +12,17 @@
#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)
-{
- precvframe->pkt_newalloc = NULL;
- precvframe->pkt = NULL;
- 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)
{
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;
- precvbuf->pbuf = NULL;
- precvbuf->pdata = NULL;
- precvbuf->phead = NULL;
- precvbuf->ptail = NULL;
- precvbuf->pend = NULL;
- precvbuf->transfer_len = 0;
- precvbuf->len = 0;
return res;
}
@@ -100,11 +70,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)
{
diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
index 91792dfd3bbe..ffd727fb32e3 100644
--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
@@ -117,16 +117,7 @@ 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 */
- sema_init(&pdvobjpriv->usb_suspend_sema, 0);
rtw_reset_continual_urb_error(pdvobjpriv);
usb_get_dev(pusbd);
@@ -148,15 +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. */
- DBG_88E("usb attached..., try to reset usb device\n");
usb_reset_device(interface_to_usbdev(usb_intf));
- }
}
kfree(dvobj);
}
@@ -184,7 +173,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);
@@ -202,8 +190,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)
@@ -215,18 +201,10 @@ 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);
+ (padapter->bSurpriseRemoved))
goto exit;
- }
pwrpriv->bInSuspend = true;
rtw_cancel_all_timer(padapter);
@@ -236,23 +214,15 @@ 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. */
rtw_disassoc_cmd(padapter, 0, false);
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);
-
+ check_fwstate(pmlmepriv, _FW_LINKED))
pmlmepriv->to_roaming = 1;
- }
/* s2-2. indicate disconnect to os */
rtw_indicate_disconnect(padapter);
/* s2-3. */
@@ -270,9 +240,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;
}
@@ -283,9 +250,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;
@@ -295,7 +259,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;
@@ -306,10 +269,8 @@ 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]);
+ if (padapter->pid[1] != 0)
rtw_signal_process(padapter->pid[1], SIGUSR2);
- }
rtw_roaming(padapter, NULL);
@@ -317,9 +278,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;
}
@@ -337,13 +295,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;
@@ -388,51 +346,39 @@ 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");
+ usb_autopm_get_interface(pusb_intf);
/* alloc dev name after read efuse. */
- rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname);
+ 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);
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 handle_dualmac;
+ 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
- );
-
- status = _SUCCESS;
+ return padapter;
+free_drv_sw:
+ 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)
@@ -445,17 +391,13 @@ 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);
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)
@@ -473,15 +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) {
- DBG_88E("rtw_init_primarystruct adapter Failed!\n");
+ if (!if1)
goto free_dvobj;
- }
- if (ui_pid[1] != 0) {
- DBG_88E("ui_pid[1]:%d\n", ui_pid[1]);
+ if (ui_pid[1] != 0)
rtw_signal_process(ui_pid[1], SIGUSR2);
- }
return 0;
@@ -500,8 +438,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;
@@ -513,14 +449,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;
@@ -529,13 +461,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);
diff --git a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
index d1cb33d3e6a7..c4b6dbc8d66d 100644
--- a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
@@ -20,20 +20,11 @@ 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;
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++) {
@@ -71,31 +62,21 @@ 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);
-
+ padapter->bWritePortCancel)
goto check_completion;
- }
if (purb->status) {
- DBG_88E("###=> urb_write_port_complete status(%d)\n", purb->status);
if (purb->status == -EINPROGRESS) {
goto check_completion;
} else if (purb->status == -ENOENT) {
- DBG_88E("%s: -ENOENT\n", __func__);
goto check_completion;
} else if (purb->status == -ECONNRESET) {
- DBG_88E("%s: -ECONNRESET\n", __func__);
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");
goto check_completion;
}
@@ -174,7 +155,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);
- DBG_88E("usb_write_port, status =%d\n", status);
switch (status) {
case -ENODEV:
@@ -202,8 +182,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++) {
diff --git a/drivers/staging/r8188eu/os_dep/xmit_linux.c b/drivers/staging/r8188eu/os_dep/xmit_linux.c
index 088c294f2586..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) {
@@ -78,10 +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]) {
- DBG_88E("pxmitbuf->pxmit_urb[i]==NULL");
+ if (!pxmitbuf->pxmit_urb[i])
return _FAIL;
- }
}
return _SUCCESS;
}
@@ -188,14 +186,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) {
- DBG_88E("%s()-%d: rtw_xmit() return error!\n", __func__, __LINE__);
pxmitpriv->tx_drop++;
dev_kfree_skb_any(newskb);
} else {
pxmitpriv->tx_pkts++;
}
} else {
- DBG_88E("%s-%d: skb_copy() failed!\n", __func__, __LINE__);
pxmitpriv->tx_drop++;
spin_unlock_bh(&pstapriv->asoc_list_lock);
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 <linux/bits.h>
+
/* 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...) \
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 ||
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index 15207dc1f5c5..68c0bf9a191a 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 */
@@ -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);
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");
}
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
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;
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);
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 105fe0e3482a..d8d394b67eeb 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;
@@ -1514,7 +1514,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)
@@ -1550,10 +1550,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/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);
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;
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 */
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 */
}
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)
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;
}
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);
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
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;
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);
diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
index 253d755e547f..88b1878854e0 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
@@ -33,8 +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
#define MIN_BUFFER_SIZE (80 * 1024)
@@ -1894,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) {
@@ -1954,9 +1951,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 +2003,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");
diff --git a/drivers/staging/vc04_services/interface/TODO b/drivers/staging/vc04_services/interface/TODO
index 241ca004735c..97085a0b3223 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,71 +16,42 @@ 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
-
-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.
-
-3) 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.
-
-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
-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.
-
-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 +59,15 @@ 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.
+
+* 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/
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 3a2e4582db8e..f0bfacfdea80 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) |
@@ -582,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;
@@ -1209,6 +1219,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.
@@ -1290,14 +1303,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;
}
/*
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..8f99272dbd6f 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -205,27 +205,27 @@ 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 "???";
}
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,
@@ -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;
}
@@ -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;
}
@@ -1037,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(&quota_spinlock);
quota->message_use_count++;
@@ -1122,7 +1119,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);
@@ -1177,8 +1174,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;
}
@@ -1187,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);
@@ -1524,15 +1519,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 */
- vchiq_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 */
@@ -1666,7 +1663,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 +2060,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);
}
@@ -2097,16 +2094,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)
{
@@ -2220,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;
@@ -2306,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))
@@ -2326,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;
@@ -2371,7 +2363,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 +2379,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
@@ -2486,7 +2467,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",
@@ -2642,7 +2623,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;
@@ -2678,7 +2659,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;
@@ -2711,9 +2692,8 @@ 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)
- vchiq_set_service_state(service, VCHIQ_SRVSTATE_LISTENING);
+ if (service->srvstate == VCHIQ_SRVSTATE_CLOSEWAIT)
+ set_service_state(service, VCHIQ_SRVSTATE_LISTENING);
}
complete(&service->remove_event);
} else {
@@ -2723,7 +2703,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 */
@@ -2754,8 +2734,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);
@@ -2763,7 +2742,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);
@@ -2788,7 +2767,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;
@@ -2837,7 +2816,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);
@@ -2855,7 +2834,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);
}
@@ -2918,7 +2897,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);
}
@@ -3666,10 +3645,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;
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);
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 <debugfs>/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);
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 ?
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);
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;
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,
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);
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;
-}
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:
diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c
index 1e1c5a7d8968..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
*
@@ -255,23 +231,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 +276,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 +416,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 +425,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)
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index e92ecfad26d2..7827e579ef3d 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));
@@ -442,12 +438,8 @@ 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;
- 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;
@@ -456,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;
@@ -479,15 +470,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;
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;
}
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 8b6623a751f0..ca974d61d3f4 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;
@@ -381,13 +381,6 @@ struct vnt_private {
struct ieee80211_low_level_stats low_stats;
};
-#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
- if ((uVar) >= ((uModulo) - 1)) \
- (uVar) = 0; \
- else \
- (uVar)++; \
-}
-
int vnt_init(struct vnt_private *priv);
#endif
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
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index b9c06b312ae1..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,
@@ -528,10 +180,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 +188,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 +281,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 +336,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 +383,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 +405,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 +440,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;
}
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index a31947f2620d..4d29f8ebb393 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;
@@ -355,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);
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);
}
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)
diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig
index 83ee4d0ca8c6..835a855409d8 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
@@ -6,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/Makefile b/drivers/staging/wfx/Makefile
index 0e0cc982ceab..c8b356f71c99 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)
@@ -17,9 +17,9 @@ 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')
wfx-$(subst m,y,$(CONFIG_MMC)) += bus_sdio.o
obj-$(CONFIG_WFX) += wfx.o
diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c
index a0f9d1b53019..bcea9d5b119c 100644
--- a/drivers/staging/wfx/bh.c
+++ b/drivers/staging/wfx/bh.c
@@ -32,19 +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))) {
+ 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);
@@ -67,14 +63,13 @@ 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;
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);
@@ -88,9 +83,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 +100,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 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 +165,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;
@@ -182,9 +178,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)
@@ -199,12 +195,12 @@ 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++) {
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;
@@ -219,19 +215,18 @@ 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)
{
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);
+ dev_warn(wdev->dev, "chip reports errors: %02x\n", cfg_reg & 0xFF);
+ wfx_config_reg_write_bits(wdev, 0xFF, 0x00);
}
}
@@ -261,8 +256,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 */
@@ -270,7 +264,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);
@@ -289,12 +283,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)
{
@@ -302,9 +295,10 @@ 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 (;;) {
- control_reg_read(wdev, &reg);
+ wfx_control_reg_read(wdev, &reg);
now = ktime_get();
if (reg & 0xFFF)
break;
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 <linux/atomic.h>
#include <linux/wait.h>
+#include <linux/completion.h>
#include <linux/workqueue.h>
struct wfx_dev;
diff --git a/drivers/staging/wfx/bus.h b/drivers/staging/wfx/bus.h
index ca04b3da6204..ccadfdd6873c 100644
--- a/drivers/staging/wfx/bus.h
+++ b/drivers/staging/wfx/bus.h
@@ -20,11 +20,9 @@
#define WFX_REG_SET_GEN_R_W 0x6
#define WFX_REG_FRAME_OUT 0x7
-struct 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);
+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 (*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 a670176ba06f..51a0d58a9070 100644
--- a/drivers/staging/wfx/bus_sdio.c
+++ b/drivers/staging/wfx/bus_sdio.c
@@ -10,8 +10,10 @@
#include <linux/mmc/sdio_func.h>
#include <linux/mmc/card.h>
#include <linux/interrupt.h>
+#include <linux/of_device.h>
#include <linux/of_irq.h>
#include <linux/irq.h>
+#include <linux/align.h>
#include "bus.h"
#include "wfx.h"
@@ -19,9 +21,24 @@
#include "main.h"
#include "bh.h"
-static const struct wfx_platform_data wfx_sdio_pdata = {
- .file_fw = "wfm_wf200",
- .file_pds = "wf200.pds",
+static const struct wfx_platform_data pdata_wf200 = {
+ .file_fw = "wfx/wfm_wf200",
+ .file_pds = "wfx/wf200.pds",
+};
+
+static const struct wfx_platform_data pdata_brd4001a = {
+ .file_fw = "wfx/wfm_wf200",
+ .file_pds = "wfx/brd4001a.pds",
+};
+
+static const struct wfx_platform_data pdata_brd8022a = {
+ .file_fw = "wfx/wfm_wf200",
+ .file_pds = "wfx/brd8022a.pds",
+};
+
+static const struct wfx_platform_data pdata_brd8023a = {
+ .file_fw = "wfx/wfm_wf200",
+ .file_pds = "wfx/brd8023a.pds",
};
struct wfx_sdio_priv {
@@ -32,16 +49,15 @@ 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;
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)
@@ -53,16 +69,15 @@ 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;
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)
@@ -125,8 +140,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);
@@ -158,26 +172,28 @@ 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 = {
- .copy_from_io = wfx_sdio_copy_from_io,
- .copy_to_io = wfx_sdio_copy_to_io,
- .irq_subscribe = wfx_sdio_irq_subscribe,
+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,
.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[] = {
- { .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 },
{ },
};
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)
{
+ 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;
@@ -188,28 +204,18 @@ static int wfx_sdio_probe(struct sdio_func *func,
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 |
- MMC_QUIRK_BROKEN_BYTE_MODE_512;
sdio_claim_host(func);
ret = sdio_enable_func(func);
@@ -217,26 +223,24 @@ static int wfx_sdio_probe(struct sdio_func *func,
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);
+ bus->core = wfx_init_common(&func->dev, 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;
}
@@ -250,12 +254,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) },
- /* FIXME: ignore VID/PID and only rely on device tree */
- // { SDIO_DEVICE(SDIO_ANY_ID, SDIO_ANY_ID) },
+ /* WF200 does not have official VID/PID */
+ { SDIO_DEVICE(0x0000, 0x1000) },
{ },
};
MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids);
diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c
index fa0ff66a457d..7fb1afb8ed31 100644
--- a/drivers/staging/wfx/bus_spi.c
+++ b/drivers/staging/wfx/bus_spi.c
@@ -23,11 +23,27 @@
#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 = "wfx/wfm_wf200",
+ .file_pds = "wfx/wf200.pds",
+ .use_rising_clk = true,
+};
+
+static const struct wfx_platform_data pdata_brd4001a = {
+ .file_fw = "wfx/wfm_wf200",
+ .file_pds = "wfx/brd4001a.pds",
+ .use_rising_clk = true,
+};
-static const struct wfx_platform_data wfx_spi_pdata = {
- .file_fw = "wfm_wf200",
- .file_pds = "wf200.pds",
+static const struct wfx_platform_data pdata_brd8022a = {
+ .file_fw = "wfx/wfm_wf200",
+ .file_pds = "wfx/brd8022a.pds",
+ .use_rising_clk = true,
+};
+
+static const struct wfx_platform_data pdata_brd8023a = {
+ .file_fw = "wfx/wfm_wf200",
+ .file_pds = "wfx/brd8023a.pds",
.use_rising_clk = true,
};
@@ -38,27 +54,25 @@ 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)
+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;
- struct spi_message m;
- struct spi_transfer t_addr = {
- .tx_buf = &regaddr,
- .len = sizeof(regaddr),
+ struct spi_message m;
+ struct spi_transfer t_addr = {
+ .tx_buf = &regaddr,
+ .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;
@@ -80,22 +94,21 @@ 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);
/* FIXME: use a bounce buffer */
u16 *src16 = (void *)src;
int ret, i;
- struct spi_message m;
- struct spi_transfer t_addr = {
- .tx_buf = &regaddr,
- .len = sizeof(regaddr),
+ struct spi_message m;
+ struct spi_transfer t_addr = {
+ .tx_buf = &regaddr,
+ .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");
@@ -149,8 +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)
@@ -163,23 +175,23 @@ 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);
}
-static const struct 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,
+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,
.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)
{
+ struct wfx_platform_data *pdata;
struct wfx_spi_priv *bus;
int ret;
@@ -188,16 +200,19 @@ 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);
+ 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,25 +222,20 @@ 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)
- 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);
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;
@@ -244,16 +254,20 @@ static void 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 },
{ },
};
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" },
{ },
};
MODULE_DEVICE_TABLE(of, wfx_spi_of_match);
diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c
index bfc3961b7b89..a4b5ffe158e4 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 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;
@@ -76,8 +74,8 @@ void wfx_rx_cb(struct wfx_vif *wvif,
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_rx.h b/drivers/staging/wfx/data_rx.h
index 84d0e3c0507b..cf708f16d602 100644
--- a/drivers/staging/wfx/data_rx.h
+++ b/drivers/staging/wfx/data_rx.h
@@ -10,9 +10,8 @@
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);
+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 052a19161dc5..e07381b2ff4d 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;
@@ -31,8 +30,8 @@ static int wfx_get_hw_rate(struct wfx_dev *wdev,
}
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) {
@@ -44,7 +43,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,35 +65,31 @@ 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 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 (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;
}
-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;
@@ -103,13 +98,12 @@ static int wfx_tx_policy_release(struct 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 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);
@@ -123,11 +117,9 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif,
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 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 +135,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,15 +149,14 @@ 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;
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;
}
@@ -173,7 +164,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);
}
@@ -183,8 +174,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);
@@ -192,7 +182,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));
@@ -207,7 +197,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;
@@ -221,8 +211,7 @@ static bool ieee80211_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 +265,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 +274,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,19 +313,17 @@ 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 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,23 +340,22 @@ 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;
- 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;
}
/* Fill tx request */
- req = (struct 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.
+ 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 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;
@@ -396,19 +380,17 @@ 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");
+ 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)
@@ -417,10 +399,10 @@ void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
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 (ieee80211_is_action_back(hdr)) {
+ if (wfx_is_action_back(hdr)) {
dev_info(wdev->dev, "drop BA action\n");
goto drop;
}
@@ -435,14 +417,13 @@ 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 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;
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);
@@ -450,9 +431,8 @@ 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,
- const struct hif_cnf_tx *arg)
+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;
int tx_count;
@@ -465,8 +445,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);
@@ -488,7 +467,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 +482,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;
@@ -513,17 +492,14 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct 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));
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 +515,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct 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,21 +533,18 @@ 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;
struct wfx_vif *wvif;
- struct hif_msg *hif;
+ struct wfx_hif_msg *hif;
struct sk_buff *skb;
skb_queue_head_init(&dropped);
@@ -588,7 +560,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..983470705e4b 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;
@@ -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_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg);
-void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- u32 queues, bool drop);
+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);
static inline struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb)
{
@@ -57,10 +55,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 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/debug.c b/drivers/staging/wfx/debug.c
index 9f93268a3202..e8265208f9a5 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;
@@ -44,17 +43,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);
}
@@ -63,21 +62,20 @@ 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 = 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)
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, \
+ 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))
@@ -153,16 +151,14 @@ 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);
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");
@@ -185,7 +181,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);
@@ -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,24 +236,23 @@ 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;
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
- * 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);
@@ -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);
@@ -289,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;
@@ -325,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;
@@ -354,12 +323,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("ps_timeout", 0600, d, wdev, &wfx_ps_timeout_fops);
+ debugfs_create_file("send_hif_msg", 0600, d, wdev, &wfx_send_hif_msg_fops);
return 0;
}
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/fwio.c b/drivers/staging/wfx/fwio.c
index 98a9391b2bee..3d1b8a135dc0 100644
--- a/drivers/staging/wfx/fwio.c
+++ b/drivers/staging/wfx/fwio.c
@@ -64,23 +64,20 @@
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 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 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 +89,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;
@@ -112,8 +109,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);
@@ -156,7 +152,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, &reg);
+ ret = wfx_sram_reg_read(wdev, WFX_DCA_NCP_STATUS, &reg);
if (ret < 0)
return -EIO;
now = ktime_get();
@@ -166,8 +162,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;
@@ -192,25 +187,21 @@ 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;
}
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 = 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;
- /* 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 = 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 +212,10 @@ static void print_boot_status(struct wfx_dev *wdev)
{
u32 reg;
- sram_reg_read(wdev, WFX_STATUS_INFO, &reg);
+ wfx_sram_reg_read(wdev, WFX_STATUS_INFO, &reg);
if (reg == 0x12345678)
return;
- sram_reg_read(wdev, WFX_ERR_INFO, &reg);
+ wfx_sram_reg_read(wdev, WFX_ERR_INFO, &reg);
if (reg < ARRAY_SIZE(fwio_errors) && fwio_errors[reg])
dev_info(wdev->dev, "secure boot: %s\n", fwio_errors[reg]);
else
@@ -245,56 +236,53 @@ 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;
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",
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,12 +308,10 @@ 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",
- 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;
}
@@ -341,13 +327,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, &reg);
+ ret = wfx_config_reg_read(wdev, &reg);
if (ret < 0) {
dev_err(wdev->dev, "bus returned an error during first read access. Bus configuration error?\n");
return -EIO;
@@ -360,8 +346,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);
@@ -374,12 +359,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, &reg);
+ ret = wfx_control_reg_read(wdev, &reg);
now = ktime_get();
if (reg & CTRL_WLAN_READY)
break;
@@ -388,18 +373,17 @@ 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 = 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_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h
index b0aa13b23a51..8b91b1d4a46b 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
*
@@ -8,11 +8,9 @@
#ifndef WFX_HIF_API_CMD_H
#define WFX_HIF_API_CMD_H
-#include <linux/ieee80211.h>
-
#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 +29,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 +49,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 +58,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 +101,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 +113,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,47 +133,47 @@ 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 {
- /* packet_id is not interpreted by the device, so it is not necessary to
- * declare it little endian
+struct wfx_hif_req_tx {
+ /* 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;
@@ -203,17 +201,17 @@ 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
- * 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;
@@ -228,13 +226,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 +240,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 +272,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 +284,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 +310,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 +326,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 +339,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 +365,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 +389,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 +415,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 +428,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 +450,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 +458,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 +479,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 +533,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 +541,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 5f74f829b7df..4d400fdc2252 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
*
@@ -8,19 +8,13 @@
#ifndef WFX_HIF_API_GENERAL_H
#define WFX_HIF_API_GENERAL_H
-#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/if_ether.h>
-#else
-#include <net/ethernet.h>
-#include <stdint.h>
-#define __packed __attribute__((__packed__))
-#endif
#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;
@@ -30,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,
@@ -43,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,
@@ -56,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,
@@ -87,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,
@@ -113,17 +107,13 @@ enum hif_api_rate_index {
API_RATE_NUM_ENTRIES = 22
};
-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.
- */
+struct wfx_hif_ind_startup {
__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];
@@ -144,23 +134,23 @@ 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;
-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,
@@ -170,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;
@@ -203,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 */
@@ -213,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,
@@ -242,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 da534f244757..7b68b83866c9 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
*
@@ -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 6963b54d5593..64ca8acb8e4f 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 wfx_hif_msg *hif, const void *buf)
{
/* All confirm messages start with status */
int status = le32_to_cpup((__le32 *)buf);
@@ -32,8 +32,7 @@ static int 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;
}
@@ -50,19 +49,19 @@ 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 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 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 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");
@@ -71,59 +70,51 @@ 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 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));
- 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);
-
+ memcpy(&wdev->hw_caps, body, sizeof(struct wfx_hif_ind_startup));
complete(&wdev->firmware_ready);
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 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 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 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);
+ dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__);
return -EIO;
}
- skb_pull(skb, sizeof(struct 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;
}
-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 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) {
@@ -147,16 +138,14 @@ static int 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 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 wfx_hif_msg *hif, const void *buf)
{
struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface);
@@ -169,12 +158,11 @@ 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 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__);
@@ -186,9 +174,8 @@ 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 wfx_hif_msg *hif, const void *buf)
{
struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface);
@@ -201,11 +188,10 @@ 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 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) {
@@ -230,10 +216,10 @@ 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 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) {
@@ -248,20 +234,17 @@ static int 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;
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;
}
}
@@ -310,10 +293,10 @@ 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 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;
@@ -326,8 +309,7 @@ static int 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,
@@ -337,15 +319,14 @@ 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 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)
- 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,
@@ -357,45 +338,41 @@ static int 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);
+ int (*handler)(struct wfx_dev *wdev, const struct wfx_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)
{
int i;
- const struct 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) {
- /* 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
- * 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) {
- hif_generic_confirm(wdev, hif, hif->body);
+ wdev->hif_cmd.buf_send && wdev->hif_cmd.buf_send->id == hif_id) {
+ wfx_hif_generic_confirm(wdev, hif, hif->body);
goto free;
}
for (i = 0; i < ARRAY_SIZE(hif_handlers); i++) {
@@ -405,12 +382,10 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb)
goto free;
}
}
- if (hif_id & 0x80)
- dev_err(wdev->dev, "unsupported HIF indication: ID %02x\n",
- hif_id);
+ if (hif_id & HIF_ID_IS_INDICATION)
+ 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 2fd8bbd36e25..ae3cc5919dcd 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 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;
@@ -37,16 +36,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 = "";
@@ -62,8 +61,8 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct 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;
@@ -73,13 +72,10 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct 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);
- wdev->hif_cmd.buf_send = NULL;
- mutex_unlock(&wdev->hif_cmd.lock);
- return 0;
+ /* Chip won't reply. Ensure the wq has send the buffer before to continue. */
+ flush_workqueue(system_highpri_wq);
+ ret = 0;
+ goto end;
}
if (wdev->poll_irq)
@@ -101,31 +97,32 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request,
ret = wdev->hif_cmd.ret;
}
+end:
wdev->hif_cmd.buf_send = NULL;
mutex_unlock(&wdev->hif_cmd.lock);
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;
}
-/* 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 hif_shutdown(struct wfx_dev *wdev)
+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)
@@ -135,17 +132,17 @@ int 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;
}
-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;
- 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;
@@ -157,11 +154,11 @@ 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;
- 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;
@@ -172,14 +169,13 @@ 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;
- 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;
@@ -190,14 +186,12 @@ int 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",
- 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,13 +202,12 @@ 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;
- 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;
@@ -227,14 +220,13 @@ 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;
- 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");
@@ -242,20 +234,16 @@ int 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
@@ -276,10 +264,10 @@ 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;
+ struct wfx_hif_msg *hif;
/* body associated to HIF_REQ_ID_STOP_SCAN is empty */
wfx_alloc_hif(0, &hif);
@@ -291,12 +279,12 @@ 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;
- 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);
@@ -309,8 +297,7 @@ int 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);
@@ -322,41 +309,36 @@ 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;
- 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;
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;
}
-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 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;
/* 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.
- */
- wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY,
- sizeof(*body));
+ /* 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));
ret = wfx_cmd_send(wdev, hif, NULL, 0, false);
@@ -364,11 +346,11 @@ 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;
- 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;
@@ -379,13 +361,12 @@ 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;
- 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;
@@ -403,18 +384,17 @@ int 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;
}
-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;
- 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;
@@ -434,12 +414,12 @@ 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;
- 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)
@@ -448,8 +428,7 @@ int 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));
@@ -458,28 +437,26 @@ 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;
- 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;
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 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;
- 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;
@@ -494,12 +471,12 @@ 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;
- 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 e57eabdcfa77..71817a6571f0 100644
--- a/drivers/staging/wfx/hif_tx.h
+++ b/drivers/staging/wfx/hif_tx.h
@@ -10,51 +10,52 @@
#ifndef WFX_HIF_TX_H
#define WFX_HIF_TX_H
+#include <linux/types.h>
+#include <linux/mutex.h>
+#include <linux/completion.h>
+
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 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 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);
+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..df1bcb1e2c02 100644
--- a/drivers/staging/wfx/hif_tx_mib.c
+++ b/drivers/staging/wfx/hif_tx_mib.c
@@ -14,22 +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 = {
+ struct wfx_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 = {
+ struct wfx_hif_mib_beacon_wake_up_period arg = {
.wakeup_period_min = dtim_interval,
.receive_dtim = 0,
.wakeup_period_max = listen_interval,
@@ -37,15 +35,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 = {
+ struct wfx_hif_mib_rcpi_rssi_threshold arg = {
.rolling_average_count = 8,
.detection = 1,
};
@@ -60,53 +56,50 @@ 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 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 hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE,
- arg, sizeof(struct hif_mib_count_table));
+ return wfx_hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE,
+ arg, sizeof(struct wfx_hif_mib_count_table));
} else {
- return hif_read_mib(wdev, vif_id,
- HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg,
- sizeof(struct 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));
}
}
-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 = { };
+ struct wfx_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 = { };
+ struct wfx_hif_mib_rx_filter arg = { };
if (filter_bssid)
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 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);
@@ -114,54 +107,52 @@ 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 = {
+ struct wfx_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 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,
};
- 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;
+ 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;
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 = { };
+ struct wfx_hif_mib_protected_mgmt_policy arg = { };
WARN(required && !capable, "incoherent arguments");
if (capable) {
@@ -170,27 +161,25 @@ 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 = {
+ 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 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 = {
+ struct wfx_hif_mib_set_association_mode arg = {
.preambtype_use = 1,
.mode = 1,
.spacing = 1,
@@ -199,14 +188,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;
+ struct wfx_hif_mib_set_tx_rate_retry_policy *arg;
size_t size = struct_size(arg, tx_rate_retry_policy, 1);
int ret;
@@ -222,25 +210,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 = {
+ struct wfx_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 = {
+ struct wfx_hif_mib_arp_ip_addr_table arg = {
.condition_idx = idx,
.arp_enable = HIF_ARP_NS_FILTERING_DISABLE,
};
@@ -250,24 +238,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 = {
+ struct wfx_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 = { };
+ struct wfx_hif_mib_set_uapsd_information arg = { };
if (val & BIT(IEEE80211_AC_VO))
arg.trig_voice = 1;
@@ -277,48 +263,45 @@ 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 = {
+ struct wfx_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 = {
+ struct wfx_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 = {
+ struct wfx_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 = {
+ struct wfx_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 2a3b84868ee4..bcd4ef6a8497 100644
--- a/drivers/staging/wfx/hif_tx_mib.h
+++ b/drivers/staging/wfx/hif_tx_mib.h
@@ -9,41 +9,40 @@
#ifndef WFX_HIF_TX_MIB_H
#define WFX_HIF_TX_MIB_H
-struct wfx_vif;
+#include <linux/types.h>
+
struct sk_buff;
+struct wfx_vif;
+struct wfx_dev;
+struct wfx_hif_ie_table_entry;
+struct wfx_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 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 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_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/hwio.c b/drivers/staging/wfx/hwio.c
index 30eb888830d2..3f9750b470be 100644
--- a/drivers/staging/wfx/hwio.c
+++ b/drivers/staging/wfx/hwio.c
@@ -8,25 +8,16 @@
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/slab.h>
+#include <linux/align.h>
#include "hwio.h"
#include "wfx.h"
#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.
- */
+#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);
@@ -34,18 +25,16 @@ static int 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;
}
-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,38 +42,36 @@ static int 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;
}
-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;
@@ -92,13 +79,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:
@@ -106,15 +93,14 @@ 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;
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)
@@ -124,20 +110,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))
@@ -157,46 +143,45 @@ 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 >= 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);
+ 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);
@@ -204,7 +189,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);
@@ -212,8 +197,7 @@ 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);
@@ -222,7 +206,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);
@@ -233,15 +217,13 @@ 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);
+ 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;
}
@@ -249,104 +231,102 @@ 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);
+ 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 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 ff09575dd1af..c6e7b065b7ff 100644
--- a/drivers/staging/wfx/hwio.h
+++ b/drivers/staging/wfx/hwio.h
@@ -12,20 +12,23 @@
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);
-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 */
@@ -55,21 +58,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/key.c b/drivers/staging/wfx/key.c
index 65134a174683..8f23e8d42bd4 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,14 +50,13 @@ 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;
- 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 hif_tkip_pairwise_key *msg,
return HIF_KEY_TYPE_TKIP_PAIRWISE;
}
-static u8 fill_tkip_group(struct 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)
@@ -92,7 +87,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,9 +96,8 @@ 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,
- struct ieee80211_key_conf *key,
- struct ieee80211_key_seq *seq)
+static u8 fill_ccmp_group(struct wfx_hif_aes_group_key *msg,
+ 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);
@@ -113,13 +107,13 @@ 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;
- 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);
@@ -128,13 +122,13 @@ 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;
- 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));
@@ -142,9 +136,8 @@ 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,
- struct ieee80211_key_conf *key,
- struct ieee80211_key_seq *seq)
+static u8 fill_aes_cmac_group(struct wfx_hif_igtk_group_key *msg,
+ 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);
@@ -158,7 +151,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);
@@ -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) {
@@ -205,13 +193,12 @@ 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;
}
- 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;
}
@@ -220,12 +207,11 @@ 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,
- 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 858d778cc589..b93b16b900c8 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 <jerome.pouiller@silabs.com>");
@@ -94,8 +95,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,
@@ -122,34 +122,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)
@@ -163,64 +163,54 @@ 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
+/* 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 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.
+ * 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 wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len)
{
- int ret;
- int start, brace_level, i;
+ int ret, chunk_type, chunk_len, chunk_num = 0;
- start = 0;
- brace_level = 0;
- if (buf[0] != '{') {
- dev_err(wdev->dev, "valid PDS start with '{'. Did you forget to compress it?\n");
+ if (*buf == '{') {
+ dev_err(wdev->dev, "PDS: malformed file (legacy format?)\n");
return -EINVAL;
}
- 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_SIZE)
- return -EFBIG;
- buf[start] = '{';
- buf[i] = 0;
- dev_dbg(wdev->dev, "send PDS '%s}'\n", buf + start);
- buf[i] = '}';
- ret = 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;
+ 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: unexpectedly 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;
}
@@ -235,18 +225,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;
}
@@ -260,10 +249,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 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 +275,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)
- + 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);
@@ -307,9 +293,11 @@ struct wfx_dev *wfx_init_common(struct device *dev,
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));
+ memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, sizeof(wfx_band_2ghz));
wdev = hw->priv;
wdev->hw = hw;
@@ -317,12 +305,11 @@ 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, "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");
@@ -330,17 +317,19 @@ 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);
- wdev->force_ps_timeout = -1;
if (devm_add_action_or_reset(dev, wfx_free_common, wdev))
return NULL;
return wdev;
+
+err:
+ ieee80211_free_hw(hw);
+ return NULL;
}
int wfx_probe(struct wfx_dev *wdev)
@@ -349,8 +338,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;
@@ -360,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);
@@ -371,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 */
@@ -388,68 +377,64 @@ 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;
+ 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;
+ dev_err(wdev->dev, "chip require secure_link, but can't negotiate it\n");
+ goto bh_unregister;
}
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->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 |=
+ 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;
+ goto bh_unregister;
wdev->poll_irq = false;
err = wdev->hwbus_ops->irq_subscribe(wdev->hwbus_priv);
if (err)
- goto err0;
+ goto bh_unregister;
- 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");
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);
- control_reg_write(wdev, 0);
- hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_QUIESCENT);
+ wfx_control_reg_write(wdev, 0);
+ 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++) {
eth_zero_addr(wdev->addresses[i].addr);
- err = of_get_mac_address(wdev->dev->of_node,
- wdev->addresses[i].addr);
- if (!err) {
+ 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]);
- }
+ 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);
}
- 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;
@@ -459,19 +444,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;
}
@@ -479,7 +464,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/main.h b/drivers/staging/wfx/main.h
index 115abd2d4378..68c665307153 100644
--- a/drivers/staging/wfx/main.h
+++ b/drivers/staging/wfx/main.h
@@ -16,23 +16,21 @@
#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 */
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;
};
-struct wfx_dev *wfx_init_common(struct device *dev,
- const struct wfx_platform_data *pdata,
- const struct 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 7a3ba3c38925..729825230db2 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",
@@ -60,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;
@@ -76,8 +74,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 +88,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;
@@ -127,13 +123,12 @@ 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__);
+ 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 +143,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 +174,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;
@@ -187,23 +182,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);
@@ -218,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;
@@ -236,7 +228,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 */
@@ -261,14 +253,12 @@ 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 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)]);
+ 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;
@@ -289,7 +279,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 +293,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..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);
@@ -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,
@@ -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 668ef2c60837..7f34f0d322f9 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 __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,24 +21,21 @@ static void __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;
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;
}
-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;
@@ -56,14 +52,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 +76,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;
}
@@ -98,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);
@@ -120,7 +115,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,
@@ -139,7 +134,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..b1e9fb14d2b4 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;
@@ -63,7 +62,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,
@@ -89,10 +88,10 @@ 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);
}
}
@@ -108,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;
@@ -133,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;
}
@@ -143,7 +141,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);
}
@@ -170,23 +168,17 @@ 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)
- 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;
@@ -206,11 +198,9 @@ 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");
- return hif_set_pm(wvif, ps, ps_timeout);
+ 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);
}
int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -224,10 +214,9 @@ 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);
- if (wvif->vif->type == NL80211_IFTYPE_STATION &&
- old_uapsd != wvif->uapsd_mask) {
- hif_set_uapsd_info(wvif, wvif->uapsd_mask);
+ wfx_hif_set_edca_queue_params(wvif, queue, params);
+ 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);
}
mutex_unlock(&wdev->conf_mutex);
@@ -240,7 +229,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;
}
@@ -262,21 +251,19 @@ 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;
- hif_wep_default_key_id(wvif, idx);
+ wfx_hif_wep_default_key_id(wvif, idx);
}
void wfx_reset(struct wfx_vif *wvif)
@@ -284,10 +271,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);
@@ -296,8 +283,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;
@@ -305,7 +291,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,13 +300,12 @@ 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;
}
-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;
@@ -329,7 +314,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 +326,13 @@ 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;
}
@@ -358,8 +341,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);
@@ -375,7 +357,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 +372,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);
@@ -415,8 +397,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);
@@ -437,23 +418,21 @@ 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);
} 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);
}
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;
@@ -470,14 +449,11 @@ 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);
- /* 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_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. */
+ wfx_hif_set_bss_params(wvif, info->aid, 7);
+ wfx_hif_set_beacon_wakeup_period(wvif, 1, 1);
wfx_update_pm(wvif);
}
@@ -499,16 +475,15 @@ 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;
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,
@@ -533,19 +508,14 @@ 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__);
- 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.
- */
+ 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);
}
@@ -557,33 +527,31 @@ 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);
}
}
- 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)
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);
@@ -597,8 +565,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;
@@ -614,7 +581,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;
@@ -648,8 +615,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)
@@ -663,8 +630,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 */
@@ -679,20 +645,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)
{
}
@@ -708,8 +670,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;
@@ -726,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;
@@ -774,7 +735,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,11 +743,11 @@ 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;
+ return 0;
}
void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
@@ -800,8 +761,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 +775,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);
}
}
diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h
index 4d7e38be4235..c69b2227e9ac 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,19 @@ 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 e90dc73c4b01..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 }
*/
@@ -158,7 +157,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)
@@ -190,9 +189,8 @@ DECLARE_EVENT_CLASS(hif_data,
__entry->mib = -1;
header_len = 0;
}
- __entry->buf_len = min_t(int, __entry->msg_len,
- sizeof(__entry->buf))
- - sizeof(struct hif_msg) - header_len;
+ __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);
),
TP_printk("%d:%d:%s_%s%s%s: %s%s (%d bytes)",
@@ -208,12 +206,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)
@@ -250,8 +248,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);
@@ -364,7 +361,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(
@@ -379,8 +376,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 +416,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 f8df59ad1639..6594cc647c2f 100644
--- a/drivers/staging/wfx/wfx.h
+++ b/drivers/staging/wfx/wfx.h
@@ -25,71 +25,70 @@
#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;
- struct device *dev;
- struct ieee80211_hw *hw;
- struct ieee80211_vif *vif[2];
- struct mac_address addresses[2];
- const struct hwbus_ops *hwbus_ops;
- void *hwbus_priv;
-
- u8 keyset;
- struct completion firmware_ready;
- struct 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 hif_rx_stats rx_stats;
- struct mutex rx_stats_lock;
- struct hif_tx_power_loop_info tx_power_loop_info;
- struct mutex tx_power_loop_info_lock;
- int force_ps_timeout;
+ 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;
+
+ 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_tx_power_loop_info tx_power_loop_info;
+ struct mutex tx_power_loop_info_lock;
};
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 tx_policy_cache tx_policy_cache;
- struct work_struct tx_policy_upload_work;
+ struct wfx_queue tx_queue[4];
+ struct wfx_tx_policy_cache tx_policy_cache;
+ 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)
@@ -104,8 +103,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;
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 <sergio.paracuellos@gmail.com>
+ */
+
+#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 */