projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5756b15
)
drm/ttm: use ffs in ttm_mem_type_from_place
author
Christian König
<
[email protected]
>
Mon, 12 Sep 2016 11:16:16 +0000
(13:16 +0200)
committer
Alex Deucher
<
[email protected]
>
Wed, 14 Sep 2016 19:10:41 +0000
(15:10 -0400)
A bit pointless to search for the first bit set manually.
Signed-off-by: Christian König <
[email protected]
>
Reviewed-by: Alex Deucher <
[email protected]
>
Reviewed-by: Chunming Zhou <
[email protected]
>
Signed-off-by: Alex Deucher <
[email protected]
>
drivers/gpu/drm/ttm/ttm_bo.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/ttm/ttm_bo.c
b/drivers/gpu/drm/ttm/ttm_bo.c
index c2a30bdc8a01996f7866a0dd344867900e32c873..fc6217dfe4016ebe7ea270189b486cba4b7db76c 100644
(file)
--- a/
drivers/gpu/drm/ttm/ttm_bo.c
+++ b/
drivers/gpu/drm/ttm/ttm_bo.c
@@
-57,14
+57,14
@@
static struct attribute ttm_bo_count = {
static inline int ttm_mem_type_from_place(const struct ttm_place *place,
uint32_t *mem_type)
{
- int
i
;
+ int
pos
;
- for (i = 0; i <= TTM_PL_PRIV5; i++)
- if (place->flags & (1 << i)) {
-
*mem_type = i
;
- return 0;
- }
- return
-EINVAL
;
+ pos = ffs(place->flags & TTM_PL_MASK_MEM);
+ if (unlikely(!pos))
+
return -EINVAL
;
+
+ *mem_type = pos - 1;
+ return
0
;
}
static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type)