Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309181
b: refs/heads/master
c: 803b527
h: refs/heads/master
i:
  309179: 907ffb1
v: v3
  • Loading branch information
Omar Ramirez Luna authored and Joerg Roedel committed Apr 19, 2012
1 parent a626bff commit 9e8b392
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 29cdd4e4ec91aae239192bb122d377d15a9d75e3
refs/heads/master: 803b5277215c75a5cc3b3eb5d19015c7290601a5
32 changes: 23 additions & 9 deletions trunk/drivers/iommu/omap-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
* @pgtable: the page table
* @iommu_dev: an omap iommu device attached to this domain. only a single
* iommu device can be attached for now.
* @dev: Device using this domain.
* @lock: domain lock, should be taken when attaching/detaching
*/
struct omap_iommu_domain {
u32 *pgtable;
struct omap_iommu *iommu_dev;
struct device *dev;
spinlock_t lock;
};

Expand Down Expand Up @@ -1081,35 +1083,41 @@ omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
}

omap_domain->iommu_dev = arch_data->iommu_dev = oiommu;
omap_domain->dev = dev;
oiommu->domain = domain;

out:
spin_unlock(&omap_domain->lock);
return ret;
}

static void omap_iommu_detach_dev(struct iommu_domain *domain,
struct device *dev)
static void _omap_iommu_detach_dev(struct omap_iommu_domain *omap_domain,
struct device *dev)
{
struct omap_iommu_domain *omap_domain = domain->priv;
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
struct omap_iommu *oiommu = dev_to_omap_iommu(dev);

spin_lock(&omap_domain->lock);
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;

/* only a single device is supported per domain for now */
if (omap_domain->iommu_dev != oiommu) {
dev_err(dev, "invalid iommu device\n");
goto out;
return;
}

iopgtable_clear_entry_all(oiommu);

omap_iommu_detach(oiommu);

omap_domain->iommu_dev = arch_data->iommu_dev = NULL;
omap_domain->dev = NULL;
}

out:
static void omap_iommu_detach_dev(struct iommu_domain *domain,
struct device *dev)
{
struct omap_iommu_domain *omap_domain = domain->priv;

spin_lock(&omap_domain->lock);
_omap_iommu_detach_dev(omap_domain, dev);
spin_unlock(&omap_domain->lock);
}

Expand Down Expand Up @@ -1148,13 +1156,19 @@ static int omap_iommu_domain_init(struct iommu_domain *domain)
return -ENOMEM;
}

/* assume device was already detached */
static void omap_iommu_domain_destroy(struct iommu_domain *domain)
{
struct omap_iommu_domain *omap_domain = domain->priv;

domain->priv = NULL;

/*
* An iommu device is still attached
* (currently, only one device can be attached) ?
*/
if (omap_domain->iommu_dev)
_omap_iommu_detach_dev(omap_domain, omap_domain->dev);

kfree(omap_domain->pgtable);
kfree(omap_domain);
}
Expand Down
10 changes: 5 additions & 5 deletions trunk/lib/dma-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,29 +430,29 @@ static struct dma_debug_entry *__dma_entry_alloc(void)
*/
static struct dma_debug_entry *dma_entry_alloc(void)
{
struct dma_debug_entry *entry;
struct dma_debug_entry *entry = NULL;
unsigned long flags;

spin_lock_irqsave(&free_entries_lock, flags);

if (list_empty(&free_entries)) {
pr_err("DMA-API: debugging out of memory - disabling\n");
global_disable = true;
spin_unlock_irqrestore(&free_entries_lock, flags);
return NULL;
goto out;
}

entry = __dma_entry_alloc();

spin_unlock_irqrestore(&free_entries_lock, flags);

#ifdef CONFIG_STACKTRACE
entry->stacktrace.max_entries = DMA_DEBUG_STACKTRACE_ENTRIES;
entry->stacktrace.entries = entry->st_entries;
entry->stacktrace.skip = 2;
save_stack_trace(&entry->stacktrace);
#endif

out:
spin_unlock_irqrestore(&free_entries_lock, flags);

return entry;
}

Expand Down

0 comments on commit 9e8b392

Please sign in to comment.