[PATCH] powerpc: reduce code duplication in legacy_serial, add UART parent types

Arnd Bergmann arnd at arndb.de
Fri Jan 25 17:17:32 EST 2008


On Thursday 24 January 2008, Paul Gortmaker wrote:
> The legacy_serial was treating each UART parent in a separate code block.
> Rather than continue this trend for the new parent IDs, this condenses
> all (soc, tsi, opb, plus two more new types) into one of_device_id array.
> The new types are wrs,epld-localbus for the Wind River sbc8560, and a
> more generic "simple-bus" as requested by Scott Wood.
> 
> Signed-off-by: Paul Gortmaker <paul.gortmaker at windriver.com>

Looks good to me, thanks!
  
> -       /* First fill our array with SOC ports */
> +       /* Iterate over all the 16550 ports, looking for known parents */
>         for_each_compatible_node(np, "serial", "ns16550") {
> -               struct device_node *soc = of_get_parent(np);
> -               if (soc && !strcmp(soc->type, "soc")) {
> +               struct device_node *parent = of_get_parent(np);
> +               if (!parent)
> +                       continue;
> +               if (of_match_node(parents, parent) != NULL) {

Personally, I prefer to write this as

	if (of_match_node(parents, parent)) {

but that question of coding style is controversial enough that I
stopped insisting on that, so do whichever you like best.

	Arnd <><



More information about the Linuxppc-dev mailing list