|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 6/7] xen: Switch to byteswap.h
On 22/10/2021 11:47, Lin Liu wrote:
> Update to use byteswap.h to swap bytes.
>
> No functional chagne.
>
> Signed-off-by: Lin Liu <lin.liu@xxxxxxxxxx>
> ---
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: George Dunlap <george.dunlap@xxxxxxxxxx>
> Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Julien Grall <julien@xxxxxxx>
> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Cc: Wei Liu <wl@xxxxxxx>
> Cc: "Roger Pau Monné" <roger.pau@xxxxxxxxxx>
> ---
> xen/common/bitmap.c | 2 +-
> xen/common/gdbstub.c | 2 +-
> xen/common/libelf/libelf-private.h | 8 ++++----
> xen/common/lz4/defs.h | 2 +-
> xen/common/lzo.c | 2 +-
> xen/common/unlzo.c | 2 +-
> xen/common/xz/private.h | 4 ++--
> xen/drivers/char/ehci-dbgp.c | 2 +-
> xen/include/asm-x86/msi.h | 2 +-
> xen/include/xen/bitmap.h | 2 +-
> xen/include/xen/device_tree.h | 2 +-
> xen/include/xen/unaligned.h | 14 +++++++-------
> xen/lib/divmod.c | 2 +-
> 13 files changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/xen/common/bitmap.c b/xen/common/bitmap.c
> index 7d4551f782..be274ca04a 100644
> --- a/xen/common/bitmap.c
> +++ b/xen/common/bitmap.c
> @@ -9,10 +9,10 @@
> #include <xen/errno.h>
> #include <xen/bitmap.h>
> #include <xen/bitops.h>
> +#include <xen/byteswap.h>
> #include <xen/cpumask.h>
> #include <xen/guest_access.h>
> #include <xen/lib.h>
> -#include <asm/byteorder.h>
>
> /*
> * bitmaps provide an array of bits, implemented using an an
> diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c
> index 848c1f4327..3c8ed52d6b 100644
> --- a/xen/common/gdbstub.c
> +++ b/xen/common/gdbstub.c
> @@ -33,6 +33,7 @@
> /* Resuming after we've stopped used to work, but more through luck
> than any actual intention. It doesn't at the moment. */
>
> +#include <xen/byteswap.h>
> #include <xen/lib.h>
> #include <xen/spinlock.h>
> #include <xen/serial.h>
> @@ -45,7 +46,6 @@
> #include <xen/console.h>
> #include <xen/errno.h>
> #include <xen/delay.h>
> -#include <asm/byteorder.h>
>
> /* Printk isn't particularly safe just after we've trapped to the
> debugger. so avoid it. */
> diff --git a/xen/common/libelf/libelf-private.h
> b/xen/common/libelf/libelf-private.h
> index 47db679966..b7089cb31b 100644
> --- a/xen/common/libelf/libelf-private.h
> +++ b/xen/common/libelf/libelf-private.h
> @@ -17,10 +17,10 @@
>
> #ifdef __XEN__
>
> +#include <xen/byteswap.h>
> #include <xen/lib.h>
> #include <xen/libelf.h>
> #include <xen/softirq.h>
> -#include <asm/byteorder.h>
> #include <public/elfnote.h>
>
> /* we would like to use elf->log_callback but we can't because
> @@ -31,9 +31,9 @@
> printk(fmt, ## args )
>
> #define strtoull(str, end, base) simple_strtoull(str, end, base)
> -#define bswap_16(x) swab16(x)
> -#define bswap_32(x) swab32(x)
> -#define bswap_64(x) swab64(x)
> +#define bswap_16(x) bswap16(x)
> +#define bswap_32(x) bswap32(x)
> +#define bswap_64(x) bswap64(x)
>
> #else /* !__XEN__ */
>
> diff --git a/xen/common/lz4/defs.h b/xen/common/lz4/defs.h
> index 10609f5a53..1ce4476478 100644
> --- a/xen/common/lz4/defs.h
> +++ b/xen/common/lz4/defs.h
> @@ -9,7 +9,7 @@
> */
>
> #ifdef __XEN__
> -#include <asm/byteorder.h>
> +#include <xen/byteswap.h>
> #include <asm/unaligned.h>
> #else
>
> diff --git a/xen/common/lzo.c b/xen/common/lzo.c
> index a87c76dded..17be9675f4 100644
> --- a/xen/common/lzo.c
> +++ b/xen/common/lzo.c
> @@ -96,7 +96,7 @@
>
> #ifdef __XEN__
> #include <xen/lib.h>
> -#include <asm/byteorder.h>
> +#include <xen/byteswap.h>
> #include <asm/unaligned.h>
> #else
> #define get_unaligned_le16(_p) (*(u16 *)(_p))
> diff --git a/xen/common/unlzo.c b/xen/common/unlzo.c
> index 74056778eb..f908d2a61f 100644
> --- a/xen/common/unlzo.c
> +++ b/xen/common/unlzo.c
> @@ -33,7 +33,7 @@
> #include <xen/lzo.h>
>
> #ifdef __XEN__
> -#include <asm/byteorder.h>
> +#include <xen/byteswap.h>
> #include <asm/unaligned.h>
> #else
>
> diff --git a/xen/common/xz/private.h b/xen/common/xz/private.h
> index 511343fcc2..647f9699a7 100644
> --- a/xen/common/xz/private.h
> +++ b/xen/common/xz/private.h
> @@ -12,7 +12,7 @@
>
> #ifdef __XEN__
> #include <xen/kernel.h>
> -#include <asm/byteorder.h>
> +#include <xen/byteswap.h>
> #include <asm/unaligned.h>
> #else
>
> @@ -28,7 +28,7 @@ static inline void put_unaligned_le32(u32 val, void *p)
>
> #endif
>
> -#define get_le32(p) le32_to_cpup((const uint32_t *)(p))
> +#define get_le32(p) le32_to_cpu(*(const uint32_t *)(p))
>
> #define false 0
> #define true 1
> diff --git a/xen/drivers/char/ehci-dbgp.c b/xen/drivers/char/ehci-dbgp.c
> index c893d246de..8412da1b11 100644
> --- a/xen/drivers/char/ehci-dbgp.c
> +++ b/xen/drivers/char/ehci-dbgp.c
> @@ -5,13 +5,13 @@
> * Linux; see the Linux source for authorship and copyrights.
> */
>
> +#include <xen/byteswap.h>
> #include <xen/console.h>
> #include <xen/delay.h>
> #include <xen/errno.h>
> #include <xen/param.h>
> #include <xen/pci.h>
> #include <xen/serial.h>
> -#include <asm/byteorder.h>
> #include <asm/io.h>
> #include <asm/fixmap.h>
> #include <public/physdev.h>
> diff --git a/xen/include/asm-x86/msi.h b/xen/include/asm-x86/msi.h
> index e228b0f3f3..277375183c 100644
> --- a/xen/include/asm-x86/msi.h
> +++ b/xen/include/asm-x86/msi.h
> @@ -1,9 +1,9 @@
> #ifndef __ASM_MSI_H
> #define __ASM_MSI_H
>
> +#include <xen/byteswap.h>
> #include <xen/cpumask.h>
> #include <xen/pci.h>
> -#include <asm/byteorder.h>
> #include <asm/hvm/vmx/vmcs.h>
>
> /*
> diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h
> index e9175ab54a..c44a1cb63c 100644
> --- a/xen/include/xen/bitmap.h
> +++ b/xen/include/xen/bitmap.h
> @@ -229,7 +229,7 @@ static inline int bitmap_weight(const unsigned long *src,
> int nbits)
> return __bitmap_weight(src, nbits);
> }
>
> -#include <asm/byteorder.h>
> +#include <xen/byteswap.h>
>
> #ifdef __LITTLE_ENDIAN
> #define BITMAP_MEM_ALIGNMENT 8
> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
> index fd6cd00b43..4921e6b142 100644
> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -10,10 +10,10 @@
> #ifndef __XEN_DEVICE_TREE_H__
> #define __XEN_DEVICE_TREE_H__
>
> -#include <asm/byteorder.h>
> #include <asm/device.h>
> #include <public/xen.h>
> #include <public/device_tree_defs.h>
> +#include <xen/byteswap.h>
> #include <xen/kernel.h>
> #include <xen/string.h>
> #include <xen/types.h>
> diff --git a/xen/include/xen/unaligned.h b/xen/include/xen/unaligned.h
> index 0a2b16d05d..8a9ec8a0ac 100644
> --- a/xen/include/xen/unaligned.h
> +++ b/xen/include/xen/unaligned.h
> @@ -11,8 +11,8 @@
> #define __XEN_UNALIGNED_H__
>
> #ifdef __XEN__
> +#include <xen/byteswap.h>
> #include <xen/types.h>
> -#include <asm/byteorder.h>
> #endif
>
> #define get_unaligned(p) (*(p))
> @@ -20,7 +20,7 @@
>
> static inline uint16_t get_unaligned_be16(const void *p)
> {
> - return be16_to_cpup(p);
> + return be16_to_cpu(*(uint16_t*)p);
Hmm - this missed one of my pieces of internal feedback.
*(const uint16_t *)p
to get correct style and avoid casting away const.
Also, the put functions what to drop the __force and use typecasting
like this.
I can fix up on commit if there are no other concerns with the series.
~Andrew
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |