[PATCH 2/7] powerpc: allow localbus compatible serial ports for console device
Arnd Bergmann
arnd at arndb.de
Fri Jan 18 09:35:48 EST 2008
On Thursday 17 January 2008, Paul Gortmaker wrote:
> +struct serial_parent {
> + char *type;
> + char *compat;
> +};
> +
> +static struct __init serial_parent parents[] = {
> + {"soc", NULL},
> + {"tsi-bridge", NULL},
> + {"opb", "ibm,opb"},
> + {NULL, "wrs,epld-localbus"},
> +};
> +
> +#define NUM_PARENTS sizeof(parents)/sizeof(struct serial_parent)
<snip>
> + for (sp = parents; sp != end; sp++) {
> + for_each_compatible_node(np, "serial", "ns16550") {
> + struct device_node *parent = of_get_parent(np);
> + int p_type_ok = 0, p_is_compat = 0;
> + if (!parent)
> + continue;
> + if (sp->type && !strcmp(parent->type, sp->type))
> + p_type_ok = 1;
> + if (sp->compat && of_device_is_compatible(parent,
> sp->compat)) + p_is_compat = 1;
> + if (p_type_ok || p_is_compat) {
> + index = add_legacy_soc_port(np, np);
> + if (index >= 0 && np == stdout)
> + legacy_serial_console = index;
> + }
> + of_node_put(parent);
I think you can express that more densely using struct of_device_id
and of_match_node(). Otherwise, it looks good to me, thanks a lot
for following up on my suggestion!
Arnd <><
More information about the Linuxppc-dev
mailing list