lib: sbi_scratch: use bitwise ops in sbi_scratch_alloc_offset()

Instead of using loop to make "size" machine word aligned, we should
use bitwise ops.

Signed-off-by: Li Jinpei <leekingp1994@163.com>
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
Li Jinpei
2020-02-11 15:27:49 +05:30
committed by Anup Patel
parent d6fa7f95bb
commit 179eddeb9c

View File

@@ -36,8 +36,8 @@ unsigned long sbi_scratch_alloc_offset(unsigned long size, const char *owner)
if (!size) if (!size)
return 0; return 0;
while (size & (__SIZEOF_POINTER__ - 1)) if (size & (__SIZEOF_POINTER__ - 1))
size++; size = (size & ~(__SIZEOF_POINTER__ - 1)) + __SIZEOF_POINTER__;
spin_lock(&extra_lock); spin_lock(&extra_lock);