diff mbox series

[u-boot-marvell,01/11] include/linux/byteorder: Fix compilation of __constant_cpu_to_be32()

Message ID 20211103020244.25428-2-kabel@kernel.org
State Superseded
Delegated to: Stefan Roese
Headers show
Series Some mvebu comphy + mox + fdt_support changes | expand

Commit Message

Marek Behún Nov. 3, 2021, 2:02 a.m. UTC
From: Pali Rohár <pali@kernel.org>

The macro __constant_cpu_to_be32() uses ___constant_swab32(), which for
some reason is not defined and causes the following error during
compilation:

  include/linux/byteorder/little_endian.h:28:52: warning:
    implicit declaration of function ‘___constant_swab32’;
    did you mean ‘__builtin_bswap32’? [-Wimplicit-function-declaration]
   #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))

Declare all ___constant_swabXX() macros.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
 include/linux/byteorder/swab.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Stefan Roese Nov. 12, 2021, 12:40 p.m. UTC | #1
On 11/3/21 03:02, Marek Behún wrote:
> From: Pali Rohár <pali@kernel.org>
> 
> The macro __constant_cpu_to_be32() uses ___constant_swab32(), which for
> some reason is not defined and causes the following error during
> compilation:
> 
>    include/linux/byteorder/little_endian.h:28:52: warning:
>      implicit declaration of function ‘___constant_swab32’;
>      did you mean ‘__builtin_bswap32’? [-Wimplicit-function-declaration]
>     #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
> 
> Declare all ___constant_swabXX() macros.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Signed-off-by: Marek Behún <marek.behun@nic.cz>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   include/linux/byteorder/swab.h | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h
> index 4334fa77e3..5efc252acf 100644
> --- a/include/linux/byteorder/swab.h
> +++ b/include/linux/byteorder/swab.h
> @@ -39,6 +39,10 @@
>   		(__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
>   		(__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
>   
> +#define ___constant_swab16(x) ___swab16(x)
> +#define ___constant_swab32(x) ___swab32(x)
> +#define ___constant_swab64(x) ___swab64(x)
> +
>   /*
>    * provide defaults when no architecture-specific optimization is detected
>    */
> 

Viele Grüße,
Stefan Roese
diff mbox series

Patch

diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h
index 4334fa77e3..5efc252acf 100644
--- a/include/linux/byteorder/swab.h
+++ b/include/linux/byteorder/swab.h
@@ -39,6 +39,10 @@ 
 		(__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
 		(__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
 
+#define ___constant_swab16(x) ___swab16(x)
+#define ___constant_swab32(x) ___swab32(x)
+#define ___constant_swab64(x) ___swab64(x)
+
 /*
  * provide defaults when no architecture-specific optimization is detected
  */