
Dear Haiying Wang,
In message 1242837043-8243-11-git-send-email-Haiying.Wang@freescale.com you wrote:
Signed-off-by: Haiying Wang Haiying.Wang@freescale.com
cpu/mpc85xx/cpu.c | 6 +++++ cpu/mpc85xx/fdt.c | 4 ++- drivers/qe/uec.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 74 insertions(+), 2 deletions(-)
diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c index b812d88..eb2aeec 100644 --- a/cpu/mpc85xx/cpu.c +++ b/cpu/mpc85xx/cpu.c @@ -399,6 +399,12 @@ int cpu_eth_init(bd_t *bis) #if defined(CONFIG_UEC_ETH6) uec_initialize(5); #endif +#if defined(CONFIG_UEC_ETH7)
- uec_initialize(6);
+#endif +#if defined(CONFIG_UEC_ETH8)
- uec_initialize(7);
+#endif
This cries for using a loop instead. There are several places that contain similar code - would it make sense to initialize a variable with a bit files of used interfaces, so we can do this in a simple runtime loop?
#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
- defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
- defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) ||\
- defined(CONFIG_HAS_ETH4) || defined(CONFIG_HAS_ETH5) ||\
- defined(CONFIG_HAS_ETH6) || defined(CONFIG_HAS_ETH7) fdt_fixup_ethernet(blob);
Ditto here.
#ifdef CONFIG_UEC_ETH6 uec_info = ð6_uec_info; #endif
- } else if (index == 6) {
+#ifdef CONFIG_UEC_ETH7
uec_info = ð7_uec_info;
+#endif
- } else if (index == 7) {
+#ifdef CONFIG_UEC_ETH8
uec_info = ð8_uec_info;
+#endif
And here again.
Best regards,
Wolfgang Denk