Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 5/8] wl12xx: add platform driver to the core module
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
  To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>

From: Felipe Balbi <balbi@ti.com>

Nnow that we have a platform_device on both glue layers, add a
platform_driver to the core driver.

It's currently an empty platform_driver but more functionality will be
added on later patches.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported, cleaned-up and rephrased commit message]
[added platform_driver.driver initialization]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/main.c |   39 ++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 194d7cc..84904bd 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -5041,6 +5041,45 @@ int wl1271_free_hw(struct wl1271 *wl)
 }
 EXPORT_SYMBOL_GPL(wl1271_free_hw);
 
+static int __devinit wl12xx_probe(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static int __devexit wl12xx_remove(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static const struct platform_device_id wl12xx_id_table[] __devinitconst = {
+	{ "wl12xx-sdio", 0 },
+	{ "wl12xx-spi", 0 },
+	{  } /* Terminating Entry */
+};
+MODULE_DEVICE_TABLE(platform, wl12xx_id_table);
+
+static struct platform_driver wl12xx_driver = {
+	.probe		= wl12xx_probe,
+	.remove		= __devexit_p(wl12xx_remove),
+	.id_table	= wl12xx_id_table,
+	.driver = {
+		.name	= "wl12xx",
+		.owner	= THIS_MODULE,
+	}
+};
+
+static int __init wl12xx_init(void)
+{
+	return platform_driver_register(&wl12xx_driver);
+}
+module_init(wl12xx_init);
+
+static void __exit wl12xx_exit(void)
+{
+	platform_driver_unregister(&wl12xx_driver);
+}
+module_exit(wl12xx_exit);
+
 u32 wl12xx_debug_level = DEBUG_NONE;
 EXPORT_SYMBOL_GPL(wl12xx_debug_level);
 module_param_named(debug_level, wl12xx_debug_level, uint, S_IRUSR | S_IWUSR);
-- 
1.7.1


^ permalink raw reply related

* [PATCH 4/8] wl12xx: add a platform device to the spi module
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
  To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>

From: Felipe Balbi <balbi@ti.com>

The platform device will be used to match the platform driver that
will be implemented by the core module.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported, cleaned-up and rephrased commit message]
[call platform_device_add() instead of platform_device_register()]
[store alloc'ed device platform directly in glue->core]
[fixed the length of memset(res...)]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/spi.c |   44 +++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index 16f0c71..e075d69 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -27,6 +27,7 @@
 #include <linux/crc7.h>
 #include <linux/spi/spi.h>
 #include <linux/wl12xx.h>
+#include <linux/platform_device.h>
 #include <linux/slab.h>
 
 #include "wl12xx.h"
@@ -72,6 +73,7 @@
 struct wl12xx_spi_glue {
 	struct device *dev;
 	struct wl1271 *wl;
+	struct platform_device *core;
 };
 
 static inline struct wl12xx_spi_glue *wl_to_glue(struct wl1271 *wl)
@@ -376,6 +378,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 	struct wl12xx_platform_data *pdata;
 	struct ieee80211_hw *hw;
 	struct wl1271 *wl;
+	struct resource res[1];
 	unsigned long irqflags;
 	int ret = -ENOMEM;
 
@@ -458,8 +461,47 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 	if (ret)
 		goto out_irq;
 
+	glue->core = platform_device_alloc("wl12xx-spi", -1);
+	if (!glue->core) {
+		dev_err(&spi->dev, "can't allocate platform_device\n");
+		ret = -ENOMEM;
+		goto out_unreg_hw;
+	}
+
+	glue->core->dev.parent = &spi->dev;
+
+	memset(res, 0x00, sizeof(res));
+
+	res[0].start = spi->irq;
+	res[0].flags = IORESOURCE_IRQ;
+	res[0].name = "irq";
+
+	ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
+	if (ret) {
+		wl1271_error("can't add resources");
+		goto out_dev_put;
+	}
+
+	ret = platform_device_add_data(glue->core, pdata, sizeof(*pdata));
+	if (ret) {
+		wl1271_error("can't add platform data");
+		goto out_dev_put;
+	}
+
+	ret = platform_device_add(glue->core);
+	if (ret) {
+		wl1271_error("can't register platform device");
+		goto out_dev_put;
+	}
+
 	return 0;
 
+out_dev_put:
+	platform_device_put(glue->core);
+
+out_unreg_hw:
+	wl1271_unregister_hw(wl);
+
 out_irq:
 	free_irq(wl->irq, wl);
 
@@ -480,6 +522,8 @@ static int __devexit wl1271_remove(struct spi_device *spi)
 	wl1271_unregister_hw(wl);
 	free_irq(wl->irq, wl);
 	wl1271_free_hw(wl);
+	platform_device_del(glue->core);
+	platform_device_put(glue->core);
 	kfree(glue);
 
 	return 0;
-- 
1.7.1


^ permalink raw reply related

* [PATCH 3/8] wl12xx: add a platform device to the sdio module
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
  To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>

From: Felipe Balbi <balbi@ti.com>

The platform device will be used to match the platform driver that
will be implemented by the core module.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported, cleaned-up and rephrased commit message]
[call platform_device_add() instead of platform_device_register()]
[store alloc'ed device platform directly in glue->core]
[fixed the length of memset(res...)]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/sdio.c |   44 ++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index c3ddaa6..500704f 100644
--- a/drivers/net/wireless/wl12xx/sdio.c
+++ b/drivers/net/wireless/wl12xx/sdio.c
@@ -24,6 +24,7 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/vmalloc.h>
+#include <linux/platform_device.h>
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/card.h>
@@ -47,6 +48,7 @@
 struct wl12xx_sdio_glue {
 	struct device *dev;
 	struct wl1271 *wl;
+	struct platform_device *core;
 };
 
 static const struct sdio_device_id wl1271_devices[] __devinitconst = {
@@ -234,6 +236,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 	const struct wl12xx_platform_data *wlan_data;
 	struct wl1271 *wl;
 	struct wl12xx_sdio_glue *glue;
+	struct resource res[1];
 	unsigned long irqflags;
 	mmc_pm_flag_t mmcflags;
 	int ret = -ENOMEM;
@@ -321,8 +324,47 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 	/* Tell PM core that we don't need the card to be powered now */
 	pm_runtime_put_noidle(&func->dev);
 
+	glue->core = platform_device_alloc("wl12xx-sdio", -1);
+	if (!glue->core) {
+		wl1271_error("can't allocate platform_device");
+		ret = -ENOMEM;
+		goto out_unreg_hw;
+	}
+
+	glue->core->dev.parent = &func->dev;
+
+	memset(res, 0x00, sizeof(res));
+
+	res[0].start = wlan_data->irq;
+	res[0].flags = IORESOURCE_IRQ;
+	res[0].name = "irq";
+
+	ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
+	if (ret) {
+		wl1271_error("can't add resources");
+		goto out_dev_put;
+	}
+
+	ret = platform_device_add_data(glue->core, wlan_data,
+				       sizeof(*wlan_data));
+	if (ret) {
+		wl1271_error("can't add platform data");
+		goto out_dev_put;
+	}
+
+	ret = platform_device_add(glue->core);
+	if (ret) {
+		wl1271_error("can't add platform device");
+		goto out_dev_put;
+	}
 	return 0;
 
+out_dev_put:
+	platform_device_put(glue->core);
+
+out_unreg_hw:
+	wl1271_unregister_hw(wl);
+
 out_irq:
 	free_irq(wl->irq, wl);
 
@@ -350,6 +392,8 @@ static void __devexit wl1271_remove(struct sdio_func *func)
 	}
 	free_irq(wl->irq, wl);
 	wl1271_free_hw(wl);
+	platform_device_del(glue->core);
+	platform_device_put(glue->core);
 	kfree(glue);
 }
 
-- 
1.7.1


^ permalink raw reply related

* [PATCH 2/8] wl12xx: add an spi glue struct to keep wl and device side-by-side
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
  To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>

From: Felipe Balbi <balbi@ti.com>

In order to fully abstract the bus, we need to save the device
structure *beside* wl1271, instead of inside it.

This will help re-structuring the driver so that we avoid the
duplicated code in the bus modules.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported and cleaned up and rephrased commit message]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/spi.c |   67 ++++++++++++++++++++++++++-----------
 1 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index 0f97186..16f0c71 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -69,14 +69,19 @@
 
 #define WSPI_MAX_NUM_OF_CHUNKS (WL1271_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE)
 
-static inline struct spi_device *wl_to_spi(struct wl1271 *wl)
+struct wl12xx_spi_glue {
+	struct device *dev;
+	struct wl1271 *wl;
+};
+
+static inline struct wl12xx_spi_glue *wl_to_glue(struct wl1271 *wl)
 {
 	return wl->if_priv;
 }
 
 static struct device *wl1271_spi_wl_to_dev(struct wl1271 *wl)
 {
-	return &(wl_to_spi(wl)->dev);
+	return wl_to_glue(wl)->dev;
 }
 
 static void wl1271_spi_disable_interrupts(struct wl1271 *wl)
@@ -91,6 +96,7 @@ static void wl1271_spi_enable_interrupts(struct wl1271 *wl)
 
 static void wl1271_spi_reset(struct wl1271 *wl)
 {
+	struct wl12xx_spi_glue *glue = wl_to_glue(wl);
 	u8 *cmd;
 	struct spi_transfer t;
 	struct spi_message m;
@@ -110,7 +116,7 @@ static void wl1271_spi_reset(struct wl1271 *wl)
 	t.len = WSPI_INIT_CMD_LEN;
 	spi_message_add_tail(&t, &m);
 
-	spi_sync(wl_to_spi(wl), &m);
+	spi_sync(to_spi_device(glue->dev), &m);
 
 	wl1271_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
 	kfree(cmd);
@@ -118,6 +124,7 @@ static void wl1271_spi_reset(struct wl1271 *wl)
 
 static void wl1271_spi_init(struct wl1271 *wl)
 {
+	struct wl12xx_spi_glue *glue = wl_to_glue(wl);
 	u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd;
 	struct spi_transfer t;
 	struct spi_message m;
@@ -165,7 +172,7 @@ static void wl1271_spi_init(struct wl1271 *wl)
 	t.len = WSPI_INIT_CMD_LEN;
 	spi_message_add_tail(&t, &m);
 
-	spi_sync(wl_to_spi(wl), &m);
+	spi_sync(to_spi_device(glue->dev), &m);
 	wl1271_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN);
 	kfree(cmd);
 }
@@ -174,6 +181,7 @@ static void wl1271_spi_init(struct wl1271 *wl)
 
 static int wl1271_spi_read_busy(struct wl1271 *wl)
 {
+	struct wl12xx_spi_glue *glue = wl_to_glue(wl);
 	struct spi_transfer t[1];
 	struct spi_message m;
 	u32 *busy_buf;
@@ -194,7 +202,7 @@ static int wl1271_spi_read_busy(struct wl1271 *wl)
 		t[0].len = sizeof(u32);
 		t[0].cs_change = true;
 		spi_message_add_tail(&t[0], &m);
-		spi_sync(wl_to_spi(wl), &m);
+		spi_sync(to_spi_device(glue->dev), &m);
 
 		if (*busy_buf & 0x1)
 			return 0;
@@ -208,6 +216,7 @@ static int wl1271_spi_read_busy(struct wl1271 *wl)
 static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
 				size_t len, bool fixed)
 {
+	struct wl12xx_spi_glue *glue = wl_to_glue(wl);
 	struct spi_transfer t[2];
 	struct spi_message m;
 	u32 *busy_buf;
@@ -243,7 +252,7 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
 		t[1].cs_change = true;
 		spi_message_add_tail(&t[1], &m);
 
-		spi_sync(wl_to_spi(wl), &m);
+		spi_sync(to_spi_device(glue->dev), &m);
 
 		if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) &&
 		    wl1271_spi_read_busy(wl)) {
@@ -259,7 +268,7 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
 		t[0].cs_change = true;
 		spi_message_add_tail(&t[0], &m);
 
-		spi_sync(wl_to_spi(wl), &m);
+		spi_sync(to_spi_device(glue->dev), &m);
 
 		wl1271_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd));
 		wl1271_dump(DEBUG_SPI, "spi_read buf <- ", buf, chunk_len);
@@ -274,6 +283,7 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
 static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf,
 			  size_t len, bool fixed)
 {
+	struct wl12xx_spi_glue *glue = wl_to_glue(wl);
 	struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS];
 	struct spi_message m;
 	u32 commands[WSPI_MAX_NUM_OF_CHUNKS];
@@ -318,7 +328,7 @@ static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf,
 		cmd++;
 	}
 
-	spi_sync(wl_to_spi(wl), &m);
+	spi_sync(to_spi_device(glue->dev), &m);
 }
 
 static irqreturn_t wl1271_hardirq(int irq, void *cookie)
