
Hi Stefano,
in message 200706051447.35025.sbabic@denx.de you wrote:
First, your SIgned-off-by: line is missing.
Second:
#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
- return &serial_smc_device;
+#if (CONFIG_CONS_INDEX==2)
- return &serial_smc2_device;
+#else
- return &serial_smc1_device;
+#endif #elif defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \ || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
- return &serial_scc_device;
+#if defined(CONFIG_CONS_INDEX) +#if (CONFIG_CONS_INDEX==3)
- return &serial_scc1_device;
+#endif +#if (CONFIG_CONS_INDEX==4)
- return &serial_scc2_device;
+#endif +#if (CONFIG_CONS_INDEX==5)
- return &serial_scc3_device;
+#endif +#if (CONFIG_CONS_INDEX==6)
- return &serial_scc4_device;
+#endif +#else +#error "Bad CONFIG_CONS_INDEX." +#endif
I really dislike this mess of #ifdef's
Maybe we can use something more readable like
#define CONFIG_CONS_DEV smc1 or #define CONFIG_CONS_DEV scc3
in the board config file, and then add a little CPP trickery like that to common/serial.c:
#define MK_DEV(dev) _MK_DEV(dev) #define _MK_DEV(dev) serial_ ## dev ## _device
Then we can replace this whole block of unreadble code by something like
return MK_DEV(CONFIG_CONS_DEV);
What do you think?
Best regards,
Wolfgang Denk