Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752008AbcLERrm (ORCPT ); Mon, 5 Dec 2016 12:47:42 -0500 Received: from smtpoutz29.laposte.net ([194.117.213.104]:49454 "EHLO smtp.laposte.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751100AbcLERrl (ORCPT ); Mon, 5 Dec 2016 12:47:41 -0500 Subject: Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields To: Linus Torvalds References: <196dd443-e3c7-2c37-1dd1-bc1d249ea2fb@laposte.net> Cc: zijun_hu , Sasha Levin , Andrew Morton , Linux Kernel Mailing List , Mason , Maxime Coquelin , Harvey Harrison , Borislav Petkov From: Sebastian Frias Message-ID: <1041cd17-5e96-61cf-16b3-82cf4d52101d@laposte.net> Date: Mon, 5 Dec 2016 18:47:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-VR-SrcIP: 92.154.11.170 X-VR-FullState: 0 X-VR-Score: -100 X-VR-Cause-1: gggruggvucftvghtrhhoucdtuddrfeelfedrgeekgdeflecutefuodetggdotefrodftvfcurfhrohhf X-VR-Cause-2: ihhlvgemucfntefrqffuvffgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhs X-VR-Cause-3: ucdlqddutddtmdenucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpefu X-VR-Cause-4: vggsrghsthhirghnucfhrhhirghsuceoshhfkeegsehlrghpohhsthgvrdhnvghtqeenucfkphepledv X-VR-Cause-5: rdduheegrdduuddrudejtdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopegludej X-VR-Cause-6: vddrvdejrddtrddvudegngdpihhnvghtpeelvddrudehgedruddurddujedtpdhmrghilhhfrhhomhep X-VR-Cause-7: shhfkeegsehlrghpohhsthgvrdhnvghtpdhrtghpthhtohepthhorhhvrghlughssehlihhnuhigqdhf X-VR-Cause-8: ohhunhgurghtihhonhdrohhrgh X-VR-AvState: No X-VR-State: 0 X-VR-State: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1370 Lines: 38 On 05/12/16 18:13, Linus Torvalds wrote: > On Mon, Dec 5, 2016 at 5:36 AM, Sebastian Frias wrote: >> Introduce SETBITFIELD(msb, lsb, value) macro to ease dealing with >> continuous bitfields, just as BIT(x) does for single bits. >> >> SETBITFIELD_ULL(msb, lsb, value) macro is also added. > > No. No, no, no. > > Didn't we have this discussion already? Or was that for one of the > other silly naming things? > > That thing doesn't "SET" anything at all. It generates a value, nothing more. > > So the name is completely unacceptable. It follows the convention of > GENMASK, so maybe GENVALUE? > Thanks for your input. I was looking for suggestions on the name, thanks for yours, I will submit a v2 with the name changed as you proposed. > I also absolutely hate the stupid "big bit first" idiocy, but we did > that for GENMASK too, so I guess we're stuck with that retarded model. > Yes, I followed the same convention. > Yes, I understand why it happened - people look at register definition > graphics, and the high bits are to the left. > > But when you then read the documentation, it will still say things > like "bits 9 through 12 contain the value XYZ", because while > individual numbers are written MSB first, we actuall _read_ left to > right. You'd never give a range as "12 to 5", you'd say "5 to 12". > > Linus >