• Geoff Thorpe's avatar
    powerpc: expose the multi-bit ops that underlie single-bit ops. · 0d2d3e38
    Geoff Thorpe authored
    The bitops.h functions that operate on a single bit in a bitfield are
    implemented by operating on the corresponding word location. In all
    cases the inner logic is valid if the mask being applied has more than
    one bit set, so this patch exposes those inner operations. Indeed,
    set_bits() was already available, but it duplicated code from
    set_bit() (rather than making the latter a wrapper) - it was also
    missing the PPC405_ERR77() workaround and the "volatile" address
    qualifier present in other APIs. This corrects that, and exposes the
    other multi-bit equivalents.
    
    One advantage of these multi-bit forms is that they allow word-sized
    variables to essentially be their own spinlocks, eg. very useful for
    state machines where an atomic "flags" variable can obviate the need
    for any additional locking.
    Signed-off-by: default avatarGeoff Thorpe <geoff@geoffthorpe.net>
    Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    0d2d3e38
bitops.h 9.77 KB