Re: [PATCH] ARM: ux500: check platform in ux500_l2x0_init

From: Linus Walleij
Date: Wed Jun 26 2013 - 15:46:15 EST


On Wed, Jun 26, 2013 at 3:30 AM, Olof Johansson <olof@xxxxxxxxx> wrote:

> Add compatible checks for ux500. This should probably be moved to generic
> DT-based probing whenever DT is populated instead, but until then at
> least don't panic all non-ux500 multiplatform machines.
>
> Signed-off-by: Olof Johansson <olof@xxxxxxxxx>

> + /* Ick. I wish there was a single compatible value to compare for,
> + * but there isn't.
> + */
> + if (!of_machine_is_compatible("st-ericsson,u8500") &&
> + !of_machine_is_compatible("st-ericsson,u8540") &&
> + !of_machine_is_compatible("st-ericsson,u9500") &&
> + !of_machine_is_compatible("st-ericsson,u8540"))
> + return -ENODEV;

This is checking u8540 twice and does not account for snowball.

With new platforms coming we cannot just line up all possible
compat strings like this, we need to rely on the cpu_is* macro
to be reporting something sane, and I think it does.

What about just doing this: