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: Lloyd Atkinson <latkinso@codeaurora.org>
This commit is contained in:
parent
f547c0a044
commit
b1b6408bcf
1 changed files with 16 additions and 2 deletions
|
@ -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,7 +206,8 @@ 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);
|
||||
|
||||
platform_device_unregister(pdev);
|
||||
if (smmu->client_dev)
|
||||
platform_device_unregister(pdev);
|
||||
kfree(smmu);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue