linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ
@ 2020-05-05 12:37 Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 01/15] staging: wfx: add support for hardware revision 2 and further Jerome Pouiller
                   ` (14 more replies)
  0 siblings, 15 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

The WF200 can be used on SPI and SDIO. When using SDIO bus, the driver
normally use the in band IRQ provided by the SDIO bus. However, WF200
also provides support for a dedicated IRQ line. This feature is used
when in-band IRQ does not work or to allows some kind of Wake-On-Wlan.
There already was an implementation of Out-Of-Band (OOB) IRQ in the
driver. However, it did not work correctly. This series mainly aims to
fix that. It add, it allows to use edge or level IRQ and unify the IRQ
handling in SPI and SDIO.

The 6 last patches are cosmetic.

Jérôme Pouiller (15):
  staging: wfx: add support for hardware revision 2 and further
  staging: wfx: reduce timeout for chip initial start up
  staging: wfx: fix double free
  staging: wfx: drop useless check
  staging: wfx: repair external IRQ for SDIO
  staging: wfx: use threaded IRQ with SPI
  staging: wfx: introduce a way to poll IRQ
  staging: wfx: poll IRQ during init
  staging: wfx: fix missing 'static' statement
  staging: wfx: fix missing 'static' keyword
  staging: wfx: prefer ARRAY_SIZE instead of a magic number
  staging: wfx: remove useless header inclusions
  staging: wfx: fix alignements of function prototypes
  staging: wfx: remove spaces after cast operator
  staging: wfx: use kernel types instead of c99 ones

 drivers/staging/wfx/bh.c         | 29 +++++++++++++++
 drivers/staging/wfx/bh.h         |  1 +
 drivers/staging/wfx/bus.h        |  2 +
 drivers/staging/wfx/bus_sdio.c   | 64 ++++++++++++++++----------------
 drivers/staging/wfx/bus_spi.c    | 50 ++++++++++++-------------
 drivers/staging/wfx/data_rx.h    |  3 +-
 drivers/staging/wfx/data_tx.c    | 11 +++---
 drivers/staging/wfx/fwio.c       |  6 +--
 drivers/staging/wfx/hif_rx.c     |  2 +-
 drivers/staging/wfx/hif_tx.c     | 30 ++++++++-------
 drivers/staging/wfx/hif_tx.h     |  7 ++--
 drivers/staging/wfx/hif_tx_mib.c |  2 +-
 drivers/staging/wfx/hif_tx_mib.h |  4 +-
 drivers/staging/wfx/hwio.c       | 16 ++++----
 drivers/staging/wfx/key.c        |  2 +-
 drivers/staging/wfx/main.c       | 43 +++++++++++++--------
 drivers/staging/wfx/main.h       |  4 +-
 drivers/staging/wfx/queue.h      |  2 -
 drivers/staging/wfx/sta.c        | 40 +++++++++-----------
 drivers/staging/wfx/sta.h        |  2 -
 drivers/staging/wfx/wfx.h        |  4 +-
 21 files changed, 175 insertions(+), 149 deletions(-)

-- 
2.26.1


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

* [PATCH 01/15] staging: wfx: add support for hardware revision 2 and further
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 02/15] staging: wfx: reduce timeout for chip initial start up Jerome Pouiller
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

Currently, the driver explicitly exclude support for chip with version
number it does not know. However, it unlikely that any futur hardware
change would break the driver. Therefore, we prefer to invert the test
and only exclude the versions we know the driver does not support.

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

diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c
index 9d61082c1e6c..e2f914296677 100644
--- a/drivers/staging/wfx/fwio.c
+++ b/drivers/staging/wfx/fwio.c
@@ -360,7 +360,7 @@ int wfx_init_device(struct wfx_dev *wdev)
 	dev_dbg(wdev->dev, "initial config register value: %08x\n", reg);
 
 	hw_revision = FIELD_GET(CFG_DEVICE_ID_MAJOR, reg);
-	if (hw_revision == 0 || hw_revision > 2) {
+	if (hw_revision == 0) {
 		dev_err(wdev->dev, "bad hardware revision number: %d\n",
 			hw_revision);
 		return -ENODEV;
-- 
2.26.1


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

* [PATCH 02/15] staging: wfx: reduce timeout for chip initial start up
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 01/15] staging: wfx: add support for hardware revision 2 and further Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 03/15] staging: wfx: fix double free Jerome Pouiller
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

The device take a few hundreds of milliseconds to start. However, the
current code wait up to 10 second for the chip. We can safely reduce
this value to 1 second. Thanks to that change, it is no more necessary
to use an interruptible timeout.

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

diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index 742a286c9207..ba2e3a6b3549 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -370,8 +370,7 @@ int wfx_probe(struct wfx_dev *wdev)
 	if (err)
 		goto err1;
 
-	err = wait_for_completion_interruptible_timeout(&wdev->firmware_ready,
-							10 * HZ);
+	err = wait_for_completion_timeout(&wdev->firmware_ready, 1 * HZ);
 	if (err <= 0) {
 		if (err == 0) {
 			dev_err(wdev->dev, "timeout while waiting for startup indication. IRQ configuration error?\n");
-- 
2.26.1


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

* [PATCH 03/15] staging: wfx: fix double free
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 01/15] staging: wfx: add support for hardware revision 2 and further Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 02/15] staging: wfx: reduce timeout for chip initial start up Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 15:20   ` Michał Mirosław
  2020-05-05 12:37 ` [PATCH 04/15] staging: wfx: drop useless check Jerome Pouiller
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller,
	Michał Mirosław

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

In case of error in wfx_probe(), wdev->hw is freed. Since an error
occurred, wfx_free_common() is called, then wdev->hw is freed again.

Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index ba2e3a6b3549..5d0754b55429 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -469,7 +469,6 @@ int wfx_probe(struct wfx_dev *wdev)
 
 err2:
 	ieee80211_unregister_hw(wdev->hw);
-	ieee80211_free_hw(wdev->hw);
 err1:
 	wfx_bh_unregister(wdev);
 	return err;
-- 
2.26.1


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

* [PATCH 04/15] staging: wfx: drop useless check
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (2 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 03/15] staging: wfx: fix double free Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 05/15] staging: wfx: repair external IRQ for SDIO Jerome Pouiller
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

Currently, the ISR check if bus->core is not NULL. But, it is a useless
check. bus->core is initialiased before to request IRQ and it is not
assigned to NULL when it is released.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/bus_sdio.c | 9 +--------
 drivers/staging/wfx/bus_spi.c  | 4 ----
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c
index dedc3ff58d3e..9ac87178270f 100644
--- a/drivers/staging/wfx/bus_sdio.c
+++ b/drivers/staging/wfx/bus_sdio.c
@@ -91,20 +91,13 @@ static void wfx_sdio_irq_handler(struct sdio_func *func)
 {
 	struct wfx_sdio_priv *bus = sdio_get_drvdata(func);
 
-	if (bus->core)
-		wfx_bh_request_rx(bus->core);
-	else
-		WARN(!bus->core, "race condition in driver init/deinit");
+	wfx_bh_request_rx(bus->core);
 }
 
 static irqreturn_t wfx_sdio_irq_handler_ext(int irq, void *priv)
 {
 	struct wfx_sdio_priv *bus = priv;
 
-	if (!bus->core) {
-		WARN(!bus->core, "race condition in driver init/deinit");
-		return IRQ_NONE;
-	}
 	sdio_claim_host(bus->func);
 	wfx_bh_request_rx(bus->core);
 	sdio_release_host(bus->func);
diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c
index 61e99b09decb..03f95e65d2f9 100644
--- a/drivers/staging/wfx/bus_spi.c
+++ b/drivers/staging/wfx/bus_spi.c
@@ -140,10 +140,6 @@ static irqreturn_t wfx_spi_irq_handler(int irq, void *priv)
 {
 	struct wfx_spi_priv *bus = priv;
 
-	if (!bus->core) {
-		WARN(!bus->core, "race condition in driver init/deinit");
-		return IRQ_NONE;
-	}
 	queue_work(system_highpri_wq, &bus->request_rx);
 	return IRQ_HANDLED;
 }
-- 
2.26.1


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

* [PATCH 05/15] staging: wfx: repair external IRQ for SDIO
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (3 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 04/15] staging: wfx: drop useless check Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 06/15] staging: wfx: use threaded IRQ with SPI Jerome Pouiller
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

When used over SDIO bus, device is able to use an external line to
signal IRQs (also called Out-Of-Band IRQ). The current code have several
problems:
  1. The ISR cannot directly acknowledge IRQ since access to the bus is
     not atomic. This patch use a threaded IRQ to solve that issue.
  2. On certain platforms, it is necessary to keep SDIO interruption
     enabled (with register SDIO_CCCR_IENx) (this part has inspired from
     the brcmfmac driver).

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

diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c
index 9ac87178270f..2f782120e438 100644
--- a/drivers/staging/wfx/bus_sdio.c
+++ b/drivers/staging/wfx/bus_sdio.c
@@ -6,10 +6,12 @@
  * Copyright (c) 2010, ST-Ericsson
  */
 #include <linux/module.h>
+#include <linux/mmc/sdio.h>
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/card.h>
 #include <linux/interrupt.h>
 #include <linux/of_irq.h>
+#include <linux/irq.h>
 
 #include "bus.h"
 #include "wfx.h"
@@ -106,31 +108,41 @@ static irqreturn_t wfx_sdio_irq_handler_ext(int irq, void *priv)
 
 static int wfx_sdio_irq_subscribe(struct wfx_sdio_priv *bus)
 {
+	u32 flags;
 	int ret;
+	u8 cccr;
 
-	if (bus->of_irq) {
-		ret = request_irq(bus->of_irq, wfx_sdio_irq_handler_ext,
-				  IRQF_TRIGGER_RISING, "wfx", bus);
-	} else {
+	if (!bus->of_irq) {
 		sdio_claim_host(bus->func);
 		ret = sdio_claim_irq(bus->func, wfx_sdio_irq_handler);
 		sdio_release_host(bus->func);
+		return ret;
 	}
-	return ret;
+
+	sdio_claim_host(bus->func);
+	cccr = sdio_f0_readb(bus->func, SDIO_CCCR_IENx, NULL);
+	cccr |= BIT(0);
+	cccr |= BIT(bus->func->num);
+	sdio_f0_writeb(bus->func, cccr, SDIO_CCCR_IENx, NULL);
+	sdio_release_host(bus->func);
+	flags = irq_get_trigger_type(bus->of_irq);
+	if (!flags)
+		flags = IRQF_TRIGGER_HIGH;
+	flags |= IRQF_ONESHOT;
+	return devm_request_threaded_irq(&bus->func->dev, bus->of_irq, NULL,
+					 wfx_sdio_irq_handler_ext, flags,
+					 "wfx", bus);
 }
 
 static int wfx_sdio_irq_unsubscribe(struct wfx_sdio_priv *bus)
 {
 	int ret;
 
-	if (bus->of_irq) {
-		free_irq(bus->of_irq, bus);
-		ret = 0;
-	} else {
-		sdio_claim_host(bus->func);
-		ret = sdio_release_irq(bus->func);
-		sdio_release_host(bus->func);
-	}
+	if (bus->of_irq)
+		devm_free_irq(&bus->func->dev, bus->of_irq, bus);
+	sdio_claim_host(bus->func);
+	ret = sdio_release_irq(bus->func);
+	sdio_release_host(bus->func);
 	return ret;
 }
 
-- 
2.26.1


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

* [PATCH 06/15] staging: wfx: use threaded IRQ with SPI
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (4 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 05/15] staging: wfx: repair external IRQ for SDIO Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 07/15] staging: wfx: introduce a way to poll IRQ Jerome Pouiller
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

Currently, the SPI implementation use a workqueue to acknowledge IRQ
while the SDIO-OOB implementation use a threaded IRQ.

The threaded also offers the advantage to allow level triggered IRQs.

Uniformize the code and use threaded IRQ in both case. Therefore, prefer
level triggered IRQs if the user does not specify it in the DT.

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

diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c
index 03f95e65d2f9..00613d046c3f 100644
--- a/drivers/staging/wfx/bus_spi.c
+++ b/drivers/staging/wfx/bus_spi.c
@@ -39,7 +39,6 @@ struct wfx_spi_priv {
 	struct spi_device *func;
 	struct wfx_dev *core;
 	struct gpio_desc *gpio_reset;
-	struct work_struct request_rx;
 	bool need_swab;
 };
 
@@ -140,21 +139,21 @@ static irqreturn_t wfx_spi_irq_handler(int irq, void *priv)
 {
 	struct wfx_spi_priv *bus = priv;
 
-	queue_work(system_highpri_wq, &bus->request_rx);
-	return IRQ_HANDLED;
-}
-
-static void wfx_spi_request_rx(struct work_struct *work)
-{
-	struct wfx_spi_priv *bus =
-		container_of(work, struct wfx_spi_priv, request_rx);
-
 	wfx_bh_request_rx(bus->core);
+	return IRQ_HANDLED;
 }
 
-static void wfx_flush_irq_work(void *w)
+static int wfx_spi_irq_subscribe(struct wfx_spi_priv *bus)
 {
-	flush_work(w);
+	u32 flags;
+
+	flags = irq_get_trigger_type(bus->func->irq);
+	if (!flags)
+		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);
 }
 
 static size_t wfx_spi_align_size(void *priv, size_t size)
@@ -212,21 +211,12 @@ static int wfx_spi_probe(struct spi_device *func)
 		usleep_range(2000, 2500);
 	}
 
-	INIT_WORK(&bus->request_rx, wfx_spi_request_rx);
 	bus->core = wfx_init_common(&func->dev, &wfx_spi_pdata,
 				    &wfx_spi_hwbus_ops, bus);
 	if (!bus->core)
 		return -EIO;
 
-	ret = devm_add_action_or_reset(&func->dev, wfx_flush_irq_work,
-				       &bus->request_rx);
-	if (ret)
-		return ret;
-
-	ret = devm_request_irq(&func->dev, func->irq, wfx_spi_irq_handler,
-			       IRQF_TRIGGER_RISING, "wfx", bus);
-	if (ret)
-		return ret;
+	wfx_spi_irq_subscribe(bus);
 
 	return wfx_probe(bus->core);
 }
-- 
2.26.1


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

* [PATCH 07/15] staging: wfx: introduce a way to poll IRQ
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (5 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 06/15] staging: wfx: use threaded IRQ with SPI Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 08/15] staging: wfx: poll IRQ during init Jerome Pouiller
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

It is possible to check if an IRQ is ending by polling the control
register. This function must used with care: if an IRQ fires while the
host reads control register, the IRQ can be lost. However, it could be
useful in some cases.

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

diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c
index ba7fa0a7cd9a..d3e7eed89c38 100644
--- a/drivers/staging/wfx/bh.c
+++ b/drivers/staging/wfx/bh.c
@@ -307,6 +307,34 @@ 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.
+ *
+ * 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)
+{
+	ktime_t now, start;
+	u32 reg;
+
+	start = ktime_get();
+	for (;;) {
+		control_reg_read(wdev, &reg);
+		now = ktime_get();
+		if (reg & 0xFFF)
+			break;
+		if (ktime_after(now, ktime_add_ms(start, 1000))) {
+			dev_err(wdev->dev, "time out while polling control register\n");
+			return;
+		}
+		udelay(200);
+	}
+	wfx_bh_request_rx(wdev);
+}
+
 void wfx_bh_register(struct wfx_dev *wdev)
 {
 	INIT_WORK(&wdev->hif.bh, bh_work);
diff --git a/drivers/staging/wfx/bh.h b/drivers/staging/wfx/bh.h
index 93ca98424e0b..4b73437869e1 100644
--- a/drivers/staging/wfx/bh.h
+++ b/drivers/staging/wfx/bh.h
@@ -28,5 +28,6 @@ void wfx_bh_register(struct wfx_dev *wdev);
 void wfx_bh_unregister(struct wfx_dev *wdev);
 void wfx_bh_request_rx(struct wfx_dev *wdev);
 void wfx_bh_request_tx(struct wfx_dev *wdev);
+void wfx_bh_poll_irq(struct wfx_dev *wdev);
 
 #endif /* WFX_BH_H */
-- 
2.26.1


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

* [PATCH 08/15] staging: wfx: poll IRQ during init
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (6 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 07/15] staging: wfx: introduce a way to poll IRQ Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 09/15] staging: wfx: fix missing 'static' statement Jerome Pouiller
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

When the chip starts in SDIO mode, the external IRQ (aka Out-Of-Band
IRQ) cannot be used before to configure it. Therefore, the first
exchanges with the chip have to be done without the OOB IRQ.

This patch allow to poll the data until the OOB IRQ is correctly setup.
In order to keep the code simpler, this patch also poll data even if OOB
IRQ is not used.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/bh.c       |  1 +
 drivers/staging/wfx/bus.h      |  2 ++
 drivers/staging/wfx/bus_sdio.c | 17 +++++++----------
 drivers/staging/wfx/bus_spi.c  | 16 +++++++++++++---
 drivers/staging/wfx/hif_tx.c   |  3 +++
 drivers/staging/wfx/main.c     | 28 ++++++++++++++++++++--------
 drivers/staging/wfx/wfx.h      |  1 +
 7 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c
index d3e7eed89c38..2572fbcf1a33 100644
--- a/drivers/staging/wfx/bh.c
+++ b/drivers/staging/wfx/bh.c
@@ -320,6 +320,7 @@ void wfx_bh_poll_irq(struct wfx_dev *wdev)
 	ktime_t now, start;
 	u32 reg;
 
+	WARN(!wdev->poll_irq, "unexpected IRQ polling can mask IRQ");
 	start = ktime_get();
 	for (;;) {
 		control_reg_read(wdev, &reg);
diff --git a/drivers/staging/wfx/bus.h b/drivers/staging/wfx/bus.h
index 62d6ecabe4cb..0370b6c59863 100644
--- a/drivers/staging/wfx/bus.h
+++ b/drivers/staging/wfx/bus.h
@@ -25,6 +25,8 @@ struct hwbus_ops {
 			    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);
 	void (*unlock)(void *bus_priv);
 	size_t (*align_size)(void *bus_priv, size_t size);
diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c
index 2f782120e438..6afde2349289 100644
--- a/drivers/staging/wfx/bus_sdio.c
+++ b/drivers/staging/wfx/bus_sdio.c
@@ -106,8 +106,9 @@ static irqreturn_t wfx_sdio_irq_handler_ext(int irq, void *priv)
 	return IRQ_HANDLED;
 }
 
-static int wfx_sdio_irq_subscribe(struct wfx_sdio_priv *bus)
+static int wfx_sdio_irq_subscribe(void *priv)
 {
+	struct wfx_sdio_priv *bus = priv;
 	u32 flags;
 	int ret;
 	u8 cccr;
@@ -134,8 +135,9 @@ static int wfx_sdio_irq_subscribe(struct wfx_sdio_priv *bus)
 					 "wfx", bus);
 }
 
-static int wfx_sdio_irq_unsubscribe(struct wfx_sdio_priv *bus)
+static int wfx_sdio_irq_unsubscribe(void *priv)
 {
+	struct wfx_sdio_priv *bus = priv;
 	int ret;
 
 	if (bus->of_irq)
@@ -156,6 +158,8 @@ static size_t wfx_sdio_align_size(void *priv, size_t 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,
+	.irq_unsubscribe = wfx_sdio_irq_unsubscribe,
 	.lock			= wfx_sdio_lock,
 	.unlock			= wfx_sdio_unlock,
 	.align_size		= wfx_sdio_align_size,
@@ -212,18 +216,12 @@ static int wfx_sdio_probe(struct sdio_func *func,
 		goto err1;
 	}
 
-	ret = wfx_sdio_irq_subscribe(bus);
-	if (ret)
-		goto err1;
-
 	ret = wfx_probe(bus->core);
 	if (ret)
-		goto err2;
+		goto err1;
 
 	return 0;
 
-err2:
-	wfx_sdio_irq_unsubscribe(bus);
 err1:
 	sdio_claim_host(func);
 	sdio_disable_func(func);
@@ -237,7 +235,6 @@ static void wfx_sdio_remove(struct sdio_func *func)
 	struct wfx_sdio_priv *bus = sdio_get_drvdata(func);
 
 	wfx_release(bus->core);
-	wfx_sdio_irq_unsubscribe(bus);
 	sdio_claim_host(func);
 	sdio_disable_func(func);
 	sdio_release_host(func);
diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c
index 00613d046c3f..e8da61fb096b 100644
--- a/drivers/staging/wfx/bus_spi.c
+++ b/drivers/staging/wfx/bus_spi.c
@@ -12,6 +12,7 @@
 #include <linux/gpio/consumer.h>
 #include <linux/spi/spi.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/of.h>
 
 #include "bus.h"
@@ -143,8 +144,9 @@ static irqreturn_t wfx_spi_irq_handler(int irq, void *priv)
 	return IRQ_HANDLED;
 }
 
-static int wfx_spi_irq_subscribe(struct wfx_spi_priv *bus)
+static int wfx_spi_irq_subscribe(void *priv)
 {
+	struct wfx_spi_priv *bus = priv;
 	u32 flags;
 
 	flags = irq_get_trigger_type(bus->func->irq);
@@ -156,6 +158,14 @@ static int wfx_spi_irq_subscribe(struct wfx_spi_priv *bus)
 					 "wfx", bus);
 }
 
+static int wfx_spi_irq_unsubscribe(void *priv)
+{
+	struct wfx_spi_priv *bus = priv;
+
+	devm_free_irq(&bus->func->dev, bus->func->irq, bus);
+	return 0;
+}
+
 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
@@ -165,6 +175,8 @@ static size_t wfx_spi_align_size(void *priv, size_t size)
 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,
+	.irq_unsubscribe = wfx_spi_irq_unsubscribe,
 	.lock			= wfx_spi_lock,
 	.unlock			= wfx_spi_unlock,
 	.align_size		= wfx_spi_align_size,
@@ -216,8 +228,6 @@ static int wfx_spi_probe(struct spi_device *func)
 	if (!bus->core)
 		return -EIO;
 
-	wfx_spi_irq_subscribe(bus);
-
 	return wfx_probe(bus->core);
 }
 
diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index e8f3c5f9ce7b..511ef874a6d9 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -82,6 +82,9 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, void *reply,
 	if (async)
 		return 0;
 
+	if (wdev->poll_irq)
+		wfx_bh_poll_irq(wdev);
+
 	ret = wait_for_completion_timeout(&wdev->hif_cmd.done, 1 * HZ);
 	if (!ret) {
 		dev_err(wdev->dev, "chip is abnormally long to answer\n");
diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index 5d0754b55429..623a9fc31153 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -363,22 +363,24 @@ int wfx_probe(struct wfx_dev *wdev)
 	// prevent bh() to touch it.
 	gpio_saved = wdev->pdata.gpio_wakeup;
 	wdev->pdata.gpio_wakeup = NULL;
+	wdev->poll_irq = true;
 
 	wfx_bh_register(wdev);
 
 	err = wfx_init_device(wdev);
 	if (err)
-		goto err1;
+		goto err0;
 
+	wfx_bh_poll_irq(wdev);
 	err = wait_for_completion_timeout(&wdev->firmware_ready, 1 * HZ);
 	if (err <= 0) {
 		if (err == 0) {
-			dev_err(wdev->dev, "timeout while waiting for startup indication. IRQ configuration error?\n");
+			dev_err(wdev->dev, "timeout while waiting for startup indication\n");
 			err = -ETIMEDOUT;
 		} else if (err == -ERESTARTSYS) {
 			dev_info(wdev->dev, "probe interrupted by user\n");
 		}
-		goto err1;
+		goto err0;
 	}
 
 	// FIXME: fill wiphy::hw_version
@@ -400,14 +402,14 @@ int wfx_probe(struct wfx_dev *wdev)
 			"unsupported firmware API version (expect 1 while firmware returns %d)\n",
 			wdev->hw_caps.api_version_major);
 		err = -ENOTSUPP;
-		goto err1;
+		goto err0;
 	}
 
 	err = wfx_sl_init(wdev);
 	if (err && wdev->hw_caps.capabilities.link_mode == SEC_LINK_ENFORCED) {
 		dev_err(wdev->dev,
 			"chip require secure_link, but can't negociate it\n");
-		goto err1;
+		goto err0;
 	}
 
 	if (wdev->hw_caps.regul_sel_mode_info.region_sel_mode) {
@@ -420,7 +422,16 @@ int wfx_probe(struct wfx_dev *wdev)
 		wdev->pdata.file_pds);
 	err = wfx_send_pdata_pds(wdev);
 	if (err < 0)
-		goto err1;
+		goto err0;
+
+	wdev->poll_irq = false;
+	err = wdev->hwbus_ops->irq_subscribe(wdev->hwbus_priv);
+	if (err)
+		goto err0;
+
+	err = 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) {
@@ -435,8 +446,6 @@ int wfx_probe(struct wfx_dev *wdev)
 		hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_DOZE);
 	}
 
-	hif_use_multi_tx_conf(wdev, true);
-
 	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);
@@ -470,6 +479,8 @@ int wfx_probe(struct wfx_dev *wdev)
 err2:
 	ieee80211_unregister_hw(wdev->hw);
 err1:
+	wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv);
+err0:
 	wfx_bh_unregister(wdev);
 	return err;
 }
@@ -478,6 +489,7 @@ void wfx_release(struct wfx_dev *wdev)
 {
 	ieee80211_unregister_hw(wdev->hw);
 	hif_shutdown(wdev);
+	wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv);
 	wfx_bh_unregister(wdev);
 	wfx_sl_deinit(wdev);
 }
diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h
index 09bbb5da4f06..4eb7762142fc 100644
--- a/drivers/staging/wfx/wfx.h
+++ b/drivers/staging/wfx/wfx.h
@@ -46,6 +46,7 @@ struct wfx_dev {
 	struct wfx_hif		hif;
 	struct sl_context	sl;
 	struct delayed_work	cooling_timeout_work;
+	bool			poll_irq;
 	bool			chip_frozen;
 	struct mutex		conf_mutex;
 
-- 
2.26.1


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

* [PATCH 09/15] staging: wfx: fix missing 'static' statement
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (7 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 08/15] staging: wfx: poll IRQ during init Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 10/15] staging: wfx: fix missing 'static' keyword Jerome Pouiller
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

The function get_firmware() is only used from fwio.c. It can be declared
static.

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

diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c
index e2f914296677..85b6a916a7d0 100644
--- a/drivers/staging/wfx/fwio.c
+++ b/drivers/staging/wfx/fwio.c
@@ -99,8 +99,8 @@ static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf,
 	return ret;
 }
 
-int get_firmware(struct wfx_dev *wdev, u32 keyset_chip,
-		 const struct firmware **fw, int *file_offset)
+static int get_firmware(struct wfx_dev *wdev, u32 keyset_chip,
+			const struct firmware **fw, int *file_offset)
 {
 	int keyset_file;
 	char filename[256];
-- 
2.26.1


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

* [PATCH 10/15] staging: wfx: fix missing 'static' keyword
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (8 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 09/15] staging: wfx: fix missing 'static' statement Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 11/15] staging: wfx: prefer ARRAY_SIZE instead of a magic number Jerome Pouiller
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

Sparse tool noticed that wfx_enable_beacon() is never used outside of
sta.c. Therefore, it can be declared static.

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

diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index 74ec0b604085..3ad0b67a7dca 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -519,7 +519,7 @@ void wfx_leave_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 	wfx_do_unjoin(wvif);
 }
 
-void wfx_enable_beacon(struct wfx_vif *wvif, bool enable)
+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
-- 
2.26.1


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

* [PATCH 11/15] staging: wfx: prefer ARRAY_SIZE instead of a magic number
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (9 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 10/15] staging: wfx: fix missing 'static' keyword Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 12/15] staging: wfx: remove useless header inclusions Jerome Pouiller
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

When possible, we prefer to use the macro ARRAY_SIZE rather than hard
coding the number of elements.

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

diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index 30aa8c267cd0..83a9256f09bf 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -166,13 +166,13 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif)
 
 	do {
 		spin_lock_bh(&wvif->tx_policy_cache.lock);
-		for (i = 0; i < HIF_TX_RETRY_POLICY_MAX; ++i) {
+		for (i = 0; i < ARRAY_SIZE(wvif->tx_policy_cache.cache); ++i) {
 			is_used = memzcmp(policies[i].rates,
 					  sizeof(policies[i].rates));
 			if (!policies[i].uploaded && is_used)
 				break;
 		}
-		if (i < HIF_TX_RETRY_POLICY_MAX) {
+		if (i < ARRAY_SIZE(wvif->tx_policy_cache.cache)) {
 			policies[i].uploaded = true;
 			memcpy(tmp_rates, policies[i].rates, sizeof(tmp_rates));
 			spin_unlock_bh(&wvif->tx_policy_cache.lock);
@@ -180,7 +180,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif)
 		} else {
 			spin_unlock_bh(&wvif->tx_policy_cache.lock);
 		}
-	} while (i < HIF_TX_RETRY_POLICY_MAX);
+	} while (i < ARRAY_SIZE(wvif->tx_policy_cache.cache));
 	return 0;
 }
 
@@ -204,7 +204,7 @@ void wfx_tx_policy_init(struct wfx_vif *wvif)
 	INIT_LIST_HEAD(&cache->used);
 	INIT_LIST_HEAD(&cache->free);
 
-	for (i = 0; i < HIF_TX_RETRY_POLICY_MAX; ++i)
+	for (i = 0; i < ARRAY_SIZE(cache->cache); ++i)
 		list_add(&cache->cache[i].link, &cache->free);
 }
 
-- 
2.26.1


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

* [PATCH 12/15] staging: wfx: remove useless header inclusions
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (10 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 11/15] staging: wfx: prefer ARRAY_SIZE instead of a magic number Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 13/15] staging: wfx: fix alignements of function prototypes Jerome Pouiller
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

In order to keep the compilation times reasonable, we try to only
include the necessary headers (especially header included from other
headers).

This patch clean up unnecessary headers inclusions.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/data_rx.h    | 3 +--
 drivers/staging/wfx/hif_tx.h     | 3 +--
 drivers/staging/wfx/hif_tx_mib.h | 2 --
 drivers/staging/wfx/main.c       | 1 +
 drivers/staging/wfx/main.h       | 2 +-
 drivers/staging/wfx/queue.h      | 2 --
 drivers/staging/wfx/sta.h        | 2 --
 drivers/staging/wfx/wfx.h        | 3 ---
 8 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wfx/data_rx.h b/drivers/staging/wfx/data_rx.h
index 61c28bfd2a37..125dbfc1f875 100644
--- a/drivers/staging/wfx/data_rx.h
+++ b/drivers/staging/wfx/data_rx.h
@@ -8,10 +8,9 @@
 #ifndef WFX_DATA_RX_H
 #define WFX_DATA_RX_H
 
-#include "hif_api_cmd.h"
-
 struct wfx_vif;
 struct sk_buff;
+struct hif_ind_rx;
 
 void wfx_rx_cb(struct wfx_vif *wvif,
 	       const struct hif_ind_rx *arg, struct sk_buff *skb);
diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h
index 038ea54e2574..826851a7e950 100644
--- a/drivers/staging/wfx/hif_tx.h
+++ b/drivers/staging/wfx/hif_tx.h
@@ -10,12 +10,11 @@
 #ifndef WFX_HIF_TX_H
 #define WFX_HIF_TX_H
 
-#include "hif_api_cmd.h"
-
 struct ieee80211_channel;
 struct ieee80211_bss_conf;
 struct ieee80211_tx_queue_params;
 struct cfg80211_scan_request;
+struct hif_req_add_key;
 struct wfx_dev;
 struct wfx_vif;
 
diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h
index b72770a4ba12..bce35eb7eaa0 100644
--- a/drivers/staging/wfx/hif_tx_mib.h
+++ b/drivers/staging/wfx/hif_tx_mib.h
@@ -9,8 +9,6 @@
 #ifndef WFX_HIF_TX_MIB_H
 #define WFX_HIF_TX_MIB_H
 
-#include "hif_api_mib.h"
-
 struct wfx_vif;
 struct sk_buff;
 
diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index 623a9fc31153..d3d86c8c92c8 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -28,6 +28,7 @@
 #include "bh.h"
 #include "sta.h"
 #include "key.h"
+#include "scan.h"
 #include "debug.h"
 #include "data_tx.h"
 #include "secure_link.h"
diff --git a/drivers/staging/wfx/main.h b/drivers/staging/wfx/main.h
index 9c9410072def..a0f37c8ce3df 100644
--- a/drivers/staging/wfx/main.h
+++ b/drivers/staging/wfx/main.h
@@ -13,10 +13,10 @@
 #include <linux/device.h>
 #include <linux/gpio/consumer.h>
 
-#include "bus.h"
 #include "hif_api_general.h"
 
 struct wfx_dev;
+struct hwbus_ops;
 
 struct wfx_platform_data {
 	/* Keyset and ".sec" extention will appended to this string */
diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h
index 1020dfde399b..0cbe5f4b06f2 100644
--- a/drivers/staging/wfx/queue.h
+++ b/drivers/staging/wfx/queue.h
@@ -11,8 +11,6 @@
 #include <linux/skbuff.h>
 #include <linux/atomic.h>
 
-#include "hif_api_cmd.h"
-
 struct wfx_dev;
 struct wfx_vif;
 
diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h
index a0e025c18341..c84c3749ec4f 100644
--- a/drivers/staging/wfx/sta.h
+++ b/drivers/staging/wfx/sta.h
@@ -10,8 +10,6 @@
 
 #include <net/mac80211.h>
 
-#include "hif_api_cmd.h"
-
 struct wfx_dev;
 struct wfx_vif;
 
diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h
index 4eb7762142fc..09a24561f092 100644
--- a/drivers/staging/wfx/wfx.h
+++ b/drivers/staging/wfx/wfx.h
@@ -21,10 +21,7 @@
 #include "main.h"
 #include "queue.h"
 #include "secure_link.h"
-#include "sta.h"
-#include "scan.h"
 #include "hif_tx.h"
-#include "hif_api_general.h"
 
 #define USEC_PER_TXOP 32 // see struct ieee80211_tx_queue_params
 #define USEC_PER_TU 1024
-- 
2.26.1


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

* [PATCH 13/15] staging: wfx: fix alignements of function prototypes
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (11 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 12/15] staging: wfx: remove useless header inclusions Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 14/15] staging: wfx: remove spaces after cast operator Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 15/15] staging: wfx: use kernel types instead of c99 ones Jerome Pouiller
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

Some function prototypes were not correctly aligned and/or exceed 80
columns.

In some other cases, the prototypes were written on more lines than
necessary.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/data_tx.c |  3 +--
 drivers/staging/wfx/hif_tx.c  | 24 ++++++++++++------------
 drivers/staging/wfx/hif_tx.h  |  4 ++--
 drivers/staging/wfx/hwio.c    | 12 ++++++------
 drivers/staging/wfx/main.c    |  4 ++--
 drivers/staging/wfx/sta.c     | 15 +++++----------
 6 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index 83a9256f09bf..f64149ab0484 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -106,8 +106,7 @@ static int wfx_tx_policy_release(struct tx_policy_cache *cache,
 }
 
 static int wfx_tx_policy_get(struct wfx_vif *wvif,
-			     struct ieee80211_tx_rate *rates,
-			     bool *renew)
+			     struct ieee80211_tx_rate *rates, bool *renew)
 {
 	int idx;
 	struct tx_policy_cache *cache = &wvif->tx_policy_cache;
diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index 511ef874a6d9..96f13d9c8c98 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -23,8 +23,8 @@ void wfx_init_hif_cmd(struct wfx_hif_cmd *hif_cmd)
 	mutex_init(&hif_cmd->key_renew_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 hif_msg *hif, int if_id,
+			    unsigned int cmd, size_t size)
 {
 	if (if_id == -1)
 		if_id = 2;
@@ -47,8 +47,8 @@ static void *wfx_alloc_hif(size_t body_len, struct hif_msg **hif)
 		return NULL;
 }
 
-int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, void *reply,
-		 size_t reply_len, bool async)
+int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request,
+		 void *reply, size_t reply_len, bool async)
 {
 	const char *mib_name = "";
 	const char *mib_sep = "";
@@ -176,8 +176,8 @@ 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 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;
@@ -207,8 +207,8 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val,
 	return ret;
 }
 
-int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val,
-		  size_t val_len)
+int 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;
@@ -494,8 +494,8 @@ int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len)
 	return ret;
 }
 
-int hif_sl_send_pub_keys(struct wfx_dev *wdev, const uint8_t *pubkey,
-			 const uint8_t *pubkey_hmac)
+int hif_sl_send_pub_keys(struct wfx_dev *wdev,
+			 const uint8_t *pubkey, const uint8_t *pubkey_hmac)
 {
 	int ret;
 	struct hif_msg *hif;
@@ -529,8 +529,8 @@ int hif_sl_config(struct wfx_dev *wdev, const unsigned long *bitmap)
 	return ret;
 }
 
-int hif_sl_set_mac_key(struct wfx_dev *wdev, const u8 *slk_key,
-		       int destination)
+int hif_sl_set_mac_key(struct wfx_dev *wdev,
+		       const uint8_t *slk_key, int destination)
 {
 	int ret;
 	struct hif_msg *hif;
diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h
index 826851a7e950..e9eca9330178 100644
--- a/drivers/staging/wfx/hif_tx.h
+++ b/drivers/staging/wfx/hif_tx.h
@@ -57,8 +57,8 @@ int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
 int hif_beacon_transmit(struct wfx_vif *wvif, bool enable);
 int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id);
 int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len);
-int hif_sl_set_mac_key(struct wfx_dev *wdev, const u8 *slk_key,
-		       int destination);
+int hif_sl_set_mac_key(struct wfx_dev *wdev,
+		       const u8 *slk_key, int destination);
 int hif_sl_config(struct wfx_dev *wdev, const unsigned long *bitmap);
 int hif_sl_send_pub_keys(struct wfx_dev *wdev,
 			 const u8 *pubkey, const u8 *pubkey_hmac);
diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c
index d3a141d95a0e..051d4b233b47 100644
--- a/drivers/staging/wfx/hwio.c
+++ b/drivers/staging/wfx/hwio.c
@@ -106,8 +106,8 @@ static int write32_bits_locked(struct wfx_dev *wdev, int reg, u32 mask, u32 val)
 	return ret;
 }
 
-static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr, void *buf,
-			 size_t len)
+static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr,
+			 void *buf, size_t len)
 {
 	int ret;
 	int i;
@@ -195,8 +195,8 @@ static int indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr,
 	return ret;
 }
 
-static int indirect_read32_locked(struct wfx_dev *wdev, int reg, u32 addr,
-				  u32 *val)
+static int indirect_read32_locked(struct wfx_dev *wdev, int reg,
+				  u32 addr, u32 *val)
 {
 	int ret;
 	__le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL);
@@ -212,8 +212,8 @@ static int indirect_read32_locked(struct wfx_dev *wdev, int reg, u32 addr,
 	return ret;
 }
 
-static int indirect_write32_locked(struct wfx_dev *wdev, int reg, u32 addr,
-				   u32 val)
+static int 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/main.c b/drivers/staging/wfx/main.c
index d3d86c8c92c8..de41f1671433 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -170,8 +170,8 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor)
 	return false;
 }
 
-struct gpio_desc *wfx_get_gpio(struct device *dev, int override,
-			       const char *label)
+struct gpio_desc *wfx_get_gpio(struct device *dev,
+			       int override, const char *label)
 {
 	struct gpio_desc *ret;
 	char label_buf[256];
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index 3ad0b67a7dca..999e0f0e19af 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -139,10 +139,8 @@ u64 wfx_prepare_multicast(struct ieee80211_hw *hw,
 	return 0;
 }
 
-void wfx_configure_filter(struct ieee80211_hw *hw,
-			     unsigned int changed_flags,
-			     unsigned int *total_flags,
-			     u64 unused)
+void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
+			  unsigned int *total_flags, u64 unused)
 {
 	struct wfx_vif *wvif = NULL;
 	struct wfx_dev *wdev = hw->priv;
@@ -532,10 +530,8 @@ static void wfx_enable_beacon(struct wfx_vif *wvif, bool enable)
 	hif_beacon_transmit(wvif, enable);
 }
 
-void wfx_bss_info_changed(struct ieee80211_hw *hw,
-			     struct ieee80211_vif *vif,
-			     struct ieee80211_bss_conf *info,
-			     u32 changed)
+void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+			  struct ieee80211_bss_conf *info, u32 changed)
 {
 	struct wfx_dev *wdev = hw->priv;
 	struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv;
@@ -800,8 +796,7 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 	return ret;
 }
 
-void wfx_remove_interface(struct ieee80211_hw *hw,
-			  struct ieee80211_vif *vif)
+void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
 	struct wfx_dev *wdev = hw->priv;
 	struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv;
-- 
2.26.1


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

* [PATCH 14/15] staging: wfx: remove spaces after cast operator
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (12 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 13/15] staging: wfx: fix alignements of function prototypes Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  2020-05-05 12:37 ` [PATCH 15/15] staging: wfx: use kernel types instead of c99 ones Jerome Pouiller
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

