Re: [PATCH 11/21] ARM: OMAP: McBSP: Prepare for splitting intoomap1 and omap2 code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
i was about to send the same patch.  it works fine for me.
chandra Shekhar


----- Original Message ----- From: "Tony Lindgren" <tony@xxxxxxxxxxx>
To: "Russell King - ARM Linux" <linux@xxxxxxxxxxxxxxxx>
Cc: <linux-arm-kernel@xxxxxxxxxxxxxxxxxxxxxx>; "Eduardo Valentin" <eduardo.valentin@xxxxxxxxxxx>; <linux-omap@xxxxxxxxxxxxxxx>; "Nikula Jarkko (NRC/Helsinki)" <jarkko.nikula@xxxxxxxxx>
Sent: Monday, June 23, 2008 3:09 PM
Subject: Re: [PATCH 11/21] ARM: OMAP: McBSP: Prepare for splitting intoomap1 and omap2 code


* Tony Lindgren <tony@xxxxxxxxxxx> [080617 11:43]:
* Russell King - ARM Linux <linux@xxxxxxxxxxxxxxxx> [080614 11:17]:
> On Fri, Jun 06, 2008 at 06:30:43PM -0700, Tony Lindgren wrote:
> > +#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;
> > +
> > +void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data > > *config,
> > + int size)
> > +{
> > + int i;
> > +
> > + if (size > OMAP_MAX_MCBSP_COUNT) {
> > + printk(KERN_WARNING "Registered too many McBSPs platform_data."
> > + " Using maximum (%d) available.\n",
> > + OMAP_MAX_MCBSP_COUNT);
> > + size = OMAP_MAX_MCBSP_COUNT;
> > + }
> > +
> > + for (i = 0; i < size; i++) {
> > + struct platform_device *new_mcbsp = &omap_mcbsp_devices[i];
>
> Any reason this can't use the platform_device_alloc() API rather than
> having a static restriction on the number (coupled with the wastage of
> space for smaller 'size's ?)

I agree, this should be allocated. Eduardo, any comments?

Here's updated patch that uses platform_device_alloc().

Tony



--------------------------------------------------------------------------------


From 53f2999d681669df0645053dc572d97cda69823d Mon Sep 17 00:00:00 2001
From: Eduardo Valentin <eduardo.valentin@xxxxxxxxxxx>
Date: Mon, 23 Jun 2008 12:37:30 +0300
Subject: [PATCH] ARM: OMAP: McBSP: Prepare for splitting into omap1 and omap2 code

This patch transform mcbsp code to use platform data
from arch/arm/plat-omap/devices.c

It also gets ride of ifdefs on mcbsp.c code.
To do it, a platform data structure was defined.

Signed-off-by: Eduardo Valentin <eduardo.valentin@xxxxxxxxxxx>
Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx>

diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 4a53f9b..81002b7 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -24,6 +24,7 @@
#include <asm/arch/mux.h>
#include <asm/arch/gpio.h>
#include <asm/arch/menelaus.h>
+#include <asm/arch/mcbsp.h>

#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)

@@ -145,6 +146,53 @@ static inline void omap_init_kp(void) {}
#endif

/*-------------------------------------------------------------------------*/
+#if defined(CONFIG_OMAP_MCBSP) || defined(CONFIG_OMAP_MCBSP_MODULE)
+
+static struct platform_device **omap_mcbsp_devices;
+
+void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
+ int size)
+{
+ int i;
+
+ if (size > OMAP_MAX_MCBSP_COUNT) {
+ printk(KERN_WARNING "Registered too many McBSPs platform_data."
+ " Using maximum (%d) available.\n",
+ OMAP_MAX_MCBSP_COUNT);
+ 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;
+ 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;
+ }
+}
+
+#else
+void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
+ int size)
+{  }
+#endif
+
+/*-------------------------------------------------------------------------*/

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

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux