staging: wfx: drop module version
PATCH 1/6 staging: wfx: drop module version
From: Jérôme Pouiller <[email protected]>
wfx_version.h says that this code is same same than driver 2.3.1 hosted on github:
https://github.com/siliconlabs/wfx-linux-driver/tree/2.3.1-public
However, it is inaccurate, driver in-tree contains multiple small patches ahead 2.3.1.
I prefer to drop this confusing information.
--- drivers/staging/wfx/TODO | 3 --- drivers/staging/wfx/main.c | 4 ---- drivers/staging/wfx/wfx_version.h | 3 --- 3 files changed, 10 deletions(-) delete mode 100644 drivers/staging/wfx/wfx_version.h
drivers/staging/wfx/TODO +0 -3
@@ -1,9 +1,6 @@ This is a list of things that need to be done to get this driver out of the staging directory. - - wfx_version.h is still there in order to ensure synchronization with github. - It can be dropped as soon as development is entirely in kernel - - I have to take a decision about secure link support. I can: - drop completely - keep it in an external patch (my preferred option)
drivers/staging/wfx/main.c +0 -4
@@ -33,14 +33,12 @@#include "secure_link.h" #include "hif_tx_mib.h" #include "hif_api_cmd.h" -#include "wfx_version.h" #define WFX_PDS_MAX_SIZE 1500MODULE_DESCRIPTION ("Silicon Labs 802.11 Wireless LAN driver for WFx" );MODULE_AUTHOR ("Jérôme Pouiller <[email protected]>" );MODULE_LICENSE ("GPL" ); -MODULE_VERSION (WFX_LABEL );static int gpio_wakeup =-2 ;module_param (gpio_wakeup, int,0644 );
@@ -480,8 +478,6 @@ static int __init wfx_core_init(void) {int ret =0 ; -pr_info ("wfx: Silicon Labs " WFX_LABEL "\n" ); -if (IS_ENABLED (CONFIG_SPI )) ret =spi_register_driver (&wfx_spi_driver);if (IS_ENABLED (CONFIG_MMC ) && !ret)
drivers/staging/wfx/wfx_version.h deleted +0 -3
@@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! */ -#define WFX_LABEL "2.3.1"
Signature · 1 line
2.20.1
PATCH 2/6 staging: wfx: relocate wfx_fill_sl_key() in secure_link.h
From: Jérôme Pouiller <[email protected]>
"Secure link" feature is not available in in-tree driver (because it depends on mbedtls). Thus, secure_link.h only empty functions.
Module parameter "slk_key" and associated function wfx_fill_sl_key() had an unjustifiable place in main.c. This patch relocate them to secure_link.h.
BTW, content of wfx_fill_sl_key() is now useless. Just keep a warning if user try to use "slk_key" attribute (unsupported by this driver).
--- drivers/staging/wfx/main.c | 29 +---------------------------- drivers/staging/wfx/main.h | 1 - drivers/staging/wfx/secure_link.h | 9 +++++++++ 3 files changed, 10 insertions(+), 29 deletions(-)
drivers/staging/wfx/main.c +1 -28
@@ -44,10 +44,6 @@ static int gpio_wakeup = -2;module_param (gpio_wakeup, int,0644 );MODULE_PARM_DESC (gpio_wakeup,"gpio number for wakeup. -1 for none." ); -static char *slk_key; -module_param (slk_key, charp,0600 ); -MODULE_PARM_DESC (slk_key,"secret key for secure link (expect 64 hexadecimal digits)." ); -#define RATETAB_ENT (_rate, _rateid, _flags) { \ .bitrate = (_rate), \ .hw_value = (_rateid), \
@@ -194,29 +190,6 @@ struct gpio_desc *wfx_get_gpio(struct device *dev, int override, const char *labreturn ret; } -static void wfx_fill_sl_key (struct device *dev,struct wfx_platform_data *pdata) -{ -const char *ascii_key =NULL ; -int ret =0 ; - -if (slk_key) - ascii_key = slk_key; -if (!ascii_key) - ret =of_property_read_string (dev->of_node,"slk_key" , &ascii_key); -if (ret == -EILSEQ || ret == -ENODATA ) -dev_err (dev,"ignoring malformatted key from DT\n" ); -if (!ascii_key) -return ; - - ret =hex2bin (pdata->slk_key, ascii_key,sizeof (pdata->slk_key)); -if (ret) { -dev_err (dev,"ignoring malformatted key: %s\n" , ascii_key); -memset (pdata->slk_key,0 ,sizeof (pdata->slk_key)); -return ; - } -dev_err (dev,"secure link is not supported by this driver, ignoring provided key\n" ); -} -/* NOTE: wfx_send_pds() destroy buf */ int wfx_send_pds (struct wfx_dev *wdev,unsigned char *buf,size_t len) {
@@ -334,7 +307,7 @@ struct wfx_dev *wfx_init_common(struct device *dev,memcpy (&wdev->pdata, pdata,sizeof (*pdata));of_property_read_string (dev->of_node,"config-file" , &wdev->pdata.file_pds); wdev->pdata.gpio_wakeup =wfx_get_gpio (dev, gpio_wakeup,"wakeup" ); -wfx_fill_sl_key (dev, &wdev->pdata); +wfx_sl_fill_pdata (dev, &wdev->pdata);mutex_init (&wdev->conf_mutex);mutex_init (&wdev->rx_stats_lock);
drivers/staging/wfx/main.h +0 -1
@@ -22,7 +22,6 @@ struct wfx_platform_data {/* Keyset and ".sec" extention will appended to this string */ const char *file_fw;const char *file_pds; -unsigned char slk_key[API_KEY_VALUE_SIZE ];struct gpio_desc *gpio_wakeup;/* * if true HIF D_out is sampled on the rising edge of the clock
drivers/staging/wfx/secure_link.h +9 -0
@@ -5,6 +5,8 @@#ifndef WFX_SECURE_LINK_H #define WFX_SECURE_LINK_H +#include <linux/of.h> +#include "hif_api_general.h" struct wfx_dev ;
@@ -33,6 +35,13 @@ static inline int wfx_sl_check_pubkey(struct wfx_dev *wdev, uint8_t *ncp_pubkey,return -EIO ; } +static inline void wfx_sl_fill_pdata (struct device *dev, +struct wfx_platform_data *pdata) +{ +if (of_find_property (dev->of_node,"slk_key" ,NULL )) +dev_err (dev,"secure link is not supported by this driver, ignoring provided key\n" ); +} +static inline int wfx_sl_init (struct wfx_dev *wdev) {return -EIO ;
Signature · 1 line
2.20.1
PATCH 3/6 staging: wfx: fix CONFIG_MMC=m with CONFIG_WFX=y
In reply to Jerome PouillerFrom: Jérôme Pouiller <[email protected]>
If CONFIG_MMC=m and CONFIG_WFX=y, compilation complains with undefined references:
drivers/staging/wfx/main.o: In function wfx_core_init': /linux/drivers/staging/wfx/main.c:488: undefined reference to sdio_register_driver' drivers/staging/wfx/main.o: In function wfx_core_exit': /linux/drivers/staging/wfx/main.c:496: undefined reference to sdio_unregister_driver' drivers/staging/wfx/main.o:(.debug_addr+0x1a8): undefined reference to sdio_register_driver' drivers/staging/wfx/main.o:(.debug_addr+0x6f0): undefined reference to sdio_unregister_driver'
Indeed, symbols sdio_* are not present in kernel image.
This patch disallows CONFIG_WFX=y if CONFIG_MMC=m.
This solution impacts users who want to use SPI bus with configuration:CONFIG_WFX=y + CONFIG_SPI=y + CONFIG_MMC=m. However, I think this is a twisted case. So, I think it won't be missed.
--- drivers/staging/wfx/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/staging/wfx/Kconfig +1 -0
@@ -1,6 +1,7 @@ config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 + depends on MMC || !MMC # do not allow WFX=y if MMC=m depends on (SPI || MMC) help This is a driver for Silicons Labs WFxxx series (WF200 and further)
Signature · 1 line
2.20.1
PATCH 4/6 staging: wfx: fix Oops when CONFIG_OF_NET is not set
In reply to Jerome PouillerFrom: Jérôme Pouiller <[email protected]>
In most case, of_get_mac_address() return NULL in case of error. However, if CONFIG_OF_NET is not set, it return -ENODEV.
--- drivers/staging/wfx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/main.c +1 -1
@@ -407,7 +407,7 @@ int wfx_probe(struct wfx_dev *wdev)for (i =0 ; i <ARRAY_SIZE (wdev->addresses); i++) {eth_zero_addr (wdev->addresses[i].addr); macaddr =of_get_mac_address (wdev->dev->of_node); -if (macaddr) { +if (!IS_ERR_OR_NULL (macaddr)) {ether_addr_copy (wdev->addresses[i].addr, macaddr); wdev->addresses[i].addr[ETH_ALEN -1 ] += i; }
Signature · 1 line
2.20.1
PATCH 5/6 staging: wfx: fix setting MAC address from DT
In reply to Jerome PouillerFrom: Jérôme Pouiller <[email protected]>
MAC address read from chip is unconditionally used even if a MAC address is configured in device tree.
--- drivers/staging/wfx/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/wfx/main.c +2 -1
@@ -410,8 +410,9 @@ int wfx_probe(struct wfx_dev *wdev)if (!IS_ERR_OR_NULL (macaddr)) {ether_addr_copy (wdev->addresses[i].addr, macaddr); wdev->addresses[i].addr[ETH_ALEN -1 ] += i; + }else { +ether_addr_copy (wdev->addresses[i].addr, wdev->hw_caps.mac_addr[i]); } -ether_addr_copy (wdev->addresses[i].addr, wdev->hw_caps.mac_addr[i]);if (!is_valid_ether_addr (wdev->addresses[i].addr)) {dev_warn (wdev->dev,"using random MAC address\n" );eth_random_addr (wdev->addresses[i].addr);
Signature · 1 line
2.20.1
PATCH 6/6 staging: wfx: fix number of available tx_policies
In reply to Jerome PouillerFrom: Jérôme Pouiller <[email protected]>
Original API declares 16 tx_policies. But in fact, the 16th is used internally by the firmware. So, only 15 tx_policies are available for driver.
--- drivers/staging/wfx/hif_api_mib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/hif_api_mib.h +1 -1
@@ -507,7 +507,7 @@ struct hif_mib_tx_rate_retry_policy {uint8_t rates[12 ]; } __packed; -#define HIF_MIB_NUM_TX_RATE_RETRY_POLICIES 16 +#define HIF_MIB_NUM_TX_RATE_RETRY_POLICIES 15struct hif_mib_set_tx_rate_retry_policy {uint8_t num_tx_rate_policies;
Signature · 1 line
2.20.1