[U-Boot] [PATCH 2/3] ventana: define CONFIG_MACH_VENTANA

Stephen Warren
2012-03-02T01:44:33Z

On 03/01/2012 03:55 PM, Troy Kisky wrote:
> On 3/1/2012 2:30 PM, Stephen Warren wrote:
>> On 03/01/2012 02:13 PM, Troy Kisky wrote:
>>> ventana uses board/nvidia/seaboard/seaboard.c
>>> which uses machine_is_ventana.
>>> diff --git a/include/configs/ventana.h b/include/configs/ventana.h
>>> +#define CONFIG_MACH_VENTANA
>> It'd be nice not to have to do this; that header already does:
>>
>> #define CONFIG_MACH_TYPE MACH_TYPE_VENTANA
>>
>> Can't the code key off that? Otherwise, any use of machine_is_xxx() will
>> be very error-prone, since CONFIG_MACH_XXX has to be manually defined,
>> and people will forget.
>>
>
> Before patch 3/3 mach-types.h has
>
> #ifdef CONFIG_MACH_VENTANA
> # ifdef machine_arch_type
> # undef machine_arch_type
> # define machine_arch_type __machine_arch_type
> # else
> # define machine_arch_type MACH_TYPE_VENTANA
> # endif
> # define machine_is_ventana() (machine_arch_type == MACH_TYPE_VENTANA)
> #else
> # define machine_is_ventana() (0)
> #endif
>
> So, it wants CONFIG_MACH_VENTANA defined.

Yes, there's certainly a pre-existing bug that needs to be fixed.

My point is that every board already needs to set CONFIG_MACH_TYPE to
the relevant type. It's quite unexpected that boards will /also/ need to
set e.g. CONFIG_MACH_VENTANA on top of that if they need to call
machine_is_xxx(). That is exactly why this bug exists for Ventana and
needs to be fixed.

So, rather than forcing this unusual requirement on boards, isn't it
possible to fix mach-types.h to use CONFIG_MACH_TYPE rather than
CONFIG_MACH_${machine_name}? It's probably not too hard to run some kind
of script over mach-types.h when importing it from the kernel, or
instead of importing the generated mach-types.h, import the source data
file and write a U-Boot-specific script that generates mach-types.h in a
format more suitable for U-Boot.

--
nvpublic