[PATCH v14 14/14] scripts/checkpatch: Check DEVICE_NATIVE_ENDIAN

Djordje Todorovic posted 14 patches 2 days, 3 hours ago
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Paolo Bonzini <pbonzini@redhat.com>
[PATCH v14 14/14] scripts/checkpatch: Check DEVICE_NATIVE_ENDIAN
Posted by Djordje Todorovic 2 days, 3 hours ago
Developers should specify endianess explicitly.

Signed-off-by: Djordje Todorovic <djordje.todorovic@htecgroup.com>
---
 scripts/checkpatch.pl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 40b6955c69..dc88fa4da4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3206,6 +3206,10 @@ sub process {
         if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\baio_bh_new\s*\(/) {
 			ERROR("use aio_bh_new_guarded() instead of aio_bh_new() to avoid reentrancy problems\n" . $herecurr);
 		}
+# check for DEVICE_NATIVE_ENDIAN, use explicit endianness instead
+		if ($line =~ /\bDEVICE_NATIVE_ENDIAN\b/) {
+			ERROR("DEVICE_NATIVE_ENDIAN is not allowed, use DEVICE_LITTLE_ENDIAN or DEVICE_BIG_ENDIAN instead\n" . $herecurr);
+		}
 # check for module_init(), use category-specific init macros explicitly please
 		if ($line =~ /^module_init\s*\(/) {
 			ERROR("please use block_init(), type_init() etc. instead of module_init()\n" . $herecurr);
-- 
2.34.1
Re: [PATCH v14 14/14] scripts/checkpatch: Check DEVICE_NATIVE_ENDIAN
Posted by Philippe Mathieu-Daudé 2 days, 1 hour ago
On 18/11/25 09:58, Djordje Todorovic wrote:
> Developers should specify endianess explicitly.
> 
> Signed-off-by: Djordje Todorovic <djordje.todorovic@htecgroup.com>
> ---
>   scripts/checkpatch.pl | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 40b6955c69..dc88fa4da4 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3206,6 +3206,10 @@ sub process {
>           if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\baio_bh_new\s*\(/) {
>   			ERROR("use aio_bh_new_guarded() instead of aio_bh_new() to avoid reentrancy problems\n" . $herecurr);
>   		}
> +# check for DEVICE_NATIVE_ENDIAN, use explicit endianness instead
> +		if ($line =~ /\bDEVICE_NATIVE_ENDIAN\b/) {
> +			ERROR("DEVICE_NATIVE_ENDIAN is not allowed, use DEVICE_LITTLE_ENDIAN or DEVICE_BIG_ENDIAN instead\n" . $herecurr);
> +		}
>   # check for module_init(), use category-specific init macros explicitly please
>   		if ($line =~ /^module_init\s*\(/) {
>   			ERROR("please use block_init(), type_init() etc. instead of module_init()\n" . $herecurr);

Thank you for this patch :)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>