@@ -362,11 +372,12 @@ static struct wl1271_if_operations spi_ops = {
 
 static int __devinit wl1271_probe(struct spi_device *spi)
 {
+	struct wl12xx_spi_glue *glue;
 	struct wl12xx_platform_data *pdata;
 	struct ieee80211_hw *hw;
 	struct wl1271 *wl;
 	unsigned long irqflags;
-	int ret;
+	int ret = -ENOMEM;
 
 	pdata = spi->dev.platform_data;
 	if (!pdata) {
@@ -374,14 +385,25 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 		return -ENODEV;
 	}
 
+	glue = kzalloc(sizeof(*glue), GFP_KERNEL);
+	if (!glue) {
+		wl1271_error("can't allocate glue");
+		goto out;
+	}
+
 	hw = wl1271_alloc_hw();
-	if (IS_ERR(hw))
-		return PTR_ERR(hw);
+	if (IS_ERR(hw)) {
+		ret = PTR_ERR(hw);
+		goto out_free_glue;
+	}
 
 	wl = hw->priv;
 
-	dev_set_drvdata(&spi->dev, wl);
-	wl->if_priv = spi;
+	glue->dev = &spi->dev;
+	glue->wl = wl;
+
+	spi_set_drvdata(spi, glue);
+	wl->if_priv = glue;
 
 	wl->if_ops = &spi_ops;
 
@@ -392,14 +414,14 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 	ret = spi_setup(spi);
 	if (ret < 0) {
 		wl1271_error("spi_setup failed");
-		goto out_free;
+		goto out_free_hw;
 	}
 
 	wl->set_power = pdata->set_power;
 	if (!wl->set_power) {
 		wl1271_error("set power function missing in platform data");
 		ret = -ENODEV;
-		goto out_free;
+		goto out_free_hw;
 	}
 
 	wl->ref_clock = pdata->board_ref_clock;
@@ -415,7 +437,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 	if (wl->irq < 0) {
 		wl1271_error("irq missing in platform data");
 		ret = -ENODEV;
-		goto out_free;
+		goto out_free_hw;
 	}
 
 	ret = request_threaded_irq(wl->irq, wl1271_hardirq, wl1271_irq,
@@ -423,7 +445,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 				   DRIVER_NAME, wl);
 	if (ret < 0) {
 		wl1271_error("request_irq() failed: %d", ret);
-		goto out_free;
+		goto out_free_hw;
 	}
 
 	disable_irq(wl->irq);
@@ -438,22 +460,27 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 
 	return 0;
 
- out_irq:
+out_irq:
 	free_irq(wl->irq, wl);
 
- out_free:
+out_free_hw:
 	wl1271_free_hw(wl);
 
+out_free_glue:
+	kfree(glue);
+out:
 	return ret;
 }
 
 static int __devexit wl1271_remove(struct spi_device *spi)
 {
-	struct wl1271 *wl = dev_get_drvdata(&spi->dev);
+	struct wl12xx_spi_glue *glue = spi_get_drvdata(spi);
+	struct wl1271 *wl = glue->wl;
 
 	wl1271_unregister_hw(wl);
 	free_irq(wl->irq, wl);
 	wl1271_free_hw(wl);
+	kfree(glue);
 
 	return 0;
 }
-- 
1.7.1


^ permalink raw reply related

* [PATCH 1/8] wl12xx: add an sdio glue struct to keep wl and device side-by-side
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
  To: coelho; +Cc: linux-wireless
In-Reply-To: <1317928259-26437-1-git-send-email-coelho@ti.com>

From: Felipe Balbi <balbi@ti.com>

In order to fully abstract the bus, we need to save the device
structure *beside* wl1271, instead of inside it.

This will help re-structuring the driver so that we avoid the
duplicated code in the bus modules.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported and cleaned up and rephrased commit message]
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/sdio.c |   59 ++++++++++++++++++++++++++----------
 1 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index 516a898..c3ddaa6 100644
--- a/drivers/net/wireless/wl12xx/sdio.c
+++ b/drivers/net/wireless/wl12xx/sdio.c
@@ -44,6 +44,11 @@
 #define SDIO_DEVICE_ID_TI_WL1271	0x4076
 #endif
 
+struct wl12xx_sdio_glue {
+	struct device *dev;
+	struct wl1271 *wl;
+};
+
 static const struct sdio_device_id wl1271_devices[] __devinitconst = {
 	{ SDIO_DEVICE(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271) },
 	{}
@@ -57,14 +62,14 @@ static void wl1271_sdio_set_block_size(struct wl1271 *wl, unsigned int blksz)
 	sdio_release_host(wl->if_priv);
 }
 
-static inline struct sdio_func *wl_to_func(struct wl1271 *wl)
+static inline struct wl12xx_sdio_glue *wl_to_glue(struct wl1271 *wl)
 {
 	return wl->if_priv;
 }
 
 static struct device *wl1271_sdio_wl_to_dev(struct wl1271 *wl)
 {
-	return &(wl_to_func(wl)->dev);
+	return wl_to_glue(wl)->dev;
 }
 
 static irqreturn_t wl1271_hardirq(int irq, void *cookie)
