Loading arch/arm/plat-omap/dma.c +24 −10 Original line number Original line Diff line number Diff line Loading @@ -2347,40 +2347,46 @@ EXPORT_SYMBOL(omap_stop_lcd_dma); static int __init omap_init_dma(void) static int __init omap_init_dma(void) { { unsigned long base; int ch, r; int ch, r; if (cpu_class_is_omap1()) { if (cpu_class_is_omap1()) { omap_dma_base = OMAP1_IO_ADDRESS(OMAP1_DMA_BASE); base = OMAP1_DMA_BASE; dma_lch_count = OMAP1_LOGICAL_DMA_CH_COUNT; dma_lch_count = OMAP1_LOGICAL_DMA_CH_COUNT; } else if (cpu_is_omap24xx()) { } else if (cpu_is_omap24xx()) { omap_dma_base = OMAP2_IO_ADDRESS(OMAP24XX_DMA4_BASE); base = OMAP24XX_DMA4_BASE; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; } else if (cpu_is_omap34xx()) { } else if (cpu_is_omap34xx()) { omap_dma_base = OMAP2_IO_ADDRESS(OMAP34XX_DMA4_BASE); base = OMAP34XX_DMA4_BASE; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; } else if (cpu_is_omap44xx()) { } else if (cpu_is_omap44xx()) { omap_dma_base = OMAP2_IO_ADDRESS(OMAP44XX_DMA4_BASE); base = OMAP44XX_DMA4_BASE; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; } else { } else { pr_err("DMA init failed for unsupported omap\n"); pr_err("DMA init failed for unsupported omap\n"); return -ENODEV; return -ENODEV; } } omap_dma_base = ioremap(base, SZ_4K); BUG_ON(!omap_dma_base); if (cpu_class_is_omap2() && omap_dma_reserve_channels if (cpu_class_is_omap2() && omap_dma_reserve_channels && (omap_dma_reserve_channels <= dma_lch_count)) && (omap_dma_reserve_channels <= dma_lch_count)) dma_lch_count = omap_dma_reserve_channels; dma_lch_count = omap_dma_reserve_channels; dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count, dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count, GFP_KERNEL); GFP_KERNEL); if (!dma_chan) if (!dma_chan) { return -ENOMEM; r = -ENOMEM; goto out_unmap; } if (cpu_class_is_omap2()) { if (cpu_class_is_omap2()) { dma_linked_lch = kzalloc(sizeof(struct dma_link_info) * dma_linked_lch = kzalloc(sizeof(struct dma_link_info) * dma_lch_count, GFP_KERNEL); dma_lch_count, GFP_KERNEL); if (!dma_linked_lch) { if (!dma_linked_lch) { kfree(dma_chan); r = -ENOMEM; return -ENOMEM; goto out_free; } } } } Loading Loading @@ -2454,7 +2460,7 @@ static int __init omap_init_dma(void) for (i = 0; i < ch; i++) for (i = 0; i < ch; i++) free_irq(omap1_dma_irq[i], free_irq(omap1_dma_irq[i], (void *) (i + 1)); (void *) (i + 1)); return r; goto out_free; } } } } } } Loading Loading @@ -2496,11 +2502,19 @@ static int __init omap_init_dma(void) "(error %d)\n", r); "(error %d)\n", r); for (i = 0; i < dma_chan_count; i++) for (i = 0; i < dma_chan_count; i++) free_irq(omap1_dma_irq[i], (void *) (i + 1)); free_irq(omap1_dma_irq[i], (void *) (i + 1)); return r; goto out_free; } } } } return 0; return 0; out_free: kfree(dma_chan); out_unmap: iounmap(omap_dma_base); return r; } } arch_initcall(omap_init_dma); arch_initcall(omap_init_dma); Loading Loading
arch/arm/plat-omap/dma.c +24 −10 Original line number Original line Diff line number Diff line Loading @@ -2347,40 +2347,46 @@ EXPORT_SYMBOL(omap_stop_lcd_dma); static int __init omap_init_dma(void) static int __init omap_init_dma(void) { { unsigned long base; int ch, r; int ch, r; if (cpu_class_is_omap1()) { if (cpu_class_is_omap1()) { omap_dma_base = OMAP1_IO_ADDRESS(OMAP1_DMA_BASE); base = OMAP1_DMA_BASE; dma_lch_count = OMAP1_LOGICAL_DMA_CH_COUNT; dma_lch_count = OMAP1_LOGICAL_DMA_CH_COUNT; } else if (cpu_is_omap24xx()) { } else if (cpu_is_omap24xx()) { omap_dma_base = OMAP2_IO_ADDRESS(OMAP24XX_DMA4_BASE); base = OMAP24XX_DMA4_BASE; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; } else if (cpu_is_omap34xx()) { } else if (cpu_is_omap34xx()) { omap_dma_base = OMAP2_IO_ADDRESS(OMAP34XX_DMA4_BASE); base = OMAP34XX_DMA4_BASE; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; } else if (cpu_is_omap44xx()) { } else if (cpu_is_omap44xx()) { omap_dma_base = OMAP2_IO_ADDRESS(OMAP44XX_DMA4_BASE); base = OMAP44XX_DMA4_BASE; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; } else { } else { pr_err("DMA init failed for unsupported omap\n"); pr_err("DMA init failed for unsupported omap\n"); return -ENODEV; return -ENODEV; } } omap_dma_base = ioremap(base, SZ_4K); BUG_ON(!omap_dma_base); if (cpu_class_is_omap2() && omap_dma_reserve_channels if (cpu_class_is_omap2() && omap_dma_reserve_channels && (omap_dma_reserve_channels <= dma_lch_count)) && (omap_dma_reserve_channels <= dma_lch_count)) dma_lch_count = omap_dma_reserve_channels; dma_lch_count = omap_dma_reserve_channels; dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count, dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count, GFP_KERNEL); GFP_KERNEL); if (!dma_chan) if (!dma_chan) { return -ENOMEM; r = -ENOMEM; goto out_unmap; } if (cpu_class_is_omap2()) { if (cpu_class_is_omap2()) { dma_linked_lch = kzalloc(sizeof(struct dma_link_info) * dma_linked_lch = kzalloc(sizeof(struct dma_link_info) * dma_lch_count, GFP_KERNEL); dma_lch_count, GFP_KERNEL); if (!dma_linked_lch) { if (!dma_linked_lch) { kfree(dma_chan); r = -ENOMEM; return -ENOMEM; goto out_free; } } } } Loading Loading @@ -2454,7 +2460,7 @@ static int __init omap_init_dma(void) for (i = 0; i < ch; i++) for (i = 0; i < ch; i++) free_irq(omap1_dma_irq[i], free_irq(omap1_dma_irq[i], (void *) (i + 1)); (void *) (i + 1)); return r; goto out_free; } } } } } } Loading Loading @@ -2496,11 +2502,19 @@ static int __init omap_init_dma(void) "(error %d)\n", r); "(error %d)\n", r); for (i = 0; i < dma_chan_count; i++) for (i = 0; i < dma_chan_count; i++) free_irq(omap1_dma_irq[i], (void *) (i + 1)); free_irq(omap1_dma_irq[i], (void *) (i + 1)); return r; goto out_free; } } } } return 0; return 0; out_free: kfree(dma_chan); out_unmap: iounmap(omap_dma_base); return r; } } arch_initcall(omap_init_dma); arch_initcall(omap_init_dma); Loading