aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/recv.c
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-03-30 05:58:45 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:35 -0400
commit797fe5cbefdb91f796502677e3a6623262eb9fcd (patch)
tree8d9931b9853a0c5d5f516d2c10bf07d24dedb749 /drivers/net/wireless/ath9k/recv.c
parent4658b985170d9d0c88304d2d4459938b600f8c0b (diff)
ath9k: Remove the useless do..while loops
These are unnecessary constructs in a function. This patch removes these from both RX and TX init routines. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/recv.c')
-rw-r--r--drivers/net/wireless/ath9k/recv.c83
1 files changed, 39 insertions, 44 deletions
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index efa57ae8901c..b46badd21f73 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -283,54 +283,51 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
283 struct ath_buf *bf; 283 struct ath_buf *bf;
284 int error = 0; 284 int error = 0;
285 285
286 do { 286 spin_lock_init(&sc->rx.rxflushlock);
287 spin_lock_init(&sc->rx.rxflushlock); 287 sc->sc_flags &= ~SC_OP_RXFLUSH;
288 sc->sc_flags &= ~SC_OP_RXFLUSH; 288 spin_lock_init(&sc->rx.rxbuflock);
289 spin_lock_init(&sc->rx.rxbuflock);
290
291 sc->rx.bufsize = roundup(IEEE80211_MAX_MPDU_LEN,
292 min(sc->cachelsz,
293 (u16)64));
294 289
295 DPRINTF(sc, ATH_DBG_CONFIG, "cachelsz %u rxbufsize %u\n", 290 sc->rx.bufsize = roundup(IEEE80211_MAX_MPDU_LEN,
296 sc->cachelsz, sc->rx.bufsize); 291 min(sc->cachelsz, (u16)64));
297 292
298 /* Initialize rx descriptors */ 293 DPRINTF(sc, ATH_DBG_CONFIG, "cachelsz %u rxbufsize %u\n",
294 sc->cachelsz, sc->rx.bufsize);
299 295
300 error = ath_descdma_setup(sc, &sc->rx.rxdma, &sc->rx.rxbuf, 296 /* Initialize rx descriptors */
301 "rx", nbufs, 1);
302 if (error != 0) {
303 DPRINTF(sc, ATH_DBG_FATAL,
304 "failed to allocate rx descriptors: %d\n", error);
305 break;
306 }
307 297
308 list_for_each_entry(bf, &sc->rx.rxbuf, list) { 298 error = ath_descdma_setup(sc, &sc->rx.rxdma, &sc->rx.rxbuf,
309 skb = ath_rxbuf_alloc(sc, sc->rx.bufsize, GFP_KERNEL); 299 "rx", nbufs, 1);
310 if (skb == NULL) { 300 if (error != 0) {
311 error = -ENOMEM; 301 DPRINTF(sc, ATH_DBG_FATAL,
312 break; 302 "failed to allocate rx descriptors: %d\n", error);
313 } 303 goto err;
304 }
314 305
315 bf->bf_mpdu = skb; 306 list_for_each_entry(bf, &sc->rx.rxbuf, list) {
316 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, 307 skb = ath_rxbuf_alloc(sc, sc->rx.bufsize, GFP_KERNEL);
317 sc->rx.bufsize, 308 if (skb == NULL) {
318 DMA_FROM_DEVICE); 309 error = -ENOMEM;
319 if (unlikely(dma_mapping_error(sc->dev, 310 goto err;
320 bf->bf_buf_addr))) {
321 dev_kfree_skb_any(skb);
322 bf->bf_mpdu = NULL;
323 DPRINTF(sc, ATH_DBG_FATAL,
324 "dma_mapping_error() on RX init\n");
325 error = -ENOMEM;
326 break;
327 }
328 bf->bf_dmacontext = bf->bf_buf_addr;
329 } 311 }
330 sc->rx.rxlink = NULL;
331 312
332 } while (0); 313 bf->bf_mpdu = skb;
314 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
315 sc->rx.bufsize,
316 DMA_FROM_DEVICE);
317 if (unlikely(dma_mapping_error(sc->dev,
318 bf->bf_buf_addr))) {
319 dev_kfree_skb_any(skb);
320 bf->bf_mpdu = NULL;
321 DPRINTF(sc, ATH_DBG_FATAL,
322 "dma_mapping_error() on RX init\n");
323 error = -ENOMEM;
324 goto err;
325 }
326 bf->bf_dmacontext = bf->bf_buf_addr;
327 }
328 sc->rx.rxlink = NULL;
333 329
330err:
334 if (error) 331 if (error)
335 ath_rx_cleanup(sc); 332 ath_rx_cleanup(sc);
336 333
@@ -345,10 +342,8 @@ void ath_rx_cleanup(struct ath_softc *sc)
345 list_for_each_entry(bf, &sc->rx.rxbuf, list) { 342 list_for_each_entry(bf, &sc->rx.rxbuf, list) {
346 skb = bf->bf_mpdu; 343 skb = bf->bf_mpdu;
347 if (skb) { 344 if (skb) {
348 dma_unmap_single(sc->dev, 345 dma_unmap_single(sc->dev, bf->bf_buf_addr,
349 bf->bf_buf_addr, 346 sc->rx.bufsize, DMA_FROM_DEVICE);
350 sc->rx.bufsize,
351 DMA_FROM_DEVICE);
352 dev_kfree_skb(skb); 347 dev_kfree_skb(skb);
353 } 348 }
354 } 349 }