Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59f01699 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cnss2: Wait for recovery completion to unregister driver"

parents 3189a52a e258a1c9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1582,6 +1582,7 @@ static int cnss_misc_init(struct cnss_plat_data *plat_priv)
	init_completion(&plat_priv->power_up_complete);
	init_completion(&plat_priv->cal_complete);
	init_completion(&plat_priv->rddm_complete);
	init_completion(&plat_priv->recovery_complete);
	mutex_init(&plat_priv->dev_lock);

	return 0;
@@ -1589,6 +1590,7 @@ static int cnss_misc_init(struct cnss_plat_data *plat_priv)

static void cnss_misc_deinit(struct cnss_plat_data *plat_priv)
{
	complete_all(&plat_priv->recovery_complete);
	complete_all(&plat_priv->rddm_complete);
	complete_all(&plat_priv->cal_complete);
	complete_all(&plat_priv->power_up_complete);
+1 −0
Original line number Diff line number Diff line
@@ -295,6 +295,7 @@ struct cnss_plat_data {
	bool cal_done;
	char firmware_name[CNSS_FW_PATH_MAX_LEN];
	struct completion rddm_complete;
	struct completion recovery_complete;
	struct cnss_control_params ctrl_params;
	u32 is_converged_dt;
	struct device_node *dev_node;
+17 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@

#define FW_ASSERT_TIMEOUT		5000
#define DEV_RDDM_TIMEOUT		5000
#define RECOVERY_TIMEOUT		60000

#ifdef CONFIG_CNSS_EMULATION
#define EMULATION_HW			1
@@ -403,6 +404,7 @@ int cnss_pci_call_driver_probe(struct cnss_pci_data *pci_priv)
			goto out;
		}
		clear_bit(CNSS_DRIVER_RECOVERY, &plat_priv->driver_state);
		complete(&plat_priv->recovery_complete);
	} else if (test_bit(CNSS_DRIVER_LOADING, &plat_priv->driver_state)) {
		ret = pci_priv->driver_ops->probe(pci_priv->pci_dev,
						  pci_priv->pci_device_id);
@@ -450,6 +452,7 @@ int cnss_pci_call_driver_remove(struct cnss_pci_data *pci_priv)
		   test_bit(CNSS_DRIVER_PROBED, &plat_priv->driver_state)) {
		pci_priv->driver_ops->remove(pci_priv->pci_dev);
		clear_bit(CNSS_DRIVER_PROBED, &plat_priv->driver_state);
		clear_bit(CNSS_DEV_ERR_NOTIFY, &plat_priv->driver_state);
	}

	return 0;
@@ -890,12 +893,26 @@ EXPORT_SYMBOL(cnss_wlan_register_driver);
void cnss_wlan_unregister_driver(struct cnss_wlan_driver *driver_ops)
{
	struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(NULL);
	int ret = 0;

	if (!plat_priv) {
		cnss_pr_err("plat_priv is NULL\n");
		return;
	}

	if (!test_bit(CNSS_DRIVER_RECOVERY, &plat_priv->driver_state) &&
	    !test_bit(CNSS_DEV_ERR_NOTIFY, &plat_priv->driver_state))
		goto skip_wait;

	reinit_completion(&plat_priv->recovery_complete);
	ret = wait_for_completion_timeout(&plat_priv->recovery_complete,
					  RECOVERY_TIMEOUT);
	if (!ret) {
		cnss_pr_err("Timeout waiting for recovery to complete\n");
		CNSS_ASSERT(0);
	}

skip_wait:
	cnss_driver_event_post(plat_priv,
			       CNSS_DRIVER_EVENT_UNREGISTER_DRIVER,
			       CNSS_EVENT_SYNC_UNINTERRUPTIBLE, NULL);