@@ -110,7 +115,8 @@ static void wl1271_sdio_raw_read(struct wl1271 *wl, int addr, void *buf,
 				 size_t len, bool fixed)
 {
 	int ret;
-	struct sdio_func *func = wl_to_func(wl);
+	struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
+	struct sdio_func *func = dev_to_sdio_func(glue->dev);
 
 	if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
 		((u8 *)buf)[0] = sdio_f0_readb(func, addr, &ret);
@@ -135,7 +141,8 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
 				  size_t len, bool fixed)
 {
 	int ret;
-	struct sdio_func *func = wl_to_func(wl);
+	struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
+	struct sdio_func *func = dev_to_sdio_func(glue->dev);
 
 	if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
 		sdio_f0_writeb(func, ((u8 *)buf)[0], addr, &ret);
@@ -158,8 +165,9 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
 
 static int wl1271_sdio_power_on(struct wl1271 *wl)
 {
-	struct sdio_func *func = wl_to_func(wl);
 	int ret;
+	struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
+	struct sdio_func *func = dev_to_sdio_func(glue->dev);
 
 	/* If enabled, tell runtime PM not to power off the card */
 	if (pm_runtime_enabled(&func->dev)) {
@@ -182,8 +190,9 @@ out:
 
 static int wl1271_sdio_power_off(struct wl1271 *wl)
 {
-	struct sdio_func *func = wl_to_func(wl);
 	int ret;
+	struct wl12xx_sdio_glue *glue = wl_to_glue(wl);
+	struct sdio_func *func = dev_to_sdio_func(glue->dev);
 
 	sdio_disable_func(func);
 	sdio_release_host(func);
@@ -224,21 +233,34 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 	struct ieee80211_hw *hw;
 	const struct wl12xx_platform_data *wlan_data;
 	struct wl1271 *wl;
+	struct wl12xx_sdio_glue *glue;
 	unsigned long irqflags;
 	mmc_pm_flag_t mmcflags;
-	int ret;
+	int ret = -ENOMEM;
 
 	/* We are only able to handle the wlan function */
 	if (func->num != 0x02)
 		return -ENODEV;
 
+	glue = kzalloc(sizeof(*glue), GFP_KERNEL);
+	if (!glue) {
+		wl1271_error("can't allocate glue");
+		goto out;
+	}
+
 	hw = wl1271_alloc_hw();
-	if (IS_ERR(hw))
-		return PTR_ERR(hw);
+	if (IS_ERR(hw)) {
+		wl1271_error("can't allocate hw");
+		ret = PTR_ERR(hw);
+		goto out_free_glue;
+	}
 
 	wl = hw->priv;
 
-	wl->if_priv = func;
+	glue->dev = &func->dev;
+	glue->wl = wl;
+
+	wl->if_priv = glue;
 	wl->if_ops = &sdio_ops;
 
 	/* Grab access to FN0 for ELP reg. */
@@ -251,7 +273,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 	if (IS_ERR(wlan_data)) {
 		ret = PTR_ERR(wlan_data);
 		wl1271_error("missing wlan platform data: %d", ret);
-		goto out_free;
+		goto out_free_hw;
 	}
 
 	wl->irq = wlan_data->irq;
@@ -269,7 +291,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 				   DRIVER_NAME, wl);
 	if (ret < 0) {
 		wl1271_error("request_irq() failed: %d", ret);
-		goto out_free;
+		goto out_free_hw;
 	}
 
 	ret = enable_irq_wake(wl->irq);
@@ -294,25 +316,29 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 	if (ret)
 		goto out_irq;
 
-	sdio_set_drvdata(func, wl);
+	sdio_set_drvdata(func, glue);
 
 	/* Tell PM core that we don't need the card to be powered now */
 	pm_runtime_put_noidle(&func->dev);
 
 	return 0;
 
- out_irq:
+out_irq:
 	free_irq(wl->irq, wl);
 
- out_free:
+out_free_hw:
 	wl1271_free_hw(wl);
 
+out_free_glue:
+	kfree(glue);
+out:
 	return ret;
 }
 
 static void __devexit wl1271_remove(struct sdio_func *func)
 {
-	struct wl1271 *wl = sdio_get_drvdata(func);
+	struct wl12xx_sdio_glue *glue= sdio_get_drvdata(func);
+	struct wl1271 *wl = glue->wl;
 
 	/* Undo decrement done above in wl1271_probe */
 	pm_runtime_get_noresume(&func->dev);
@@ -324,6 +350,7 @@ static void __devexit wl1271_remove(struct sdio_func *func)
 	}
 	free_irq(wl->irq, wl);
 	wl1271_free_hw(wl);
+	kfree(glue);
 }
 
 #ifdef CONFIG_PM
-- 
1.7.1


^ permalink raw reply related

* [PATCH 0/8] wl12xx: forward ported Balbi's bus driver refactor
From: Luciano Coelho @ 2011-10-06 19:10 UTC (permalink / raw)
  To: coelho; +Cc: linux-wireless

Hi,

Felipe sent this series of patches a long time ago with very good
suggestion on how to avoid the duplicate code we have in the sdio and
spi drivers.

With this, we create a platform device that is handled by a platform
driver.  The bus-specific module, creates a platform device and the
core module implements the driver that supports both platform devices
(namely "wl12xx-sdio" and "wl12xx-spi").

I didn't apply this earlier because I had concerns about the change in
the platform data, but now I'm convinced it's not a real problem.  It
may affect compat-wireless, but it's easy to solve.

I have now forward-ported the patches, fixed some bugs, removed some
style changes and moved some other things around.  For the changes I
made, see the commit message of each patch.  Some changes are not in
the commit message, but are explained in the patch emails, after the
Signed-off-by area.

I'm keeping Felipe as the author, since most of the work is his.  I
have just tested and fixed it up.

Cheers,
Luca.

Felipe Balbi (8):
  wl12xx: add an sdio glue struct to keep wl and device side-by-side
  wl12xx: add an spi glue struct to keep wl and device side-by-side
  wl12xx: add a platform device to the sdio module
  wl12xx: add a platform device to the spi module
  wl12xx: add platform driver to the core module
  wl12xx: move common init code from bus modules to main
  wl12xx: mark some symbols static
  wl12xx: drop unneeded plat_dev

 drivers/net/wireless/wl12xx/io.c                   |   11 +-
 drivers/net/wireless/wl12xx/io.h                   |   23 +--
 drivers/net/wireless/wl12xx/main.c                 |  271 +++++++++++++-------
 drivers/net/wireless/wl12xx/sdio.c                 |  217 +++++++----------
 drivers/net/wireless/wl12xx/spi.c                  |  194 ++++++---------
 drivers/net/wireless/wl12xx/wl12xx.h               |   18 +-
 drivers/net/wireless/wl12xx/wl12xx_platform_data.c |    4 +-
 include/linux/wl12xx.h                             |    5 +-
 8 files changed, 370 insertions(+), 373 deletions(-)


^ permalink raw reply

* Compat-wireless release for 2011-10-06 is baked
From: Compat-wireless cronjob account @ 2011-10-06 19:04 UTC (permalink / raw)
  To: linux-wireless

>From git://github.com/mcgrof/compat-wireless
   2309ddb..e4f1a17  master     -> origin/master
>From git://github.com/mcgrof/compat
   966e847..b5edac3  master     -> origin/master
>From git://github.com/sfrothwell/linux-next
 + a2851f2...98b3e8f akpm-end   -> origin/akpm-end  (forced update)
   a8062e4..538d288  akpm-start -> origin/akpm-start
 + 09d70e2...40a33ae master     -> origin/master  (forced update)
   a8062e4..538d288  stable     -> origin/stable
 * [new tag]         next-20111006 -> next-20111006
>From git://github.com/sfrothwell/linux-next
 * [new tag]         v3.1-rc9   -> v3.1-rc9

compat-wireless code metrics

    811845 - Total upstream lines of code being pulled
      2413 - backport code changes
      2097 - backport code additions
       316 - backport code deletions
      8588 - backport from compat module
     11001 - total backport code
    1.3551 - % of code consists of backport work
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(601) [sender=3.0.7]

^ permalink raw reply

* Re: [ath9k-devel] [RFC 5/6] ath9k: enable DFS pulse detection
From: Luis R. Rodriguez @ 2011-10-06 18:41 UTC (permalink / raw)
  To: Christian Lamparter; +Cc: kgiori, ath9k-devel, linux-wireless, Zefir Kurtisi
In-Reply-To: <CAB=NE6WbMi2GYJyFfvsdH-NSXn8dPBsgxgfdGXO_RHiJxwz2Fw@mail.gmail.com>

On Thu, Oct 6, 2011 at 11:36 AM, Luis R. Rodriguez
<rodrigue@qca.qualcomm.com> wrote:
> On Thu, Oct 6, 2011 at 9:49 AM, Christian Lamparter
> <chunkeey@googlemail.com> wrote:

>> Is this something about politics/laws I don't know about [I'm just
>> curious, because I don't really buy "testing" here, since Zefir
>> obviously has a working prototype
>
> No, we haven't passed certified testing with this code yet.

And to be clear, no there is no political issues here or concerns. The
law however is strict about DFS, extremely strict and I want to make
sure upstream code respect it well and we get the best DFS test
infrastructure out there to test this to ensure we get to the point to
always have DFS properly working upstream.

  Luis

^ permalink raw reply

* Re: [ath9k-devel] [RFC 5/6] ath9k: enable DFS pulse detection
From: Luis R. Rodriguez @ 2011-10-06 18:36 UTC (permalink / raw)
  To: Christian Lamparter; +Cc: kgiori, ath9k-devel, linux-wireless, Zefir Kurtisi
In-Reply-To: <201110061849.48838.chunkeey@googlemail.com>

On Thu, Oct 6, 2011 at 9:49 AM, Christian Lamparter
<chunkeey@googlemail.com> wrote:
> On Thursday, October 06, 2011 12:27:03 AM Luis R. Rodriguez wrote:
>> You do have a good point, but I disagree that you do not need to test
>> / regress test hardware / driver code for DFS.
>
> Actually, you are sort of contradicting yourself here.
>
> Take a look at your "wireless: add DFS master support" patch
> series. I don't see any IFDEFs to select between the old
> and the new "way" even though you know full well that there's
> some black magic going on.

Well its true, but the regdb and CRDA stuff is can have the DFS master
region support, its just the mapping, not a technical implementation.
IMHO DFS support should be a kconfig on both the 802.11 stack and
driver part, and the driver part depend on the 802.11 stack option.

> http://permalink.gmane.org/gmane.linux.kernel.wireless.general/78455
> Quote:
> "Here's a puzzle though... If we change this series to use the other
> pad byte that was available, the first pad byte, instead of the last
> one, we loose backward compatibility support and I cannot figure out
> why."

That's an implementation weirdness with python pack on generating the
binary output, not a DFS issue per se.

> [Note: This is just an recent enough example. I do think I could come
> up with a better one, e.g.: why didn't athXk have a compile-time
> switch to disable ANI when it was introduced because it can(and has?)
> caused some regressions as well?]

No ANI is *required*, without it the cards are useless. ANI is also
properly tested and validated by our systems team. Have you tried
disabling ANI? When we introduced a revamp of the new ANI though we
did enable users to use the new ANI for older generation cards, the
module parameter is still there.

DFS is a different beast. Testing DFS cannot be compared to testing
ANI, DFS has a slew of different tests you need to run against, and
then *if* you do want to sell cards in certain geographies with
support for DFS channels you need to get proper regulatory
certification for an intended radiator that supports DFS properly. If
you get this certification technically you cannot even expose a knob
to users to disable DFS when operating on a DFS channel.

> so, why do you want a useless compile-time for *this option* *now*?

What I want to do is enable an option which lets distributors disable
DFS if they don't want to even deal with the question of whether or
not a card had DFS support enabled through driver support.

> Is this something about politics/laws I don't know about [I'm just
> curious, because I don't really buy "testing" here, since Zefir
> obviously has a working prototype

No, we haven't passed certified testing with this code yet.

> and Atheros has a working and certificated codebase as well

Exactly, and that is the code we are enabling Neratec with to be able
to upstream into the kernel for, but the code being referenced uses a
different 802.11 stack, different base driver, etc.

> which he can access and base his work on. So I don't think its that unstable and needs added
> ugliness.]

