[PATCH 2/7] powerpc: allow localbus compatible serial ports for console device
Paul Gortmaker
paul.gortmaker at windriver.com
Tue Jan 8 02:33:21 EST 2008
Arnd Bergmann wrote:
> On Monday 07 January 2008, Paul Gortmaker wrote:
>
>> + /* Next, fill our array with any localbus serial ports */
>> + for_each_compatible_node(np, "serial", "ns16550") {
>> + struct device_node *lbs = of_get_parent(np);
>> + if (lbs && of_device_is_compatible(lbs, "localbus")) {
>> + index = add_legacy_soc_port(np, np);
>> + if (index >= 0 && np == stdout)
>> + legacy_serial_console = index;
>> + }
>> + of_node_put(lbs);
>> + }
>> +
>>
>
> This is getting a little silly. Can't you finally unify the code
> so it checks for any 8250/16450/16550 on any soc/isa/tsi-bridge/opb/localbus?
>
I'd thought about doing that, but there are slight differences
in each test. To remain 100% faithful to the original implementation
you'd have to have a table or similar that had these various fields
and loop over that -- something like:
compat parent pnt-compat pnt-type add-fcn
---------------------------------------------------------------
ns16550 NULL NULL soc add_legacy_soc_port
NULL isa NULL NULL add_legacy_isa_port
ns16550 NULL NULL tsi-bridge add_legacy_soc_port
ns16550 NULL ibm,opb opb add_legacy_soc_port
ns16550 NULL localbus NULL add_legacy_soc_port
But, if we were willing to move away from checks based on
the parent->type and stick with parent->compat, then the
unification would be a lot cleaner and easier to implement.
(we could also leave the ISA one out as an oddball, and then
not have to carry an add-fcn either).
Paul.
> Arnd <><
>
More information about the Linuxppc-dev
mailing list