[U-Boot-Users] [PATCH] Added support for multiple serial for MPC8XX
Wolfgang Denk
wd at denx.de
Tue Jun 5 15:53:07 CEST 2007
Hi Stefano,
in message <200706051447.35025.sbabic at 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
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Mandrell: "You know what I think?"
Doctor: "Ah, ah that's a catch question. With a brain your size you
don't think, right?"
- Dr. Who
More information about the U-Boot
mailing list