Skip to content

Commit

Permalink
iommu/fsl: Fix the device domain attach condition.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Varun Sethi authored and Joerg Roedel committed Jul 7, 2014
1 parent d033f48 commit 75f0e46
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions drivers/iommu/fsl_pamu_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,6 @@ static struct fsl_dma_domain *iommu_alloc_dma_domain(void)
return domain;
}

static inline struct device_domain_info *find_domain(struct device *dev)
{
return dev->archdata.iommu_domain;
}

static void remove_device_ref(struct device_domain_info *info, u32 win_cnt)
{
unsigned long flags;
Expand Down Expand Up @@ -380,7 +375,7 @@ static void attach_device(struct fsl_dma_domain *dma_domain, int liodn, struct d
* Check here if the device is already attached to domain or not.
* If the device is already attached to a domain detach it.
*/
old_domain_info = find_domain(dev);
old_domain_info = dev->archdata.iommu_domain;
if (old_domain_info && old_domain_info->domain != dma_domain) {
spin_unlock_irqrestore(&device_domain_lock, flags);
detach_device(dev, old_domain_info->domain);
Expand All @@ -399,7 +394,7 @@ static void attach_device(struct fsl_dma_domain *dma_domain, int liodn, struct d
* the info for the first LIODN as all
* LIODNs share the same domain
*/
if (!old_domain_info)
if (!dev->archdata.iommu_domain)
dev->archdata.iommu_domain = info;
spin_unlock_irqrestore(&device_domain_lock, flags);

Expand Down

0 comments on commit 75f0e46

Please sign in to comment.