aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2021-10-27 17:07:38 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2021-11-18 23:10:34 +0000
commitae2268efd5f8aaa6aba27dfc4e34b3225f211901 (patch)
tree3e9b3361dd95b0225c22b698188af48616c844c8
parentf4bf849bb894f4934b8df6c04a820dfa52e9576c (diff)
downloadsrc-ae2268efd5f8aaa6aba27dfc4e34b3225f211901.tar.gz
src-ae2268efd5f8aaa6aba27dfc4e34b3225f211901.zip
LinuxKPI: make bcd.h use libkern
Rather than having code to re-define bcd2bin() for the LinuxKPI make sure libkern.h is always included before the LinuxKPI version. Then only re-define our local LinuxKPI implementation. [1] From the argument truncating wrapper call the libkern version. If we change our libkern implementation in the future we can save us the remainder of the hassle. [2] Given I need this to MFC, which I am not sure we can with libkern, commit this intermediate step. Suggested by: Johannes Berg (johannes sipsolutions.net) [1] Suggested by: ian [2] Sponsored by: The FreeBSD Foundation MFC after: 3 days X-MFC with: 548ada00e54a9e7745d041b1ec7f68f3bd493365 Differential Revision: https://reviews.freebsd.org/D32695
-rw-r--r--sys/compat/linuxkpi/common/include/linux/bcd.h14
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/bcd.h b/sys/compat/linuxkpi/common/include/linux/bcd.h
index 57fcb4c6bd98..8a40da1a330b 100644
--- a/sys/compat/linuxkpi/common/include/linux/bcd.h
+++ b/sys/compat/linuxkpi/common/include/linux/bcd.h
@@ -31,23 +31,15 @@
#define _LINUXKPI_LINUX_BCD_H
#include <sys/types.h>
+#include <sys/libkern.h>
-/*
- * We could use libkern, but we need the argument truncating.
- *
- * This leaves us with a duplicate symbol with conflicting types
- * so we cannot simply re-define as libkern.h gets included in
- * too many places directly or indirectly. This means for now
- * drivers will have to be adjusted to call linuxkpi_bcd2bin().
- */
+/* Compared to the libkern version this one truncates the argument. */
static inline uint8_t linuxkpi_bcd2bin(uint8_t x)
{
- return (x & 0x0f) + (x >> 4) * 10;
+ return (bcd2bin(x));
}
-#if 0
#define bcd2bin(_x) linuxkpi_bcd2bin(_x)
-#endif
#endif /* _LINUXKPI_LINUX_BCD_H */