Its the same with 802.11s, its new code and people may want to disable
this crap to not deal with it in code path or even consider the
support for it.

>> This is what I'm talking about. But yes, userspace also submits
>> itself to the same criteria.
>> >> You may also want to simply disable DFS if you do not want to
>> >> deal with the regulatory test implications of having it enabled.
>> > AFAIK you can't "simply" disable the DFS requirement: hostapd
>> > (hw_features.c), [cfg80211] (checks if tx on secondary channel
>> > is possible) and mac80211 (tx.c) all have checks. Indeed, the
>> > easiest way is to modify crda's database. So there's no need
>> > for an extra compile-time option.
>>
>> No, DFS is set for certain channels on wireless-regdb/CRDA, I just
>> posted DFS master region support for wireless-regdb and CRDA. Apart
>> from this we then need driver support. To get DFS you need all of
>> these + hostapd part. Each one has its own set of components and does
>> deserve its own set of tests and review.
>
> This "deserve its own set of tests and review". Does it translate in:
> "ath9k [every driver], mac80211, cfg80211 and hostapd need extra
> DFS IFDEFS?".

I still have yet to see patches for cfg80211 / mac80211 for DFS. What
I'm saying is we have an kconfig option on the 802.11 stack to  allow
us to disable DFS support, and the driver respective component depend
on it.

> In fact, ifdefs make it harder to do reviews, because
> sometimes you just forget the IFDEF/ELSIF/ELSE context of the code.

I hate ifdefs, and if you read my e-mail carefully what I was
suggesting was to do this properly by building all the code if the
kconfig option is enabled therefore eliminating all ifdef junk from
the code and only leaving it for header files.

> And regression testing can be done by "git bisect". In fact, isn't
> this what git bisect is for?

There is a difference between regression testing and finding the
culprit of an issue. git bisect is used to find the culprit of an
issue. However if you want to ensure code does not regress you need to
ensure to run a suite of tests on code after a delta is applied. Only
if you find an issue do you then use git bisect.

I want proper test infrastructure set up before I even consider
enabling any DFS code upstream for ath9k.

  Luis

^ permalink raw reply

* Re: [PATCH v3] move brcm80211 drivers to mainline
From: Greg KH @ 2011-10-06 18:18 UTC (permalink / raw)
  To: John W. Linville
  Cc: Arend van Spriel, linux-wireless@vger.kernel.org,
	devel@linuxdriverproject.org, Brett Rudley, Franky (Zhenhui) Lin,
	Roland Vossen, Alwin Beukers
In-Reply-To: <20111005142402.GC17286@tuxdriver.com>

On Wed, Oct 05, 2011 at 10:24:03AM -0400, John W. Linville wrote:
> On Wed, Oct 05, 2011 at 04:08:47PM +0200, Arend van Spriel wrote:
> > With number of cleanup patch series merged in by Greg KH, I'd like to
> > once again propose moving brcm80211 out of staging and into mainline.
> > 
> > I've put together a patch to add a copy of the current sources from
> > staging-next into drivers/net/wireless/brcm80211 of the wireless-next
> > repository.
> > 
> > The patch is somewhat large, so I've posted the patch at:
> > 
> > http://linuxwireless.org/en/users/Drivers/brcm80211?action=AttachFile&do=view&target=0001-net-wireless-add-brcm80211-drivers-v3.patch
> 
> Feel free to complain, but I plan to merge this in time for the merge
> window unless someone identifies a true "showstopper" problem with
> this patch in the next day or so.

I have no objection to this, feel free to add:
	Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
to the merge patch.

greg k-h

^ permalink raw reply

* Re: [PATCH] compat-wireless: make patches apply again
From: Luis R. Rodriguez @ 2011-10-06 17:13 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-wireless
In-Reply-To: <1317919980-30865-1-git-send-email-hauke@hauke-m.de>

On Thu, Oct 6, 2011 at 9:53 AM, Hauke Mehrtens <hauke@hauke-m.de> wrote:
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Applied, and pushed, thanks!

   Luis

^ permalink raw reply

* [PATCH] compat-wireless: make patches apply again
From: Hauke Mehrtens @ 2011-10-06 16:53 UTC (permalink / raw)
  To: mcgrof, mcgrof; +Cc: linux-wireless, Hauke Mehrtens


Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 patches/35-fix-makefile-includes.patch |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/patches/35-fix-makefile-includes.patch b/patches/35-fix-makefile-includes.patch
index 17994b7..c9f8eb1 100644
--- a/patches/35-fix-makefile-includes.patch
+++ b/patches/35-fix-makefile-includes.patch
@@ -20,8 +20,8 @@ path the make process will search in the kernel tree for the headers.
 +ccflags-y += -I$(obj)/..
 --- a/drivers/staging/brcm80211/brcmfmac/Makefile
 +++ b/drivers/staging/brcm80211/brcmfmac/Makefile
