unsigned int revision;
 };
 
-static int trie_debug = 0;
-
-#define DBG(x...) do { if (trie_debug) printk(x); } while (0)
-
 static void put_child(struct trie *t, struct tnode *tn, int i, struct node *n);
 static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, int wasfull);
 static struct node *resize(struct trie *t, struct tnode *tn);
 static struct tnode *halve(struct trie *t, struct tnode *tn);
 static void tnode_free(struct tnode *tn);
 static void trie_dump_seq(struct seq_file *seq, struct trie *t);
-extern struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio);
-extern int fib_detect_death(struct fib_info *fi, int order,
-                           struct fib_info **last_resort, int *last_idx, int *dflt);
-
-extern void rtmsg_fib(int event, u32 key, struct fib_alias *fa, int z, int tb_id,
-                     struct nlmsghdr *n, struct netlink_skb_parms *req);
 
 static kmem_cache_t *fn_alias_kmem;
 static struct trie *trie_local = NULL, *trie_main = NULL;
 
 */
 
-static void check_tnode(struct tnode *tn)
+static inline void check_tnode(const struct tnode *tn)
 {
-       if (tn && tn->pos+tn->bits > 32) {
-               printk("TNODE ERROR tn=%p, pos=%d, bits=%d\n", tn, tn->pos, tn->bits);
-       }
+       WARN_ON(tn && tn->pos+tn->bits > 32);
 }
 
 static int halve_threshold = 25;
                tn->empty_children = 1<<bits;
        }
 
-       DBG("AT %p s=%u %u\n", tn, (unsigned int) sizeof(struct tnode),
-              (unsigned int) (sizeof(struct node) * 1<<bits));
+       pr_debug("AT %p s=%u %u\n", tn, (unsigned int) sizeof(struct tnode),
+                (unsigned int) (sizeof(struct node) * 1<<bits));
        return tn;
 }
 
 static void tnode_free(struct tnode *tn)
 {
-       BUG_ON(!tn);
-
        if (IS_LEAF(tn)) {
                free_leaf((struct leaf *)tn);
-               DBG("FL %p \n", tn);
+               pr_debug("FL %p \n", tn);
        } else {
                __tnode_free(tn);
-               DBG("FT %p \n", tn);
+               pr_debug("FT %p \n", tn);
        }
 }
 
        struct node *chi;
        int isfull;
 
-       if (i >= 1<<tn->bits) {
-               printk("bits=%d, i=%d\n", tn->bits, i);
-               BUG();
-       }
+       BUG_ON(i >= 1<<tn->bits);
+
        write_lock_bh(&fib_lock);
        chi = tn->child[i];
 
        if (!tn)
                return NULL;
 
-       DBG("In tnode_resize %p inflate_threshold=%d threshold=%d\n",
-             tn, inflate_threshold, halve_threshold);
+       pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n",
+                tn, inflate_threshold, halve_threshold);
 
        /* No children */
        if (tn->empty_children == tnode_child_length(tn)) {
        int olen = tnode_child_length(tn);
        int i;
 
-       DBG("In inflate\n");
+       pr_debug("In inflate\n");
 
        tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits + 1);
 
-       if (!tn) 
+       if (!tn)
                return ERR_PTR(-ENOMEM);
 
        /*
                int size = tnode_child_length(tn);
                int j;
 
-               for(j = 0; j < size; j++)
+               for (j = 0; j < size; j++)
                        if (tn->child[j])
                                tnode_free((struct tnode *)tn->child[j]);
 
                tnode_free(tn);
-       
+
                return ERR_PTR(-ENOMEM);
        }
 }
        int i;
        int olen = tnode_child_length(tn);
 
-       DBG("In halve\n");
+       pr_debug("In halve\n");
 
        tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits - 1);
 
                right = tnode_get_child(oldtnode, i+1);
 
                /* Two nonempty children */
