Wambui Karuga [Thu, 10 Oct 2019 13:15:31 +0000 (16:15 +0300)]
staging: rtl8723bs: Remove comparisons to booleans in conditionals.
Remove comparisons to true and false in multiple if statements in
drivers/staging/rtl8723bs/core/rtw_mlme.c
Issues reported by checkpatch.pl as:
CHECK: Using comparison to false is error prone
CHECK: Using comparison to true is error prone
Wambui Karuga [Thu, 10 Oct 2019 13:15:30 +0000 (16:15 +0300)]
staging: rtl8723bs: Remove unnecessary braces for single statements
Clean up multiple unnecessary braces around single statement blocks in
drivers/staging/rtl8723bs/core/rtw_mlme.c
Issues reported by checkpatch.pl as:
WARNING: braces {} are not necessary for single statement blocks or
WARNING: braces {} are not necessary for any arm of this statement
Wambui Karuga [Thu, 10 Oct 2019 13:15:29 +0000 (16:15 +0300)]
staging: rtl8723bs: Remove comparisons to NULL in conditionals
Remove most comparisons to NULL in conditionals in
drivers/staging/rtl8723bs/core/rtw_mlme.c
Issues reported by checkpatch.pl as:
CHECK: Comparison to NULL could be written
Javier F. Arias [Wed, 9 Oct 2019 23:19:56 +0000 (18:19 -0500)]
staging: rtl8723bs: Fix incorrect type in declaration
Fix incorrect type in declaration to solve the warnings 'incorrect
type in argument 2' in the rtw_get_wpa_ie and rtw_get_wpa_ie function
calls, as both expect the same variable in argument 2 with the
type int *.
Issue found by Sparse.
The rtl8723bs driver tries to load various parameters from disk,
circumventing the standard firmware loader mechanism and using DIY
code for this.
No devices which run the mainline kernel ship with these files and even
if these files were present then they still would not be loaded without
additional module parameters. To be precise the following 3 conditions
must all 3 be true for on disk parameters to be used:
1) The rtw_load_phy_file modparam must contain the mask for the type, this
defaults to(LOAD_BB_PG_PARA_FILE | LOAD_RF_TXPWR_LMT_PARA_FILE) so with
the default settings this condition is only true for:
phy_ConfigBBWithPgParaFile()
PHY_ConfigRFWithPowerLimitTableParaFile(); and
2) rtw_phy_file_path modparam must be set to say "/lib/firmware/"; and
3) Store a /lib/firmware/rtl8723b/XXX file in the expected format.
In practice all 3 being true never happens, so the
phy_Config*With*ParaFile() calls are nops, remove them.
The actual code implementing them will be removed in a separate patch.
Note the ODM_ConfigRFWithHeaderFile() and ODM_ConfigBBWithHeaderFile()
functions always return HAL_STATUS_SUCCESS, this patch makes use of this
to simplify the new code without the phy_Config*With*ParaFile() calls.
zhengbin [Tue, 8 Oct 2019 23:55:05 +0000 (07:55 +0800)]
staging: rtl8723bs: Remove set but not used variable 'i'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/staging/rtl8723bs/core/rtw_xmit.c: In function update_attrib:
drivers/staging/rtl8723bs/core/rtw_xmit.c:680:7: warning: variable i set but not used [-Wunused-but-set-variable]
It is not used since commit 554c0a3abf21 ("staging:
Add rtl8723bs sdio wifi driver")
zhengbin [Wed, 9 Oct 2019 13:50:30 +0000 (21:50 +0800)]
staging: wfx: Make some functions static in sta.c
Fix sparse warnings:
drivers/staging/wfx/sta.c:269:6: warning: symbol 'wfx_update_filtering_work' was not declared. Should it be static?
drivers/staging/wfx/sta.c:475:6: warning: symbol 'wfx_event_handler_work' was not declared. Should it be static?
drivers/staging/wfx/sta.c:521:6: warning: symbol 'wfx_bss_loss_work' was not declared. Should it be static?
drivers/staging/wfx/sta.c:528:6: warning: symbol 'wfx_bss_params_work' was not declared. Should it be static?
drivers/staging/wfx/sta.c:539:6: warning: symbol 'wfx_set_beacon_wakeup_period_work' was not declared. Should it be static?
drivers/staging/wfx/sta.c:732:6: warning: symbol 'wfx_unjoin_work' was not declared. Should it be static?
drivers/staging/wfx/sta.c:794:6: warning: symbol 'wfx_set_cts_work' was not declared. Should it be static?
drivers/staging/wfx/sta.c:1234:6: warning: symbol 'wfx_set_tim_work' was not declared. Should it be static?
zhengbin [Wed, 9 Oct 2019 13:50:28 +0000 (21:50 +0800)]
staging: wfx: Make function 'sram_write_dma_safe', 'load_firmware_secure' static
Fix sparse warnings:
drivers/staging/wfx/fwio.c:83:5: warning: symbol 'sram_write_dma_safe' was not declared. Should it be static?
drivers/staging/wfx/fwio.c:229:5: warning: symbol 'load_firmware_secure' was not declared. Should it be static?
Colin Ian King [Wed, 9 Oct 2019 09:46:02 +0000 (10:46 +0100)]
staging: wfx: fix swapped arguments in memset call
The memset appears to have the 2nd and 3rd arguments in the wrong
order, fix this by swapping these around into the correct order.
Addresses-Coverity: ("Memset fill truncated") Fixes: 4f8b7fabb15d ("staging: wfx: allow to send commands to chip") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191009094602.19663-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
zhengbin [Tue, 8 Oct 2019 07:41:55 +0000 (15:41 +0800)]
staging: comedi: Remove set but not used variable 'aref'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/staging/comedi/drivers/dt3000.c: In function dt3k_ai_insn_read:
drivers/staging/comedi/drivers/dt3000.c:511:27: warning: variable aref set but not used [-Wunused-but-set-variable]
It is not used since commit 2e310235ca8f ("staging:
comedi: dt3000: rename dt3k_ai_insn()")
Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: zhengbin <zhengbin13@huawei.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/1570520515-2186-7-git-send-email-zhengbin13@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
zhengbin [Tue, 8 Oct 2019 07:41:52 +0000 (15:41 +0800)]
staging: sm750fb: Remove set but not used variable 'actual_mx_clk'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/staging/sm750fb/ddk750_chip.c: In function set_chip_clock:
drivers/staging/sm750fb/ddk750_chip.c:59:15: warning: variable actual_mx_clk set but not used [-Wunused-but-set-variable]
It is not used since commit f0977109a577 ("staging:
sm750fb: lower case to fix camelcase checkpatch warning")
zhengbin [Tue, 8 Oct 2019 07:41:51 +0000 (15:41 +0800)]
staging: sm750fb: Remove set but not used variable 'uiActualPixelClk'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/staging/sm750fb/ddk750_mode.c: In function ddk750_setModeTiming:
drivers/staging/sm750fb/ddk750_mode.c:212:15: warning: variable uiActualPixelClk set but not used [-Wunused-but-set-variable]
It is not used since commit 81dee67e215b ("staging:
sm750fb: add sm750 to staging")
Paul Burton [Mon, 7 Oct 2019 23:18:06 +0000 (23:18 +0000)]
staging/octeon: Use stubs for MIPS && !CAVIUM_OCTEON_SOC
When building for a non-Cavium MIPS system with COMPILE_TEST=y, the
Octeon ethernet driver hits a number of issues due to use of macros
provided only for CONFIG_CAVIUM_OCTEON_SOC=y configurations. For
example:
drivers/staging/octeon/ethernet-rx.c:190:6: error:
'CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE' undeclared (first use in this function)
drivers/staging/octeon/ethernet-rx.c:472:25: error:
'OCTEON_IRQ_WORKQ0' undeclared (first use in this function)
These come from various asm/ headers that a non-Octeon build will be
using a non-Octeon version of.
Fix this by using the octeon-stubs.h header for non-Cavium MIPS builds,
and only using the real asm/octeon/ headers when building a Cavium
Octeon kernel configuration.
This requires that octeon-stubs.h doesn't redefine XKPHYS_TO_PHYS, which
is defined for MIPS by asm/addrspace.h which is pulled in by many other
common asm/ headers.
Signed-off-by: Paul Burton <paul.burton@mips.com> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
URL: https://lore.kernel.org/linux-mips/CAMuHMdXvu+BppwzsU9imNWVKea_hoLcRt9N+a29Q-QsjW=ip2g@mail.gmail.com/ Fixes: 171a9bae68c7 ("staging/octeon: Allow test build on !MIPS") Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: David S. Miller <davem@davemloft.net> Link: https://lore.kernel.org/r/20191007231741.2012860-1-paul.burton@mips.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jérôme Pouiller [Tue, 8 Oct 2019 09:42:58 +0000 (09:42 +0000)]
staging: wfx: simplify memory allocation in wfx_update_filtering()
Original code did not handle case where kmalloc failed. By the way, it
is more convenient to allocate and build HIF message in
hif_set_beacon_filter_table() instead of to ask to caller function to
build it.
Fixes: 40115bbc40e2 ("staging: wfx: implement the rest of mac80211 API") Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191008094232.10014-2-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: vc04_services: make use of devm_platform_ioremap_resource
fix below issue reported by coccicheck
drivers/staging//vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:139
WARNING: Use devm_platform_ioremap_resource for g_regs
zhengbin [Sun, 6 Oct 2019 09:09:59 +0000 (17:09 +0800)]
staging: rtl8723bs: Remove set but not used variable 'adapter'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/staging/rtl8723bs/core/rtw_mlme.c: In function rtw_select_roaming_candidate:
drivers/staging/rtl8723bs/core/rtw_mlme.c:2007:18: warning: variable adapter set but not used [-Wunused-but-set-variable]
It is not used since commit 554c0a3abf21 ("staging:
Add rtl8723bs sdio wifi driver")
zhengbin [Sun, 6 Oct 2019 09:09:58 +0000 (17:09 +0800)]
staging: rtl8723bs: Remove set but not used variables 'ppp', 'type', 'data'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/staging/rtl8723bs/core/rtw_recv.c: In function validate_80211w_mgmt:
drivers/staging/rtl8723bs/core/rtw_recv.c:1415:8: warning: variable ppp set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_recv.c: In function validate_80211w_mgmt:
drivers/staging/rtl8723bs/core/rtw_recv.c:1403:5: warning: variable type set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_recv.c: In function recvframe_defrag:
drivers/staging/rtl8723bs/core/rtw_recv.c:1713:6: warning: variable data set but not used [-Wunused-but-set-variable]
They are not used since commit 554c0a3abf21 ("staging:
Add rtl8723bs sdio wifi driver")
zhengbin [Sun, 6 Oct 2019 09:09:57 +0000 (17:09 +0800)]
staging: rtl8723bs: Remove set but not used variable 'prwskeylen'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/staging/rtl8723bs/core/rtw_security.c: In function rtw_tkip_encrypt:
drivers/staging/rtl8723bs/core/rtw_security.c:660:6: warning: variable prwskeylen set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_security.c: In function rtw_tkip_decrypt:
drivers/staging/rtl8723bs/core/rtw_security.c:768:6: warning: variable prwskeylen set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_security.c: In function rtw_aes_encrypt:
drivers/staging/rtl8723bs/core/rtw_security.c:1528:6: warning: variable prwskeylen set but not used [-Wunused-but-set-variable]
It is not used since commit 554c0a3abf21 ("staging:
Add rtl8723bs sdio wifi driver")
zhengbin [Sun, 6 Oct 2019 09:09:56 +0000 (17:09 +0800)]
staging: rtl8723bs: Remove set but not used variable 'tmp_aid'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c: In function rtw_alloc_stainfo:
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c:190:7: warning: variable tmp_aid set but not used [-Wunused-but-set-variable]
It is not used since commit 554c0a3abf21 ("staging:
Add rtl8723bs sdio wifi driver")
zhengbin [Sun, 6 Oct 2019 09:33:02 +0000 (17:33 +0800)]
staging: rtl8723bs: Remove set but not used variable 'oldcnt'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/staging/rtl8723bs/hal/sdio_ops.c: In function sdio_read_port:
drivers/staging/rtl8723bs/hal/sdio_ops.c:430:6: warning: variable oldcnt set but not used [-Wunused-but-set-variable]
It is not used since commit dedf215bd1c7 ("staging:
rtl8723bs: remove unused code")
Michael Straube [Sat, 5 Oct 2019 14:18:52 +0000 (16:18 +0200)]
staging: rtl8188eu: remove unnecessary asignment and initialization
Variable badworden is asigned in two subsequent lines. So the first
asignment is useless and not needed. Also the initialization to zero
is not needed. Remove the first asignment and the initialization.
Adham Abozaeid [Fri, 4 Oct 2019 21:40:22 +0000 (21:40 +0000)]
staging: wilc1000: don't use wdev while setting tx power
WILC doesn't support per-vif tx power, and hence, wdev will always be
null in calls to set_tx_power.
Instead, wiphy should be used to execute the operation
Benjamin Poirier [Fri, 27 Sep 2019 10:12:11 +0000 (19:12 +0900)]
staging: qlge: Refill empty buffer queues from wq
When operating at mtu 9000, qlge does order-1 allocations for rx buffers in
atomic context. This is especially unreliable when free memory is low or
fragmented. Add an approach similar to commit 3161e453e496 ("virtio: net
refill on out-of-memory") to qlge so that the device doesn't lock up if
there are allocation failures.
Benjamin Poirier [Fri, 27 Sep 2019 10:12:10 +0000 (19:12 +0900)]
staging: qlge: Refill rx buffers up to multiple of 16
Reading the {s,l}bq_prod_idx registers on a running device, it appears that
the adapter will only use buffers up to prod_idx & 0xfff0. The driver
currently uses fixed-size guard zones (16 for sbq, 32 for lbq - don't know
why this difference). After the previous patch, this approach no longer
guarantees prod_idx values aligned on multiples of 16. While it appears
that we can write unaligned values to prod_idx without ill effects on
device operation, it makes more sense to change qlge_refill_bq() to refill
up to a limit that corresponds with the device's behavior.
Benjamin Poirier [Fri, 27 Sep 2019 10:12:09 +0000 (19:12 +0900)]
staging: qlge: Update buffer queue prod index despite oom
Currently, if we repeatedly fail to allocate all of the buffers from the
desired batching budget, we will never update the prod_idx register.
Restructure code to always update prod_idx if new buffers could be
allocated. This eliminates the current two stage process (clean_idx ->
prod_idx) and some associated bookkeeping variables.
Benjamin Poirier [Fri, 27 Sep 2019 10:12:08 +0000 (19:12 +0900)]
staging: qlge: Replace memset with assignment
Instead of clearing the structure wholesale, it is sufficient to initialize
the skb member which is used to manage sbq instances. lbq instances are
managed according to curr_idx and clean_idx.
Benjamin Poirier [Fri, 27 Sep 2019 10:12:03 +0000 (19:12 +0900)]
staging: qlge: Fix dma_sync_single calls
Using the unmap addr elsewhere than unmap calls is a misuse of the dma api.
In prevision of this fix, qlge kept two copies of the dma address around ;)
Fixes: c4e84bde1d59 ("qlge: New Qlogic 10Gb Ethernet Driver.") Fixes: 7c734359d350 ("qlge: Size RX buffers based on MTU.") Fixes: 2c9a266afefe ("qlge: Fix receive packets drop.") Signed-off-by: Benjamin Poirier <bpoirier@suse.com> Link: https://lore.kernel.org/r/20190927101210.23856-10-bpoirier@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The qlge driver (and device) uses two kinds of buffers for reception,
so-called "small buffers" and "large buffers". The two are arranged in
rings, the sbq and lbq. These two share similar data structures and code.
Factor out data structures into a common struct qlge_bq, make required
adjustments to code and dedup the most obvious cases of copy/paste.
This patch should not introduce any functional change other than to some of
the printk format strings.
This is unneeded for two reasons:
1) the cpu does not write data for the device in the mapping
2) calls like ..._sync_..._for_device(..., ..._FROMDEVICE) are
nonsensical, see commit 3f0fb4e85b38 ("Documentation/DMA-API-HOWTO.txt:
fix misleading example")
Benjamin Poirier [Fri, 27 Sep 2019 10:12:00 +0000 (19:12 +0900)]
staging: qlge: Remove rx_ring.sbq_buf_size
Tx completion rings have sbq_buf_size = 0 but there's no case where the
code actually tests on that value. We can remove sbq_buf_size and use a
constant instead.
Benjamin Poirier [Fri, 27 Sep 2019 10:11:58 +0000 (19:11 +0900)]
staging: qlge: Deduplicate lbq_buf_size
lbq_buf_size is duplicated to every rx_ring structure whereas lbq_buf_order
is present once in the ql_adapter structure. All rings use the same buf
size, keep only one copy of it. Also factor out the calculation of
lbq_buf_size instead of having two copies.
Benjamin Poirier [Fri, 27 Sep 2019 10:11:56 +0000 (19:11 +0900)]
staging: qlge: Remove irq_cnt
qlge uses an irq enable/disable refcounting scheme that is:
* poorly implemented
Uses a spin_lock to protect accesses to the irq_cnt atomic
variable.
* buggy
Breaks when there is not a 1:1 sequence of irq - napi_poll, such as
when using SO_BUSY_POLL.
* unnecessary
The purpose or irq_cnt is to reduce irq control writes when
multiple work items result from one irq: the irq is re-enabled
after all work is done.
Analysis of the irq handler shows that there is only one case where
there might be two workers scheduled at once, and those have
separate irq masking bits.
Therefore, remove irq_cnt.
Additionally, we get a performance improvement:
perf stat -e cycles -a -r5 super_netperf 100 -H 192.168.33.1 -t TCP_RR
Benjamin Poirier [Fri, 27 Sep 2019 10:11:55 +0000 (19:11 +0900)]
staging: qlge: Fix irq masking in INTx mode
Tracing the driver operation reveals that the INTR_EN_EN bit (per-queue
interrupt control) does not immediately prevent rx completion interrupts
when the device is operating in INTx mode. This leads to interrupts being
raised while napi is scheduled/running. Those interrupts are ignored by
qlge_isr() and falsely reported as IRQ_NONE thanks to the irq_cnt scheme.
This in turn can cause frames to loiter in the receive queue until a later
frame leads to another rx interrupt that will schedule napi.
Use the INTR_EN_EI bit (master interrupt control) instead.
Chip can make foreground scan or background, but both can't be mixed in
same request. So, we need to split each mac80211 requests into multiple
HIF requests.
Three things make this task more complex than it should:
- Chip necessitate to associate a link-id to each station. It is same
thing than association ID but, using 8 bits only.
- Rate policy is sent separately from Tx frames
- Driver try to handle itself power saving of stations and multicast
data
A few tasks remain to be done in order to finish chip initial
configuration:
- configure chip to use multi-tx confirmation (speed up data
transfer)
- configure chip to use wake-up feature (save power consumption
during runtime)
- set hardware configuration (clocks, RF, pinout, etc...) using a
Platform Data Set (PDS) file
On release, driver completely shutdown the chip to save power
consumption.
Documentation about PDS and PDS data for sample boards are available
here[1]. One day, PDS data may find a place in device tree but,
currently, PDS is too much linked with firmware to allowing that.
This patch also add "send_pds" file in debugfs to be able to dynamically
change PDS (only for debug, of course).
Chip support encryption of the link between host and chip. This feature
is called "secure link". Driver code on github[1] support it. However,
it relies on mbedtls for cryptographic functions. So, I decided to not
import this feature in current patch. However, in order to keep code
synchronized between github and kernel, I imported all code related to
this feature, even if most of it is just no-op.
Chip has multiple input buffers and can handle multiple 802.11 frames
in parallel. However, other HIF command must be sent sequentially.
wsm_send_cmd() handles these requests.
This commit also add send_hif_cmd in debugfs. This file allows to send
arbitrary commands to chip. It can be used for debug and testing.