All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5] bitops: introduce BIT() definition
Date: Wed, 9 Sep 2015 21:58:58 +0300	[thread overview]
Message-ID: <55F08172.8070804@linaro.org> (raw)
In-Reply-To: <1441818637.29081.19.camel@freescale.com>



On 09.09.15 20:10, Scott Wood wrote:
> On Wed, 2015-09-09 at 12:37 -0400, Tom Rini wrote:
>> On Wed, Sep 09, 2015 at 11:22:25AM -0500, Scott Wood wrote:
>>> On Tue, 2015-09-08 at 21:01 +0300, ivan.khoronzhuk wrote:
>>>> Hi, Andreas
>>>>
>>>> On 07.09.15 14:43, Andreas Bie?mann wrote:
>>>>> From: Heiko Schocher <hs@denx.de>
>>>>>
>>>>> introduce BIT() definition, used in at91_udc gadget
>>>>> driver.
>>>>>
>>>>> Signed-off-by: Heiko Schocher <hs@denx.de>
>>>>> [remove all other occurrences of BIT(x) definition]
>>>>> Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
>>>>> ---
>>>>> Full buildman is running
>>>>>
>>>>
>>>> ....
>>>>
>>>>>
>>>>> +#define BIT(nr)            (1UL << (nr))
>>>>
>>>> Why UL? Why not simply 1 << (nr)?
>>>
>>> That would give the wrong result for nr == 31 if used as a 64-bit number,
>>> and
>>> would produce undefined behavior for nr >= 32 (though even with 1UL that
>>> would be undefined on 32-bit builds).
>>>
>>>> What if I need set ULL bit on 32-bit system?
>>>> Thanks for explanation.
>>>
>>> Yes, ULL would be better.
>>
>> That would be BIT_ULL(nr) ?  I want to assume that there was some care
>> given upstream here.  It was about 2 years ago now the kernel added a
>> specific BIT_ULL and family in addition to BIT(nr) from back in 2007.
>
> A quick search didn't turn up much justification for keeping them separate
> (and it seems like using BIT where BIT_ULL is needed could be a source of
> difficult bugs), but sure, we don't want to encourage writing driver code
> that will break on Linux.
Better to keep same approach.

>
> -Scott
>

-- 
Regards,
Ivan Khoronzhuk

  reply	other threads:[~2015-09-09 18:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 17:01 [U-Boot] [PATCH v4 0/4] add dfu support for at91 sam9260 based boards Heiko Schocher
2015-08-21 17:01 ` [U-Boot] [PATCH v4 1/4] bitops: introduce BIT() definition Heiko Schocher
2015-08-21 19:26   ` Michael Heimpold
2015-08-21 19:29     ` Marek Vasut
2015-09-07 11:20   ` Andreas Bießmann
2015-09-07 11:52     ` Heiko Schocher
2015-09-07 12:01       ` Andreas Bießmann
2015-09-07 12:15         ` Marek Vasut
2015-09-07 12:42           ` Jagan Teki
2015-09-07 11:43   ` [U-Boot] [PATCH v5] " Andreas Bießmann
2015-09-07 11:47     ` Stefan Roese
2015-09-08 15:54     ` Tom Warren
2015-09-08 16:17     ` Anatolij Gustschin
2015-09-08 18:01     ` ivan.khoronzhuk
2015-09-09 16:22       ` Scott Wood
2015-09-09 16:37         ` Tom Rini
2015-09-09 17:10           ` Scott Wood
2015-09-09 18:58             ` Ivan Khoronzhuk [this message]
2015-09-09 18:52         ` Ivan Khoronzhuk
2015-09-09 18:59           ` Scott Wood
2015-09-09 18:25     ` Wolfgang Denk
2015-09-09 19:04       ` Scott Wood
2015-09-12 12:52     ` [U-Boot] [U-Boot,v5] " Tom Rini
2015-09-08 18:03   ` [U-Boot] [PATCH v4 1/4] " Jagan Teki
2015-08-21 17:01 ` [U-Boot] [PATCH v4 2/4] usb: gadget: at91_udc: port linux driver at91_udc Heiko Schocher
2015-08-21 17:01 ` [U-Boot] [PATCH v4 3/4] usb: gadget: at91_udc: add at91_udc into U-Boot Heiko Schocher
2015-08-21 17:01 ` [U-Boot] [PATCH v4 4/4] at91, taurus, smartweb: add dfu support Heiko Schocher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55F08172.8070804@linaro.org \
    --to=ivan.khoronzhuk@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.