• Akinobu Mita's avatar
    This introduces new bitmap functions: · 3b237a6f
    Akinobu Mita authored
    bitmap_set: Set specified bit area
    bitmap_clear: Clear specified bit area
    bitmap_find_next_zero_area: Find free bit area
    
    These are mostly stolen from iommu helper. The differences are:
    
    - Use find_next_bit instead of doing test_bit for each bit
    
    - Rewrite bitmap_set and bitmap_clear
    
      Instead of setting or clearing for each bit.
    
    - Check the last bit of the limit
    
      iommu-helper doesn't want to find such area
    
    - The return value if there is no zero area
    
      find_next_zero_area in iommu helper: returns -1
      bitmap_find_next_zero_area: return >= bitmap size
    Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
    Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Greg Kroah-Hartman <gregkh@suse.de>
    Cc: Lothar Wassmann <LW@KARO-electronics.de>
    Cc: Roland Dreier <rolandd@cisco.com>
    Cc: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: Joerg Roedel <joerg.roedel@amd.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    3b237a6f
bitmap.c 32.7 KB