mutex_unlock(&ab->core_lock);
}
+static int ath12k_core_device_setup(struct ath12k_base *ab)
+{
+ int ret;
+
+ guard(mutex)(&ab->core_lock);
+
+ ret = ath12k_core_pdev_create(ab);
+ if (ret) {
+ ath12k_err(ab, "failed to create pdev core %d\n", ret);
+ return ret;
+ }
+
+ ath12k_hif_irq_enable(ab);
+
+ ret = ath12k_core_rfkill_config(ab);
+ if (ret && ret != -EOPNOTSUPP)
+ return ret;
+
+ return 0;
+}
+
static void ath12k_core_hw_group_stop(struct ath12k_hw_group *ag)
{
struct ath12k_base *ab;
clear_bit(ATH12K_GROUP_FLAG_REGISTERED, &ag->flags);
- ath12k_mac_unregister(ag);
-
- ath12k_mac_mlo_teardown(ag);
-
for (i = ag->num_devices - 1; i >= 0; i--) {
ab = ag->ab[i];
if (!ab)
ath12k_core_device_cleanup(ab);
}
+ /* Unregister MAC (drops wiphys) only after per-device cleanup */
+ ath12k_mac_unregister(ag);
+
+ /* Teardown MLO state after MAC unregister for symmetry */
+ ath12k_mac_mlo_teardown(ag);
+
ath12k_mac_destroy(ag);
}
if (!ab)
continue;
- mutex_lock(&ab->core_lock);
-
set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags);
- ret = ath12k_core_pdev_create(ab);
- if (ret) {
- ath12k_err(ab, "failed to create pdev core %d\n", ret);
- mutex_unlock(&ab->core_lock);
- goto err;
- }
-
- ath12k_hif_irq_enable(ab);
-
- ret = ath12k_core_rfkill_config(ab);
- if (ret && ret != -EOPNOTSUPP) {
- mutex_unlock(&ab->core_lock);
+ ret = ath12k_core_device_setup(ab);
+ if (ret)
goto err;
- }
-
- mutex_unlock(&ab->core_lock);
}
return 0;