Signed-off-by: Tony Lindgren <[EMAIL PROTECTED]>

---
 arch/arm/plat-omap/devices.c |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

Index: linux-omap-2.6/arch/arm/plat-omap/devices.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/plat-omap/devices.c    2008-06-25
15:54:09.000000000 +0530
+++ linux-omap-2.6/arch/arm/plat-omap/devices.c 2008-06-25 15:55:06.000000000
+0530
@@ -153,8 +153,7 @@
 /*-------------------------------------------------------------------------*/
 #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,32 @@
                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 +557,6 @@
         */
        omap_init_dsp();
        omap_init_kp();
-       omap_init_mcbsp();
        omap_init_mmc();
        omap_init_uwire();
        omap_init_wdt();


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to