-@@ -18,8 +18,8 @@
- ccflags-$(CONFIG_BRCMDBG)	+= -DSHOW_EVENTS
+@@ -16,8 +16,8 @@
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  
  ccflags-y += \
 -	-Idrivers/staging/brcm80211/brcmfmac	\
@@ -33,10 +33,10 @@ path the make process will search in the kernel tree for the headers.
  	wl_cfg80211.o \
 --- a/drivers/staging/brcm80211/brcmsmac/Makefile
 +++ b/drivers/staging/brcm80211/brcmsmac/Makefile
-@@ -16,9 +16,9 @@
- # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+@@ -17,9 +17,9 @@
  
- ccflags-y :=				\
+ ccflags-y := \
+ 	-D__CHECK_ENDIAN__ \
 -	-Idrivers/staging/brcm80211/brcmsmac \
 -	-Idrivers/staging/brcm80211/brcmsmac/phy \
 -	-Idrivers/staging/brcm80211/include
-- 
1.7.4.1


^ permalink raw reply related

* Re: [ath9k-devel] [RFC 5/6] ath9k: enable DFS pulse detection
From: Christian Lamparter @ 2011-10-06 16:49 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: kgiori, ath9k-devel, linux-wireless, Zefir Kurtisi
In-Reply-To: <CAB=NE6VC3txpDh4SdDKDxKWKKZVtGQXKVH8opszKDnZeeZTjUQ@mail.gmail.com>

On Thursday, October 06, 2011 12:27:03 AM Luis R. Rodriguez wrote:
> On Tue, Oct 4, 2011 at 6:38 AM, Christian Lamparter
> <chunkeey@googlemail.com> wrote:
> > On Monday, October 03, 2011 09:31:12 PM Luis R. Rodriguez wrote:
> >> On Mon, Oct 3, 2011 at 12:24 PM, Christian Lamparter
> >> <chunkeey@googlemail.com> wrote:
> >> > On Monday, October 03, 2011 08:27:39 PM Luis R. Rodriguez wrote:
> >> >> On Mon, Oct 3, 2011 at 3:29 AM, Zefir Kurtisi <zefir.kurtisi@neratec.com> wrote:
> >> >> >
> >> >> > Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
> >> >> > ---
> >> >> >  drivers/net/wireless/ath/ath9k/main.c |   12 ++++++++++++
> >> >> >  1 files changed, 12 insertions(+), 0 deletions(-)
> >> >> >
> >> >> > diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
> >> >> > index e8aeb98..5defebe 100644
> >> >> > --- a/drivers/net/wireless/ath/ath9k/main.c
> >> >> > +++ b/drivers/net/wireless/ath/ath9k/main.c
> >> >> > [...]
> >> >> > +#ifdef CONFIG_ATH9K_DFS
> >> >>
> >> >> Please spare the #ifdef and just call something within dfs.c, then
> >> >> dfs.h would wrap it to nothing if DFS is disabled.
> >> > Why would anyone want to disable DFS driver support?
> >> > I would say: drop the ifdefs altogether since DFS
> >> > is and will be "required".
> >>
> >> Because DFS requires to be properly tested before being enabled.
> > Testing if a driver detects a pulse is "trivial" compared to the
> > stuff mac80211/cfg80211 and hostapd will have to do to make a
> > channel-change as smooth as possible. I think if there's a DFS
> > "OFF" switch, it should be in hostapd and I hope more people
> > agree on this one.
> 
> You do have a good point, but I disagree that you do not need to test
> / regress test hardware / driver code for DFS.

Actually, you are sort of contradicting yourself here.

Take a look at your "wireless: add DFS master support" patch
series. I don't see any IFDEFs to select between the old
and the new "way" even though you know full well that there's
some black magic going on.

http://permalink.gmane.org/gmane.linux.kernel.wireless.general/78455
Quote:
"Here's a puzzle though... If we change this series to use the other
pad byte that was available, the first pad byte, instead of the last
one, we loose backward compatibility support and I cannot figure out
why."

[Note: This is just an recent enough example. I do think I could come
up with a better one, e.g.: why didn't athXk have a compile-time
switch to disable ANI when it was introduced because it can(and has?)
caused some regressions as well?]

so, why do you want a useless compile-time for *this option* *now*?
Is this something about politics/laws I don't know about [I'm just
curious, because I don't really buy "testing" here, since Zefir
obviously has a working prototype and Atheros has a working and
certificated codebase as well which he can access and base his
work on. So I don't think its that unstable and needs added
ugliness.]
> This is what I'm talking about. But yes, userspace also submits
> itself to the same criteria.
> >> You may also want to simply disable DFS if you do not want to
> >> deal with the regulatory test implications of having it enabled.
> > AFAIK you can't "simply" disable the DFS requirement: hostapd
> > (hw_features.c), [cfg80211] (checks if tx on secondary channel
> > is possible) and mac80211 (tx.c) all have checks. Indeed, the
> > easiest way is to modify crda's database. So there's no need
> > for an extra compile-time option.
> 
> No, DFS is set for certain channels on wireless-regdb/CRDA, I just
> posted DFS master region support for wireless-regdb and CRDA. Apart
> from this we then need driver support. To get DFS you need all of
> these + hostapd part. Each one has its own set of components and does
> deserve its own set of tests and review.
This "deserve its own set of tests and review". Does it translate in:
"ath9k [every driver], mac80211, cfg80211 and hostapd need extra
DFS IFDEFS?". In fact, ifdefs make it harder to do reviews, because
sometimes you just forget the IFDEF/ELSIF/ELSE context of the code.
And regression testing can be done by "git bisect". In fact, isn't
this what git bisect is for?

Regards,
	Chr

^ permalink raw reply

* Re: [PATCH] compat: make driver-select only select complete lines
From: Luis R. Rodriguez @ 2011-10-06 15:13 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1317892545.3945.2.camel@jlt3.sipsolutions.net>

On Thu, Oct 6, 2011 at 2:15 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Otherwise we end up enabling CONFIG_FOOBAR if
> only CONFIG_FOO is requested.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Thanks, applied and pushed!

  Luis

^ permalink raw reply

* Re: [PATCH] compat: fix warning in alloc_netdev_mqs
From: Luis R. Rodriguez @ 2011-10-06 15:12 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1317890726.3945.0.camel@jlt3.sipsolutions.net>

On Thu, Oct 6, 2011 at 1:45 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Depending on the arguments to alloc_netdev_mqs(),
> it may give a warning due to the use of max().
> Fix the warning with max_t().
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Thanks, applied and pushed!

  Luis

^ permalink raw reply

