Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 May 2016 11:31:01 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299360 - head/sys/compat/linuxkpi/common/include/asm
Message-ID:  <201605101131.u4ABV1xS095150@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue May 10 11:31:00 2016
New Revision: 299360
URL: https://svnweb.freebsd.org/changeset/base/299360

Log:
  Allow the argument for the cpu_to_xxxp() and xxx_to_cpup() macros to
  point to a constant.
  
  Obtained from:	kmacy @
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/asm/byteorder.h

Modified: head/sys/compat/linuxkpi/common/include/asm/byteorder.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/asm/byteorder.h	Tue May 10 11:18:53 2016	(r299359)
+++ head/sys/compat/linuxkpi/common/include/asm/byteorder.h	Tue May 10 11:31:00 2016	(r299360)
@@ -55,18 +55,18 @@
 #define	be16_to_cpu	be16toh
 #define	__be16_to_cpu	be16toh
 
-#define	cpu_to_le64p(x)	htole64(*((uint64_t *)x))
-#define	le64_to_cpup(x)	le64toh(*((uint64_t *)x))
-#define	cpu_to_le32p(x)	htole32(*((uint32_t *)x))
-#define	le32_to_cpup(x)	le32toh(*((uint32_t *)x))
-#define	cpu_to_le16p(x)	htole16(*((uint16_t *)x))
-#define	le16_to_cpup(x)	le16toh(*((uint16_t *)x))
-#define	cpu_to_be64p(x)	htobe64(*((uint64_t *)x))
-#define	be64_to_cpup(x)	be64toh(*((uint64_t *)x))
-#define	cpu_to_be32p(x)	htobe32(*((uint32_t *)x))
-#define	be32_to_cpup(x)	be32toh(*((uint32_t *)x))
-#define	cpu_to_be16p(x)	htobe16(*((uint16_t *)x))
-#define	be16_to_cpup(x)	be16toh(*((uint16_t *)x))
+#define	cpu_to_le64p(x)	htole64(*((const uint64_t *)(x)))
+#define	le64_to_cpup(x)	le64toh(*((const uint64_t *)(x)))
+#define	cpu_to_le32p(x)	htole32(*((const uint32_t *)(x)))
+#define	le32_to_cpup(x)	le32toh(*((const uint32_t *)(x)))
+#define	cpu_to_le16p(x)	htole16(*((const uint16_t *)(x)))
+#define	le16_to_cpup(x)	le16toh(*((const uint16_t *)(x)))
+#define	cpu_to_be64p(x)	htobe64(*((const uint64_t *)(x)))
+#define	be64_to_cpup(x)	be64toh(*((const uint64_t *)(x)))
+#define	cpu_to_be32p(x)	htobe32(*((const uint32_t *)(x)))
+#define	be32_to_cpup(x)	be32toh(*((const uint32_t *)(x)))
+#define	cpu_to_be16p(x)	htobe16(*((const uint16_t *)(x)))
+#define	be16_to_cpup(x)	be16toh(*((const uint16_t *)(x)))
 
 #define	cpu_to_le64s(x)	do { *((uint64_t *)x) = cpu_to_le64p((x)) } while (0)
 #define	le64_to_cpus(x)	do { *((uint64_t *)x) = le64_to_cpup((x)) } while (0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605101131.u4ABV1xS095150>