-               if (left && right)  {
+               if (left && right) {
                        struct tnode *newn;
-  
+
                        newn = tnode_new(left->key, tn->pos + tn->bits, 1);
-  
-                       if (!newn) 
+
+                       if (!newn)
                                goto nomem;
-  
+
                        put_child(t, tn, i/2, (struct node *)newn);
                }
 
                                continue;
                        put_child(t, tn, i/2, right);
                        continue;
-               } 
+               }
 
                if (right == NULL) {
                        put_child(t, tn, i/2, left);
                /* Two nonempty children */
                newBinNode = (struct tnode *) tnode_get_child(tn, i/2);
                put_child(t, tn, i/2, NULL);
-
-               BUG_ON(!newBinNode);
-
                put_child(t, newBinNode, 0, left);
                put_child(t, newBinNode, 1, right);
                put_child(t, tn, i/2, resize(t, newBinNode));
                int size = tnode_child_length(tn);
                int j;
 
-               for(j = 0; j < size; j++)
+               for (j = 0; j < size; j++)
                        if (tn->child[j])
                                tnode_free((struct tnode *)tn->child[j]);
 
                tnode_free(tn);
-       
+
                return ERR_PTR(-ENOMEM);
        }
 }
        t_key cindex, key;
        struct tnode *tp = NULL;
 
-       BUG_ON(!tn);
-
        key = tn->key;
        i = 0;
 
        while (tn != NULL && NODE_PARENT(tn) != NULL) {
-               if (i > 10) {
-                       printk("Rebalance tn=%p \n", tn);
-                       if (tn)
-                               printk("tn->parent=%p \n", NODE_PARENT(tn));
-
-                       printk("Rebalance tp=%p \n", tp);
-                       if (tp)
-                               printk("tp->parent=%p \n", NODE_PARENT(tp));
-               }
-
                BUG_ON(i > 12); /* Why is this a bug? -ojn */
                i++;
 
                        pos = tn->pos + tn->bits;
                        n = tnode_get_child(tn, tkey_extract_bits(key, tn->pos, tn->bits));
 
-                       if (n && NODE_PARENT(n) != tn) {
-                               printk("BUG tn=%p, n->parent=%p\n", tn, NODE_PARENT(n));
-                               BUG();
-                       }
+                       BUG_ON(n && NODE_PARENT(n) != tn);
                } else
                        break;
        }
 
                NODE_SET_PARENT(l, tp);
 
-               BUG_ON(!tp);
-
                cindex = tkey_extract_bits(key, tp->pos, tp->bits);
                put_child(t, (struct tnode *)tp, cindex, (struct node *)l);
        } else {
 
        key = ntohl(key);
 
-       DBG("Insert table=%d %08x/%d\n", tb->tb_id, key, plen);
+       pr_debug("Insert table=%d %08x/%d\n", tb->tb_id, key, plen);
 
        mask = ntohl(inet_make_mask(plen));
 
        return err;
 }
 
-static inline int check_leaf(struct trie *t, struct leaf *l,  t_key key, int *plen, const struct flowi *flp,
+static inline int check_leaf(struct trie *t, struct leaf *l,
+                            t_key key, int *plen, const struct flowi *flp,
                             struct fib_result *res)
 {
        int err, i;
        struct node *n = t->trie;
        struct leaf *l;
 
-       DBG("entering trie_leaf_remove(%p)\n", n);
+       pr_debug("entering trie_leaf_remove(%p)\n", n);
 
        /* Note that in the case skipped bits, those bits are *not* checked!
         * When we finish this, we will have NULL or a T_LEAF, and the
                check_tnode(tn);
                n = tnode_get_child(tn ,tkey_extract_bits(key, tn->pos, tn->bits));
 
-               if (n && NODE_PARENT(n) != tn) {
-                       printk("BUG tn=%p, n->parent=%p\n", tn, NODE_PARENT(n));
-                       BUG();
-               }
+               BUG_ON(n && NODE_PARENT(n) != tn);
        }
        l = (struct leaf *) n;
 
        if (!fa)
                return -ESRCH;
 
-       DBG("Deleting %08x/%d tos=%d t=%p\n", key, plen, tos, t);
+       pr_debug("Deleting %08x/%d tos=%d t=%p\n", key, plen, tos, t);
 
        fa_to_delete = NULL;
        fa_head = fa->fa_list.prev;
        if (ll && hlist_empty(&ll->list))
                trie_leaf_remove(t, ll->key);
 
-       DBG("trie_flush found=%d\n", found);
+       pr_debug("trie_flush found=%d\n", found);
        return found;
 }