]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - lib/radix-tree.c
Driver Core: constify the name passed to platform_device_register_simple
[linux-2.6-omap-h63xx.git] / lib / radix-tree.c
index 519d3f00ef9ee4fde8c616125c55e17f79b38651..48c250fe2233d82c6d8fd563e83c234cdf1109ee 100644 (file)
@@ -98,7 +98,8 @@ radix_tree_node_alloc(struct radix_tree_root *root)
        struct radix_tree_node *ret;
        gfp_t gfp_mask = root_gfp_mask(root);
 
-       ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask);
+       ret = kmem_cache_alloc(radix_tree_node_cachep,
+                               set_migrateflags(gfp_mask, __GFP_RECLAIMABLE));
        if (ret == NULL && !(gfp_mask & __GFP_WAIT)) {
                struct radix_tree_preload *rtp;
 
@@ -142,7 +143,8 @@ int radix_tree_preload(gfp_t gfp_mask)
        rtp = &__get_cpu_var(radix_tree_preloads);
        while (rtp->nr < ARRAY_SIZE(rtp->nodes)) {
                preempt_enable();
-               node = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask);
+               node = kmem_cache_alloc(radix_tree_node_cachep,
+                               set_migrateflags(gfp_mask, __GFP_RECLAIMABLE));
                if (node == NULL)
                        goto out;
                preempt_disable();
@@ -1040,19 +1042,21 @@ int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag)
 EXPORT_SYMBOL(radix_tree_tagged);
 
 static void
-radix_tree_node_ctor(void *node, struct kmem_cache *cachep, unsigned long flags)
+radix_tree_node_ctor(struct kmem_cache *cachep, void *node)
 {
        memset(node, 0, sizeof(struct radix_tree_node));
 }
 
 static __init unsigned long __maxindex(unsigned int height)
 {
-       unsigned int tmp = height * RADIX_TREE_MAP_SHIFT;
-       unsigned long index = (~0UL >> (RADIX_TREE_INDEX_BITS - tmp - 1)) >> 1;
-
-       if (tmp >= RADIX_TREE_INDEX_BITS)
-               index = ~0UL;
-       return index;
+       unsigned int width = height * RADIX_TREE_MAP_SHIFT;
+       int shift = RADIX_TREE_INDEX_BITS - width;
+
+       if (shift < 0)
+               return ~0UL;
+       if (shift >= BITS_PER_LONG)
+               return 0UL;
+       return ~0UL >> shift;
 }
 
 static __init void radix_tree_init_maxindex(void)