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

Commit 479690d4 authored by Lloyd Atkinson's avatar Lloyd Atkinson Committed by Narendra Muppalla
Browse files

drm/msm: implement smmu detach and guard freeing of client dev



Provide a basic implementation of msm_smmu_detach. Check
that smmu client_dev exists before doing
platform_device_unregister.

Change-Id: Ied1481003d878af452d3b00b950b234c6b7dd698
Signed-off-by: default avatarLloyd Atkinson <latkinso@codeaurora.org>
parent 7d070947
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -82,7 +82,20 @@ static int msm_smmu_attach(struct msm_mmu *mmu, const char **names, int cnt)

static void msm_smmu_detach(struct msm_mmu *mmu, const char **names, int cnt)
{
	DBG("detaching");
	struct msm_smmu *smmu = to_msm_smmu(mmu);
	struct msm_smmu_client *client = msm_smmu_to_client(smmu);

	if (!client) {
		pr_err("undefined smmu client\n");
		return;
	}

	if (!client->domain_attached)
		return;

	arm_iommu_detach_device(client->dev);
	client->domain_attached = false;
	dev_dbg(client->dev, "iommu domain detached\n");
}

static int msm_smmu_map(struct msm_mmu *mmu, uint32_t iova,
@@ -193,6 +206,7 @@ static void msm_smmu_destroy(struct msm_mmu *mmu)
	struct msm_smmu *smmu = to_msm_smmu(mmu);
	struct platform_device *pdev = to_platform_device(smmu->client_dev);

	if (smmu->client_dev)
		platform_device_unregister(pdev);
	kfree(smmu);
}