| @@ -3473,6 +3473,28 @@ int ath10k_pci_setup_resource(struct ath10k *ar) · 3472 unmodified lines |
| 3473 | | 3473 | |
| 3474 | timer_setup(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry, 0); | 3474 | timer_setup(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry, 0); |
| 3475 | | 3475 | |
| | 3476 | ar_pci->attr = kmemdup(pci_host_ce_config_wlan, |
| | 3477 | sizeof(pci_host_ce_config_wlan), |
| | 3478 | GFP_KERNEL); |
| | 3479 | if (!ar_pci->attr) |
| | 3480 | return -ENOMEM; |
| | 3481 | |
| | 3482 | ar_pci->pipe_config = kmemdup(pci_target_ce_config_wlan, |
| | 3483 | sizeof(pci_target_ce_config_wlan), |
| | 3484 | GFP_KERNEL); |
| | 3485 | if (!ar_pci->pipe_config) { |
| | 3486 | ret = -ENOMEM; |
| | 3487 | goto err_free_attr; |
| | 3488 | } |
| | 3489 | |
| | 3490 | ar_pci->serv_to_pipe = kmemdup(pci_target_service_to_ce_map_wlan, |
| | 3491 | sizeof(pci_target_service_to_ce_map_wlan), |
| | 3492 | GFP_KERNEL); |
| | 3493 | if (!ar_pci->serv_to_pipe) { |
| | 3494 | ret = -ENOMEM; |
| | 3495 | goto err_free_pipe_config; |
| | 3496 | } |
| | 3497 | |
| 3476 | if (QCA_REV_6174(ar) || QCA_REV_9377(ar)) | 3498 | if (QCA_REV_6174(ar) || QCA_REV_9377(ar)) |
| 3477 | ath10k_pci_override_ce_config(ar); | 3499 | ath10k_pci_override_ce_config(ar); |
| 3478 | | 3500 | |
| @@ -3480,18 +3502,31 @@ int ath10k_pci_setup_resource(struct ath10k *ar) · 1 unmodified line |
| 3480 | if (ret) { | 3502 | if (ret) { |
| 3481 | ath10k_err(ar, "failed to allocate copy engine pipes: %d\n", | 3503 | ath10k_err(ar, "failed to allocate copy engine pipes: %d\n", |
| 3482 | ret); | 3504 | ret); |
| 3483 | return ret; | 3505 | goto err_free_serv_to_pipe; |
| 3484 | } | 3506 | } |
| 3485 | | 3507 | |
| 3486 | return 0; | 3508 | return 0; |
| | 3509 | |
| | 3510 | err_free_serv_to_pipe: |
| | 3511 | kfree(ar_pci->serv_to_pipe); |
| | 3512 | err_free_pipe_config: |
| | 3513 | kfree(ar_pci->pipe_config); |
| | 3514 | err_free_attr: |
| | 3515 | kfree(ar_pci->attr); |
| | 3516 | return ret; |
| 3487 | } | 3517 | } |
| 3488 | | 3518 | |
| 3489 | void ath10k_pci_release_resource(struct ath10k *ar) | 3519 | void ath10k_pci_release_resource(struct ath10k *ar) |
| 3490 | { | 3520 | { |
| | 3521 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
| | 3522 | |
| 3491 | ath10k_pci_rx_retry_sync(ar); | 3523 | ath10k_pci_rx_retry_sync(ar); |
| 3492 | netif_napi_del(&ar->napi); | 3524 | netif_napi_del(&ar->napi); |
| 3493 | ath10k_pci_ce_deinit(ar); | 3525 | ath10k_pci_ce_deinit(ar); |
| 3494 | ath10k_pci_free_pipes(ar); | 3526 | ath10k_pci_free_pipes(ar); |
| | 3527 | kfree(ar_pci->attr); |
| | 3528 | kfree(ar_pci->pipe_config); |
| | 3529 | kfree(ar_pci->serv_to_pipe); |
| 3495 | } | 3530 | } |
| 3496 | | 3531 | |
| 3497 | static const struct ath10k_bus_ops ath10k_pci_bus_ops = { | 3532 | static const struct ath10k_bus_ops ath10k_pci_bus_ops = { |
| @@ -3601,30 +3636,6 @@ static int ath10k_pci_probe(struct pci_dev *pdev, · 103 unmodified lines |
| 3601 | | 3636 | |
| 3602 | timer_setup(&ar_pci->ps_timer, ath10k_pci_ps_timer, 0); | 3637 | timer_setup(&ar_pci->ps_timer, ath10k_pci_ps_timer, 0); |
| 3603 | | 3638 | |
| 3604 | ar_pci->attr = kmemdup(pci_host_ce_config_wlan, | | |
| 3605 | sizeof(pci_host_ce_config_wlan), | | |
| 3606 | GFP_KERNEL); | | |
| 3607 | if (!ar_pci->attr) { | | |
| 3608 | ret = -ENOMEM; | | |
| 3609 | goto err_free; | | |
| 3610 | } | | |
| 3611 | | | |
| 3612 | ar_pci->pipe_config = kmemdup(pci_target_ce_config_wlan, | | |
| 3613 | sizeof(pci_target_ce_config_wlan), | | |
| 3614 | GFP_KERNEL); | | |
| 3615 | if (!ar_pci->pipe_config) { | | |
| 3616 | ret = -ENOMEM; | | |
| 3617 | goto err_free; | | |
| 3618 | } | | |
| 3619 | | | |
| 3620 | ar_pci->serv_to_pipe = kmemdup(pci_target_service_to_ce_map_wlan, | | |
| 3621 | sizeof(pci_target_service_to_ce_map_wlan), | | |
| 3622 | GFP_KERNEL); | | |
| 3623 | if (!ar_pci->serv_to_pipe) { | | |
| 3624 | ret = -ENOMEM; | | |
| 3625 | goto err_free; | | |
| 3626 | } | | |
| 3627 | | | |
| 3628 | ret = ath10k_pci_setup_resource(ar); | 3639 | ret = ath10k_pci_setup_resource(ar); |
| 3629 | if (ret) { | 3640 | if (ret) { |
| 3630 | ath10k_err(ar, "failed to setup resource: %d\n", ret); | 3641 | ath10k_err(ar, "failed to setup resource: %d\n", ret); |
| @@ -3705,10 +3716,9 @@ err_unsupported: · 74 unmodified lines |
| 3705 | | 3716 | |
| 3706 | err_free_irq: | 3717 | err_free_irq: |
| 3707 | ath10k_pci_free_irq(ar); | 3718 | ath10k_pci_free_irq(ar); |
| 3708 | ath10k_pci_rx_retry_sync(ar); | | |
| 3709 | | 3719 | |
| 3710 | err_deinit_irq: | 3720 | err_deinit_irq: |
| 3711 | ath10k_pci_deinit_irq(ar); | 3721 | ath10k_pci_release_resource(ar); |
| 3712 | | 3722 | |
| 3713 | err_sleep: | 3723 | err_sleep: |
| 3714 | ath10k_pci_sleep_sync(ar); | 3724 | ath10k_pci_sleep_sync(ar); |
| @@ -3720,29 +3730,18 @@ err_free_pipes: · 5 unmodified lines |
| 3720 | err_core_destroy: | 3730 | err_core_destroy: |
| 3721 | ath10k_core_destroy(ar); | 3731 | ath10k_core_destroy(ar); |
| 3722 | | 3732 | |
| 3723 | err_free: | | |
| 3724 | kfree(ar_pci->attr); | | |
| 3725 | kfree(ar_pci->pipe_config); | | |
| 3726 | kfree(ar_pci->serv_to_pipe); | | |
| 3727 | | | |
| 3728 | return ret; | 3733 | return ret; |
| 3729 | } | 3734 | } |
| 3730 | | 3735 | |
| 3731 | static void ath10k_pci_remove(struct pci_dev *pdev) | 3736 | static void ath10k_pci_remove(struct pci_dev *pdev) |
| 3732 | { | 3737 | { |
| 3733 | struct ath10k *ar = pci_get_drvdata(pdev); | 3738 | struct ath10k *ar = pci_get_drvdata(pdev); |
| 3734 | struct ath10k_pci *ar_pci; | | |
| 3735 | | 3739 | |
| 3736 | ath10k_dbg(ar, ATH10K_DBG_PCI, "pci remove\n"); | 3740 | ath10k_dbg(ar, ATH10K_DBG_PCI, "pci remove\n"); |
| 3737 | | 3741 | |
| 3738 | if (!ar) | 3742 | if (!ar) |
| 3739 | return; | 3743 | return; |
| 3740 | | 3744 | |
| 3741 | ar_pci = ath10k_pci_priv(ar); | | |
| 3742 | | | |
| 3743 | if (!ar_pci) | | |
| 3744 | return; | | |
| 3745 | | | |
| 3746 | ath10k_core_unregister(ar); | 3745 | ath10k_core_unregister(ar); |
| 3747 | ath10k_pci_free_irq(ar); | 3746 | ath10k_pci_free_irq(ar); |
| 3748 | ath10k_pci_deinit_irq(ar); | 3747 | ath10k_pci_deinit_irq(ar); |
| @@ -3750,9 +3749,6 @@ static void ath10k_pci_remove(struct pci_dev *pdev) · 1 unmodified line |
| 3750 | ath10k_pci_sleep_sync(ar); | 3749 | ath10k_pci_sleep_sync(ar); |
| 3751 | ath10k_pci_release(ar); | 3750 | ath10k_pci_release(ar); |
| 3752 | ath10k_core_destroy(ar); | 3751 | ath10k_core_destroy(ar); |
| 3753 | kfree(ar_pci->attr); | | |
| 3754 | kfree(ar_pci->pipe_config); | | |
| 3755 | kfree(ar_pci->serv_to_pipe); | | |
| 3756 | } | 3752 | } |
| 3757 | | 3753 | |
| 3758 | MODULE_DEVICE_TABLE(pci, ath10k_pci_id_table); | 3754 | MODULE_DEVICE_TABLE(pci, ath10k_pci_id_table); |