diff options
author | Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> | 2011-07-16 10:59:13 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-08-09 12:45:19 -0400 |
commit | 18a0f93e539cd9269d604ad9de59bca49c488808 (patch) | |
tree | 738adb115fb3c70d4c2a3d4c64d6e41f2f54713c /drivers/net/wireless/ath/ath6kl | |
parent | ac2bba019b2b677882d9ea7846a1fdf7c9fd8959 (diff) |
ath6kl: Move down scatter enable and cleanup functions
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl')
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/sdio.c | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c index 797a39fb0df..9220a01915b 100644 --- a/drivers/net/wireless/ath/ath6kl/sdio.c +++ b/drivers/net/wireless/ath/ath6kl/sdio.c | |||
@@ -318,64 +318,6 @@ static int ath6kl_sdio_alloc_prep_scat_req(struct ath6kl_sdio *ar_sdio, | |||
318 | return 0; | 318 | return 0; |
319 | } | 319 | } |
320 | 320 | ||
321 | /* clean up scatter support */ | ||
322 | static void ath6kl_sdio_cleanup_scatter(struct ath6kl *ar) | ||
323 | { | ||
324 | struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); | ||
325 | struct hif_scatter_req *s_req, *tmp_req; | ||
326 | unsigned long flag; | ||
327 | |||
328 | /* empty the free list */ | ||
329 | spin_lock_irqsave(&ar_sdio->scat_lock, flag); | ||
330 | list_for_each_entry_safe(s_req, tmp_req, &ar_sdio->scat_req, list) { | ||
331 | list_del(&s_req->list); | ||
332 | spin_unlock_irqrestore(&ar_sdio->scat_lock, flag); | ||
333 | |||
334 | if (s_req->busrequest) | ||
335 | ath6kl_sdio_free_bus_req(ar_sdio, s_req->busrequest); | ||
336 | kfree(s_req->virt_dma_buf); | ||
337 | kfree(s_req->sgentries); | ||
338 | kfree(s_req); | ||
339 | |||
340 | spin_lock_irqsave(&ar_sdio->scat_lock, flag); | ||
341 | } | ||
342 | spin_unlock_irqrestore(&ar_sdio->scat_lock, flag); | ||
343 | } | ||
344 | |||
345 | /* setup of HIF scatter resources */ | ||
346 | static int ath6kl_sdio_enable_scatter(struct ath6kl *ar, | ||
347 | struct hif_dev_scat_sup_info *pinfo) | ||
348 | { | ||
349 | struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); | ||
350 | int ret = 0; | ||
351 | |||
352 | /* check if host supports scatter and it meets our requirements */ | ||
353 | if (ar_sdio->func->card->host->max_segs < MAX_SCATTER_ENTRIES_PER_REQ) { | ||
354 | ath6kl_err("hif-scatter: host only supports scatter of : %d entries, need: %d\n", | ||
355 | ar_sdio->func->card->host->max_segs, | ||
356 | MAX_SCATTER_ENTRIES_PER_REQ); | ||
357 | return -EINVAL; | ||
358 | } | ||
359 | |||
360 | ath6kl_dbg(ATH6KL_DBG_ANY, | ||
361 | "hif-scatter enabled: max scatter req : %d entries: %d\n", | ||
362 | MAX_SCATTER_REQUESTS, MAX_SCATTER_ENTRIES_PER_REQ); | ||
363 | |||
364 | ret = ath6kl_sdio_alloc_prep_scat_req(ar_sdio, | ||
365 | MAX_SCATTER_ENTRIES_PER_REQ, | ||
366 | MAX_SCATTER_REQUESTS, 0); | ||
367 | if (ret) { | ||
368 | ath6kl_err("hif-scatter: failed to alloc scatter resources !\n"); | ||
369 | ath6kl_sdio_cleanup_scatter(ar); | ||
370 | return ret; | ||
371 | } | ||
372 | |||
373 | pinfo->max_scat_entries = MAX_SCATTER_ENTRIES_PER_REQ; | ||
374 | pinfo->max_xfer_szper_scatreq = MAX_SCATTER_REQ_TRANSFER_SIZE; | ||
375 | |||
376 | return 0; | ||
377 | } | ||
378 | |||
379 | static int ath6kl_sdio_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf, | 321 | static int ath6kl_sdio_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf, |
380 | u32 len, u32 request) | 322 | u32 len, u32 request) |
381 | { | 323 | { |
@@ -658,6 +600,64 @@ static int ath6kl_sdio_async_rw_scatter(struct ath6kl *ar, | |||
658 | return status; | 600 | return status; |
659 | } | 601 | } |
660 | 602 | ||
603 | /* clean up scatter support */ | ||
604 | static void ath6kl_sdio_cleanup_scatter(struct ath6kl *ar) | ||
605 | { | ||
606 | struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); | ||
607 | struct hif_scatter_req *s_req, *tmp_req; | ||
608 | unsigned long flag; | ||
609 | |||
610 | /* empty the free list */ | ||
611 | spin_lock_irqsave(&ar_sdio->scat_lock, flag); | ||
612 | list_for_each_entry_safe(s_req, tmp_req, &ar_sdio->scat_req, list) { | ||
613 | list_del(&s_req->list); | ||
614 | spin_unlock_irqrestore(&ar_sdio->scat_lock, flag); | ||
615 | |||
616 | if (s_req->busrequest) | ||
617 | ath6kl_sdio_free_bus_req(ar_sdio, s_req->busrequest); | ||
618 | kfree(s_req->virt_dma_buf); | ||
619 | kfree(s_req->sgentries); | ||
620 | kfree(s_req); | ||
621 | |||
622 | spin_lock_irqsave(&ar_sdio->scat_lock, flag); | ||
623 | } | ||
624 | spin_unlock_irqrestore(&ar_sdio->scat_lock, flag); | ||
625 | } | ||
626 | |||
627 | /* setup of HIF scatter resources */ | ||
628 | static int ath6kl_sdio_enable_scatter(struct ath6kl *ar, | ||
629 | struct hif_dev_scat_sup_info *pinfo) | ||
630 | { | ||
631 | struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); | ||
632 | int ret = 0; | ||
633 | |||
634 | /* check if host supports scatter and it meets our requirements */ | ||
635 | if (ar_sdio->func->card->host->max_segs < MAX_SCATTER_ENTRIES_PER_REQ) { | ||
636 | ath6kl_err("hif-scatter: host only supports scatter of : %d entries, need: %d\n", | ||
637 | ar_sdio->func->card->host->max_segs, | ||
638 | MAX_SCATTER_ENTRIES_PER_REQ); | ||
639 | return -EINVAL; | ||
640 | } | ||
641 | |||
642 | ath6kl_dbg(ATH6KL_DBG_ANY, | ||
643 | "hif-scatter enabled: max scatter req : %d entries: %d\n", | ||
644 | MAX_SCATTER_REQUESTS, MAX_SCATTER_ENTRIES_PER_REQ); | ||
645 | |||
646 | ret = ath6kl_sdio_alloc_prep_scat_req(ar_sdio, | ||
647 | MAX_SCATTER_ENTRIES_PER_REQ, | ||
648 | MAX_SCATTER_REQUESTS, 0); | ||
649 | if (ret) { | ||
650 | ath6kl_err("hif-scatter: failed to alloc scatter resources !\n"); | ||
651 | ath6kl_sdio_cleanup_scatter(ar); | ||
652 | return ret; | ||
653 | } | ||
654 | |||
655 | pinfo->max_scat_entries = MAX_SCATTER_ENTRIES_PER_REQ; | ||
656 | pinfo->max_xfer_szper_scatreq = MAX_SCATTER_REQ_TRANSFER_SIZE; | ||
657 | |||
658 | return 0; | ||
659 | } | ||
660 | |||
661 | static const struct ath6kl_hif_ops ath6kl_sdio_ops = { | 661 | static const struct ath6kl_hif_ops ath6kl_sdio_ops = { |
662 | .read_write_sync = ath6kl_sdio_read_write_sync, | 662 | .read_write_sync = ath6kl_sdio_read_write_sync, |
663 | .write_async = ath6kl_sdio_write_async, | 663 | .write_async = ath6kl_sdio_write_async, |