All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <pure.logic@nexus-software.ie>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 0/9] Fixup set_bit/clear_bit definition and usage
Date: Mon, 30 Apr 2018 11:36:54 +0100	[thread overview]
Message-ID: <314d1a7b-6723-cd3f-0f78-2ed75db65041@nexus-software.ie> (raw)
In-Reply-To: <CAEUhbmUN50Wo_6rRz2+L2kEKSNAvdQLVAXbS0WSa3mWT++=Qbg@mail.gmail.com>

On 28/04/18 00:38, Bin Meng wrote:
> Hi Bryan,
> 
> On Fri, Apr 27, 2018 at 11:08 PM, Bryan O'Donoghue
> <pure.logic@nexus-software.ie> wrote:
>> Following on from a discussion with Marek and Lukasz re: a namespace
>> collision with set_bit and clear_bit in f_mass_storage, I noticed some
>> inconsistencies in the definition and usage of PLATFORM__SET_BIT and
>> PLATFORM__CLEAR_BIT as well as a similar use of __set_bit in the composite
>> USB gadget driver.
>>
>> __set_bit is lock-prefixed on x86 whereas set_bit is not and the analog
>> driver in upstream Linux does set_bit() not __set_bit().
>>
> 
> I am confused. So this changes enables x86's own __set_bit which is
> lock-prefixed.

No sorry Bin,

It's the other way around.

Let me reword this for you..

/**
  * set_bit - Atomically set a bit in memory
  * @nr: the bit to set
  * @addr: the address to start counting from
  *
  * This function is atomic and may not be reordered.  See __set_bit()
  * if you do not require the atomic guarantees.
  * Note that @nr may be almost arbitrarily large; this function is not
  * restricted to acting on a single-word quantity.
  */
static __inline__ void set_bit(int nr, volatile void * addr)
{
         __asm__ __volatile__( LOCK_PREFIX
                 "btsl %1,%0"
                 :"=m" (ADDR)
                 :"Ir" (nr));
}

/**
  * __set_bit - Set a bit in memory
  * @nr: the bit to set
  * @addr: the address to start counting from
  *
  * Unlike set_bit(), this function is non-atomic and may be reordered.
  * If it's called on the same region of memory simultaneously, the effect
  * may be that only one operation succeeds.
  */
static __inline__ void __set_bit(int nr, volatile void * addr)
{
         __asm__(
                 "btsl %1,%0"
                 :"=m" (ADDR)
                 :"Ir" (nr));
}

      reply	other threads:[~2018-04-30 10:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-27 15:08 [U-Boot] [PATCH 0/9] Fixup set_bit/clear_bit definition and usage Bryan O'Donoghue
2018-04-27 15:08 ` [U-Boot] [PATCH 1/9] x86: Define PLATFORM__SET_BIT for generic_set_bit() Bryan O'Donoghue
2018-04-27 15:08 ` [U-Boot] [PATCH 2/9] riscv: " Bryan O'Donoghue
2018-04-27 15:08 ` [U-Boot] [PATCH 3/9] riscv: : Define PLATFORM__CLEAR_BIT for generic_clear_bit() Bryan O'Donoghue
2018-04-27 15:08 ` [U-Boot] [PATCH 4/9] nios2: Define PLATFORM__SET_BIT for generic_set_bit() Bryan O'Donoghue
2018-04-27 15:08 ` [U-Boot] [PATCH 5/9] nios2: : Define PLATFORM__CLEAR_BIT for generic_clear_bit() Bryan O'Donoghue
2018-04-27 15:08 ` [U-Boot] [PATCH 6/9] nds32: Define PLATFORM__SET_BIT for generic_set_bit() Bryan O'Donoghue
2018-04-27 15:08 ` [U-Boot] [PATCH 7/9] nds2: : Define PLATFORM__CLEAR_BIT for generic_clear_bit() Bryan O'Donoghue
2018-04-27 15:08 ` [U-Boot] [PATCH v3 8/9] usb: f_mass_storage: Fix set_bit and clear_bit usage Bryan O'Donoghue
2018-04-27 16:20   ` Lukasz Majewski
2018-04-30 10:34     ` Bryan O'Donoghue
2018-04-27 15:08 ` [U-Boot] [PATCH 9/9] usb: composite convert __set_bit to generic_set_bit Bryan O'Donoghue
2018-04-27 23:38 ` [U-Boot] [PATCH 0/9] Fixup set_bit/clear_bit definition and usage Bin Meng
2018-04-30 10:36   ` Bryan O'Donoghue [this message]

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=314d1a7b-6723-cd3f-0f78-2ed75db65041@nexus-software.ie \
    --to=pure.logic@nexus-software.ie \
    --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.