diff options
author | Kalle Valo <kalle.valo@nokia.com> | 2009-06-12 07:15:08 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 14:57:43 -0400 |
commit | 4721213fdde4456a36a5e63f02e5c2556a4df398 (patch) | |
tree | 4dd00bb4827642316e84f3a97a54f470017a826f /drivers | |
parent | 53d65423ba1bc3c38d53b27656395c632b073590 (diff) |
wl12xx: fix rx descriptor use
Rx descriptor was incorrectly allocated from stack, use struct wl12xx
instead. Needed for DMA transfers.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/rx.c | 11 | ||||
-rw-r--r-- | 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 6d27cd687672..3c6cd774192d 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) | |||
1261 | wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE; | 1261 | wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE; |
1262 | wl->tx_mgmt_frm_mod = DEFAULT_HW_GEN_MODULATION_TYPE; | 1262 | wl->tx_mgmt_frm_mod = DEFAULT_HW_GEN_MODULATION_TYPE; |
1263 | 1263 | ||
1264 | wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL); | ||
1265 | if (!wl->rx_descriptor) { | ||
1266 | wl12xx_error("could not allocate memory for rx descriptor"); | ||
1267 | ret = -ENOMEM; | ||
1268 | goto out_free; | ||
1269 | } | ||
1270 | |||
1264 | /* This is the only SPI value that we need to set here, the rest | 1271 | /* This is the only SPI value that we need to set here, the rest |
1265 | * comes from the board-peripherals file */ | 1272 | * comes from the board-peripherals file */ |
1266 | spi->bits_per_word = 32; | 1273 | spi->bits_per_word = 32; |
@@ -1313,6 +1320,9 @@ static int __devinit wl12xx_probe(struct spi_device *spi) | |||
1313 | free_irq(wl->irq, wl); | 1320 | free_irq(wl->irq, wl); |
1314 | 1321 | ||
1315 | out_free: | 1322 | out_free: |
1323 | kfree(wl->rx_descriptor); | ||
1324 | wl->rx_descriptor = NULL; | ||
1325 | |||
1316 | ieee80211_free_hw(hw); | 1326 | ieee80211_free_hw(hw); |
1317 | 1327 | ||
1318 | return ret; | 1328 | return ret; |
@@ -1333,6 +1343,10 @@ static int __devexit wl12xx_remove(struct spi_device *spi) | |||
1333 | wl->fw = NULL; | 1343 | wl->fw = NULL; |
1334 | kfree(wl->nvs); | 1344 | kfree(wl->nvs); |
1335 | wl->nvs = NULL; | 1345 | wl->nvs = NULL; |
1346 | |||
1347 | kfree(wl->rx_descriptor); | ||
1348 | wl->rx_descriptor = NULL; | ||
1349 | |||
1336 | ieee80211_free_hw(wl->hw); | 1350 | ieee80211_free_hw(wl->hw); |
1337 | 1351 | ||
1338 | return 0; | 1352 | return 0; |
diff --git a/drivers/net/wireless/wl12xx/rx.c b/drivers/net/wireless/wl12xx/rx.c index 5fd916a0b254..7ac26ef209b7 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, | |||
39 | if (wl->rx_current_buffer) | 39 | if (wl->rx_current_buffer) |
40 | rx_packet_ring_addr += wl->data_path->rx_packet_ring_chunk_size; | 40 | rx_packet_ring_addr += wl->data_path->rx_packet_ring_chunk_size; |
41 | 41 | ||
42 | wl12xx_spi_mem_read(wl, rx_packet_ring_addr, desc, | 42 | wl12xx_spi_mem_read(wl, rx_packet_ring_addr, desc, sizeof(*desc)); |
43 | sizeof(struct wl12xx_rx_descriptor)); | ||
44 | } | 43 | } |
45 | 44 | ||
46 | static void wl12xx_rx_status(struct wl12xx *wl, | 45 | static void wl12xx_rx_status(struct wl12xx *wl, |
@@ -175,16 +174,18 @@ static void wl12xx_rx_ack(struct wl12xx *wl) | |||
175 | 174 | ||
176 | void wl12xx_rx(struct wl12xx *wl) | 175 | void wl12xx_rx(struct wl12xx *wl) |
177 | { | 176 | { |
178 | struct wl12xx_rx_descriptor rx_desc; | 177 | struct wl12xx_rx_descriptor *rx_desc; |
179 | 178 | ||
180 | if (wl->state != WL12XX_STATE_ON) | 179 | if (wl->state != WL12XX_STATE_ON) |
181 | return; | 180 | return; |
182 | 181 | ||
182 | rx_desc = wl->rx_descriptor; | ||
183 | |||
183 | /* We first read the frame's header */ | 184 | /* We first read the frame's header */ |
184 | wl12xx_rx_header(wl, &rx_desc); | 185 | wl12xx_rx_header(wl, rx_desc); |
185 | 186 | ||
186 | /* Now we can read the body */ | 187 | /* Now we can read the body */ |
187 | wl12xx_rx_body(wl, &rx_desc); | 188 | wl12xx_rx_body(wl, rx_desc); |
188 | 189 | ||
189 | /* Finally, we need to ACK the RX */ | 190 | /* Finally, we need to ACK the RX */ |
190 | wl12xx_rx_ack(wl); | 191 | wl12xx_rx_ack(wl); |
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h index b81102098c7d..b87421461a7d 100644 --- a/drivers/net/wireless/wl12xx/wl12xx.h +++ b/drivers/net/wireless/wl12xx/wl12xx.h | |||
@@ -387,6 +387,7 @@ struct wl12xx { | |||
387 | u32 buffer_32; | 387 | u32 buffer_32; |
388 | u32 buffer_cmd; | 388 | u32 buffer_cmd; |
389 | u8 buffer_busyword[WL12XX_BUSY_WORD_LEN]; | 389 | u8 buffer_busyword[WL12XX_BUSY_WORD_LEN]; |
390 | struct wl12xx_rx_descriptor *rx_descriptor; | ||
390 | }; | 391 | }; |
391 | 392 | ||
392 | int wl12xx_plt_start(struct wl12xx *wl); | 393 | int wl12xx_plt_start(struct wl12xx *wl); |