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

Commit b9fdcb27 authored by Sujeev Dias's avatar Sujeev Dias
Browse files

mhi: core: always setup/teardown irq during power on/off transitions



It's possible for MHI control driver to call mhi de-init after
PCIe link is off. During free_irq() call, unclock register access
could happens since link is off. Teardown interrupts immediately
after MHI shutdown before de-init call.

CRs-Fixed: 2418657
Change-Id: Ic44f4f897273f13293dd2306bb7f5d9d905a1baf
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 1ff48618
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -1392,12 +1392,6 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl)
		goto error_dev_ctxt;
	}

	ret = mhi_init_irq_setup(mhi_cntrl);
	if (ret) {
		MHI_ERR("Error setting up irq\n");
		goto error_setup_irq;
	}

	/*
	 * allocate rddm table if specified, this table is for debug purpose
	 * so we'll ignore erros
@@ -1436,10 +1430,6 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl)
		mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->rddm_image);
		mhi_cntrl->rddm_image = NULL;
	}
	mhi_deinit_free_irq(mhi_cntrl);

error_setup_irq:
	mhi_deinit_dev_ctxt(mhi_cntrl);

error_dev_ctxt:
	mutex_unlock(&mhi_cntrl->pm_mutex);
@@ -1460,7 +1450,6 @@ void mhi_unprepare_after_power_down(struct mhi_controller *mhi_cntrl)
		mhi_cntrl->rddm_image = NULL;
	}

	mhi_deinit_free_irq(mhi_cntrl);
	mhi_deinit_dev_ctxt(mhi_cntrl);
	mhi_cntrl->pre_init = false;
}
+8 −8
Original line number Diff line number Diff line
@@ -796,13 +796,13 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
			MHI_ERR("Error setting dev_context\n");
			goto error_dev_ctxt;
		}
	}

	ret = mhi_init_irq_setup(mhi_cntrl);
	if (ret) {
		MHI_ERR("Error setting up irq\n");
		goto error_setup_irq;
	}
	}

	/* setup bhi offset & intvec */
	write_lock_irq(&mhi_cntrl->pm_lock);
@@ -858,7 +858,6 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
	return 0;

error_bhi_offset:
	if (!mhi_cntrl->pre_init)
	mhi_deinit_free_irq(mhi_cntrl);

error_setup_irq:
@@ -893,13 +892,14 @@ void mhi_power_down(struct mhi_controller *mhi_cntrl, bool graceful)

	mhi_deinit_debugfs(mhi_cntrl);

	mhi_deinit_free_irq(mhi_cntrl);

	if (!mhi_cntrl->pre_init) {
		/* free all allocated resources */
		if (mhi_cntrl->fbc_image) {
			mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image);
			mhi_cntrl->fbc_image = NULL;
		}
		mhi_deinit_free_irq(mhi_cntrl);
		mhi_deinit_dev_ctxt(mhi_cntrl);
	}
}