From nobody Thu Nov 18 23:15:37 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2281D18A0BAB; Thu, 18 Nov 2021 23:15:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HwFyd67Kjz4gZP; Thu, 18 Nov 2021 23:15:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4B981D9D4; Thu, 18 Nov 2021 23:15:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AINFbtW006133; Thu, 18 Nov 2021 23:15:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AINFbG0006132; Thu, 18 Nov 2021 23:15:37 GMT (envelope-from git) Date: Thu, 18 Nov 2021 23:15:37 GMT Message-Id: <202111182315.1AINFbG0006132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ae2268efd5f8 - main - LinuxKPI: make bcd.h use libkern List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ae2268efd5f8aaa6aba27dfc4e34b3225f211901 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ae2268efd5f8aaa6aba27dfc4e34b3225f211901 commit ae2268efd5f8aaa6aba27dfc4e34b3225f211901 Author: Bjoern A. Zeeb AuthorDate: 2021-10-27 17:07:38 +0000 Commit: Bjoern A. Zeeb 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 +#include -/* - * 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 */