Re: [PATCH 35/50] wifi: ath12k: add pci.c

Kalle Valo
2022-11-08T14:45:44Z

Jeff Johnson <quic_jjohnson@quicinc.com> writes:

> On 8/12/2022 9:09 AM, Kalle Valo wrote:
>> From: Kalle Valo <quic_kvalo@quicinc.com>
>>
>> (Patches split into one patch per file for easier review, but the final
>> commit will be one big patch. See the cover letter for more info.)
>>
>> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
>> ---
>> drivers/net/wireless/ath/ath12k/pci.c | 1344 +++++++++++++++++++++++++++++++++
>> 1 file changed, 1344 insertions(+)
>>
>> diff --git a/drivers/net/wireless/ath/ath12k/pci.c
>> b/drivers/net/wireless/ath/ath12k/pci.c
>
> snip
>
>> +static void ath12k_pci_remove(struct pci_dev *pdev)
>> +{
>> + struct ath12k_base *ab = pci_get_drvdata(pdev);
>> + struct ath12k_pci *ab_pci = ath12k_pci_priv(ab);
>> +
>> + if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) {
>> + ath12k_pci_power_down(ab);
>> + ath12k_qmi_deinit_service(ab);
>> + goto qmi_fail;
>> + }
>> +
>> + set_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags);
>> +
>> + cancel_work_sync(&ab->reset_work);
>> + ath12k_core_deinit(ab);
>> +
>> +qmi_fail:
>> + ath12k_mhi_unregister(ab_pci);
>> +
>> + ath12k_pci_free_irq(ab);
>> + ath12k_pci_msi_free(ab_pci);
>> + ath12k_pci_free_region(ab_pci);
>> +
>> + ath12k_hal_srng_deinit(ab);
>> + ath12k_ce_free_pipes(ab);
>> + destroy_workqueue(ab->workqueue_aux);
>
> it seems strange/asymetrical to destroy this here.
>
> it was allocated in ath12k_core_alloc() so I'd expect it to be
> destroyed in ath12k_core_free() to maintain symmetry

Fixed.

> in addition I don't see ab->workqueue being destroyed, and imo that
> should also take place in ath12k_core_free() for the same reason

This is also fixed.

>> +static SIMPLE_DEV_PM_OPS(ath12k_pci_pm_ops,
>> + ath12k_pci_pm_suspend,
>> + ath12k_pci_pm_resume);
>> +
>> +static struct pci_driver ath12k_pci_driver = {
>> + .name = "ath12k_pci",
>> + .id_table = ath12k_pci_id_table,
>> + .probe = ath12k_pci_probe,
>> + .remove = ath12k_pci_remove,
>> + .shutdown = ath12k_pci_shutdown,
>> +#ifdef CONFIG_PM
>> + .driver.pm = &ath12k_pci_pm_ops,
>> +#endif
>
> conditional compilation is unnecessary here since SIMPLE_DEV_PM_OPS
> handles the conditional

Fixed.

--