linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kalle.valo@iki.fi>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 08/33] wl12xx: fix rx descriptor use
Date: Fri, 12 Jun 2009 14:15:08 +0300	[thread overview]
Message-ID: <20090612111507.8877.773.stgit@tikku> (raw)
In-Reply-To: <20090612110225.8877.92418.stgit@tikku>

From: Kalle Valo <kalle.valo@nokia.com>

Rx descriptor was incorrectly allocated from stack, use struct wl12xx
instead. Needed for DMA transfers.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---

 drivers/net/wireless/wl12xx/main.c   |   14 ++++++++++++++
 drivers/net/wireless/wl12xx/rx.c     |   11 ++++++-----
 drivers/net/wireless/wl12xx/wl12xx.h |    1 +
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 6d27cd6..3c6cd77 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1261,6 +1261,13 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
 	wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE;
 	wl->tx_mgmt_frm_mod = DEFAULT_HW_GEN_MODULATION_TYPE;
 
+	wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL);
+	if (!wl->rx_descriptor) {
+		wl12xx_error("could not allocate memory for rx descriptor");
+		ret = -ENOMEM;
+		goto out_free;
+	}
+
 	/* This is the only SPI value that we need to set here, the rest
 	 * comes from the board-peripherals file */
 	spi->bits_per_word = 32;
@@ -1313,6 +1320,9 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
 	free_irq(wl->irq, wl);
 
  out_free:
+	kfree(wl->rx_descriptor);
+	wl->rx_descriptor = NULL;
+
 	ieee80211_free_hw(hw);
 
 	return ret;
@@ -1333,6 +1343,10 @@ static int __devexit wl12xx_remove(struct spi_device *spi)
 	wl->fw = NULL;
 	kfree(wl->nvs);
 	wl->nvs = NULL;
+
+	kfree(wl->rx_descriptor);
+	wl->rx_descriptor = NULL;
+
 	ieee80211_free_hw(wl->hw);
 
 	return 0;
diff --git a/drivers/net/wireless/wl12xx/rx.c b/drivers/net/wireless/wl12xx/rx.c
index 5fd916a..7ac26ef 100644
--- a/drivers/net/wireless/wl12xx/rx.c
+++ b/drivers/net/wireless/wl12xx/rx.c
@@ -39,8 +39,7 @@ static void wl12xx_rx_header(struct wl12xx *wl,
 	if (wl->rx_current_buffer)
 		rx_packet_ring_addr += wl->data_path->rx_packet_ring_chunk_size;
 
-	wl12xx_spi_mem_read(wl, rx_packet_ring_addr, desc,
-			    sizeof(struct wl12xx_rx_descriptor));
+	wl12xx_spi_mem_read(wl, rx_packet_ring_addr, desc, sizeof(*desc));
 }
 
 static void wl12xx_rx_status(struct wl12xx *wl,
@@ -175,16 +174,18 @@ static void wl12xx_rx_ack(struct wl12xx *wl)
 
 void wl12xx_rx(struct wl12xx *wl)
 {
-	struct wl12xx_rx_descriptor rx_desc;
+	struct wl12xx_rx_descriptor *rx_desc;
 
 	if (wl->state != WL12XX_STATE_ON)
 		return;
 
+	rx_desc = wl->rx_descriptor;
+
 	/* We first read the frame's header */
-	wl12xx_rx_header(wl, &rx_desc);
+	wl12xx_rx_header(wl, rx_desc);
 
 	/* Now we can read the body */
-	wl12xx_rx_body(wl, &rx_desc);
+	wl12xx_rx_body(wl, rx_desc);
 
 	/* Finally, we need to ACK the RX */
 	wl12xx_rx_ack(wl);
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index b811020..b874214 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -387,6 +387,7 @@ struct wl12xx {
 	u32 buffer_32;
 	u32 buffer_cmd;
 	u8 buffer_busyword[WL12XX_BUSY_WORD_LEN];
+	struct wl12xx_rx_descriptor *rx_descriptor;
 };
 
 int wl12xx_plt_start(struct wl12xx *wl);


  parent reply	other threads:[~2009-06-12 11:16 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12 11:14 [PATCH 00/33] wl12xx update for 2.6.32 Kalle Valo
2009-06-12 11:14 ` [PATCH 01/33] wl12xx: cmd and acx interface rework Kalle Valo
2009-06-12 11:14 ` [PATCH 02/33] wl12xx: reserver buffer for read32()/write32() in struct wl12xx Kalle Valo
2009-06-12 11:14 ` [PATCH 03/33] wl12xx: fix error handling in wl12xx_probe() Kalle Valo
2009-06-12 11:14 ` [PATCH 04/33] wl12xx: reserve buffer for partition command in struct wl12xx Kalle Valo
2009-06-12 11:14 ` [PATCH 05/33] wl12xx: allocate buffer spi read/write command buffer kzalloc() Kalle Valo
2009-06-12 11:14 ` [PATCH 06/33] wl12xx: allocate buffer the spi busy word from struct wl12xx Kalle Valo
2009-06-12 11:15 ` [PATCH 07/33] wl12xx: use wl12xx_mem_read32() to read the rx counter Kalle Valo
2009-06-12 11:15 ` Kalle Valo [this message]
2009-06-12 11:15 ` [PATCH 09/33] wl12xx: removed chipset interrupt source configuration from fw wakeup Kalle Valo
2009-06-12 11:15 ` [PATCH 10/33] wl12xx: add wl12xx_spi_reg_read() and wl12xx_spi_reg_write() functions Kalle Valo
2009-06-12 11:15 ` [PATCH 11/33] wl12xx: moved firmware version reading routine to chip-specific functions Kalle Valo
2009-06-12 11:15 ` [PATCH 12/33] wl12xx: add support for new WL1271 chip revision Kalle Valo
2009-06-12 11:15 ` [PATCH 13/33] wl12xx: add support for fixed address in wl12xx_spi_read Kalle Valo
2009-06-12 11:15 ` [PATCH 14/33] wl12xx: pass the wake up condition when configuring the wake up event Kalle Valo
2009-06-12 11:15 ` [PATCH 15/33] wl12xx: Moved wl1251 TX path implementation into chip specific files Kalle Valo
2009-06-12 11:16 ` [PATCH 16/33] wl12xx: Add support for block reading from a fixed register address Kalle Valo
2009-06-12 11:16 ` [PATCH 17/33] wl12xx: Fix incorrect warning message Kalle Valo
2009-06-12 11:16 ` [PATCH 18/33] wl12xx: Fix CMD_TEST regression via netlink Kalle Valo
2009-06-12 11:16 ` [PATCH 19/33] wl12xx: protect wl12xx_op_set_rts_threshold() Kalle Valo
2009-06-12 11:16 ` [PATCH 20/33] wl12xx: optimise elp wakeup and sleep calls Kalle Valo
2009-06-12 11:16 ` [PATCH 21/33] wl12xx: check if elp wakeup failed Kalle Valo
2009-06-12 11:16 ` [PATCH 22/33] wl12xx: enable ELP mode Kalle Valo
2009-06-12 11:16 ` [PATCH 23/33] wl12xx: Assign value to rx msdu lifetime variable Kalle Valo
2009-06-12 11:16 ` [PATCH 24/33] wl12xx: Use chipset specific join commands Kalle Valo
2009-06-12 11:16 ` [PATCH 25/33] wl12xx: rename wl1251.c wl1251_ops.c Kalle Valo
2009-06-12 11:17 ` [PATCH 26/33] wl12xx: rename driver to wl1251 Kalle Valo
2009-06-12 11:17 ` [PATCH 27/33] wl1251: remove wl1271_setup() Kalle Valo
2009-06-12 11:17 ` [PATCH 28/33] wl1251: add wl1251 prefix to all 1251 files Kalle Valo
2009-06-12 11:17 ` [PATCH 29/33] wl1251: rename wl12xx.h to wl1251.h Kalle Valo
2009-06-12 11:17 ` [PATCH 30/33] wl12xx: remove unused wl12xx_hw_init_mem_config() Kalle Valo
2009-06-12 11:17 ` [PATCH 31/33] wl1251: use wl1251 prefix everywhere Kalle Valo
2009-06-12 11:17 ` [PATCH 32/33] wl1251: fix a checkpatch warning Kalle Valo
2009-06-12 11:17 ` [PATCH 33/33] wl1251: change psm enabled/disabled info to debug Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090612111507.8877.773.stgit@tikku \
    --to=kalle.valo@iki.fi \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).