diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-07-26 00:43:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-26 00:43:18 -0400 |
commit | 547b792cac0a038b9dbf958d3c120df3740b5572 (patch) | |
tree | 08554d083b0ca7d65739dc1ce12f9b12a9b8e1f8 /net/sched | |
parent | 53e5e96ec18da6f65e89f05674711e1c93d8df67 (diff) |
net: convert BUG_TRAP to generic WARN_ON
Removes legacy reinvent-the-wheel type thing. The generic
machinery integrates much better to automated debugging aids
such as kerneloops.org (and others), and is unambiguous due to
better naming. Non-intuively BUG_TRAP() is actually equal to
WARN_ON() rather than BUG_ON() though some might actually be
promoted to BUG_ON() but I left that to future.
I could make at least one BUILD_BUG_ON conversion.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/act_api.c | 2 | ||||
-rw-r--r-- | net/sched/act_police.c | 2 | ||||
-rw-r--r-- | net/sched/cls_u32.c | 10 | ||||
-rw-r--r-- | net/sched/sch_cbq.c | 4 | ||||
-rw-r--r-- | net/sched/sch_generic.c | 2 | ||||
-rw-r--r-- | net/sched/sch_htb.c | 16 |
6 files changed, 18 insertions, 18 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 74e662cbb2c5..d308c19aa3f9 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -41,7 +41,7 @@ void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo) | |||
41 | return; | 41 | return; |
42 | } | 42 | } |
43 | } | 43 | } |
44 | BUG_TRAP(0); | 44 | WARN_ON(1); |
45 | } | 45 | } |
46 | EXPORT_SYMBOL(tcf_hash_destroy); | 46 | EXPORT_SYMBOL(tcf_hash_destroy); |
47 | 47 | ||
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 32c3f9d9fb7a..38015b493947 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -116,7 +116,7 @@ static void tcf_police_destroy(struct tcf_police *p) | |||
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | } | 118 | } |
119 | BUG_TRAP(0); | 119 | WARN_ON(1); |
120 | } | 120 | } |
121 | 121 | ||
122 | static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = { | 122 | static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = { |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 527db2559dd2..246f9065ce34 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -345,7 +345,7 @@ static int u32_delete_key(struct tcf_proto *tp, struct tc_u_knode* key) | |||
345 | } | 345 | } |
346 | } | 346 | } |
347 | } | 347 | } |
348 | BUG_TRAP(0); | 348 | WARN_ON(1); |
349 | return 0; | 349 | return 0; |
350 | } | 350 | } |
351 | 351 | ||
@@ -368,7 +368,7 @@ static int u32_destroy_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht) | |||
368 | struct tc_u_common *tp_c = tp->data; | 368 | struct tc_u_common *tp_c = tp->data; |
369 | struct tc_u_hnode **hn; | 369 | struct tc_u_hnode **hn; |
370 | 370 | ||
371 | BUG_TRAP(!ht->refcnt); | 371 | WARN_ON(ht->refcnt); |
372 | 372 | ||
373 | u32_clear_hnode(tp, ht); | 373 | u32_clear_hnode(tp, ht); |
374 | 374 | ||
@@ -380,7 +380,7 @@ static int u32_destroy_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht) | |||
380 | } | 380 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | BUG_TRAP(0); | 383 | WARN_ON(1); |
384 | return -ENOENT; | 384 | return -ENOENT; |
385 | } | 385 | } |
386 | 386 | ||
@@ -389,7 +389,7 @@ static void u32_destroy(struct tcf_proto *tp) | |||
389 | struct tc_u_common *tp_c = tp->data; | 389 | struct tc_u_common *tp_c = tp->data; |
390 | struct tc_u_hnode *root_ht = xchg(&tp->root, NULL); | 390 | struct tc_u_hnode *root_ht = xchg(&tp->root, NULL); |
391 | 391 | ||
392 | BUG_TRAP(root_ht != NULL); | 392 | WARN_ON(root_ht == NULL); |
393 | 393 | ||
394 | if (root_ht && --root_ht->refcnt == 0) | 394 | if (root_ht && --root_ht->refcnt == 0) |
395 | u32_destroy_hnode(tp, root_ht); | 395 | u32_destroy_hnode(tp, root_ht); |
@@ -407,7 +407,7 @@ static void u32_destroy(struct tcf_proto *tp) | |||
407 | while ((ht = tp_c->hlist) != NULL) { | 407 | while ((ht = tp_c->hlist) != NULL) { |
408 | tp_c->hlist = ht->next; | 408 | tp_c->hlist = ht->next; |
409 | 409 | ||
410 | BUG_TRAP(ht->refcnt == 0); | 410 | WARN_ON(ht->refcnt != 0); |
411 | 411 | ||
412 | kfree(ht); | 412 | kfree(ht); |
413 | } | 413 | } |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index f1d2f8ec8b4c..14954bf4a683 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1175,7 +1175,7 @@ static void cbq_unlink_class(struct cbq_class *this) | |||
1175 | this->tparent->children = NULL; | 1175 | this->tparent->children = NULL; |
1176 | } | 1176 | } |
1177 | } else { | 1177 | } else { |
1178 | BUG_TRAP(this->sibling == this); | 1178 | WARN_ON(this->sibling != this); |
1179 | } | 1179 | } |
1180 | } | 1180 | } |
1181 | 1181 | ||
@@ -1699,7 +1699,7 @@ static void cbq_destroy_class(struct Qdisc *sch, struct cbq_class *cl) | |||
1699 | { | 1699 | { |
1700 | struct cbq_sched_data *q = qdisc_priv(sch); | 1700 | struct cbq_sched_data *q = qdisc_priv(sch); |
1701 | 1701 | ||
1702 | BUG_TRAP(!cl->filters); | 1702 | WARN_ON(cl->filters); |
1703 | 1703 | ||
1704 | tcf_destroy_chain(&cl->filter_list); | 1704 | tcf_destroy_chain(&cl->filter_list); |
1705 | qdisc_destroy(cl->q); | 1705 | qdisc_destroy(cl->q); |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 43abd4d27ea6..fd2a6cadb115 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -746,5 +746,5 @@ void dev_shutdown(struct net_device *dev) | |||
746 | { | 746 | { |
747 | netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); | 747 | netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); |
748 | shutdown_scheduler_queue(dev, &dev->rx_queue, NULL); | 748 | shutdown_scheduler_queue(dev, &dev->rx_queue, NULL); |
749 | BUG_TRAP(!timer_pending(&dev->watchdog_timer)); | 749 | WARN_ON(timer_pending(&dev->watchdog_timer)); |
750 | } | 750 | } |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 30c999c61b01..75a40951c4f2 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -524,7 +524,7 @@ htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, long *diff) | |||
524 | */ | 524 | */ |
525 | static inline void htb_activate(struct htb_sched *q, struct htb_class *cl) | 525 | static inline void htb_activate(struct htb_sched *q, struct htb_class *cl) |
526 | { | 526 | { |
527 | BUG_TRAP(!cl->level && cl->un.leaf.q && cl->un.leaf.q->q.qlen); | 527 | WARN_ON(cl->level || !cl->un.leaf.q || !cl->un.leaf.q->q.qlen); |
528 | 528 | ||
529 | if (!cl->prio_activity) { | 529 | if (!cl->prio_activity) { |
530 | cl->prio_activity = 1 << (cl->un.leaf.aprio = cl->un.leaf.prio); | 530 | cl->prio_activity = 1 << (cl->un.leaf.aprio = cl->un.leaf.prio); |
@@ -542,7 +542,7 @@ static inline void htb_activate(struct htb_sched *q, struct htb_class *cl) | |||
542 | */ | 542 | */ |
543 | static inline void htb_deactivate(struct htb_sched *q, struct htb_class *cl) | 543 | static inline void htb_deactivate(struct htb_sched *q, struct htb_class *cl) |
544 | { | 544 | { |
545 | BUG_TRAP(cl->prio_activity); | 545 | WARN_ON(!cl->prio_activity); |
546 | 546 | ||
547 | htb_deactivate_prios(q, cl); | 547 | htb_deactivate_prios(q, cl); |
548 | cl->prio_activity = 0; | 548 | cl->prio_activity = 0; |
@@ -757,7 +757,7 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio, | |||
757 | u32 *pid; | 757 | u32 *pid; |
758 | } stk[TC_HTB_MAXDEPTH], *sp = stk; | 758 | } stk[TC_HTB_MAXDEPTH], *sp = stk; |
759 | 759 | ||
760 | BUG_TRAP(tree->rb_node); | 760 | WARN_ON(!tree->rb_node); |
761 | sp->root = tree->rb_node; | 761 | sp->root = tree->rb_node; |
762 | sp->pptr = pptr; | 762 | sp->pptr = pptr; |
763 | sp->pid = pid; | 763 | sp->pid = pid; |
@@ -777,7 +777,7 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio, | |||
777 | *sp->pptr = (*sp->pptr)->rb_left; | 777 | *sp->pptr = (*sp->pptr)->rb_left; |
778 | if (sp > stk) { | 778 | if (sp > stk) { |
779 | sp--; | 779 | sp--; |
780 | BUG_TRAP(*sp->pptr); | 780 | WARN_ON(!*sp->pptr); |
781 | if (!*sp->pptr) | 781 | if (!*sp->pptr) |
782 | return NULL; | 782 | return NULL; |
783 | htb_next_rb_node(sp->pptr); | 783 | htb_next_rb_node(sp->pptr); |
@@ -792,7 +792,7 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio, | |||
792 | sp->pid = cl->un.inner.last_ptr_id + prio; | 792 | sp->pid = cl->un.inner.last_ptr_id + prio; |
793 | } | 793 | } |
794 | } | 794 | } |
795 | BUG_TRAP(0); | 795 | WARN_ON(1); |
796 | return NULL; | 796 | return NULL; |
797 | } | 797 | } |
798 | 798 | ||
@@ -810,7 +810,7 @@ static struct sk_buff *htb_dequeue_tree(struct htb_sched *q, int prio, | |||
810 | 810 | ||
811 | do { | 811 | do { |
812 | next: | 812 | next: |
813 | BUG_TRAP(cl); | 813 | WARN_ON(!cl); |
814 | if (!cl) | 814 | if (!cl) |
815 | return NULL; | 815 | return NULL; |
816 | 816 | ||
@@ -1185,7 +1185,7 @@ static void htb_parent_to_leaf(struct htb_sched *q, struct htb_class *cl, | |||
1185 | { | 1185 | { |
1186 | struct htb_class *parent = cl->parent; | 1186 | struct htb_class *parent = cl->parent; |
1187 | 1187 | ||
1188 | BUG_TRAP(!cl->level && cl->un.leaf.q && !cl->prio_activity); | 1188 | WARN_ON(cl->level || !cl->un.leaf.q || cl->prio_activity); |
1189 | 1189 | ||
1190 | if (parent->cmode != HTB_CAN_SEND) | 1190 | if (parent->cmode != HTB_CAN_SEND) |
1191 | htb_safe_rb_erase(&parent->pq_node, q->wait_pq + parent->level); | 1191 | htb_safe_rb_erase(&parent->pq_node, q->wait_pq + parent->level); |
@@ -1205,7 +1205,7 @@ static void htb_parent_to_leaf(struct htb_sched *q, struct htb_class *cl, | |||
1205 | static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl) | 1205 | static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl) |
1206 | { | 1206 | { |
1207 | if (!cl->level) { | 1207 | if (!cl->level) { |
1208 | BUG_TRAP(cl->un.leaf.q); | 1208 | WARN_ON(!cl->un.leaf.q); |
1209 | qdisc_destroy(cl->un.leaf.q); | 1209 | qdisc_destroy(cl->un.leaf.q); |
1210 | } | 1210 | } |
1211 | gen_kill_estimator(&cl->bstats, &cl->rate_est); | 1211 | gen_kill_estimator(&cl->bstats, &cl->rate_est); |