diff mbox

[v5,4/8] vringh: introduce vringh_is_little_endian() helper

Message ID 20150423152648.11795.30368.stgit@bahia.local (mailing list archive)
State New, archived
Headers show

Commit Message

Greg Kurz April 23, 2015, 3:26 p.m. UTC
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---
 include/linux/vringh.h |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Thomas Huth April 23, 2015, 7 p.m. UTC | #1
On Thu, 23 Apr 2015 17:26:52 +0200
Greg Kurz <gkurz@linux.vnet.ibm.com> wrote:

> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
>  include/linux/vringh.h |   17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/vringh.h b/include/linux/vringh.h
> index a3fa537..3ed62ef 100644
> --- a/include/linux/vringh.h
> +++ b/include/linux/vringh.h
> @@ -226,33 +226,38 @@ static inline void vringh_notify(struct vringh *vrh)
>  		vrh->notify(vrh);
>  }
>  
> +static inline bool vringh_is_little_endian(const struct vringh *vrh)
> +{
> +	return vrh->little_endian;
> +}
> +
>  static inline u16 vringh16_to_cpu(const struct vringh *vrh, __virtio16 val)
>  {
> -	return __virtio16_to_cpu(vrh->little_endian, val);
> +	return __virtio16_to_cpu(vringh_is_little_endian(vrh), val);
>  }
>  
>  static inline __virtio16 cpu_to_vringh16(const struct vringh *vrh, u16 val)
>  {
> -	return __cpu_to_virtio16(vrh->little_endian, val);
> +	return __cpu_to_virtio16(vringh_is_little_endian(vrh), val);
>  }
>  
>  static inline u32 vringh32_to_cpu(const struct vringh *vrh, __virtio32 val)
>  {
> -	return __virtio32_to_cpu(vrh->little_endian, val);
> +	return __virtio32_to_cpu(vringh_is_little_endian(vrh), val);
>  }
>  
>  static inline __virtio32 cpu_to_vringh32(const struct vringh *vrh, u32 val)
>  {
> -	return __cpu_to_virtio32(vrh->little_endian, val);
> +	return __cpu_to_virtio32(vringh_is_little_endian(vrh), val);
>  }
>  
>  static inline u64 vringh64_to_cpu(const struct vringh *vrh, __virtio64 val)
>  {
> -	return __virtio64_to_cpu(vrh->little_endian, val);
> +	return __virtio64_to_cpu(vringh_is_little_endian(vrh), val);
>  }
>  
>  static inline __virtio64 cpu_to_vringh64(const struct vringh *vrh, u64 val)
>  {
> -	return __cpu_to_virtio64(vrh->little_endian, val);
> +	return __cpu_to_virtio64(vringh_is_little_endian(vrh), val);
>  }
>  #endif /* _LINUX_VRINGH_H */

Reviewed-by: Thomas Huth <thuth@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/vringh.h b/include/linux/vringh.h
index a3fa537..3ed62ef 100644
--- a/include/linux/vringh.h
+++ b/include/linux/vringh.h
@@ -226,33 +226,38 @@  static inline void vringh_notify(struct vringh *vrh)
 		vrh->notify(vrh);
 }
 
+static inline bool vringh_is_little_endian(const struct vringh *vrh)
+{
+	return vrh->little_endian;
+}
+
 static inline u16 vringh16_to_cpu(const struct vringh *vrh, __virtio16 val)
 {
-	return __virtio16_to_cpu(vrh->little_endian, val);
+	return __virtio16_to_cpu(vringh_is_little_endian(vrh), val);
 }
 
 static inline __virtio16 cpu_to_vringh16(const struct vringh *vrh, u16 val)
 {
-	return __cpu_to_virtio16(vrh->little_endian, val);
+	return __cpu_to_virtio16(vringh_is_little_endian(vrh), val);
 }
 
 static inline u32 vringh32_to_cpu(const struct vringh *vrh, __virtio32 val)
 {
-	return __virtio32_to_cpu(vrh->little_endian, val);
+	return __virtio32_to_cpu(vringh_is_little_endian(vrh), val);
 }
 
 static inline __virtio32 cpu_to_vringh32(const struct vringh *vrh, u32 val)
 {
-	return __cpu_to_virtio32(vrh->little_endian, val);
+	return __cpu_to_virtio32(vringh_is_little_endian(vrh), val);
 }
 
 static inline u64 vringh64_to_cpu(const struct vringh *vrh, __virtio64 val)
 {
-	return __virtio64_to_cpu(vrh->little_endian, val);
+	return __virtio64_to_cpu(vringh_is_little_endian(vrh), val);
 }
 
 static inline __virtio64 cpu_to_vringh64(const struct vringh *vrh, u64 val)
 {
-	return __cpu_to_virtio64(vrh->little_endian, val);
+	return __cpu_to_virtio64(vringh_is_little_endian(vrh), val);
 }
 #endif /* _LINUX_VRINGH_H */