[U-Boot] [PATCH 1/7] fdt_support: Add multi-serial support for stdout fixup
Anton Vorontsov
avorontsov at ru.mvista.com
Wed Sep 16 17:17:04 CEST 2009
Thanks for review Jerry.
On Wed, Sep 16, 2009 at 08:59:14AM -0400, Jerry Van Baren wrote:
[...]
> Below is a *HAND MODIFIED* (i.e. probably broken) edit of Anton's
> patch reflecting my thoughts.
>
> I'll leave it up to Anton and Kumar... I'm OK with Anton's original
> patch and you have my
> Acked-by: Gerald Van Baren <vanbaren at cideas.com>
> or you can verify and adopt my proposed change (more work :-() and add a
> Signed-off-by: Gerald Van Baren <vanbaren at cideas.com>
> to Anton's s-o-b.
>
> Thanks,
> gvb
> ------------------------------------------------------------------------
[...]
> #ifdef CONFIG_OF_STDOUT_VIA_ALIAS
> +
> +#ifdef CONFIG_SERIAL_MULTI
> +static void fdt_fill_sername(char *sername, size_t maxlen)
> +{
> + const char *outname = stdio_devices[stdout]->name;
> +
> + if (strcmp(outname, "serial") > 0)
> + strncpy(sername, outname, maxlen);
(1)
> + /* eserial? */
> + if (strcmp(outname + 1, "serial") > 0)
> + strncpy(sername, outname + 1, maxlen);
> +}
> +#else
> +static inline void fdt_fill_sername(char *sername, size_t maxlen)
> +{
> + sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1);
This case is also needed with multiserial, since 'serial' is
what you get by default, and (1) doesn't account 'serial' name.
So, we can either leave the patch as, or duplicate some code
for multiserial case, or do this ugly thing (I quite dislike
#ifdef like this, i.e. inside the code flow):
static void fdt_fill_sername(char *sername, size_t maxlen)
{
#ifdef CONFIG_SERIAL_MULTI
const char *outname = stdio_devices[stdout]->name;
if (strcmp(outname, "serial") > 0)
strncpy(sername, outname, maxlen);
/* eserial? */
if (strcmp(outname + 1, "serial") > 0)
strncpy(sername, outname + 1, maxlen);
#endif
if (!sername[0])
sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1);
}
Though, I'll do whatever you prefer.
Thanks,
--
Anton Vorontsov
email: cbouatmailru at gmail.com
irc://irc.freenode.net/bd2
More information about the U-Boot
mailing list