aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2011-11-25 09:35:02 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-26 14:48:15 -0500
commit7df899c36cf09678bdef1824ce591ef4ac0e9864 (patch)
treedf5d5e8ae7d01d5958432e38ee557ed2d1d154ba /net
parentad293b8a218ca13a9ee3e3c98137fa301987577c (diff)
dsa: Combine core and tagging code
These files have circular dependencies, so if we make DSA modular then they must be built into the same module. Therefore, link them together and merge their respective module init and exit functions. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/dsa/Makefile13
-rw-r--r--net/dsa/dsa.c26
-rw-r--r--net/dsa/dsa_priv.h3
-rw-r--r--net/dsa/tag_dsa.c15
-rw-r--r--net/dsa/tag_edsa.c15
-rw-r--r--net/dsa/tag_trailer.c15
6 files changed, 38 insertions, 49 deletions
diff --git a/net/dsa/Makefile b/net/dsa/Makefile
index 2374faff4dea..5431b4a43c13 100644
--- a/net/dsa/Makefile
+++ b/net/dsa/Makefile
@@ -1,13 +1,14 @@
1# the core
2obj-$(CONFIG_NET_DSA) += dsa_core.o
3dsa_core-y += dsa.o slave.o
4
1# tagging formats 5# tagging formats
2obj-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o 6dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
3obj-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o 7dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
4obj-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o 8dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
5 9
6# switch drivers 10# switch drivers
7obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o 11obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o
8obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o 12obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
9obj-$(CONFIG_NET_DSA_MV88E6123_61_65) += mv88e6123_61_65.o 13obj-$(CONFIG_NET_DSA_MV88E6123_61_65) += mv88e6123_61_65.o
10obj-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o 14obj-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o
11
12# the core
13obj-$(CONFIG_NET_DSA) += dsa.o slave.o
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index fc93088cdc90..88e7c2f3fa0d 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -398,12 +398,36 @@ static struct platform_driver dsa_driver = {
398 398
399static int __init dsa_init_module(void) 399static int __init dsa_init_module(void)
400{ 400{
401 return platform_driver_register(&dsa_driver); 401 int rc;
402
403 rc = platform_driver_register(&dsa_driver);
404 if (rc)
405 return rc;
406
407#ifdef CONFIG_NET_DSA_TAG_DSA
408 dev_add_pack(&dsa_packet_type);
409#endif
410#ifdef CONFIG_NET_DSA_TAG_EDSA
411 dev_add_pack(&edsa_packet_type);
412#endif
413#ifdef CONFIG_NET_DSA_TAG_TRAILER
414 dev_add_pack(&trailer_packet_type);
415#endif
416 return 0;
402} 417}
403module_init(dsa_init_module); 418module_init(dsa_init_module);
404 419
405static void __exit dsa_cleanup_module(void) 420static void __exit dsa_cleanup_module(void)
406{ 421{
422#ifdef CONFIG_NET_DSA_TAG_TRAILER
423 dev_remove_pack(&trailer_packet_type);
424#endif
425#ifdef CONFIG_NET_DSA_TAG_EDSA
426 dev_remove_pack(&edsa_packet_type);
427#endif
428#ifdef CONFIG_NET_DSA_TAG_DSA
429 dev_remove_pack(&dsa_packet_type);
430#endif
407 platform_driver_unregister(&dsa_driver); 431 platform_driver_unregister(&dsa_driver);
408} 432}
409module_exit(dsa_cleanup_module); 433module_exit(dsa_cleanup_module);
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index a45186cb6daf..89a2eb48232a 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -137,12 +137,15 @@ struct net_device *dsa_slave_create(struct dsa_switch *ds,
137 137
138/* tag_dsa.c */ 138/* tag_dsa.c */
139netdev_tx_t dsa_xmit(struct sk_buff *skb, struct net_device *dev); 139netdev_tx_t dsa_xmit(struct sk_buff *skb, struct net_device *dev);
140extern struct packet_type dsa_packet_type;
140 141
141/* tag_edsa.c */ 142/* tag_edsa.c */
142netdev_tx_t edsa_xmit(struct sk_buff *skb, struct net_device *dev); 143netdev_tx_t edsa_xmit(struct sk_buff *skb, struct net_device *dev);
144extern struct packet_type edsa_packet_type;
143 145
144/* tag_trailer.c */ 146/* tag_trailer.c */
145netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev); 147netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev);
148extern struct packet_type trailer_packet_type;
146 149
147 150
148#endif 151#endif
diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
index 98dfe80b4538..cacce1e22f9c 100644
--- a/net/dsa/tag_dsa.c
+++ b/net/dsa/tag_dsa.c
@@ -186,20 +186,7 @@ out:
186 return 0; 186 return 0;
187} 187}
188 188
189static struct packet_type dsa_packet_type __read_mostly = { 189struct packet_type dsa_packet_type __read_mostly = {
190 .type = cpu_to_be16(ETH_P_DSA), 190 .type = cpu_to_be16(ETH_P_DSA),
191 .func = dsa_rcv, 191 .func = dsa_rcv,
192}; 192};
193
194static int __init dsa_init_module(void)
195{
196 dev_add_pack(&dsa_packet_type);
197 return 0;
198}
199module_init(dsa_init_module);
200
201static void __exit dsa_cleanup_module(void)
202{
203 dev_remove_pack(&dsa_packet_type);
204}
205module_exit(dsa_cleanup_module);
diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c
index 6f383322ad25..e70c43c25e64 100644
--- a/net/dsa/tag_edsa.c
+++ b/net/dsa/tag_edsa.c
@@ -205,20 +205,7 @@ out:
205 return 0; 205 return 0;
206} 206}
207 207
208static struct packet_type edsa_packet_type __read_mostly = { 208struct packet_type edsa_packet_type __read_mostly = {
209 .type = cpu_to_be16(ETH_P_EDSA), 209 .type = cpu_to_be16(ETH_P_EDSA),
210 .func = edsa_rcv, 210 .func = edsa_rcv,
211}; 211};
212
213static int __init edsa_init_module(void)
214{
215 dev_add_pack(&edsa_packet_type);
216 return 0;
217}
218module_init(edsa_init_module);
219
220static void __exit edsa_cleanup_module(void)
221{
222 dev_remove_pack(&edsa_packet_type);
223}
224module_exit(edsa_cleanup_module);
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c
index d6d7d0add3cb..94bc260d015d 100644
--- a/net/dsa/tag_trailer.c
+++ b/net/dsa/tag_trailer.c
@@ -114,20 +114,7 @@ out:
114 return 0; 114 return 0;
115} 115}
116 116
117static struct packet_type trailer_packet_type __read_mostly = { 117struct packet_type trailer_packet_type __read_mostly = {
118 .type = cpu_to_be16(ETH_P_TRAILER), 118 .type = cpu_to_be16(ETH_P_TRAILER),
119 .func = trailer_rcv, 119 .func = trailer_rcv,
120}; 120};
121
122static int __init trailer_init_module(void)
123{
124 dev_add_pack(&trailer_packet_type);
125 return 0;
126}
127module_init(trailer_init_module);
128
129static void __exit trailer_cleanup_module(void)
130{
131 dev_remove_pack(&trailer_packet_type);
132}
133module_exit(trailer_cleanup_module);