git: 51425bb84689 - stable/13 - virtio: Silence a -Wunused warning

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 21 Nov 2022 13:53:25 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=51425bb84689001515b15e52f713a979b4bf3cdb

commit 51425bb84689001515b15e52f713a979b4bf3cdb
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-11-14 20:07:34 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-11-21 13:48:00 +0000

    virtio: Silence a -Wunused warning
    
    Remove virtio_swap_endian().  htole*() are nops on little-endian
    platforms.  No functional change intended.
    
    MFC after:      1 week
    Reviewed by:    corvink, jhb
    Differential Revision:  https://reviews.freebsd.org/D37298
    
    (cherry picked from commit db494ceb65ef301c8fb48f57b60c4f7a9cfebba5)
---
 sys/dev/virtio/virtio_endian.h | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/sys/dev/virtio/virtio_endian.h b/sys/dev/virtio/virtio_endian.h
index 19d7fcc12079..5c9bc7ec8f79 100644
--- a/sys/dev/virtio/virtio_endian.h
+++ b/sys/dev/virtio/virtio_endian.h
@@ -42,20 +42,10 @@
  * and the Host's (device's) endianness when needed.
  */
 
-static inline bool
-virtio_swap_endian(bool modern)
-{
-#if _BYTE_ORDER == _LITTLE_ENDIAN
-	return (false);
-#else
-	return (modern);
-#endif
-}
-
 static inline uint16_t
 virtio_htog16(bool modern, uint16_t val)
 {
-	if (virtio_swap_endian(modern))
+	if (modern)
 		return (le16toh(val));
 	else
 		return (val);
@@ -64,7 +54,7 @@ virtio_htog16(bool modern, uint16_t val)
 static inline uint16_t
 virtio_gtoh16(bool modern, uint16_t val)
 {
-	if (virtio_swap_endian(modern))
+	if (modern)
 		return (htole16(val));
 	else
 		return (val);
@@ -73,7 +63,7 @@ virtio_gtoh16(bool modern, uint16_t val)
 static inline uint32_t
 virtio_htog32(bool modern, uint32_t val)
 {
-	if (virtio_swap_endian(modern))
+	if (modern)
 		return (le32toh(val));
 	else
 		return (val);
@@ -82,7 +72,7 @@ virtio_htog32(bool modern, uint32_t val)
 static inline uint32_t
 virtio_gtoh32(bool modern, uint32_t val)
 {
-	if (virtio_swap_endian(modern))
+	if (modern)
 		return (htole32(val));
 	else
 		return (val);
@@ -91,7 +81,7 @@ virtio_gtoh32(bool modern, uint32_t val)
 static inline uint64_t
 virtio_htog64(bool modern, uint64_t val)
 {
-	if (virtio_swap_endian(modern))
+	if (modern)
 		return (le64toh(val));
 	else
 		return (val);
@@ -100,7 +90,7 @@ virtio_htog64(bool modern, uint64_t val)
 static inline uint64_t
 virtio_gtoh64(bool modern, uint64_t val)
 {
-	if (virtio_swap_endian(modern))
+	if (modern)
 		return (htole64(val));
 	else
 		return (val);