[alsa-devel] [PATCH v2 1/3] ASoC: multi-comp: OMAP McBSP: use macro for platform_device

Peter Ujfalusi peter.ujfalusi at nokia.com
Fri Aug 6 13:10:36 CEST 2010


Use macro (and define it in the plat/mcbsp.h) to create
the omap-mcbsp-dai devices.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi at nokia.com>
---
 arch/arm/mach-omap2/devices.c           |   29 +++++------------------------
 arch/arm/plat-omap/include/plat/mcbsp.h |    7 +++++++
 2 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 088b050..758d39b 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -297,30 +297,11 @@ static struct platform_device omap_pcm = {
 	.id	= -1,
 };
 
-static struct platform_device omap_mcbsp1 = {
-	.name	= "omap-mcbsp-dai",
-	.id	= OMAP_MCBSP1,
-};
-
-static struct platform_device omap_mcbsp2 = {
-	.name	= "omap-mcbsp-dai",
-	.id	= OMAP_MCBSP2,
-};
-
-static struct platform_device omap_mcbsp3 = {
-	.name	= "omap-mcbsp-dai",
-	.id	= OMAP_MCBSP3,
-};
-
-static struct platform_device omap_mcbsp4 = {
-	.name	= "omap-mcbsp-dai",
-	.id	= OMAP_MCBSP4,
-};
-
-static struct platform_device omap_mcbsp5 = {
-	.name	= "omap-mcbsp-dai",
-	.id	= OMAP_MCBSP5,
-};
+OMAP_MCBSP_PLATFORM_DEVICE(1);
+OMAP_MCBSP_PLATFORM_DEVICE(2);
+OMAP_MCBSP_PLATFORM_DEVICE(3);
+OMAP_MCBSP_PLATFORM_DEVICE(4);
+OMAP_MCBSP_PLATFORM_DEVICE(5);
 
 static void omap_init_audio(void)
 {
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index b4ff6a1..5b20103 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -30,6 +30,13 @@
 #include <mach/hardware.h>
 #include <plat/clock.h>
 
+/* macro for building platform_device for McBSP ports */
+#define OMAP_MCBSP_PLATFORM_DEVICE(port_nr)		\
+static struct platform_device omap_mcbsp##port_nr = {	\
+	.name	= "omap-mcbsp-dai",			\
+	.id	= OMAP_MCBSP##port_nr,			\
+}
+
 #define OMAP7XX_MCBSP1_BASE	0xfffb1000
 #define OMAP7XX_MCBSP2_BASE	0xfffb1800
 
-- 
1.7.2



More information about the Alsa-devel mailing list