Skip to contentSkip to conversation

ARM: mmp: encode device id into {pxa168, pxa910, mmp2}_add_*()

PATCH New Eric Miao 2 participants 2 messages Nov 15, 2011

Subsystems (3)
lore
Share & tools
lore

Eric Miao

author
#0 lore raw

PATCH 1/1 ARM: mmp: encode device id into {pxa168, pxa910, mmp2}_add_*()

Use

  pxa168_add_uart1();

instead of

  pxa168_add_uart(1);

to further eliminate the parameter passing to the function, which could be error prone, and also making the code a bit simpler and faster.

Idea came from Russell King.

Cc Russell King <[email protected]>
Cc Haojian Zhuang <[email protected]>
---
 arch/arm/mach-mmp/aspenite.c            |    6 +-
 arch/arm/mach-mmp/avengers_lite.c       |    2 +-
 arch/arm/mach-mmp/brownstone.c          |   10 ++--
 arch/arm/mach-mmp/flint.c               |    4 +-
 arch/arm/mach-mmp/gplugd.c              |    6 +-
 arch/arm/mach-mmp/include/mach/mmp2.h   |   70 +++++++++++++-----------------
 arch/arm/mach-mmp/include/mach/pxa168.h |   72 +++++++++++-------------------
 arch/arm/mach-mmp/include/mach/pxa910.h |   51 ++++++++--------------
 arch/arm/mach-mmp/jasper.c              |    8 ++--
 arch/arm/mach-mmp/tavorevb.c            |    2 +-
 arch/arm/mach-mmp/teton_bga.c           |    4 +-
 arch/arm/mach-mmp/ttc_dkb.c             |    4 +-
 12 files changed, 100 insertions(+), 139 deletions(-)
arch/arm/mach-mmp/aspenite.c +3 -3
index 7a60bbb..bc5f139 100644
@@ -226,9 +226,9 @@ static void __init common_init(void)
 	mfp_config(ARRAY_AND_SIZE(common_pin_config));
 
 	/* on-chip devices */
-	pxa168_add_uart(1);
-	pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info));
-	pxa168_add_ssp(1);
+	pxa168_add_uart1();
+	pxa168_add_twsi1(NULL, aspenite_i2c_info);
+	pxa168_add_ssp1();
 	pxa168_add_nand(&aspenite_nand_info);
 	pxa168_add_fb(&aspenite_lcd_info);
 	pxa168_add_keypad(&aspenite_keypad_info);
arch/arm/mach-mmp/avengers_lite.c +1 -1
index 39f0878..f29551b 100644
@@ -37,7 +37,7 @@ static void __init avengers_lite_init(void)
 	mfp_config(ARRAY_AND_SIZE(avengers_lite_pin_config_V16F));
 
 	/* on-chip devices */
-	pxa168_add_uart(2);
+	pxa168_add_uart2();
 }
 
 MACHINE_START(AVENGERS_LITE, "PXA168 Avengers lite Development Platform")
arch/arm/mach-mmp/brownstone.c +5 -5
index 983cfb1..c81bec1 100644
@@ -200,11 +200,11 @@ static void __init brownstone_init(void)
 	mfp_config(ARRAY_AND_SIZE(brownstone_pin_config));
 
 	/* on-chip devices */
-	mmp2_add_uart(1);
-	mmp2_add_uart(3);
-	mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
-	mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
-	mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */
+	mmp2_add_uart1();
+	mmp2_add_uart3();
+	mmp2_add_twsi1(NULL, brownstone_twsi1_info);
+	mmp2_add_sdhost0(&mmp2_sdh_platdata_mmc0); /* SD/MMC */
+	mmp2_add_sdhost2(&mmp2_sdh_platdata_mmc2); /* eMMC */
 	mmp2_add_asram(&mmp2_asram_platdata);
 	mmp2_add_isram(&mmp2_isram_platdata);
 
arch/arm/mach-mmp/flint.c +2 -2
index c4fd806..07feb63 100644
@@ -108,8 +108,8 @@ static void __init flint_init(void)
 	mfp_config(ARRAY_AND_SIZE(flint_pin_config));
 
 	/* on-chip devices */
-	mmp2_add_uart(1);
-	mmp2_add_uart(2);
+	mmp2_add_uart1();
+	mmp2_add_uart2();
 
 	/* off-chip devices */
 	platform_device_register(&smc91x_device);
arch/arm/mach-mmp/gplugd.c +3 -3
index 4665767..5507335 100644
@@ -181,9 +181,9 @@ static void __init gplugd_init(void)
 	select_disp_freq();
 
 	/* on-chip devices */