* Re: Carl9170 firmware source code /w kernel.org down
From: Christian Lamparter @ 2011-10-06 14:43 UTC (permalink / raw)
  To: tmail133; +Cc: linux-wireless
In-Reply-To: <3b4ddb232a2c884c0d83ee5fe1754932.squirrel@mail.errtech.com>

On Wednesday, October 05, 2011 03:11:08 AM chris wrote:
> How can I get the source code for the Carl9170 firmware
> and drive with kernel.org being down?
Sure, but why the sudden interest?

http://www.sendspace.com/file/cvg2gv [~132 kb]
[This is a snapshot from the latest HEAD, if you
want a specific release just let me know].
> The wiki says:
> 
> You can get the firmware source code from
> http://git.kernel.org/?p=linux/kernel/git/chr/carl9170fw.git.
The kernel.org git is still unavailable and will be for
some time:
https://www.linuxfoundation.org/news-media/blogs/browse/2011/08/cracking-kernelorg

Regards,
	Chr

^ permalink raw reply

* RE: [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c
From: Arend Van Spriel @ 2011-10-06 14:15 UTC (permalink / raw)
  To: gregkh@suse.de
  Cc: devel@linuxdriverproject.org, linux-wireless@vger.kernel.org
In-Reply-To: <1317820814-7083-2-git-send-email-arend@broadcom.com>

> From: Arend van Spriel [mailto:arend@broadcom.com]
> Sent: woensdag 5 oktober 2011 15:20
> 
> The driver uses variables which are stored in string format. Using
> strings as variable identifiers is disliked by the community. The
> driver has been cleaned up and the only module providing these
> variables is srom.c. The variable retrieval functions have been
> moved to srom.c in preparation of a more likable way to store and
> lookup these driver variables.
> 
> Reported-by: Johannes Berg <johannes@sipsolutions.net>
> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
> Reviewed-by: Alwin Beukers <alwin@broadcom.com>
> Reviewed-by: Roland Vossen <rvossen@broadcom.com>
> Signed-off-by: Arend van Spriel <arend@broadcom.com>

Well, Greg

And there is the original patch coming out of some hole. Please discard this one.

Gr. AvS



^ permalink raw reply

* [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c
From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
In-Reply-To: <1317820814-7083-1-git-send-email-arend@broadcom.com>

The driver uses variables which are stored in string format. Using
strings as variable identifiers is disliked by the community. The
driver has been cleaned up and the only module providing these
variables is srom.c. The variable retrieval functions have been
moved to srom.c in preparation of a more likable way to store and
lookup these driver variables.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c |   44 -----------------------------
 drivers/staging/brcm80211/brcmsmac/srom.c |   44 +++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 9fa8485..100e6ec 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -8881,47 +8881,3 @@ void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc)
 	wlc->mpc = mpc;
 	brcms_c_radio_mpc_upd(wlc);
 }
-
-/*
- * Search the name=value vars for a specific one and return its value.
- * Returns NULL if not found.
- */
-char *getvar(char *vars, const char *name)
-{
-	char *s;
-	int len;
-
-	if (!name)
-		return NULL;
-
-	len = strlen(name);
-	if (len == 0)
-		return NULL;
-
-	/* first look in vars[] */
-	for (s = vars; s && *s;) {
-		if ((memcmp(s, name, len) == 0) && (s[len] == '='))
-			return &s[len + 1];
-
-		while (*s++)
-			;
-	}
-	/* nothing found */
-	return NULL;
-}
-
-/*
- * Search the vars for a specific one and return its value as
- * an integer. Returns 0 if not found.
- */
-int getintvar(char *vars, const char *name)
-{
-	char *val;
-	unsigned long res;
-
-	val = getvar(vars, name);
-	if (val && !kstrtoul(val, 0, &res))
-		return res;
-
-	return 0;
-}
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index 13d17eb..02dbd98 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -1242,3 +1242,47 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars,
 
 	return -EINVAL;
 }
+
+/*
+ * Search the name=value vars for a specific one and return its value.
+ * Returns NULL if not found.
+ */
+char *getvar(char *vars, const char *name)
+{
+	char *s;
+	int len;
+
+	if (!name)
+		return NULL;
+
+	len = strlen(name);
+	if (len == 0)
+		return NULL;
+
+	/* first look in vars[] */
+	for (s = vars; s && *s;) {
+		if ((memcmp(s, name, len) == 0) && (s[len] == '='))
+			return &s[len + 1];
+
+		while (*s++)
+			;
+	}
+	/* nothing found */
+	return NULL;
+}
+
+/*
+ * Search the vars for a specific one and return its value as
+ * an integer. Returns 0 if not found.
+ */
+int getintvar(char *vars, const char *name)
+{
+	char *val;
+	unsigned long res;
+
+	val = getvar(vars, name);
+	if (val && !kstrtoul(val, 0, &res))
+		return res;
+
+	return 0;
+}
-- 
1.7.4.1



^ permalink raw reply related

* Re: [PATCH 00/29] wl12xx: start preparing the driver for multi-vif support
From: Luciano Coelho @ 2011-10-06 13:18 UTC (permalink / raw)
  To: Eliad Peller; +Cc: linux-wireless
In-Reply-To: <1317808566-18857-1-git-send-email-eliad@wizery.com>

On Wed, 2011-10-05 at 11:55 +0200, Eliad Peller wrote: 
> The wl12xx fw currently supports only a single vif at a time.
> Upcoming fw versions are going to support concurrentl vifs.
> 
> While mac80211 works well with multiple vifs, the wl12xx
> driver assumes it handles only a single interface.
> 
> This is the first patchset in order to make the driver ready
> for multiple vifs support. The main action here is defining
> a new per-interface data struct (wlvif), and moving the
> currently-global fields into it.
> 
> (Additional global fields/flags will be addressed by further patchsets)
> 
> Note that this patchset only adds functionality - it doesn't
> break compatability with the current fw.

Applied the series.  Thanks for the patchbomb! :P


-- 
Cheers,
Luca.


^ permalink raw reply

* Re: [PATCH] wl12xx: configure rate policy for p2p operations
From: Luciano Coelho @ 2011-10-06 13:17 UTC (permalink / raw)
  To: Eliad Peller; +Cc: linux-wireless
In-Reply-To: <1317636396-23387-1-git-send-email-eliad@wizery.com>

On Mon, 2011-10-03 at 12:06 +0200, Eliad Peller wrote: 
> p2p packets should go out only with OFDM rates.
> 
> Configure a new rate policy that will (later) be used
> during p2p_find (when the p2p_cli / p2p_go interfaces
> are in use, we won't have to use this policy, as
> the configured rates should already be OFDM-only).
> 
> Additionally, update CONF_TX_MAX_RATE_CLASSES to reflect
> the current value from the fw api.
> 
> Signed-off-by: Eliad Peller <eliad@wizery.com>
> ---

Applied, thanks!

-- 
Cheers,
Luca.


^ permalink raw reply

* Re: [PATCH] wl12xx: Add support for HW channel switch
From: Luciano Coelho @ 2011-10-06 13:17 UTC (permalink / raw)
  To: Shahar Levi; +Cc: linux-wireless
In-Reply-To: <1315476093-27583-1-git-send-email-shahar_levi@ti.com>

On Thu, 2011-09-08 at 13:01 +0300, Shahar Levi wrote: 
> WL12xx FW supports HW channel switch mechanism.
> Add HW channel switch support via channel_switch ops.
> 
> Signed-off-by: Shahar Levi <shahar_levi@ti.com>
> ---

Applied with some modifications and a rephrased commit message.

-- 
Cheers,
Luca.


^ permalink raw reply

* Re: [PATCH] wl12xx: set max_sched_scan_ie_len correctly
From: Luciano Coelho @ 2011-10-06 13:16 UTC (permalink / raw)
  To: linux-wireless
In-Reply-To: <1317129755-14825-1-git-send-email-coelho@ti.com>

On Tue, 2011-09-27 at 16:22 +0300, Luciano Coelho wrote: 
> The wiphy max_sched_scan_ie_len attribute was not set correctly and
> remained as 0, so when IEs were being passed in a scheduled scan, we
> were returning -EINVAL.
> 
> Fix this by setting the attribute properly.
> 
> Signed-off-by: Luciano Coelho <coelho@ti.com>
> ---

Applied.

-- 
Cheers,
Luca.


^ permalink raw reply

* [PATCH] ath6kl: fix firmware start address for ar6003 hw2.0
From: Sangwook Lee @ 2011-10-06 13:12 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless

From: Kalle Valo <kvalo@qca.qualcomm.com>

Sangwook found out that commit 639d0b89 ("ath6kl: read firmware start
address from hardware") broke firmware boot on ar6003 hw2.0 as it seems
it's not posible to automatically query the address from hardware. So
we need to hardcode the address for hw2.0.

Reported-by: Sangwook Lee <sangwook.lee@linaro.org>
Tested-by: Sangwook Lee <sangwook.lee@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
Kalle:
I slightly changed again. without running ath6kl_bmi_read() before,
ath6kl_bmi_execute() failed with hw2.0 board, but I am not clear about this reason.

 drivers/net/wireless/ath/ath6kl/init.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index b277111..07a6a44 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1183,6 +1183,7 @@ static int ath6kl_upload_board_file(struct ath6kl *ar)
 static int ath6kl_upload_otp(struct ath6kl *ar)
 {
 	u32 address, param;
+	bool from_hw = false;
 	int ret;
 
 	if (WARN_ON(ar->fw_otp == NULL))
@@ -1201,25 +1202,28 @@ static int ath6kl_upload_otp(struct ath6kl *ar)
 	}
 
 	/* read firmware start address */
-	ret = ath6kl_bmi_read(ar,
-			      ath6kl_get_hi_item_addr(ar,
-						      HI_ITEM(hi_app_start)),
-			      (u8 *) &address, sizeof(address));
+	ret = ath6kl_bmi_read(ar, ath6kl_get_hi_item_addr(ar,
+		HI_ITEM(hi_app_start)), (u8 *) &address, sizeof(address));
 
 	if (ret) {
 		ath6kl_err("Failed to read hi_app_start: %d\n", ret);
 		return ret;
 	}
 
-	ar->hw.app_start_override_addr = address;
+	if (ar->hw.app_start_override_addr == 0) {
+		ar->hw.app_start_override_addr = address;
+		from_hw = true;
+	}
 
-	ath6kl_dbg(ATH6KL_DBG_BOOT, "app_start_override_addr 0x%x\n",
+	ath6kl_dbg(ATH6KL_DBG_BOOT, "app_start_override_addr%s 0x%x\n",
+		   from_hw ? " (from hw)" : "",
 		   ar->hw.app_start_override_addr);
 
 	/* execute the OTP code */
-	ath6kl_dbg(ATH6KL_DBG_BOOT, "executing OTP at 0x%x\n", address);
+	ath6kl_dbg(ATH6KL_DBG_BOOT, "executing OTP at 0x%x\n",
+		   ar->hw.app_start_override_addr);
 	param = 0;
-	ath6kl_bmi_execute(ar, address, &param);
+	ath6kl_bmi_execute(ar, ar->hw.app_start_override_addr, &param);
 
 	return ret;
 }
@@ -1421,6 +1425,10 @@ static int ath6kl_init_hw_params(struct ath6kl *ar)
 		ar->hw.app_load_addr = AR6003_REV2_APP_LOAD_ADDRESS;
 		ar->hw.board_ext_data_addr = AR6003_REV2_BOARD_EXT_DATA_ADDRESS;
 		ar->hw.reserved_ram_size = AR6003_REV2_RAM_RESERVE_SIZE;
+
+		/* hw2.0 needs override address hardcoded */
+		ar->hw.app_start_override_addr = 0x944C00;
+
 		break;
 	case AR6003_REV3_VERSION:
 		ar->hw.dataset_patch_addr = AR6003_REV3_DATASET_PATCH_ADDRESS;
-- 
1.7.4.1


^ permalink raw reply related

* [PATCH] of: include errno.h
From: Kalle Valo @ 2011-10-06 12:40 UTC (permalink / raw)
  To: grant.likely; +Cc: devicetree-discuss, linux-wireless, linux-kernel

When compiling ath6kl for beagleboard (omap2plus_defconfig plus
CONFIG_ATH6KL, CONFIG_OF disable) with current linux-next compilation
fails:

include/linux/of.h:269: error: 'ENOSYS' undeclared (first use in this function)
include/linux/of.h:276: error: 'ENOSYS' undeclared (first use in this function)
include/linux/of.h:289: error: 'ENOSYS' undeclared (first use in this function)

Fix this by including errno.h from of.h.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 include/linux/of.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index 9180dc5..219c29d 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -17,6 +17,7 @@
  */
 #include <linux/types.h>
 #include <linux/bitops.h>
+#include <linux/errno.h>
 #include <linux/kref.h>
 #include <linux/mod_devicetable.h>
 #include <linux/spinlock.h>


^ permalink raw reply related

* [PATCH] ath6kl: fix null skb dereference in ath6kl_rx()
From: Kalle Valo @ 2011-10-06 11:32 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless

smatch found that skb might be null in some cases in ath6kl_rx():

ath6kl/txrx.c +1252 ath6kl_rx(222) error: potential null derefence 'skb'.

This will happen when ath6kl is in AP mode and two clients send traffic
to each other.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/txrx.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c
index bcf7b01..a9dff01 100644
--- a/drivers/net/wireless/ath/ath6kl/txrx.c
+++ b/drivers/net/wireless/ath/ath6kl/txrx.c
@@ -1247,6 +1247,11 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
 		}
 		if (skb1)
 			ath6kl_data_tx(skb1, ar->net_dev);
+
+		if (skb == NULL) {
+			/* nothing to deliver up the stack */
+			return;
+		}
 	}
 
 	datap = (struct ethhdr *) skb->data;


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox