Re: [PATCH] use cpu_to_le{16,32} instead of __constant_cpu_to_

From: Arnd Bergmann
Date: Wed Sep 02 2020 - 16:40:45 EST


On Thu, Aug 27, 2020 at 11:06 PM Rene Rebe <rene@xxxxxxxxxxxxx> wrote:
>
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index fbb80a043b4f..3de6bf94ccc0 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c

The qla2xxx and qla4xxx changes all look good.

> diff --git a/fs/cifs/smb2status.h b/fs/cifs/smb2status.h
> index 7505056e9580..3d5ef02f1416 100644
> --- a/fs/cifs/smb2status.h
> +++ b/fs/cifs/smb2status.h
> @@ -29,7 +29,7 @@
> * C is set if "customer defined" error, N bit is reserved and MBZ
> */
>
> -#define STATUS_SEVERITY_SUCCESS __constant_cpu_to_le32(0x0000)
> +#define STATUS_SEVERITY_SUCCESS cpu_to_le32(0x0000)
> #define STATUS_SEVERITY_INFORMATIONAL cpu_to_le32(0x0001)
> #define STATUS_SEVERITY_WARNING cpu_to_le32(0x0002)
> #define STATUS_SEVERITY_ERROR cpu_to_le32(0x0003)

This was apparently left over in f5307104e757 ("cifs: don't use
__constant_cpu_to_le32()").

> diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
> index 8ff4d1a1e774..230a5a7fdafa 100644
> --- a/fs/jffs2/nodelist.h
> +++ b/fs/jffs2/nodelist.h
> @@ -59,8 +59,8 @@
> #define cpu_to_je32(x) ((jint32_t){cpu_to_le32(x)})
> #define cpu_to_jemode(x) ((jmode_t){cpu_to_le32(os_to_jffs2_mode(x))})
>
> -#define constant_cpu_to_je16(x) ((jint16_t){__constant_cpu_to_le16(x)})
> -#define constant_cpu_to_je32(x) ((jint32_t){__constant_cpu_to_le32(x)})
> +#define constant_cpu_to_je16(x) ((jint16_t){cpu_to_le16(x)})
> +#define constant_cpu_to_je32(x) ((jint32_t){cpu_to_le32(x)})

This one would break the build, as these have to be constant expressions,
whereas cpu_to_le32() is a compiler builtin or an inline function on some
architectures.

Arnd