-	pxa168_add_uart(3);
-	pxa168_add_ssp(1);
-	pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
+	pxa168_add_uart3();
+	pxa168_add_ssp1();
+	pxa168_add_twsi0(NULL, gplugd_i2c_board_info);
 
 	pxa168_add_eth(&gplugd_eth_platform_data);
 }
arch/arm/mach-mmp/include/mach/mmp2.h +31 -39

99 lines not on this page · raw message

arch/arm/mach-mmp/include/mach/pxa168.h +27 -45

106 lines not on this page · raw message

arch/arm/mach-mmp/include/mach/pxa910.h +19 -32

81 lines not on this page · raw message

arch/arm/mach-mmp/jasper.c +4 -4
index 8bfac66..8e48ed2 100644
@@ -161,10 +161,10 @@ static void __init jasper_init(void)
 	mfp_config(ARRAY_AND_SIZE(jasper_pin_config));
 
 	/* on-chip devices */
-	mmp2_add_uart(1);
-	mmp2_add_uart(3);
-	mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info));
-	mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
+	mmp2_add_uart1();
+	mmp2_add_uart3();
+	mmp2_add_twsi1(NULL, jasper_twsi1_info);
+	mmp2_add_sdhost0(&mmp2_sdh_platdata_mmc0); /* SD/MMC */
 
 	regulator_has_full_constraints();
 }
arch/arm/mach-mmp/tavorevb.c +1 -1
index eb5be87..5cdced9 100644
@@ -92,7 +92,7 @@ static void __init tavorevb_init(void)
 	mfp_config(ARRAY_AND_SIZE(tavorevb_pin_config));
 
 	/* on-chip devices */
-	pxa910_add_uart(1);
+	pxa910_add_uart1();
 
 	/* off-chip devices */
 	platform_device_register(&smc91x_device);
arch/arm/mach-mmp/teton_bga.c +2 -2
index bbe4727..0066634 100644
@@ -75,9 +75,9 @@ static void __init teton_bga_init(void)
 	mfp_config(ARRAY_AND_SIZE(teton_bga_pin_config));
 
 	/* on-chip devices */
-	pxa168_add_uart(1);
+	pxa168_add_uart1();
 	pxa168_add_keypad(&teton_bga_keypad_info);
-	pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
+	pxa168_add_twsi0(NULL, teton_bga_i2c_info);
 }
 
 MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform")
arch/arm/mach-mmp/ttc_dkb.c +2 -2
index 176515a..e5e073a 100644
@@ -146,10 +146,10 @@ static void __init ttc_dkb_init(void)
 	mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
 
 	/* on-chip devices */
-	pxa910_add_uart(1);
+	pxa910_add_uart1();
 
 	/* off-chip devices */
-	pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
+	pxa910_add_twsi0(NULL, ttc_dkb_i2c_info);
 	platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
 }
 
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 ARM: mmp: encode device id into {pxa168, pxa910, mmp2}_add_*()

Quoted 30 lines · Eric Miao

Use

?pxa168_add_uart1();

instead of

?pxa168_add_uart(1);

to further eliminate the parameter passing to the function, which could be error prone, and also making the code a bit simpler and faster.

Idea came from Russell King.

Cc Russell King <[email protected]>
Cc Haojian Zhuang <[email protected]>

---

?arch/arm/mach-mmp/aspenite.c ? ? ? ? ? ?| ? ?6 +-
?arch/arm/mach-mmp/avengers_lite.c ? ? ? | ? ?2 +-
?arch/arm/mach-mmp/brownstone.c ? ? ? ? ?| ? 10 ++--
?arch/arm/mach-mmp/flint.c ? ? ? ? ? ? ? | ? ?4 +-
?arch/arm/mach-mmp/gplugd.c ? ? ? ? ? ? ?| ? ?6 +-
?arch/arm/mach-mmp/include/mach/mmp2.h ? | ? 70 +++++++++++++-----------------
?arch/arm/mach-mmp/include/mach/pxa168.h | ? 72 +++++++++++-------------------
?arch/arm/mach-mmp/include/mach/pxa910.h | ? 51 ++++++++--------------
?arch/arm/mach-mmp/jasper.c ? ? ? ? ? ? ?| ? ?8 ++--
?arch/arm/mach-mmp/tavorevb.c ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/teton_bga.c ? ? ? ? ? | ? ?4 +-
?arch/arm/mach-mmp/ttc_dkb.c ? ? ? ? ? ? | ? ?4 +-
Quoted 2 lines

?12 files changed, 100 insertions(+), 139 deletions(-)