Commit 209bfbb4 authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

[POWERPC] Split out the logic that allocates struct iommus

Split out the logic that allocates a struct iommu into a separate
function.  This can fail however the calling code has never cared - so
just return if we can't allocate an iommu.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 41d824bf
...@@ -565,10 +565,9 @@ static int __init cell_iommu_get_window(struct device_node *np, ...@@ -565,10 +565,9 @@ static int __init cell_iommu_get_window(struct device_node *np,
return 0; return 0;
} }
static void __init cell_iommu_init_one(struct device_node *np, unsigned long offset) static struct cbe_iommu * __init cell_iommu_alloc(struct device_node *np)
{ {
struct cbe_iommu *iommu; struct cbe_iommu *iommu;
unsigned long base, size;
int nid, i; int nid, i;
/* Get node ID */ /* Get node ID */
...@@ -576,7 +575,7 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off ...@@ -576,7 +575,7 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off
if (nid < 0) { if (nid < 0) {
printk(KERN_ERR "iommu: failed to get node for %s\n", printk(KERN_ERR "iommu: failed to get node for %s\n",
np->full_name); np->full_name);
return; return NULL;
} }
pr_debug("iommu: setting up iommu for node %d (%s)\n", pr_debug("iommu: setting up iommu for node %d (%s)\n",
nid, np->full_name); nid, np->full_name);
...@@ -592,7 +591,7 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off ...@@ -592,7 +591,7 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off
if (cbe_nr_iommus >= NR_IOMMUS) { if (cbe_nr_iommus >= NR_IOMMUS) {
printk(KERN_ERR "iommu: too many IOMMUs detected ! (%s)\n", printk(KERN_ERR "iommu: too many IOMMUs detected ! (%s)\n",
np->full_name); np->full_name);
return; return NULL;
} }
/* Init base fields */ /* Init base fields */
...@@ -603,6 +602,19 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off ...@@ -603,6 +602,19 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off
snprintf(iommu->name, sizeof(iommu->name), "iommu%d", i); snprintf(iommu->name, sizeof(iommu->name), "iommu%d", i);
INIT_LIST_HEAD(&iommu->windows); INIT_LIST_HEAD(&iommu->windows);
return iommu;
}
static void __init cell_iommu_init_one(struct device_node *np,
unsigned long offset)
{
struct cbe_iommu *iommu;
unsigned long base, size;
iommu = cell_iommu_alloc(np);
if (!iommu)
return;
/* Obtain a window for it */ /* Obtain a window for it */
cell_iommu_get_window(np, &base, &size); cell_iommu_get_window(np, &base, &size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment