diff options
| author | Michael Ellerman <michael@ellerman.id.au> | 2008-01-29 09:13:59 -0500 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2008-01-30 20:11:10 -0500 |
| commit | 209bfbb4780190754a6383ad052e59ce8b5bedeb (patch) | |
| tree | 2dada617645452adac673d09c82c3e51edf52ab8 | |
| parent | 41d824bf61b507c001868861cddda25eaab23cd7 (diff) | |
[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: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
| -rw-r--r-- | arch/powerpc/platforms/cell/iommu.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index eb2a94b0dc4c..26c1bba848b6 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
| @@ -565,10 +565,9 @@ static int __init cell_iommu_get_window(struct device_node *np, | |||
| 565 | return 0; | 565 | return 0; |
| 566 | } | 566 | } |
| 567 | 567 | ||
| 568 | static void __init cell_iommu_init_one(struct device_node *np, unsigned long offset) | 568 | static struct cbe_iommu * __init cell_iommu_alloc(struct device_node *np) |
| 569 | { | 569 | { |
| 570 | struct cbe_iommu *iommu; | 570 | struct cbe_iommu *iommu; |
| 571 | unsigned long base, size; | ||
| 572 | int nid, i; | 571 | int nid, i; |
| 573 | 572 | ||
| 574 | /* Get node ID */ | 573 | /* Get node ID */ |
| @@ -576,7 +575,7 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off | |||
| 576 | if (nid < 0) { | 575 | if (nid < 0) { |
| 577 | printk(KERN_ERR "iommu: failed to get node for %s\n", | 576 | printk(KERN_ERR "iommu: failed to get node for %s\n", |
| 578 | np->full_name); | 577 | np->full_name); |
| 579 | return; | 578 | return NULL; |
| 580 | } | 579 | } |
| 581 | pr_debug("iommu: setting up iommu for node %d (%s)\n", | 580 | pr_debug("iommu: setting up iommu for node %d (%s)\n", |
| 582 | nid, np->full_name); | 581 | nid, np->full_name); |
| @@ -592,7 +591,7 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off | |||
| 592 | if (cbe_nr_iommus >= NR_IOMMUS) { | 591 | if (cbe_nr_iommus >= NR_IOMMUS) { |
| 593 | printk(KERN_ERR "iommu: too many IOMMUs detected ! (%s)\n", | 592 | printk(KERN_ERR "iommu: too many IOMMUs detected ! (%s)\n", |
| 594 | np->full_name); | 593 | np->full_name); |
| 595 | return; | 594 | return NULL; |
| 596 | } | 595 | } |
| 597 | 596 | ||
| 598 | /* Init base fields */ | 597 | /* Init base fields */ |
| @@ -603,6 +602,19 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off | |||
| 603 | snprintf(iommu->name, sizeof(iommu->name), "iommu%d", i); | 602 | snprintf(iommu->name, sizeof(iommu->name), "iommu%d", i); |
| 604 | INIT_LIST_HEAD(&iommu->windows); | 603 | INIT_LIST_HEAD(&iommu->windows); |
| 605 | 604 | ||
| 605 | return iommu; | ||
| 606 | } | ||
| 607 | |||
| 608 | static void __init cell_iommu_init_one(struct device_node *np, | ||
| 609 | unsigned long offset) | ||
| 610 | { | ||
| 611 | struct cbe_iommu *iommu; | ||
| 612 | unsigned long base, size; | ||
| 613 | |||
| 614 | iommu = cell_iommu_alloc(np); | ||
| 615 | if (!iommu) | ||
| 616 | return; | ||
| 617 | |||
| 606 | /* Obtain a window for it */ | 618 | /* Obtain a window for it */ |
| 607 | cell_iommu_get_window(np, &base, &size); | 619 | cell_iommu_get_window(np, &base, &size); |
| 608 | 620 | ||
