Commit fde20fbe authored by Tony Lindgren's avatar Tony Lindgren

ARM: OMAP: Allocate McBSP devices dynamically

Allocate McBSP devices dynamically. Also remove some
unnecessary inludes. Based on comments from Russell King.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 6a32eb13
......@@ -153,8 +153,7 @@ static inline void omap_init_kp(void) {}
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_OMAP_MCBSP) || defined(CONFIG_OMAP_MCBSP_MODULE)
static struct platform_device omap_mcbsp_devices[OMAP_MAX_MCBSP_COUNT];
static int mcbsps_configured;
static struct platform_device **omap_mcbsp_devices;
void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
int size)
......@@ -168,29 +167,34 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
size = OMAP_MAX_MCBSP_COUNT;
}
omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *),
GFP_KERNEL);
if (!omap_mcbsp_devices) {
printk(KERN_ERR "Could not register McBSP devices\n");
return;
}
for (i = 0; i < size; i++) {
struct platform_device *new_mcbsp = &omap_mcbsp_devices[i];
new_mcbsp->name = "omap-mcbsp";
new_mcbsp->id = i + 1;
struct platform_device *new_mcbsp;
int ret;
new_mcbsp = platform_device_alloc("omap-mcbsp", i + 1);
if (!new_mcbsp)
continue;
new_mcbsp->dev.platform_data = &config[i];
ret = platform_device_add(new_mcbsp);
if (ret) {
platform_device_put(new_mcbsp);
continue;
}
omap_mcbsp_devices[i] = new_mcbsp;
}
mcbsps_configured = size;
}
static void __init omap_init_mcbsp(void)
{
int i;
for (i = 0; i < mcbsps_configured; i++)
platform_device_register(&omap_mcbsp_devices[i]);
}
#else
void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
int size)
{ }
static inline void __init omap_init_mcbsp(void)
{ }
#endif
/*-------------------------------------------------------------------------*/
......@@ -555,7 +559,6 @@ static int __init omap_init_devices(void)
*/
omap_init_dsp();
omap_init_kp();
omap_init_mcbsp();
omap_init_mmc();
omap_init_uwire();
omap_init_wdt();
......
......@@ -23,7 +23,6 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <asm/arch/dma.h>
#include <asm/arch/mcbsp.h>
......
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