diff options
author | Stepan Moskovchenko <stepanm@codeaurora.org> | 2010-11-12 22:29:56 -0500 |
---|---|---|
committer | Daniel Walker <dwalker@codeaurora.org> | 2010-11-30 19:03:51 -0500 |
commit | 00d4b2bb03b9ed27f28336b0a68f2bd7f67caa40 (patch) | |
tree | 738995cfae9dbea6649668539561f97c3e86694f /arch/arm/mach-msm | |
parent | 2607b0a26094b2d2d174c3e27b2ecc9c49d86f40 (diff) |
msm: iommu: Check if device is already attached
An IOMMU device can only be attached to one IOMMU domain at
any given time. Check whether the device is already
attached to a domain before allowing it to be attached to
another domain. If so, return busy.
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
Diffstat (limited to 'arch/arm/mach-msm')
-rw-r--r-- | arch/arm/mach-msm/iommu.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm/mach-msm/iommu.c b/arch/arm/mach-msm/iommu.c index 74f2157eba4e..67e8f531b7af 100644 --- a/arch/arm/mach-msm/iommu.c +++ b/arch/arm/mach-msm/iommu.c | |||
@@ -241,6 +241,11 @@ static int msm_iommu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
241 | goto fail; | 241 | goto fail; |
242 | } | 242 | } |
243 | 243 | ||
244 | if (!list_empty(&ctx_drvdata->attached_elm)) { | ||
245 | ret = -EBUSY; | ||
246 | goto fail; | ||
247 | } | ||
248 | |||
244 | list_for_each_entry(tmp_drvdata, &priv->list_attached, attached_elm) | 249 | list_for_each_entry(tmp_drvdata, &priv->list_attached, attached_elm) |
245 | if (tmp_drvdata == ctx_drvdata) { | 250 | if (tmp_drvdata == ctx_drvdata) { |
246 | ret = -EBUSY; | 251 | ret = -EBUSY; |