The kernel coding style expects no space after cast operator. This patch
make the wfx driver compliant with this rule.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/hif_rx.c |  2 +-
 drivers/staging/wfx/hif_tx.c |  4 ++--
 drivers/staging/wfx/hwio.c   |  4 ++--
 drivers/staging/wfx/key.c    |  2 +-
 drivers/staging/wfx/main.c   |  2 +-
 drivers/staging/wfx/sta.c    | 23 +++++++++++------------
 6 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c
index b786714a8755..ac4ec4f30496 100644
--- a/drivers/staging/wfx/hif_rx.c
+++ b/drivers/staging/wfx/hif_rx.c
@@ -263,7 +263,7 @@ static int hif_generic_indication(struct wfx_dev *wdev,
 		return 0;
 	case HIF_GENERIC_INDICATION_TYPE_STRING:
 		dev_info(wdev->dev, "firmware says: %s\n",
-			 (char *) body->indication_data.raw_data);
+			 (char *)body->indication_data.raw_data);
 		return 0;
 	case HIF_GENERIC_INDICATION_TYPE_RX_STATS:
 		mutex_lock(&wdev->rx_stats_lock);
diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index 96f13d9c8c98..b083fcace303 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -106,7 +106,7 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request,
 
 	if (ret &&
 	    (cmd == HIF_REQ_ID_READ_MIB || cmd == HIF_REQ_ID_WRITE_MIB)) {
-		mib_name = get_mib_name(((u16 *) request)[2]);
+		mib_name = get_mib_name(((u16 *)request)[2]);
 		mib_sep = "/";
 	}
 	if (ret < 0)
@@ -470,7 +470,7 @@ int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id)
 
 	if (mac_addr)
 		ether_addr_copy(body->mac_addr, mac_addr);
-	body->map_link_flags = *(struct hif_map_link_flags *) &flags;
+	body->map_link_flags = *(struct hif_map_link_flags *)&flags;
 	body->peer_sta_id = sta_id;
 	wfx_fill_header(hif, wvif->id, HIF_REQ_ID_MAP_LINK, sizeof(*body));
 	ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c
index 051d4b233b47..d878cb3e84fc 100644
--- a/drivers/staging/wfx/hwio.c
+++ b/drivers/staging/wfx/hwio.c
@@ -233,7 +233,7 @@ int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t len)
 {
 	int ret;
 
-	WARN((long) buf & 3, "%s: unaligned buffer", __func__);
+	WARN((long)buf & 3, "%s: unaligned buffer", __func__);
 	wdev->hwbus_ops->lock(wdev->hwbus_priv);
 	ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv,
 					    WFX_REG_IN_OUT_QUEUE, buf, len);
@@ -249,7 +249,7 @@ 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((long)buf & 3, "%s: unaligned buffer", __func__);
 	wdev->hwbus_ops->lock(wdev->hwbus_priv);
 	ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv,
 					  WFX_REG_IN_OUT_QUEUE, buf, len);
diff --git a/drivers/staging/wfx/key.c b/drivers/staging/wfx/key.c
index ceb57cbdfefd..5ee2ffc5f935 100644
--- a/drivers/staging/wfx/key.c
+++ b/drivers/staging/wfx/key.c
@@ -228,7 +228,7 @@ int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		struct ieee80211_key_conf *key)
 {
 	int ret = -EOPNOTSUPP;
-	struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv;
+	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
 
 	mutex_lock(&wvif->wdev->conf_mutex);
 	if (cmd == SET_KEY)
diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index de41f1671433..18c96b82c66e 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -390,7 +390,7 @@ int wfx_probe(struct wfx_dev *wdev)
 		 wdev->hw_caps.firmware_build, wdev->hw_caps.firmware_label,
 		 wdev->hw_caps.api_version_major,
 		 wdev->hw_caps.api_version_minor,
-		 wdev->keyset, *((u32 *) &wdev->hw_caps.capabilities));
+		 wdev->keyset, *((u32 *)&wdev->hw_caps.capabilities));
 	snprintf(wdev->hw->wiphy->fw_version,
 		 sizeof(wdev->hw->wiphy->fw_version),
 		 "%d.%d.%d",
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index 999e0f0e19af..1a876a0faaf5 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -251,7 +251,7 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		   u16 queue, const struct ieee80211_tx_queue_params *params)
 {
 	struct wfx_dev *wdev = hw->priv;
-	struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv;
+	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
 	int old_uapsd = wvif->uapsd_mask;
 
 	WARN_ON(queue >= hw->queues);
@@ -345,8 +345,7 @@ static void wfx_set_mfp(struct wfx_vif *wvif,
 
 	rcu_read_lock();
 	if (bss)
-		ptr = (const u16 *) ieee80211_bss_get_ie(bss,
-							      WLAN_EID_RSN);
+		ptr = (const u16 *)ieee80211_bss_get_ie(bss, WLAN_EID_RSN);
 
 	if (ptr) {
 		ptr += pairwise_cipher_suite_count_offset;
@@ -411,8 +410,8 @@ static void wfx_do_join(struct wfx_vif *wvif)
 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;
+	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
+	struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv;
 
 	spin_lock_init(&sta_priv->lock);
 	sta_priv->vif_id = wvif->id;
@@ -432,8 +431,8 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 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;
+	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
+	struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv;
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(sta_priv->buffered); i++)
@@ -534,7 +533,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			  struct ieee80211_bss_conf *info, u32 changed)
 {
 	struct wfx_dev *wdev = hw->priv;
-	struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv;
+	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
 	int i;
 
 	mutex_lock(&wdev->conf_mutex);
@@ -703,7 +702,7 @@ void wfx_change_chanctx(struct ieee80211_hw *hw,
 int wfx_assign_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;
+	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
 	struct ieee80211_channel *ch = conf->def.chan;
 
 	WARN(wvif->channel, "channel overwrite");
@@ -716,7 +715,7 @@ 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;
+	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
 	struct ieee80211_channel *ch = conf->def.chan;
 
 	WARN(wvif->channel != ch, "channel mismatch");
@@ -732,7 +731,7 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
 	int i, ret = 0;
 	struct wfx_dev *wdev = hw->priv;
-	struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv;
+	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
 
 	vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER |
 			     IEEE80211_VIF_SUPPORTS_UAPSD |
@@ -799,7 +798,7 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
 	struct wfx_dev *wdev = hw->priv;
-	struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv;
+	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
 
 	wait_for_completion_timeout(&wvif->set_pm_mode_complete, msecs_to_jiffies(300));
 
-- 
2.26.1


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

* [PATCH 15/15] staging: wfx: use kernel types instead of c99 ones
  2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
                   ` (13 preceding siblings ...)
  2020-05-05 12:37 ` [PATCH 14/15] staging: wfx: remove spaces after cast operator Jerome Pouiller
@ 2020-05-05 12:37 ` Jerome Pouiller
  14 siblings, 0 replies; 17+ messages in thread
From: Jerome Pouiller @ 2020-05-05 12:37 UTC (permalink / raw)
  To: devel, linux-wireless
  Cc: netdev, linux-kernel, Greg Kroah-Hartman, Kalle Valo,
	David S . Miller, Jérôme Pouiller

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

The kernel coding style promotes the use of kernel types (u8, u16, u32,
etc...) instead of the C99 ones.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/hif_tx.c     | 5 ++---
 drivers/staging/wfx/hif_tx_mib.c | 2 +-
 drivers/staging/wfx/hif_tx_mib.h | 2 +-
 drivers/staging/wfx/main.c       | 4 ++--
 drivers/staging/wfx/main.h       | 2 +-
 5 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index b083fcace303..58013c019192 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -495,7 +495,7 @@ int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len)
 }
 
 int hif_sl_send_pub_keys(struct wfx_dev *wdev,
-			 const uint8_t *pubkey, const uint8_t *pubkey_hmac)
+			 const u8 *pubkey, const u8 *pubkey_hmac)
 {
 	int ret;
 	struct hif_msg *hif;
@@ -529,8 +529,7 @@ int hif_sl_config(struct wfx_dev *wdev, const unsigned long *bitmap)
 	return ret;
 }
 
-int hif_sl_set_mac_key(struct wfx_dev *wdev,
-		       const uint8_t *slk_key, int destination)
+int hif_sl_set_mac_key(struct wfx_dev *wdev, const u8 *slk_key, int destination)
 {
 	int ret;
 	struct hif_msg *hif;
diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c
index 6fdde5a4c9a1..65381b22437e 100644
--- a/drivers/staging/wfx/hif_tx_mib.c
+++ b/drivers/staging/wfx/hif_tx_mib.c
@@ -215,7 +215,7 @@ int hif_set_association_mode(struct wfx_vif *wvif,
 }
 
 int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif,
-				 int policy_index, uint8_t *rates)
+				 int policy_index, u8 *rates)
 {
 	struct hif_mib_set_tx_rate_retry_policy *arg;
 	size_t size = struct_size(arg, tx_rate_retry_policy, 1);
diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h
index bce35eb7eaa0..86683de7de7c 100644
--- a/drivers/staging/wfx/hif_tx_mib.h
+++ b/drivers/staging/wfx/hif_tx_mib.h
@@ -36,7 +36,7 @@ int hif_set_block_ack_policy(struct wfx_vif *wvif,
 int hif_set_association_mode(struct wfx_vif *wvif,
 			     struct ieee80211_bss_conf *info);
 int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif,
-				 int policy_index, uint8_t *rates);
+				 int policy_index, u8 *rates);
 int hif_set_mac_addr_condition(struct wfx_vif *wvif,
 			       int idx, const u8 *mac_addr);
 int hif_set_uc_mc_bc_condition(struct wfx_vif *wvif,
diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index 18c96b82c66e..25d70ebe9933 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -203,7 +203,7 @@ struct gpio_desc *wfx_get_gpio(struct device *dev,
 }
 
 /* NOTE: wfx_send_pds() destroy buf */
-int wfx_send_pds(struct wfx_dev *wdev, unsigned char *buf, size_t len)
+int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len)
 {
 	int ret;
 	int start, brace_level, i;
@@ -252,7 +252,7 @@ static int wfx_send_pdata_pds(struct wfx_dev *wdev)
 {
 	int ret = 0;
 	const struct firmware *pds;
-	unsigned char *tmp_buf;
+	u8 *tmp_buf;
 
 	ret = request_firmware(&pds, wdev->pdata.file_pds, wdev->dev);
 	if (ret) {
diff --git a/drivers/staging/wfx/main.h b/drivers/staging/wfx/main.h
index a0f37c8ce3df..f832ce409fda 100644
--- a/drivers/staging/wfx/main.h
+++ b/drivers/staging/wfx/main.h
@@ -41,6 +41,6 @@ void wfx_release(struct wfx_dev *wdev);
 struct gpio_desc *wfx_get_gpio(struct device *dev, int override,
 			       const char *label);
 bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor);
-int wfx_send_pds(struct wfx_dev *wdev, unsigned char *buf, size_t len);
+int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len);
 
 #endif
-- 
2.26.1


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

* Re: [PATCH 03/15] staging: wfx: fix double free
  2020-05-05 12:37 ` [PATCH 03/15] staging: wfx: fix double free Jerome Pouiller
@ 2020-05-05 15:20   ` Michał Mirosław
  0 siblings, 0 replies; 17+ messages in thread
From: Michał Mirosław @ 2020-05-05 15:20 UTC (permalink / raw)
  To: Jerome Pouiller
  Cc: devel, linux-wireless, netdev, linux-kernel, Greg Kroah-Hartman,
	Kalle Valo, David S . Miller

On Tue, May 05, 2020 at 02:37:45PM +0200, Jerome Pouiller wrote:
> From: Jérôme Pouiller <jerome.pouiller@silabs.com>
> 
> In case of error in wfx_probe(), wdev->hw is freed. Since an error
> occurred, wfx_free_common() is called, then wdev->hw is freed again.
> 
> Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
> ---
>  drivers/staging/wfx/main.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
> index ba2e3a6b3549..5d0754b55429 100644
> --- a/drivers/staging/wfx/main.c
> +++ b/drivers/staging/wfx/main.c
> @@ -469,7 +469,6 @@ int wfx_probe(struct wfx_dev *wdev)
>  
>  err2:
>  	ieee80211_unregister_hw(wdev->hw);
> -	ieee80211_free_hw(wdev->hw);
>  err1:
>  	wfx_bh_unregister(wdev);
>  	return err;

Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Fixes: 4033714d6cbe ("staging: wfx: fix init/remove vs IRQ race")

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

end of thread, other threads:[~2020-05-05 15:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 12:37 [PATCH 00/15] staging: wfx: fix Out-Of-Band IRQ Jerome Pouiller
2020-05-05 12:37 ` [PATCH 01/15] staging: wfx: add support for hardware revision 2 and further Jerome Pouiller
2020-05-05 12:37 ` [PATCH 02/15] staging: wfx: reduce timeout for chip initial start up Jerome Pouiller
2020-05-05 12:37 ` [PATCH 03/15] staging: wfx: fix double free Jerome Pouiller
2020-05-05 15:20   ` Michał Mirosław
2020-05-05 12:37 ` [PATCH 04/15] staging: wfx: drop useless check Jerome Pouiller
2020-05-05 12:37 ` [PATCH 05/15] staging: wfx: repair external IRQ for SDIO Jerome Pouiller
2020-05-05 12:37 ` [PATCH 06/15] staging: wfx: use threaded IRQ with SPI Jerome Pouiller
2020-05-05 12:37 ` [PATCH 07/15] staging: wfx: introduce a way to poll IRQ Jerome Pouiller
2020-05-05 12:37 ` [PATCH 08/15] staging: wfx: poll IRQ during init Jerome Pouiller
2020-05-05 12:37 ` [PATCH 09/15] staging: wfx: fix missing 'static' statement Jerome Pouiller
2020-05-05 12:37 ` [PATCH 10/15] staging: wfx: fix missing 'static' keyword Jerome Pouiller
2020-05-05 12:37 ` [PATCH 11/15] staging: wfx: prefer ARRAY_SIZE instead of a magic number Jerome Pouiller
2020-05-05 12:37 ` [PATCH 12/15] staging: wfx: remove useless header inclusions Jerome Pouiller
2020-05-05 12:37 ` [PATCH 13/15] staging: wfx: fix alignements of function prototypes Jerome Pouiller
2020-05-05 12:37 ` [PATCH 14/15] staging: wfx: remove spaces after cast operator Jerome Pouiller
2020-05-05 12:37 ` [PATCH 15/15] staging: wfx: use kernel types instead of c99 ones 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).