2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-28 07:04:00 +08:00
linux-next/drivers/staging/wilc1000
Jason Litzinger e9837cd9e3 staging: wilc1000: Refactor handling of HT caps fields
This addresses the following sparse warnings:

drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2006:51: warning: incorrect type in assignment (different base types)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2006:51:    expected unsigned short [unsigned] [assigned] [usertype] ht_capa_info
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2006:51:    got restricted __le16 const [usertype] cap_info
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2011:52: warning: incorrect type in assignment (different base types)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2011:52:    expected unsigned short [unsigned] [assigned] [usertype] ht_ext_params
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2011:52:    got restricted __le16 const [usertype] extended_ht_cap_info
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2012:51: warning: incorrect type in assignment (different base types)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2012:51:    expected unsigned int [unsigned] [assigned] [usertype] ht_tx_bf_cap
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2012:51:    got restricted __le32 const [usertype] tx_BF_cap_info
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2078:51: warning: incorrect type in assignment (different base types)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2078:51:    expected unsigned short [unsigned] [assigned] [usertype] ht_capa_info
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2078:51:    got restricted __le16 const [usertype] cap_info
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2083:52: warning: incorrect type in assignment (different base types)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2083:52:    expected unsigned short [unsigned] [assigned] [usertype] ht_ext_params
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2083:52:    got restricted __le16 const [usertype] extended_ht_cap_info
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2084:51: warning: incorrect type in assignment (different base types)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2084:51:    expected unsigned int [unsigned] [assigned] [usertype] ht_tx_bf_cap
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2084:51:    got restricted __le32 const [usertype] tx_BF_cap_info

This is not the first attempt to address this problem:
    https://lkml.org/lkml/2017/3/7/808

First, the current code works because the final use of the
ht_capa values (in host_interface.c: WILC_HostIf_PackStaParam) packs them
into a buffer in little-endian format. Since this matches the byte-order of
struct ieee80211_ht_cap, all is seemingly well.

What the current code does not do, and what these warnings expose, is
clearly communicate what the fields in struct add_sta_param
represent -- values with a specific (little endian) byte order.
This will lead to problems if the values are ever actually used by the
host, and that host is not little endian.

The proposed change addresses this by embedding a
struct ieee80211_ht_cap into struct add_sta_param.  When the values
are later packed out, the newly embedded struct is copied directly
into the outbound buffer.  All 16 and 32 bit types are treated as
little endian and marked as such.  Future use of the values by the
host would still require conversion, or sparse would flag them again.

The following items are required for this to be correct:
    1.  The data is not currently used by the host.
    2.  struct ieee80211_ht_cap is packed.
    3.  The packing of the fields matches the order in
        struct ieee80211_ht_cap.

This is similar, I believe, to how the same data is handled in
marvell/mwifiex/11n.c.

Test-compiled/loaded against staging-next on x86_64
Test-compiled against staging-next for ARM.
Applied/built against staging-testing.

Testing consists of compilation for the above trees/targets, and a
sparse check, no functional testing.

Signed-off-by: Jason Litzinger <jlitzingerdev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15 07:41:58 +02:00
..
coreconfigurator.c Staging: wilc1000: Compress return logic into one line 2016-10-16 10:27:34 +02:00
coreconfigurator.h staging: wilc1000: Fixes camel-casing in wilc_gnrl_info_received 2017-03-09 14:52:22 +01:00
host_interface.c staging: wilc1000: Refactor handling of HT caps fields 2017-05-15 07:41:58 +02:00
host_interface.h staging: wilc1000: Refactor handling of HT caps fields 2017-05-15 07:41:58 +02:00
Kconfig staging: wilc1000: removes WIRELESS_EXT 2016-03-28 07:30:36 -07:00
linux_mon.c staging: wilc1000: fix unchecked return value 2017-04-28 12:00:21 +02:00
linux_wlan.c staging: wilc1000: fix incorrect strncasecmp length 2017-04-08 13:00:44 +02:00
Makefile staging: wilc1000: message_queue: Move code to host interface 2016-06-25 14:39:53 -07:00
TODO drivers: wilc1000: remove references to semaphores 2016-08-21 17:27:16 +02:00
wilc_debugfs.c staging:wilc1000:wilc_debugfs.c Removes multiple blank lines 2017-01-16 18:10:25 +01:00
wilc_sdio.c drivers/staging/wilc1000: Removing explicit function tracing using dev_dbg/info 2017-03-29 09:37:14 +02:00
wilc_spi.c staging: wilc1000: Remove unnecessary brackets 2017-03-16 11:47:41 +09:00
wilc_wfi_cfgoperations.c staging: wilc1000: Refactor handling of HT caps fields 2017-05-15 07:41:58 +02:00
wilc_wfi_cfgoperations.h Staging: wilc1000: Remove unused function WILC_WFI_update_stats 2016-02-20 14:43:48 -08:00
wilc_wfi_netdevice.h staging: wilc1000: Remove unused function wilc_lock_timeout 2016-10-25 10:53:27 +02:00
wilc_wlan_cfg.c staging: wilc1000: Use new format for configuring firmware 2017-04-08 13:00:43 +02:00
wilc_wlan_cfg.h staging: wilc1000: wilc_wlan_cfg_init: changes unused argument 2016-02-22 11:48:19 -08:00
wilc_wlan_if.h drivers: wilc1000: remove references to semaphores 2016-08-21 17:27:16 +02:00
wilc_wlan.c staging: wilc1000: Alignment should match open parenthesis 2017-03-07 06:53:30 +01:00
wilc_wlan.h staging: wilc1000: function prototype argument should have identifier name 2017-03-07 06:53:30 +01:00