diff options
author | Varun Sethi <Varun.Sethi@freescale.com> | 2014-06-24 09:57:16 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2014-07-07 04:30:02 -0400 |
commit | 75f0e4615dc328e67634eccd86bc71597da9f8a3 (patch) | |
tree | 3b28358c4cb72c27ac3e86d46b269f62c599ccf6 /drivers/iommu | |
parent | d033f48f3a4a9279c7475891fbb060d4881c22da (diff) |
iommu/fsl: Fix the device domain attach condition.
Store the domain information for the device, only if it's not already
attached to a domain.
Signed-off-by: Varun Sethi <Varun.Sethi@freescale.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/fsl_pamu_domain.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index 3dd0b8edd429..54060d16dec8 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c | |||
@@ -335,11 +335,6 @@ static struct fsl_dma_domain *iommu_alloc_dma_domain(void) | |||
335 | return domain; | 335 | return domain; |
336 | } | 336 | } |
337 | 337 | ||
338 | static inline struct device_domain_info *find_domain(struct device *dev) | ||
339 | { | ||
340 | return dev->archdata.iommu_domain; | ||
341 | } | ||
342 | |||
343 | static void remove_device_ref(struct device_domain_info *info, u32 win_cnt) | 338 | static void remove_device_ref(struct device_domain_info *info, u32 win_cnt) |
344 | { | 339 | { |
345 | unsigned long flags; | 340 | unsigned long flags; |
@@ -380,7 +375,7 @@ static void attach_device(struct fsl_dma_domain *dma_domain, int liodn, struct d | |||
380 | * Check here if the device is already attached to domain or not. | 375 | * Check here if the device is already attached to domain or not. |
381 | * If the device is already attached to a domain detach it. | 376 | * If the device is already attached to a domain detach it. |
382 | */ | 377 | */ |
383 | old_domain_info = find_domain(dev); | 378 | old_domain_info = dev->archdata.iommu_domain; |
384 | if (old_domain_info && old_domain_info->domain != dma_domain) { | 379 | if (old_domain_info && old_domain_info->domain != dma_domain) { |
385 | spin_unlock_irqrestore(&device_domain_lock, flags); | 380 | spin_unlock_irqrestore(&device_domain_lock, flags); |
386 | detach_device(dev, old_domain_info->domain); | 381 | detach_device(dev, old_domain_info->domain); |
@@ -399,7 +394,7 @@ static void attach_device(struct fsl_dma_domain *dma_domain, int liodn, struct d | |||
399 | * the info for the first LIODN as all | 394 | * the info for the first LIODN as all |
400 | * LIODNs share the same domain | 395 | * LIODNs share the same domain |
401 | */ | 396 | */ |
402 | if (!old_domain_info) | 397 | if (!dev->archdata.iommu_domain) |
403 | dev->archdata.iommu_domain = info; | 398 | dev->archdata.iommu_domain = info; |
404 | spin_unlock_irqrestore(&device_domain_lock, flags); | 399 | spin_unlock_irqrestore(&device_domain_lock, flags); |
405 | 400 | ||