linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] staging: wfx: usual maintenance
@ 2022-02-25 11:23 Jerome Pouiller
  2022-02-25 11:23 ` [PATCH 01/10] staging: wfx: sta.o was linked twice Jerome Pouiller
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:23 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

This PR contains fixes for various small defects I have seen these last
weeks.

Jérôme Pouiller (10):
  staging: wfx: sta.o was linked twice
  staging: wfx: fix struct alignment
  staging: wfx: format comments on 100 columns
  staging: wfx: format code on 100 columns
  staging: wfx: remove useless variable
  staging: wfx: drop useless include
  staging: wfx: remove duplicated code in wfx_cmd_send()
  staging: wfx: prefer to wait for an event instead to sleep
  staging: wfx: ensure HIF request has been sent before polling
  staging: wfx: flags for SPI IRQ were ignored

 drivers/staging/wfx/Makefile      |  1 -
 drivers/staging/wfx/bh.c          |  1 +
 drivers/staging/wfx/bus_spi.c     | 30 +++++++++++++++---------------
 drivers/staging/wfx/data_tx.c     |  8 ++------
 drivers/staging/wfx/fwio.c        |  3 +--
 drivers/staging/wfx/hif_api_cmd.h |  2 --
 drivers/staging/wfx/hif_rx.c      |  3 +--
 drivers/staging/wfx/hif_tx.c      | 13 ++++++-------
 drivers/staging/wfx/hif_tx_mib.c  |  3 +--
 drivers/staging/wfx/hwio.c        |  9 +++------
 drivers/staging/wfx/queue.c       |  9 ++++-----
 drivers/staging/wfx/sta.c         | 11 +++++------
 drivers/staging/wfx/sta.h         |  3 +--
 13 files changed, 40 insertions(+), 56 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 01/10] staging: wfx: sta.o was linked twice
  2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
@ 2022-02-25 11:23 ` Jerome Pouiller
  2022-02-25 11:23 ` [PATCH 02/10] staging: wfx: fix struct alignment Jerome Pouiller
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:23 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

sta.o was listed twice in the Makefile.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile
index ae94c6552d77..c8b356f71c99 100644
--- a/drivers/staging/wfx/Makefile
+++ b/drivers/staging/wfx/Makefile
@@ -17,7 +17,6 @@ wfx-y := \
 	sta.o \
 	key.o \
 	main.o \
-	sta.o \
 	debug.o
 wfx-$(CONFIG_SPI) += bus_spi.o
 # When CONFIG_MMC == m, append to 'wfx-y' (and not to 'wfx-m')
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 02/10] staging: wfx: fix struct alignment
  2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
  2022-02-25 11:23 ` [PATCH 01/10] staging: wfx: sta.o was linked twice Jerome Pouiller
@ 2022-02-25 11:23 ` Jerome Pouiller
  2022-02-25 11:23 ` [PATCH 03/10] staging: wfx: format comments on 100 columns Jerome Pouiller
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:23 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

There is no reason to add multiple spaces between a variable name and
its type.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/bus_spi.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c
index 062826aa7e6c..a0a98c074cb5 100644
--- a/drivers/staging/wfx/bus_spi.c
+++ b/drivers/staging/wfx/bus_spi.c
@@ -65,14 +65,14 @@ static int wfx_spi_copy_from_io(void *priv, unsigned int addr, void *dst, size_t
 {
 	struct wfx_spi_priv *bus = priv;
 	u16 regaddr = (addr << 12) | (count / 2) | SET_READ;
-	struct spi_message      m;
-	struct spi_transfer     t_addr = {
-		.tx_buf         = &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;
@@ -101,14 +101,14 @@ static int wfx_spi_copy_to_io(void *priv, unsigned int addr, const void *src, si
 	/* FIXME: use a bounce buffer */
 	u16 *src16 = (void *)src;
 	int ret, i;
-	struct spi_message      m;
-	struct spi_transfer     t_addr = {
-		.tx_buf         = &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");
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 03/10] staging: wfx: format comments on 100 columns
  2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
  2022-02-25 11:23 ` [PATCH 01/10] staging: wfx: sta.o was linked twice Jerome Pouiller
  2022-02-25 11:23 ` [PATCH 02/10] staging: wfx: fix struct alignment Jerome Pouiller
@ 2022-02-25 11:23 ` Jerome Pouiller
  2022-03-01  1:12   ` Joe Perches
  2022-02-25 11:23 ` [PATCH 04/10] staging: wfx: format code " Jerome Pouiller
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:23 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

A few comments were not yet formatted on 100 columns.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/data_tx.c | 8 ++------
 drivers/staging/wfx/queue.c   | 9 ++++-----
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index d7bcf3bae08a..e07381b2ff4d 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -117,9 +117,7 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif, struct ieee80211_tx_rate *rat
 	if (idx >= 0) {
 		*renew = false;
 	} else {
-		/* If policy is not found create a new one using the oldest
-		 * entry in "free" list
-		 */
+		/* If policy is not found create a new one using the oldest entry in "free" list */
 		*renew = true;
 		entry = list_entry(cache->free.prev, struct wfx_tx_policy, link);
 		memcpy(entry->rates, wanted.rates, sizeof(entry->rates));
@@ -494,9 +492,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg)
 	wfx_tx_fill_rates(wdev, tx_info, arg);
 	skb_trim(skb, skb->len - tx_priv->icv_size);
 
-	/* From now, you can touch to tx_info->status, but do not touch to
-	 * tx_priv anymore
-	 */
+	/* From now, you can touch to tx_info->status, but do not touch to tx_priv anymore */
 	/* FIXME: use ieee80211_tx_info_clear_status() */
 	memset(tx_info->rate_driver_data, 0, sizeof(tx_info->rate_driver_data));
 	memset(tx_info->pad, 0, sizeof(tx_info->pad));
diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c
index 9186726ff07f..729825230db2 100644
--- a/drivers/staging/wfx/queue.c
+++ b/drivers/staging/wfx/queue.c
@@ -210,8 +210,8 @@ bool wfx_tx_queues_has_cab(struct wfx_vif *wvif)
 	if (wvif->vif->type != NL80211_IFTYPE_AP)
 		return false;
 	for (i = 0; i < IEEE80211_NUM_ACS; ++i)
-		/* Note: since only AP can have mcast frames in queue and only
-		 * one vif can be AP, all queued frames has same interface id
+		/* Note: since only AP can have mcast frames in queue and only one vif can be AP,
+		 * all queued frames has same interface id
 		 */
 		if (!skb_queue_empty_lockless(&wvif->tx_queue[i].cab))
 			return true;
@@ -253,9 +253,8 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev)
 			skb = skb_dequeue(&queues[i]->cab);
 			if (!skb)
 				continue;
-			/* Note: since only AP can have mcast frames in queue
-			 * and only one vif can be AP, all queued frames has
-			 * same interface id
+			/* Note: since only AP can have mcast frames in queue and only one vif can
+			 * be AP, all queued frames has same interface id
 			 */
 			hif = (struct wfx_hif_msg *)skb->data;
 			WARN_ON(hif->interface != wvif->id);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 04/10] staging: wfx: format code on 100 columns
  2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
                   ` (2 preceding siblings ...)
  2022-02-25 11:23 ` [PATCH 03/10] staging: wfx: format comments on 100 columns Jerome Pouiller
@ 2022-02-25 11:23 ` Jerome Pouiller
  2022-02-25 11:24 ` [PATCH 05/10] staging: wfx: remove useless variable Jerome Pouiller
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:23 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

A few lines were not yet formatted on 100 columns.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/fwio.c       | 3 +--
 drivers/staging/wfx/hif_rx.c     | 3 +--
 drivers/staging/wfx/hif_tx.c     | 3 +--
 drivers/staging/wfx/hif_tx_mib.c | 3 +--
 drivers/staging/wfx/hwio.c       | 9 +++------
 drivers/staging/wfx/sta.c        | 7 +++----
 drivers/staging/wfx/sta.h        | 3 +--
 7 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c
index 9005a6fe48c8..3d1b8a135dc0 100644
--- a/drivers/staging/wfx/fwio.c
+++ b/drivers/staging/wfx/fwio.c
@@ -192,8 +192,7 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len)
 				return ret;
 		}
 		if (ktime_compare(now, start))
-			dev_dbg(wdev->dev, "answer after %lldus\n",
-				ktime_us_delta(now, start));
+			dev_dbg(wdev->dev, "answer after %lldus\n", ktime_us_delta(now, start));
 
 		ret = wfx_sram_write_dma_safe(wdev, WFX_DNLD_FIFO + (offs % DNLD_FIFO_SIZE),
 					      data + offs, DNLD_BLOCK_SIZE);
diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c
index 302bdb2bf036..64ca8acb8e4f 100644
--- a/drivers/staging/wfx/hif_rx.c
+++ b/drivers/staging/wfx/hif_rx.c
@@ -244,8 +244,7 @@ static int wfx_hif_generic_indication(struct wfx_dev *wdev,
 		mutex_unlock(&wdev->tx_power_loop_info_lock);
 		return 0;
 	default:
-		dev_err(wdev->dev, "generic_indication: unknown indication type: %#.8x\n",
-			type);
+		dev_err(wdev->dev, "generic_indication: unknown indication type: %#.8x\n", type);
 		return -EIO;
 	}
 }
diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index ea2582714bb9..236f9d62e3a9 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -169,8 +169,7 @@ int wfx_hif_reset(struct wfx_vif *wvif, bool reset_stat)
 	return ret;
 }
 
-int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
-		     void *val, size_t val_len)
+int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, size_t val_len)
 {
 	int ret;
 	struct wfx_hif_msg *hif;
diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c
index 1c57dd2b697c..df1bcb1e2c02 100644
--- a/drivers/staging/wfx/hif_tx_mib.c
+++ b/drivers/staging/wfx/hif_tx_mib.c
@@ -84,8 +84,7 @@ int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac)
 				 &arg, sizeof(arg));
 }
 
-int wfx_hif_set_rx_filter(struct wfx_vif *wvif,
-			  bool filter_bssid, bool filter_prbreq)
+int wfx_hif_set_rx_filter(struct wfx_vif *wvif, bool filter_bssid, bool filter_prbreq)
 {
 	struct wfx_hif_mib_rx_filter arg = { };
 
diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c
index c15810bdaecb..3f9750b470be 100644
--- a/drivers/staging/wfx/hwio.c
+++ b/drivers/staging/wfx/hwio.c
@@ -71,8 +71,7 @@ static int wfx_write32_locked(struct wfx_dev *wdev, int reg, u32 val)
 	return ret;
 }
 
-static int wfx_write32_bits_locked(struct wfx_dev *wdev,
-				   int reg, u32 mask, u32 val)
+static int wfx_write32_bits_locked(struct wfx_dev *wdev, int reg, u32 mask, u32 val)
 {
 	int ret;
 	u32 val_r, val_w;
@@ -94,8 +93,7 @@ static int wfx_write32_bits_locked(struct wfx_dev *wdev,
 	return ret;
 }
 
-static int wfx_indirect_read(struct wfx_dev *wdev, int reg, u32 addr,
-			     void *buf, size_t len)
+static int wfx_indirect_read(struct wfx_dev *wdev, int reg, u32 addr, void *buf, size_t len)
 {
 	int ret;
 	int i;
@@ -199,8 +197,7 @@ static int wfx_indirect_read32_locked(struct wfx_dev *wdev, int reg, u32 addr, u
 	return ret;
 }
 
-static int wfx_indirect_write32_locked(struct wfx_dev *wdev, int reg,
-				       u32 addr, u32 val)
+static int wfx_indirect_write32_locked(struct wfx_dev *wdev, int reg, u32 addr, u32 val)
 {
 	int ret;
 	__le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL);
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index ba53e4d70c4f..28474614a8e5 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -432,8 +432,7 @@ static void wfx_join(struct wfx_vif *wvif)
 	wfx_tx_unlock(wvif->wdev);
 }
 
-static void wfx_join_finalize(struct wfx_vif *wvif,
-			      struct ieee80211_bss_conf *info)
+static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info)
 {
 	struct ieee80211_sta *sta = NULL;
 	int ampdu_density = 0;
@@ -539,8 +538,8 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		wfx_enable_beacon(wvif, info->enable_beacon);
 
 	if (changed & BSS_CHANGED_KEEP_ALIVE)
-		wfx_hif_keep_alive_period(wvif, info->max_idle_period *
-						USEC_PER_TU / USEC_PER_MSEC);
+		wfx_hif_keep_alive_period(wvif,
+					  info->max_idle_period * USEC_PER_TU / USEC_PER_MSEC);
 
 	if (changed & BSS_CHANGED_ERP_CTS_PROT)
 		wfx_hif_erp_use_protection(wvif, info->use_cts_prot);
diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h
index 082329d7bbcd..c69b2227e9ac 100644
--- a/drivers/staging/wfx/sta.h
+++ b/drivers/staging/wfx/sta.h
@@ -46,8 +46,7 @@ int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		     struct ieee80211_ampdu_params *params);
 int wfx_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf);
 void wfx_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf);
-void wfx_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf,
-			u32 changed);
+void wfx_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf, u32 changed);
 int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			   struct ieee80211_chanctx_conf *conf);
 void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 05/10] staging: wfx: remove useless variable
  2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
                   ` (3 preceding siblings ...)
  2022-02-25 11:23 ` [PATCH 04/10] staging: wfx: format code " Jerome Pouiller
@ 2022-02-25 11:24 ` Jerome Pouiller
  2022-02-25 11:24 ` [PATCH 06/10] staging: wfx: drop useless include Jerome Pouiller
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:24 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

Obviously, the variable "ret" was useless.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/sta.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index 28474614a8e5..b1e9fb14d2b4 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -687,7 +687,7 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed)
 
 int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
-	int i, ret = 0;
+	int i;
 	struct wfx_dev *wdev = hw->priv;
 	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
 
@@ -747,7 +747,7 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 		else
 			wfx_hif_set_block_ack_policy(wvif, 0x00, 0x00);
 	}
-	return ret;
+	return 0;
 }
 
 void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 06/10] staging: wfx: drop useless include
  2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
                   ` (4 preceding siblings ...)
  2022-02-25 11:24 ` [PATCH 05/10] staging: wfx: remove useless variable Jerome Pouiller
@ 2022-02-25 11:24 ` Jerome Pouiller
  2022-02-25 11:24 ` [PATCH 07/10] staging: wfx: remove duplicated code in wfx_cmd_send() Jerome Pouiller
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:24 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

ieee80211.h is useless since commit 5e911c3d9dbc9 ("staging: wfx: avoid
defining array of flexible struct")

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/hif_api_cmd.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h
index 444ff7ed882d..8b91b1d4a46b 100644
--- a/drivers/staging/wfx/hif_api_cmd.h
+++ b/drivers/staging/wfx/hif_api_cmd.h
@@ -8,8 +8,6 @@
 #ifndef WFX_HIF_API_CMD_H
 #define WFX_HIF_API_CMD_H
 
-#include <linux/ieee80211.h>
-
 #include "hif_api_general.h"
 
 enum wfx_hif_requests_ids {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 07/10] staging: wfx: remove duplicated code in wfx_cmd_send()
  2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
                   ` (5 preceding siblings ...)
  2022-02-25 11:24 ` [PATCH 06/10] staging: wfx: drop useless include Jerome Pouiller
@ 2022-02-25 11:24 ` Jerome Pouiller
  2022-02-25 11:24 ` [PATCH 08/10] staging: wfx: prefer to wait for an event instead to sleep Jerome Pouiller
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:24 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

The code to execute on end of the function is the same whatever the
command replies or not.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/hif_tx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index 236f9d62e3a9..0b1ed12c0e83 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -74,9 +74,8 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request,
 	if (no_reply) {
 		/* Chip won't reply. Give enough time to the wq to send the buffer. */
 		msleep(100);
-		wdev->hif_cmd.buf_send = NULL;
-		mutex_unlock(&wdev->hif_cmd.lock);
-		return 0;
+		ret = 0;
+		goto end;
 	}
 
 	if (wdev->poll_irq)
@@ -98,6 +97,7 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request,
 		ret = wdev->hif_cmd.ret;
 	}
 
+end:
 	wdev->hif_cmd.buf_send = NULL;
 	mutex_unlock(&wdev->hif_cmd.lock);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 08/10] staging: wfx: prefer to wait for an event instead to sleep
  2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
                   ` (6 preceding siblings ...)
  2022-02-25 11:24 ` [PATCH 07/10] staging: wfx: remove duplicated code in wfx_cmd_send() Jerome Pouiller
@ 2022-02-25 11:24 ` Jerome Pouiller
  2022-02-25 11:24 ` [PATCH 09/10] staging: wfx: ensure HIF request has been sent before polling Jerome Pouiller
  2022-02-25 11:24 ` [PATCH 10/10] staging: wfx: flags for SPI IRQ were ignored Jerome Pouiller
  9 siblings, 0 replies; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:24 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

When possible it is better to wait for an explicit event instead of wait
an arbitrary amount of time.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/hif_tx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index 0b1ed12c0e83..ae3cc5919dcd 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -72,8 +72,8 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request,
 	wfx_bh_request_tx(wdev);
 
 	if (no_reply) {
-		/* Chip won't reply. Give enough time to the wq to send the buffer. */
-		msleep(100);
+		/* Chip won't reply. Ensure the wq has send the buffer before to continue. */
+		flush_workqueue(system_highpri_wq);
 		ret = 0;
 		goto end;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 09/10] staging: wfx: ensure HIF request has been sent before polling
  2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
                   ` (7 preceding siblings ...)
  2022-02-25 11:24 ` [PATCH 08/10] staging: wfx: prefer to wait for an event instead to sleep Jerome Pouiller
@ 2022-02-25 11:24 ` Jerome Pouiller
  2022-02-25 11:24 ` [PATCH 10/10] staging: wfx: flags for SPI IRQ were ignored Jerome Pouiller
  9 siblings, 0 replies; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:24 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

wfx_bh_request_tx() send HIF request asynchronously through bh_work().
Then the caller will run wfx_bh_poll_irq() to poll the answer.

However it useless to burn CPU cycles for the polling while the request
has yet been sent. Worse, wfx_bh_poll_irq() may get the CPU and prevent
wfx_bh_request_tx() to run. This problem has been observed on mono core
architecture.

This first exchange is correct:
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003000
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003000
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003004
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003004
    kworker/0:1H-40    [000] ....    : io_read: QUEUE: 08 00 09 0c 00 00 00 00 3a 7b 00 30 (12 bytes)
    kworker/0:1H-40    [000] ....    : piggyback: CONTROL: 00003000
    kworker/0:1H-40    [000] ....    : hif_recv: 0:2:CNF_CONFIGURATION: 00 00 00 00 (8 bytes)
    kworker/0:1H-40    [000] ....    : io_read32: CONFIG: 03010200
    kworker/0:1H-40    [000] ....    : bh_stats: IND/REQ/CNF:  0/  0/  1, REQ in progress:  0, WUP: release

... while the following is not:
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003000
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003000
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003000
    [...loop until timeout...]
    wfx-sdio mmc0:0001:1: time out while polling control register

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/bh.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c
index 4c6ba9c342a6..bcea9d5b119c 100644
--- a/drivers/staging/wfx/bh.c
+++ b/drivers/staging/wfx/bh.c
@@ -295,6 +295,7 @@ void wfx_bh_poll_irq(struct wfx_dev *wdev)
 	u32 reg;
 
 	WARN(!wdev->poll_irq, "unexpected IRQ polling can mask IRQ");
+	flush_workqueue(system_highpri_wq);
 	start = ktime_get();
 	for (;;) {
 		wfx_control_reg_read(wdev, &reg);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 10/10] staging: wfx: flags for SPI IRQ were ignored
  2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
                   ` (8 preceding siblings ...)
  2022-02-25 11:24 ` [PATCH 09/10] staging: wfx: ensure HIF request has been sent before polling Jerome Pouiller
@ 2022-02-25 11:24 ` Jerome Pouiller
  9 siblings, 0 replies; 13+ messages in thread
From: Jerome Pouiller @ 2022-02-25 11:24 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman,
	Jérôme Pouiller

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

The flags declared in the DT were not forwarded to request_irq().

Fixes: a7efb62509d8 ("staging: wfx: use threaded IRQ with SPI")
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/bus_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c
index a0a98c074cb5..bb31f8a005bf 100644
--- a/drivers/staging/wfx/bus_spi.c
+++ b/drivers/staging/wfx/bus_spi.c
@@ -162,7 +162,7 @@ static int wfx_spi_irq_subscribe(void *priv)
 		flags = IRQF_TRIGGER_HIGH;
 	flags |= IRQF_ONESHOT;
 	return devm_request_threaded_irq(&bus->func->dev, bus->func->irq, NULL,
-					 wfx_spi_irq_handler, IRQF_ONESHOT, "wfx", bus);
+					 wfx_spi_irq_handler, flags, "wfx", bus);
 }
 
 static int wfx_spi_irq_unsubscribe(void *priv)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 03/10] staging: wfx: format comments on 100 columns
  2022-02-25 11:23 ` [PATCH 03/10] staging: wfx: format comments on 100 columns Jerome Pouiller
@ 2022-03-01  1:12   ` Joe Perches
  2022-03-01 17:13     ` Jeff Johnson
  0 siblings, 1 reply; 13+ messages in thread
From: Joe Perches @ 2022-03-01  1:12 UTC (permalink / raw)
  To: Jerome Pouiller, linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman

On Fri, 2022-02-25 at 12:23 +0100, Jerome Pouiller wrote:
> From: Jérôme Pouiller <jerome.pouiller@silabs.com>
> 
> A few comments were not yet formatted on 100 columns.

IMO, none of these changes are necessary or good changes.

80 columns is preferred.

Really comments should most always use 80 columns, and
only occasionally should code be more than 80 columns
and almost never should code be more than 100 columns.

> diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
[]
> @@ -117,9 +117,7 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif, struct ieee80211_tx_rate *rat
>  	if (idx >= 0) {
>  		*renew = false;
>  	} else {
> -		/* If policy is not found create a new one using the oldest
> -		 * entry in "free" list
> -		 */
> +		/* If policy is not found create a new one using the oldest entry in "free" list */
>  		*renew = true;
>  		entry = list_entry(cache->free.prev, struct wfx_tx_policy, link);
>  		memcpy(entry->rates, wanted.rates, sizeof(entry->rates));
> @@ -494,9 +492,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg)
>  	wfx_tx_fill_rates(wdev, tx_info, arg);
>  	skb_trim(skb, skb->len - tx_priv->icv_size);
>  
> -	/* From now, you can touch to tx_info->status, but do not touch to
> -	 * tx_priv anymore
> -	 */
> +	/* From now, you can touch to tx_info->status, but do not touch to tx_priv anymore */
>  	/* FIXME: use ieee80211_tx_info_clear_status() */
>  	memset(tx_info->rate_driver_data, 0, sizeof(tx_info->rate_driver_data));
>  	memset(tx_info->pad, 0, sizeof(tx_info->pad));
> diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c
[]
> @@ -210,8 +210,8 @@ bool wfx_tx_queues_has_cab(struct wfx_vif *wvif)
>  	if (wvif->vif->type != NL80211_IFTYPE_AP)
>  		return false;
>  	for (i = 0; i < IEEE80211_NUM_ACS; ++i)
> -		/* Note: since only AP can have mcast frames in queue and only
> -		 * one vif can be AP, all queued frames has same interface id
> +		/* Note: since only AP can have mcast frames in queue and only one vif can be AP,
> +		 * all queued frames has same interface id
>  		 */
>  		if (!skb_queue_empty_lockless(&wvif->tx_queue[i].cab))
>  			return true;
> @@ -253,9 +253,8 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev)
>  			skb = skb_dequeue(&queues[i]->cab);
>  			if (!skb)
>  				continue;
> -			/* Note: since only AP can have mcast frames in queue
> -			 * and only one vif can be AP, all queued frames has
> -			 * same interface id
> +			/* Note: since only AP can have mcast frames in queue and only one vif can
> +			 * be AP, all queued frames has same interface id
>  			 */
>  			hif = (struct wfx_hif_msg *)skb->data;
>  			WARN_ON(hif->interface != wvif->id);



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 03/10] staging: wfx: format comments on 100 columns
  2022-03-01  1:12   ` Joe Perches
@ 2022-03-01 17:13     ` Jeff Johnson
  0 siblings, 0 replies; 13+ messages in thread
From: Jeff Johnson @ 2022-03-01 17:13 UTC (permalink / raw)
  To: Joe Perches, Jerome Pouiller, linux-wireless, Kalle Valo
  Cc: devel, netdev, linux-kernel, Greg Kroah-Hartman

On 2/28/2022 5:12 PM, Joe Perches wrote:
> On Fri, 2022-02-25 at 12:23 +0100, Jerome Pouiller wrote:
>> From: Jérôme Pouiller <jerome.pouiller@silabs.com>
>>
>> A few comments were not yet formatted on 100 columns.
> 
> IMO, none of these changes are necessary or good changes.
> 
> 80 columns is preferred.
> 
> Really comments should most always use 80 columns, and
> only occasionally should code be more than 80 columns
> and almost never should code be more than 100 columns.

That was my reaction as well. Just because we've relaxed rules so that 
we *can* exceed 80 columns, it doesn't mean we *should*, and definitely 
doesn't mean we should *strive* to do so.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-03-01 17:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
2022-02-25 11:23 ` [PATCH 01/10] staging: wfx: sta.o was linked twice Jerome Pouiller
2022-02-25 11:23 ` [PATCH 02/10] staging: wfx: fix struct alignment Jerome Pouiller
2022-02-25 11:23 ` [PATCH 03/10] staging: wfx: format comments on 100 columns Jerome Pouiller
2022-03-01  1:12   ` Joe Perches
2022-03-01 17:13     ` Jeff Johnson
2022-02-25 11:23 ` [PATCH 04/10] staging: wfx: format code " Jerome Pouiller
2022-02-25 11:24 ` [PATCH 05/10] staging: wfx: remove useless variable Jerome Pouiller
2022-02-25 11:24 ` [PATCH 06/10] staging: wfx: drop useless include Jerome Pouiller
2022-02-25 11:24 ` [PATCH 07/10] staging: wfx: remove duplicated code in wfx_cmd_send() Jerome Pouiller
2022-02-25 11:24 ` [PATCH 08/10] staging: wfx: prefer to wait for an event instead to sleep Jerome Pouiller
2022-02-25 11:24 ` [PATCH 09/10] staging: wfx: ensure HIF request has been sent before polling Jerome Pouiller
2022-02-25 11:24 ` [PATCH 10/10] staging: wfx: flags for SPI IRQ were ignored Jerome Pouiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).