Date: Mon, 26 Jun 2023 12:08:47 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: d5881640664c - stable/13 - LinuxKPI: add put_unaligned_le16() and get_unaligned_be64() Message-ID: <202306261208.35QC8lMc083306@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=d5881640664cf8740b48888397b90eae32f4fd01 commit d5881640664cf8740b48888397b90eae32f4fd01 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2023-05-20 00:52:27 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2023-06-26 09:17:32 +0000 LinuxKPI: add put_unaligned_le16() and get_unaligned_be64() Add the two new functions needed by wireless drivers by the same implementation pattern we did for different sizes. Sponsored by: The FreeBSD Foundation Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40174 (cherry picked from commit ae1e336e05171b80123bf6db7457f19c174accc4) --- sys/compat/linuxkpi/common/include/asm/unaligned.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/asm/unaligned.h b/sys/compat/linuxkpi/common/include/asm/unaligned.h index 8a001ec38c3d..c13089b2c5f4 100644 --- a/sys/compat/linuxkpi/common/include/asm/unaligned.h +++ b/sys/compat/linuxkpi/common/include/asm/unaligned.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2020 The FreeBSD Foundation + * Copyright (c) 2020,2023 The FreeBSD Foundation * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. @@ -50,6 +50,15 @@ get_unaligned_le32(const void *p) return (le32_to_cpup((const __le32 *)p)); } +static __inline void +put_unaligned_le16(__le16 v, void *p) +{ + __le16 x; + + x = cpu_to_le16(v); + memcpy(p, &x, sizeof(x)); +} + static __inline void put_unaligned_le32(__le32 v, void *p) { @@ -82,4 +91,11 @@ get_unaligned_be32(const void *p) return (be32_to_cpup((const __be32 *)p)); } +static __inline uint64_t +get_unaligned_be64(const void *p) +{ + + return (be64_to_cpup((const __be64 *)p)); +} + #endif /* _LINUXKPI_ASM_UNALIGNED_H */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202306261208.35QC8lMc083306>