From nobody Mon Oct 25 21:33:14 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 8EFF2182EF76; Mon, 25 Oct 2021 21:33:21 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdSqj3NlQz3mt3; Mon, 25 Oct 2021 21:33:21 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 27D21917C; Mon, 25 Oct 2021 21:33:21 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id EF5408D4A179; Mon, 25 Oct 2021 21:33:18 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 3D538E70848; Mon, 25 Oct 2021 21:33:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id IRb4mHUZiMb1; Mon, 25 Oct 2021 21:33:16 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id D569DE70847; Mon, 25 Oct 2021 21:33:15 +0000 (UTC) Date: Mon, 25 Oct 2021 21:33:14 +0000 (UTC) From: "Bjoern A. Zeeb" To: Ian Lepore cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 548ada00e54a - main - LinuxKPI: add bcd.h In-Reply-To: <845d99d8f7c189418b36a832017518c493af729b.camel@freebsd.org> Message-ID: References: <202110252023.19PKNSRO031788@gitrepo.freebsd.org> <832a2403091df094d6f7ab471aef0694adebb939.camel@freebsd.org> <845d99d8f7c189418b36a832017518c493af729b.camel@freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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: MULTIPART/MIXED; BOUNDARY="0-1547604112-1635197595=:68830" X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1547604112-1635197595=:68830 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Mon, 25 Oct 2021, Ian Lepore wrote: > On Mon, 2021-10-25 at 21:17 +0000, Bjoern A. Zeeb wrote: >> On Mon, 25 Oct 2021, Ian Lepore wrote: >> >>> On Mon, 2021-10-25 at 20:23 +0000, Bjoern A. Zeeb wrote: >>>> The branch main has been updated by bz: >>>> >>>> URL: >>>> https://cgit.FreeBSD.org/src/commit/?id=548ada00e54a9e7745d041b1ec7f68f3bd493365 >>>> >>>> commit 548ada00e54a9e7745d041b1ec7f68f3bd493365 >>>> Author:     Bjoern A. Zeeb >>>> AuthorDate: 2021-10-25 18:14:08 +0000 >>>> Commit:     Bjoern A. Zeeb >>>> CommitDate: 2021-10-25 20:20:53 +0000 >>>> >>>>     LinuxKPI: add bcd.h >>>>     >>>>     Add bcd2bin() as linuxkpi_bcd2bin().  Libkern does provide a >>>> bcd2bin() >>>> >>>> [...] >>>> + * We could use libkern, but we need the argument truncating. >>>> + * >>> >>> >>> What does that mean, "we need the argument truncating"? >> >> This one takes an uint8_t as argument. >> >> If my memory serves me correctly the Linux driver code through >> macros passes in larger values 0xabcdxx which are truncated by >> the argument type. >> >> We take an int and then have a KASSERT() which doesn't work so well >> for these larger values. >> >> /bz >> >> -- >> Bjoern A. Zeeb                                                     >> r15:7 > > I had forgotten that we added a KASSERT a few years ago. But we don't > expect linux to be relying on getting bad answers in response to bad > inputs, do we? > > I wonder why we can't just change the prototype of our inline function > from int to uint8_t and remove the >= 0 part from the assert? I wonder why the int arguments were there the first time now that you made me look again. Be my guest to change it and I'll happily reduce this file to the #include line. /bz -- Bjoern A. Zeeb r15:7 --0-1547604112-1635197595=:68830--