diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-18 05:37:43 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-18 05:37:43 -0400 |
commit | 04dfcfcb54b073133bcca2c8f25b55e904558931 (patch) | |
tree | 123d13f9e242751f629924e92fcb297dc669d767 /lib | |
parent | 0bd5c4f7c874cf48ff7904dcf8a59988c8fea0e8 (diff) | |
parent | ee568b25ee9e160b32d1aef73d8b2ee9c05d34db (diff) |
Merge branch 'linus' into core/iommu
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bitmap.c | 16 | ||||
-rw-r--r-- | lib/idr.c | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index 1338469ac849..35a1f7ff4149 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -948,15 +948,15 @@ done: | |||
948 | */ | 948 | */ |
949 | int bitmap_find_free_region(unsigned long *bitmap, int bits, int order) | 949 | int bitmap_find_free_region(unsigned long *bitmap, int bits, int order) |
950 | { | 950 | { |
951 | int pos; /* scans bitmap by regions of size order */ | 951 | int pos, end; /* scans bitmap by regions of size order */ |
952 | 952 | ||
953 | for (pos = 0; pos < bits; pos += (1 << order)) | 953 | for (pos = 0 ; (end = pos + (1 << order)) <= bits; pos = end) { |
954 | if (__reg_op(bitmap, pos, order, REG_OP_ISFREE)) | 954 | if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) |
955 | break; | 955 | continue; |
956 | if (pos == bits) | 956 | __reg_op(bitmap, pos, order, REG_OP_ALLOC); |
957 | return -ENOMEM; | 957 | return pos; |
958 | __reg_op(bitmap, pos, order, REG_OP_ALLOC); | 958 | } |
959 | return pos; | 959 | return -ENOMEM; |
960 | } | 960 | } |
961 | EXPORT_SYMBOL(bitmap_find_free_region); | 961 | EXPORT_SYMBOL(bitmap_find_free_region); |
962 | 962 | ||
@@ -449,6 +449,7 @@ void idr_remove_all(struct idr *idp) | |||
449 | 449 | ||
450 | n = idp->layers * IDR_BITS; | 450 | n = idp->layers * IDR_BITS; |
451 | p = idp->top; | 451 | p = idp->top; |
452 | rcu_assign_pointer(idp->top, NULL); | ||
452 | max = 1 << n; | 453 | max = 1 << n; |
453 | 454 | ||
454 | id = 0; | 455 | id = 0; |
@@ -467,7 +468,6 @@ void idr_remove_all(struct idr *idp) | |||
467 | p = *--paa; | 468 | p = *--paa; |
468 | } | 469 | } |
469 | } | 470 | } |
470 | rcu_assign_pointer(idp->top, NULL); | ||
471 | idp->layers = 0; | 471 | idp->layers = 0; |
472 | } | 472 | } |
473 | EXPORT_SYMBOL(idr_remove_all); | 473 | EXPORT_SYMBOL(idr_remove_all); |