summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>2004-02-20 02:41:57 -0800
committerDavid S. Miller <davem@nuts.davemloft.net>2004-02-20 02:41:57 -0800
commita4c844769e25ba573a7c313dd1dae34610fd3a6d (patch)
tree082af5139cc1ee6466a826d2dc110788dcd50513
parent144abfc2830e661ac6c0b90360af4e487f838a9e (diff)
[PKT_SCHED]: Convert to {subsys,module}_initcall(), fix init failure bugs in sch_teql.c
pktsched_init() and tc_filter_init() converted to subsys_initcall(). initialization of individual qdisc and tcf_proto switched to module_init(). Some of them used to be registered twice if built-in, BTW. init failure handling in sch_teql.c fixed - it used to leave objects (both qdisc and netdev) registered if insmod failed.
-rw-r--r--include/net/pkt_sched.h3
-rw-r--r--net/core/dev.c4
-rw-r--r--net/sched/Makefile18
-rw-r--r--net/sched/cls_api.c27
-rw-r--r--net/sched/cls_fw.c11
-rw-r--r--net/sched/cls_route.c11
-rw-r--r--net/sched/cls_rsvp.h11
-rw-r--r--net/sched/cls_tcindex.c12
-rw-r--r--net/sched/cls_u32.c11
-rw-r--r--net/sched/sch_api.c60
-rw-r--r--net/sched/sch_atm.c12
-rw-r--r--net/sched/sch_cbq.c11
-rw-r--r--net/sched/sch_csz.c12
-rw-r--r--net/sched/sch_dsmark.c12
-rw-r--r--net/sched/sch_gred.c12
-rw-r--r--net/sched/sch_hfsc.c2
-rw-r--r--net/sched/sch_htb.c11
-rw-r--r--net/sched/sch_ingress.c13
-rw-r--r--net/sched/sch_prio.c12
-rw-r--r--net/sched/sch_red.c12
-rw-r--r--net/sched/sch_sfq.c11
-rw-r--r--net/sched/sch_tbf.c11
-rw-r--r--net/sched/sch_teql.c35
23 files changed, 124 insertions, 210 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 35f600ba43ba..80661d855fd8 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -440,9 +440,6 @@ int qdisc_new_estimator(struct tc_stats *stats, struct rtattr *opt);
void qdisc_kill_estimator(struct tc_stats *stats);
struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct rtattr *tab);
void qdisc_put_rtab(struct qdisc_rate_table *tab);
-int teql_init(void);
-int tc_filter_init(void);
-int pktsched_init(void);
extern int qdisc_restart(struct net_device *dev);
diff --git a/net/core/dev.c b/net/core/dev.c
index b2333ae5affe..94c16c74dc99 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3217,10 +3217,6 @@ static int __init net_dev_init(void)
dst_init();
dev_mcast_init();
-
-#ifdef CONFIG_NET_SCHED
- pktsched_init();
-#endif
rc = 0;
out:
return rc;
diff --git a/net/sched/Makefile b/net/sched/Makefile
index e2fc6cf17bd5..525b9956c51e 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -8,23 +8,23 @@ obj-$(CONFIG_NET_SCHED) += sch_api.o sch_fifo.o
obj-$(CONFIG_NET_ESTIMATOR) += estimator.o
obj-$(CONFIG_NET_CLS) += cls_api.o
obj-$(CONFIG_NET_CLS_POLICE) += police.o
-obj-$(CONFIG_NET_SCH_INGRESS) += sch_ingress.o
obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o
+obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o
obj-$(CONFIG_NET_SCH_CSZ) += sch_csz.o
obj-$(CONFIG_NET_SCH_HPFQ) += sch_hpfq.o
obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o
-obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o
-obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o
obj-$(CONFIG_NET_SCH_RED) += sch_red.o
-obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o
-obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o
-obj-$(CONFIG_NET_SCH_TEQL) += sch_teql.o
obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o
+obj-$(CONFIG_NET_SCH_INGRESS) += sch_ingress.o
obj-$(CONFIG_NET_SCH_DSMARK) += sch_dsmark.o
-obj-$(CONFIG_NET_CLS_TCINDEX) += cls_tcindex.o
+obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o
+obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o
+obj-$(CONFIG_NET_SCH_TEQL) += sch_teql.o
+obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o
obj-$(CONFIG_NET_SCH_ATM) += sch_atm.o
obj-$(CONFIG_NET_CLS_U32) += cls_u32.o
-obj-$(CONFIG_NET_CLS_RSVP) += cls_rsvp.o
-obj-$(CONFIG_NET_CLS_RSVP6) += cls_rsvp6.o
obj-$(CONFIG_NET_CLS_ROUTE4) += cls_route.o
obj-$(CONFIG_NET_CLS_FW) += cls_fw.o
+obj-$(CONFIG_NET_CLS_RSVP) += cls_rsvp.o
+obj-$(CONFIG_NET_CLS_TCINDEX) += cls_tcindex.o
+obj-$(CONFIG_NET_CLS_RSVP6) += cls_rsvp6.o
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index f50691da2348..a48b75d54fb9 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -425,7 +425,7 @@ out:
}
-int __init tc_filter_init(void)
+static int __init tc_filter_init(void)
{
struct rtnetlink_link *link_p = rtnetlink_links[PF_UNSPEC];
@@ -439,31 +439,10 @@ int __init tc_filter_init(void)
link_p[RTM_GETTFILTER-RTM_BASE].doit = tc_ctl_tfilter;
link_p[RTM_GETTFILTER-RTM_BASE].dumpit = tc_dump_tfilter;
}
-#define INIT_TC_FILTER(name) { \
- extern struct tcf_proto_ops cls_##name##_ops; \
- register_tcf_proto_ops(&cls_##name##_ops); \
- }
-
-#ifdef CONFIG_NET_CLS_U32
- INIT_TC_FILTER(u32);
-#endif
-#ifdef CONFIG_NET_CLS_ROUTE4
- INIT_TC_FILTER(route4);
-#endif
-#ifdef CONFIG_NET_CLS_FW
- INIT_TC_FILTER(fw);
-#endif
-#ifdef CONFIG_NET_CLS_RSVP
- INIT_TC_FILTER(rsvp);
-#endif
-#ifdef CONFIG_NET_CLS_TCINDEX
- INIT_TC_FILTER(tcindex);
-#endif
-#ifdef CONFIG_NET_CLS_RSVP6
- INIT_TC_FILTER(rsvp6);
-#endif
return 0;
}
+subsys_initcall(tc_filter_init);
+
EXPORT_SYMBOL(register_tcf_proto_ops);
EXPORT_SYMBOL(unregister_tcf_proto_ops);
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index caca242d22a6..5b614b63aa66 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -347,7 +347,7 @@ rtattr_failure:
return -1;
}
-struct tcf_proto_ops cls_fw_ops = {
+static struct tcf_proto_ops cls_fw_ops = {
.next = NULL,
.kind = "fw",
.classify = fw_classify,
@@ -362,15 +362,16 @@ struct tcf_proto_ops cls_fw_ops = {
.owner = THIS_MODULE,
};
-#ifdef MODULE
-int init_module(void)
+static int __init init_fw(void)
{
return register_tcf_proto_ops(&cls_fw_ops);
}
-void cleanup_module(void)
+static void __exit exit_fw(void)
{
unregister_tcf_proto_ops(&cls_fw_ops);
}
-#endif
+
+module_init(init_fw)
+module_exit(exit_fw)
MODULE_LICENSE("GPL");
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index 69f5d1a4fe80..4c09012edbce 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -602,7 +602,7 @@ rtattr_failure:
return -1;
}
-struct tcf_proto_ops cls_route4_ops = {
+static struct tcf_proto_ops cls_route4_ops = {
.next = NULL,
.kind = "route",
.classify = route4_classify,
@@ -617,15 +617,16 @@ struct tcf_proto_ops cls_route4_ops = {
.owner = THIS_MODULE,
};
-#ifdef MODULE
-int init_module(void)
+static int __init init_route4(void)
{
return register_tcf_proto_ops(&cls_route4_ops);
}
-void cleanup_module(void)
+static void __exit exit_route4(void)
{
unregister_tcf_proto_ops(&cls_route4_ops);
}
-#endif
+
+module_init(init_route4)
+module_exit(exit_route4)
MODULE_LICENSE("GPL");
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
index e3324225e4d5..85e028d84757 100644
--- a/net/sched/cls_rsvp.h
+++ b/net/sched/cls_rsvp.h
@@ -667,7 +667,7 @@ rtattr_failure:
return -1;
}
-struct tcf_proto_ops RSVP_OPS = {
+static struct tcf_proto_ops RSVP_OPS = {
.next = NULL,
.kind = RSVP_ID,
.classify = rsvp_classify,
@@ -682,14 +682,15 @@ struct tcf_proto_ops RSVP_OPS = {
.owner = THIS_MODULE,
};
-#ifdef MODULE
-int init_module(void)
+static int __init init_rsvp(void)
{
return register_tcf_proto_ops(&RSVP_OPS);
}
-void cleanup_module(void)
+static void __exit exit_rsvp(void)
{
unregister_tcf_proto_ops(&RSVP_OPS);
}
-#endif
+
+module_init(init_rsvp)
+module_exit(exit_rsvp)
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index a65fa5f3d446..adbc77dd2318 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -476,7 +476,7 @@ rtattr_failure:
return -1;
}
-struct tcf_proto_ops cls_tcindex_ops = {
+static struct tcf_proto_ops cls_tcindex_ops = {
.next = NULL,
.kind = "tcindex",
.classify = tcindex_classify,
@@ -491,16 +491,16 @@ struct tcf_proto_ops cls_tcindex_ops = {
.owner = THIS_MODULE,
};
-
-#ifdef MODULE
-int init_module(void)
+static int __init init_tcindex(void)
{
return register_tcf_proto_ops(&cls_tcindex_ops);
}
-void cleanup_module(void)
+static void __exit exit_tcindex(void)
{
unregister_tcf_proto_ops(&cls_tcindex_ops);
}
-#endif
+
+module_init(init_tcindex)
+module_exit(exit_tcindex)
MODULE_LICENSE("GPL");
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 96488808098a..938d88744b63 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -684,7 +684,7 @@ rtattr_failure:
return -1;
}
-struct tcf_proto_ops cls_u32_ops = {
+static struct tcf_proto_ops cls_u32_ops = {
.next = NULL,
.kind = "u32",
.classify = u32_classify,
@@ -699,15 +699,16 @@ struct tcf_proto_ops cls_u32_ops = {
.owner = THIS_MODULE,
};
-#ifdef MODULE
-int init_module(void)
+static int __init init_u32(void)
{
return register_tcf_proto_ops(&cls_u32_ops);
}
-void cleanup_module(void)
+static void __exit exit_u32(void)
{
unregister_tcf_proto_ops(&cls_u32_ops);
}
-#endif
+
+module_init(init_u32)
+module_exit(exit_u32)
MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 926a5e3eccc0..432531dca1c8 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1165,7 +1165,7 @@ int __init psched_calibrate_clock(void)
}
#endif
-int __init pktsched_init(void)
+static int __init pktsched_init(void)
{
struct rtnetlink_link *link_p;
@@ -1197,65 +1197,15 @@ int __init pktsched_init(void)
link_p[RTM_GETTCLASS-RTM_BASE].dumpit = tc_dump_tclass;
}
-#define INIT_QDISC(name) { \
- extern struct Qdisc_ops name##_qdisc_ops; \
- register_qdisc(& name##_qdisc_ops); \
- }
-
- INIT_QDISC(pfifo);
- INIT_QDISC(bfifo);
-
-#ifdef CONFIG_NET_SCH_CBQ
- INIT_QDISC(cbq);
-#endif
-#ifdef CONFIG_NET_SCH_HTB
- INIT_QDISC(htb);
-#endif
-#ifdef CONFIG_NET_SCH_CSZ
- INIT_QDISC(csz);
-#endif
-#ifdef CONFIG_NET_SCH_HPFQ
- INIT_QDISC(hpfq);
-#endif
-#ifdef CONFIG_NET_SCH_HFSC
- INIT_QDISC(hfsc);
-#endif
-#ifdef CONFIG_NET_SCH_RED
- INIT_QDISC(red);
-#endif
-#ifdef CONFIG_NET_SCH_GRED
- INIT_QDISC(gred);
-#endif
-#ifdef CONFIG_NET_SCH_INGRESS
- INIT_QDISC(ingress);
-#endif
-#ifdef CONFIG_NET_SCH_DSMARK
- INIT_QDISC(dsmark);
-#endif
-#ifdef CONFIG_NET_SCH_SFQ
- INIT_QDISC(sfq);
-#endif
-#ifdef CONFIG_NET_SCH_TBF
- INIT_QDISC(tbf);
-#endif
-#ifdef CONFIG_NET_SCH_TEQL
- teql_init();
-#endif
-#ifdef CONFIG_NET_SCH_PRIO
- INIT_QDISC(prio);
-#endif
-#ifdef CONFIG_NET_SCH_ATM
- INIT_QDISC(atm);
-#endif
-#ifdef CONFIG_NET_CLS
- tc_filter_init();
-#endif
-
+ register_qdisc(&pfifo_qdisc_ops);
+ register_qdisc(&bfifo_qdisc_ops);
proc_net_fops_create("psched", 0, &psched_fops);
return 0;
}
+subsys_initcall(pktsched_init);
+
EXPORT_SYMBOL(qdisc_copy_stats);
EXPORT_SYMBOL(qdisc_get_rtab);
EXPORT_SYMBOL(qdisc_put_rtab);
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 8dfaf3f38b52..767b883302b4 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -682,7 +682,7 @@ static struct Qdisc_class_ops atm_class_ops = {
.dump = atm_tc_dump_class,
};
-struct Qdisc_ops atm_qdisc_ops = {
+static struct Qdisc_ops atm_qdisc_ops = {
.next = NULL,
.cl_ops = &atm_class_ops,
.id = "atm",
@@ -700,15 +700,15 @@ struct Qdisc_ops atm_qdisc_ops = {
};
-#ifdef MODULE
-int init_module(void)
+static int __init atm_init(void)
{
return register_qdisc(&atm_qdisc_ops);
}
-
-void cleanup_module(void)
+static void __exit atm_exit(void)
{
unregister_qdisc(&atm_qdisc_ops);
}
-#endif
+
+module_init(atm_init)
+module_exit(atm_exit)
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index fad828b45c9d..04d05a2aad56 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -2074,7 +2074,7 @@ static struct Qdisc_class_ops cbq_class_ops = {
.dump = cbq_dump_class,
};
-struct Qdisc_ops cbq_qdisc_ops = {
+static struct Qdisc_ops cbq_qdisc_ops = {
.next = NULL,
.cl_ops = &cbq_class_ops,
.id = "cbq",
@@ -2091,15 +2091,14 @@ struct Qdisc_ops cbq_qdisc_ops = {
.owner = THIS_MODULE,
};
-#ifdef MODULE
-int init_module(void)
+static int __init cbq_module_init(void)
{
return register_qdisc(&cbq_qdisc_ops);
}
-
-void cleanup_module(void)
+static void __exit cbq_module_exit(void)
{
unregister_qdisc(&cbq_qdisc_ops);
}
-#endif
+module_init(cbq_module_init)
+module_exit(cbq_module_exit)
MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_csz.c b/net/sched/sch_csz.c
index 4bbb60b13c9d..3d9a5538b5ab 100644
--- a/net/sched/sch_csz.c
+++ b/net/sched/sch_csz.c
@@ -1027,7 +1027,7 @@ struct Qdisc_class_ops csz_class_ops = {
.dump = csz_dump_class,
};
-struct Qdisc_ops csz_qdisc_ops = {
+static struct Qdisc_ops csz_qdisc_ops = {
.next = NULL,
.cl_ops = &csz_class_ops,
.id = "csz",
@@ -1044,16 +1044,14 @@ struct Qdisc_ops csz_qdisc_ops = {
.owner = THIS_MODULE,
};
-
-#ifdef MODULE
-int init_module(void)
+static int __init csz_module_init(void)
{
return register_qdisc(&csz_qdisc_ops);
}
-
-void cleanup_module(void)
+static void __exit csz_module_exit(void)
{
unregister_qdisc(&csz_qdisc_ops);
}
-#endif
+module_init(csz_module_init)
+module_exit(csz_module_exit)
MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index 3470a40c3820..acf782f0174c 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -447,7 +447,7 @@ static struct Qdisc_class_ops dsmark_class_ops = {
.dump = dsmark_dump_class,
};
-struct Qdisc_ops dsmark_qdisc_ops = {
+static struct Qdisc_ops dsmark_qdisc_ops = {
.next = NULL,
.cl_ops = &dsmark_class_ops,
.id = "dsmark",
@@ -464,16 +464,14 @@ struct Qdisc_ops dsmark_qdisc_ops = {
.owner = THIS_MODULE,
};
-#ifdef MODULE
-int init_module(void)
+static int __init dsmark_module_init(void)
{
return register_qdisc(&dsmark_qdisc_ops);
}
-
-
-void cleanup_module(void)
+static void __exit dsmark_module_exit(void)
{
unregister_qdisc(&dsmark_qdisc_ops);
}
-#endif
+module_init(dsmark_module_init)
+module_exit(dsmark_module_exit)
MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index 080ca2e54438..f8a080062ae3 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -602,7 +602,7 @@ static void gred_destroy(struct Qdisc *sch)
}
}
-struct Qdisc_ops gred_qdisc_ops = {
+static struct Qdisc_ops gred_qdisc_ops = {
.next = NULL,
.cl_ops = NULL,
.id = "gred",
@@ -619,16 +619,14 @@ struct Qdisc_ops gred_qdisc_ops = {
.owner = THIS_MODULE,
};
-
-#ifdef MODULE
-int init_module(void)
+static int __init gred_module_init(void)
{
return register_qdisc(&gred_qdisc_ops);
}
-
-void cleanup_module(void)
+static void __exit gred_module_exit(void)
{
unregister_qdisc(&gred_qdisc_ops);
}
-#endif
+module_init(gred_module_init)
+module_exit(gred_module_exit)
MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index d6e22a4cedcc..1b09227a8831 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1831,7 +1831,7 @@ static struct Qdisc_class_ops hfsc_class_ops = {
.walk = hfsc_walk
};
-struct Qdisc_ops hfsc_qdisc_ops = {
+static struct Qdisc_ops hfsc_qdisc_ops = {
.id = "hfsc",
.init = hfsc_init_qdisc,
.change = hfsc_change_qdisc,
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 5743406b75cf..067dc942f30d 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1646,7 +1646,7 @@ static struct Qdisc_class_ops htb_class_ops = {
.dump = htb_dump_class,
};
-struct Qdisc_ops htb_qdisc_ops = {
+static struct Qdisc_ops htb_qdisc_ops = {
.next = NULL,
.cl_ops = &htb_class_ops,
.id = "htb",
@@ -1663,15 +1663,14 @@ struct Qdisc_ops htb_qdisc_ops = {
.owner = THIS_MODULE,
};
-#ifdef MODULE
-int init_module(void)
+static int __init htb_module_init(void)
{
return register_qdisc(&htb_qdisc_ops);
}
-
-void cleanup_module(void)
+static void __exit htb_module_exit(void)
{
unregister_qdisc(&htb_qdisc_ops);
}
+module_init(htb_module_init)
+module_exit(htb_module_exit)
MODULE_LICENSE("GPL");
-#endif
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 71ecbcbc83ca..37eb5df8f304 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -333,7 +333,7 @@ static struct Qdisc_class_ops ingress_class_ops = {
.dump = NULL,
};
-struct Qdisc_ops ingress_qdisc_ops = {
+static struct Qdisc_ops ingress_qdisc_ops = {
.next = NULL,
.cl_ops = &ingress_class_ops,
.id = "ingress",
@@ -350,9 +350,7 @@ struct Qdisc_ops ingress_qdisc_ops = {
.owner = THIS_MODULE,
};
-
-#ifdef MODULE
-int init_module(void)
+static int __init ingress_module_init(void)
{
int ret = 0;
@@ -363,13 +361,12 @@ int init_module(void)
return ret;
}
-
-
-void cleanup_module(void)
+static void __exit ingress_module_exit(void)
{
unregister_qdisc(&ingress_qdisc_ops);
if (nf_registered)
nf_unregister_hook(&ing_ops);
}
-#endif
+module_init(ingress_module_init)
+module_exit(ingress_module_exit)
MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 6c76742a3a03..f8eafc507644 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -382,7 +382,7 @@ static struct Qdisc_class_ops prio_class_ops = {
.dump = prio_dump_class,
};
-struct Qdisc_ops prio_qdisc_ops = {
+static struct Qdisc_ops prio_qdisc_ops = {
.next = NULL,
.cl_ops = &prio_class_ops,
.id = "prio",
@@ -399,17 +399,17 @@ struct Qdisc_ops prio_qdisc_ops = {
.owner = THIS_MODULE,
};
-#ifdef MODULE
-
-int init_module(void)
+static int __init prio_module_init(void)
{
return register_qdisc(&prio_qdisc_ops);
}
-void cleanup_module(void)
+static void __exit prio_module_exit(void)
{
unregister_qdisc(&prio_qdisc_ops);
}
-#endif
+module_init(prio_module_init)
+module_exit(prio_module_exit)
+
MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 05879ec4c9cd..f698115a2215 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -453,7 +453,7 @@ static void red_destroy(struct Qdisc *sch)
{
}
-struct Qdisc_ops red_qdisc_ops = {
+static struct Qdisc_ops red_qdisc_ops = {
.next = NULL,
.cl_ops = NULL,
.id = "red",
@@ -470,16 +470,14 @@ struct Qdisc_ops red_qdisc_ops = {
.owner = THIS_MODULE,
};
-
-#ifdef MODULE
-int init_module(void)
+static int __init red_module_init(void)
{
return register_qdisc(&red_qdisc_ops);
}
-
-void cleanup_module(void)
+static void __exit red_module_exit(void)
{
unregister_qdisc(&red_qdisc_ops);
}
-#endif
+module_init(red_module_init)
+module_exit(red_module_exit)
MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index e70661d8eedb..acf2666ad748 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -466,7 +466,7 @@ rtattr_failure:
return -1;
}
-struct Qdisc_ops sfq_qdisc_ops = {
+static struct Qdisc_ops sfq_qdisc_ops = {
.next = NULL,
.cl_ops = NULL,
.id = "sfq",
@@ -483,15 +483,14 @@ struct Qdisc_ops sfq_qdisc_ops = {
.owner = THIS_MODULE,
};
-#ifdef MODULE
-int init_module(void)
+static int __init sfq_module_init(void)
{
return register_qdisc(&sfq_qdisc_ops);
}
-
-void cleanup_module(void)
+static void __exit sfq_module_exit(void)
{
unregister_qdisc(&sfq_qdisc_ops);
}
-#endif
+module_init(sfq_module_init)
+module_exit(sfq_module_exit)
MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 507f3dd8c6b0..97e200a61daa 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -510,7 +510,7 @@ static struct Qdisc_class_ops tbf_class_ops =
.dump = tbf_dump_class,
};
-struct Qdisc_ops tbf_qdisc_ops = {
+static struct Qdisc_ops tbf_qdisc_ops = {
.next = NULL,
.cl_ops = &tbf_class_ops,
.id = "tbf",
@@ -527,16 +527,15 @@ struct Qdisc_ops tbf_qdisc_ops = {
.owner = THIS_MODULE,
};
-
-#ifdef MODULE
-int init_module(void)
+static int __init tbf_module_init(void)
{
return register_qdisc(&tbf_qdisc_ops);
}
-void cleanup_module(void)
+static void __exit tbf_module_exit(void)
{
unregister_qdisc(&tbf_qdisc_ops);
}
-#endif
+module_init(tbf_module_init)
+module_exit(tbf_module_exit)
MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 2e938e1ad9ae..da5e89c22b83 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -418,14 +418,12 @@ static int teql_master_mtu(struct net_device *dev, int new_mtu)
return 0;
}
-static __init int teql_master_init(struct net_device *dev)
+static __init void teql_master_setup(struct net_device *dev)
{
struct teql_master *master = dev->priv;
struct Qdisc_ops *ops = &master->qops;
master->dev = dev;
-
- strlcpy(ops->id, dev->name, IFNAMSIZ);
ops->priv_size = sizeof(struct teql_sched_data);
ops->enqueue = teql_enqueue;
@@ -436,12 +434,6 @@ static __init int teql_master_init(struct net_device *dev)
ops->destroy = teql_destroy;
ops->owner = THIS_MODULE;
- return register_qdisc(ops);
-}
-
-static __init void teql_master_setup(struct net_device *dev)
-{
- dev->init = teql_master_init;
dev->open = teql_master_open;
dev->hard_start_xmit = teql_master_xmit;
dev->stop = teql_master_close;
@@ -460,10 +452,10 @@ static int max_equalizers = 1;
MODULE_PARM(max_equalizers, "i");
MODULE_PARM_DESC(max_equalizers, "Max number of link equalizers");
-int __init teql_init(void)
+static int __init teql_init(void)
{
int i;
- int err = 0;
+ int err = -ENODEV;
for (i = 0; i < max_equalizers; i++) {
struct net_device *dev;
@@ -471,19 +463,30 @@ int __init teql_init(void)
dev = alloc_netdev(sizeof(struct teql_master),
"teql%d", teql_master_setup);
- if (!dev)
- return -ENOMEM;
+ if (!dev) {
+ err = -ENOMEM;
+ break;
+ }
if ((err = register_netdev(dev))) {
free_netdev(dev);
- goto out;
+ break;
}
master = dev->priv;
+
+ strlcpy(master->qops.id, dev->name, IFNAMSIZ);
+ err = register_qdisc(&master->qops);
+
+ if (err) {
+ unregister_netdev(dev);
+ free_netdev(dev);
+ break;
+ }
+
list_add_tail(&master->master_list, &master_dev_list);
}
- out:
- return err;
+ return i ? 0 : err;
}
static void __exit teql_exit(void)