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

Commit 0ab2dbad authored by Yue Ma's avatar Yue Ma Committed by Gerrit - the friendly Code Review server
Browse files

cnss2: Dot not post work event from force RDDM function



The force RDDM function may be called from any serialized work event.
If it posts another work event and waits for it to complete, the new
work event will be blocked by current one and results deadlock. Avoid
posting the assert firmware work event by directly calling the event
handler and honoring the return code properly.

Change-Id: I08beab6f72319df96a26fc95e4294926d6a3c25f
Signed-off-by: default avatarYue Ma <yuem@codeaurora.org>
parent f5f31790
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -993,6 +993,11 @@ int cnss_force_fw_assert(struct device *dev)
		return -EOPNOTSUPP;
	}

	if (cnss_pci_is_device_down(dev)) {
		cnss_pr_info("Device is already in bad state, ignore force assert\n");
		return 0;
	}

	if (test_bit(CNSS_DRIVER_RECOVERY, &plat_priv->driver_state)) {
		cnss_pr_info("Recovery is already in progress, ignore forced FW assert\n");
		return 0;
@@ -1021,14 +1026,19 @@ int cnss_force_collect_rddm(struct device *dev)
		return -EOPNOTSUPP;
	}

	if (cnss_pci_is_device_down(dev)) {
		cnss_pr_info("Device is already in bad state, ignore force collect rddm\n");
		return 0;
	}

	if (test_bit(CNSS_DRIVER_RECOVERY, &plat_priv->driver_state)) {
		cnss_pr_info("Recovery is already in progress, ignore forced collect rddm\n");
		return 0;
	}

	cnss_driver_event_post(plat_priv,
			       CNSS_DRIVER_EVENT_FORCE_FW_ASSERT,
			       0, NULL);
	ret = cnss_bus_force_fw_assert_hdlr(plat_priv);
	if (ret)
		return ret;

	reinit_completion(&plat_priv->rddm_complete);
	ret = wait_for_completion_timeout
+1 −6
Original line number Diff line number Diff line
@@ -1677,17 +1677,12 @@ int cnss_pci_force_fw_assert_hdlr(struct cnss_pci_data *pci_priv)
	if (!plat_priv)
		return -ENODEV;

	if (cnss_pci_is_device_down(&pci_priv->pci_dev->dev)) {
		cnss_pr_info("Device is already in bad state, ignore force assert\n");
		return 0;
	}

	ret = cnss_pci_set_mhi_state(pci_priv, CNSS_MHI_TRIGGER_RDDM);
	if (ret) {
		cnss_pr_err("Failed to trigger RDDM, err = %d\n", ret);
		cnss_schedule_recovery(&pci_priv->pci_dev->dev,
				       CNSS_REASON_DEFAULT);
		return 0;
		return ret;
	}

	if (!test_bit(CNSS_DEV_ERR_NOTIFY, &plat_priv->driver_state)) {