From: Tom Rini Date: Thu, 30 Apr 2015 09:30:39 -0400 Subject: [U-Boot] [PATCH v2 1/2] linux/bitops.h: Add BIT macro In-Reply-To: References: <1430309106-22973-1-git-send-email-jagannadh.teki@gmail.com> <20150429130852.GW16702@bill-the-cat> Message-ID: <20150430133039.GG16702@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Apr 29, 2015 at 06:33:41PM -0600, Simon Glass wrote: > Hi Jagan, > > On 29 April 2015 at 08:58, Jagan Teki wrote: > > Hi Simon, > > > > On 29 April 2015 at 20:12, Simon Glass wrote: > >> Hi Tom, > >> > >> On 29 April 2015 at 07:08, Tom Rini wrote: > >>> On Wed, Apr 29, 2015 at 05:35:05PM +0530, Jagannadha Sutradharudu Teki wrote: > >>> > >>>> Replace (1 << nr) to BIT(nr) where nr = 0, 1, 2 .... 31 > >>>> > >>>> Signed-off-by: Jagannadha Sutradharudu Teki > >>>> Cc: Masahiro Yamada > >>>> Cc: Tom Rini > >>>> Cc: Simon Glass > >>> > >>> I think that conceptually this is a good idea. We need to apply this > >>> fairly quickly however as it already throws out a few rejects with the > >>> PRs I've taken and doing some local testing on. > >> > >> We have to date avoided this (I've been here before). But I think it > >> is useful. One concern I have is misuse, when someone does BIT(0) | > >> BIT(1))| BIT(2) | BIT(3) instead of 0xf, for example. > > > > Probably we can achieve this with GENMASK(h, l), may be we can add that also? > > I'm not sure about that...we might end up with this: > > http://patchwork.ozlabs.org/patch/93363/ Welcome to the world of introducing an idea before the rest of the community is ready :( . GENMASK as Jagan is talking about came into the kernel (well, into in 2013. So yeah, we could pull that macro in too and clean up as needed / ensure people don't do funny looking things like BIT(1) | BIT(2) | ... -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: