git: ae2268efd5f8 - main - LinuxKPI: make bcd.h use libkern
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 Nov 2021 23:15:37 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=ae2268efd5f8aaa6aba27dfc4e34b3225f211901
commit ae2268efd5f8aaa6aba27dfc4e34b3225f211901
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-10-27 17:07:38 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-11-18 23:10:34 +0000
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
---
sys/compat/linuxkpi/common/include/linux/bcd.h | 14 +++-----------
1 file 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 */