diff options
author | Chandra Shekhar <x0044955@ti.com> | 2008-10-08 11:01:39 +0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-10-08 11:01:39 +0400 |
commit | b4b58f5834a023dab67201db9a626bef07bb200c (patch) | |
tree | 721917a3f675ba7f55ce6d8df0fef9f0a6ed88a5 /arch/arm/mach-omap2 | |
parent | 25cef2251415cef5438e20965fec87096fe2efb0 (diff) | |
download | linux-b4b58f5834a023dab67201db9a626bef07bb200c.tar.xz |
ARM: OMAP: Allocate McBSP devices dynamically
Based on Chandra's earlier patches in linux-omap tree.
Note that omap1_mcbsp_check and omap2_mcbsp_check are no longer
needed as there's now omap_mcbsp_check_valid_id() defined.
Also some functions can now be marked __init.
Signed-off-by: Chandra Shekhar <x0044955@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/mcbsp.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index 709db03b9999..73f2279ef2ea 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c @@ -28,7 +28,7 @@ struct mcbsp_internal_clk { int n_childs; }; -#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) +#if defined(CONFIG_ARCH_OMAP24XX) static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) { const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" }; @@ -117,18 +117,8 @@ static void omap2_mcbsp_request(unsigned int id) omap2_mcbsp2_mux_setup(); } -static int omap2_mcbsp_check(unsigned int id) -{ - if (id > OMAP_MAX_MCBSP_COUNT - 1) { - printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1); - return -ENODEV; - } - return 0; -} - static struct omap_mcbsp_ops omap2_mcbsp_ops = { .request = omap2_mcbsp_request, - .check = omap2_mcbsp_check, }; #ifdef CONFIG_ARCH_OMAP24XX @@ -185,7 +175,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { #define OMAP34XX_MCBSP_PDATA_SZ 0 #endif -int __init omap2_mcbsp_init(void) +static int __init omap2_mcbsp_init(void) { int i; @@ -196,13 +186,19 @@ int __init omap2_mcbsp_init(void) } if (cpu_is_omap24xx()) + omap_mcbsp_count = OMAP24XX_MCBSP_PDATA_SZ; + if (cpu_is_omap34xx()) + omap_mcbsp_count = OMAP34XX_MCBSP_PDATA_SZ; + + mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *), + GFP_KERNEL); + if (!mcbsp_ptr) + return -ENOMEM; + + if (cpu_is_omap24xx()) omap_mcbsp_register_board_cfg(omap24xx_mcbsp_pdata, OMAP24XX_MCBSP_PDATA_SZ); - if (cpu_is_omap34xx()) - omap_mcbsp_register_board_cfg(omap34xx_mcbsp_pdata, - OMAP34XX_MCBSP_PDATA_SZ); - return omap_mcbsp_init(); } arch_initcall(omap2_mcbsp_init); |