Re: [PATCH 2/2] Kbuild: always define endianess in kconfig.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 2, 2018 at 5:31 PM, Masahiro Yamada
<yamada.masahiro@xxxxxxxxxxxxx> wrote:
> 2018-02-03 0:40 GMT+09:00 Arnd Bergmann <arnd@xxxxxxxx>:

>> ---
>>  include/linux/kconfig.h | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
>> index fec5076eda91..cc8fa109cfa3 100644
>> --- a/include/linux/kconfig.h
>> +++ b/include/linux/kconfig.h
>> @@ -4,6 +4,12 @@
>>
>>  #include <generated/autoconf.h>
>>
>> +#ifdef CONFIG_CPU_BIG_ENDIAN
>> +#define __BIG_ENDIAN 4321
>> +#else
>> +#define __LITTLE_ENDIAN 1234
>> +#endif
>> +
>>  #define __ARG_PLACEHOLDER_1 0,
>>  #define __take_second_arg(__ignored, val, ...) val
>>
>> --
>> 2.9.0
>>
>
> If all architectures define
> CONFIG_CPU_BIG_ENDIAN or CONFIG_CPU_LITTLE_ENDIAN,
> is it possible to use this for endian test?
>
> i.e.
>
> Is it possible to replace like this?
>    #ifdef __BIG_ENDIAN       ->  #ifdef CONFIG_CPU_BIG_ENDIAN
>
>    #ifdef __LITTLE_ENDIAN     -> #ifdef CONFIG_CPU_LITTLE_ENDIAN

I believe we don't always define CONFIG_CPU_LITTLE_ENDIAN,
but it would work in principle. The main issue here is changing so
many files:

$ git grep -wl '__\(BIG\|LITTLE\)_ENDIAN' | wc -l
418

$ git grep -wl 'CONFIG_CPU_\(BIG\|LITTLE\)_ENDIAN' | wc -l
145

      Arnd



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]