projects
/
platform
/
kernel
/
opensbi-spacemit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d6fa7f9
)
lib: sbi_scratch: use bitwise ops in sbi_scratch_alloc_offset()
author
Li Jinpei
<leekingp1994@163.com>
Tue, 11 Feb 2020 09:57:49 +0000
(15:27 +0530)
committer
Anup Patel
<anup@brainfault.org>
Thu, 13 Feb 2020 03:40:55 +0000
(09:10 +0530)
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>
lib/sbi/sbi_scratch.c
patch
|
blob
|
history
diff --git
a/lib/sbi/sbi_scratch.c
b/lib/sbi/sbi_scratch.c
index
95ee2f2
..
26716c5
100644
(file)
--- a/
lib/sbi/sbi_scratch.c
+++ b/
lib/sbi/sbi_scratch.c
@@
-36,8
+36,8
@@
unsigned long sbi_scratch_alloc_offset(unsigned long size, const char *owner)
if (!size)
return 0;
-
while
(size & (__SIZEOF_POINTER__ - 1))
- size
++
;
+
if
(size & (__SIZEOF_POINTER__ - 1))
+ size
= (size & ~(__SIZEOF_POINTER__ - 1)) + __SIZEOF_POINTER__
;
spin_lock(&extra_lock);