The branch main has been updated by markj:

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

commit db494ceb65ef301c8fb48f57b60c4f7a9cfebba5
Author:     Mark Johnston <[email protected]>
AuthorDate: 2022-11-14 20:07:34 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2022-11-14 20:07:34 +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
---
 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);

Reply via email to