[prev in list] [next in list] [prev in thread] [next in thread] 

List:       u-boot
Subject:    Re: [U-Boot] [PATCH v2 1/2] linux/bitops.h: Add BIT macro
From:       Simon Glass <sjg () chromium ! org>
Date:       2015-04-30 18:07:50
Message-ID: CAPnjgZ1LGyvrMuiryFsXUC4jD6qNpU2TNesA+U4HOJ+whCfT1Q () mail ! gmail ! com
[Download RAW message or body]

Hi Tom,

On 30 April 2015 at 07:30, Tom Rini <trini@konsulko.com> wrote:
> On Wed, Apr 29, 2015 at 06:33:41PM -0600, Simon Glass wrote:
>> Hi Jagan,
>>
>> On 29 April 2015 at 08:58, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>> > Hi Simon,
>> >
>> > On 29 April 2015 at 20:12, Simon Glass <sjg@chromium.org> wrote:
>> >> Hi Tom,
>> >>
>> >> On 29 April 2015 at 07:08, Tom Rini <trini@konsulko.com> 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 <jagannadh.teki@gmail.com>
>> >>>> Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
>> >>>> Cc: Tom Rini <trini@konsulko.com>
>> >>>> Cc: Simon Glass <sjg@chromium.org>
>> >>>
>> >>> 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 <linux/bitops.h> 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) | ...

SGTM.

Regards,
Simon
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic