diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2011-11-25 09:35:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-26 14:48:15 -0500 |
commit | 7df899c36cf09678bdef1824ce591ef4ac0e9864 (patch) | |
tree | df5d5e8ae7d01d5958432e38ee557ed2d1d154ba /net | |
parent | ad293b8a218ca13a9ee3e3c98137fa301987577c (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/Makefile | 13 | ||||
-rw-r--r-- | net/dsa/dsa.c | 26 | ||||
-rw-r--r-- | net/dsa/dsa_priv.h | 3 | ||||
-rw-r--r-- | net/dsa/tag_dsa.c | 15 | ||||
-rw-r--r-- | net/dsa/tag_edsa.c | 15 | ||||
-rw-r--r-- | net/dsa/tag_trailer.c | 15 |
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 | ||
2 | obj-$(CONFIG_NET_DSA) += dsa_core.o | ||
3 | dsa_core-y += dsa.o slave.o | ||
4 | |||
1 | # tagging formats | 5 | # tagging formats |
2 | obj-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o | 6 | dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o |
3 | obj-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o | 7 | dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o |
4 | obj-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o | 8 | dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o |
5 | 9 | ||
6 | # switch drivers | 10 | # switch drivers |
7 | obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o | 11 | obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o |
8 | obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o | 12 | obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o |
9 | obj-$(CONFIG_NET_DSA_MV88E6123_61_65) += mv88e6123_61_65.o | 13 | obj-$(CONFIG_NET_DSA_MV88E6123_61_65) += mv88e6123_61_65.o |
10 | obj-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o | 14 | obj-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o |
11 | |||
12 | # the core | ||
13 | obj-$(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 | ||
399 | static int __init dsa_init_module(void) | 399 | static 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 | } |
403 | module_init(dsa_init_module); | 418 | module_init(dsa_init_module); |
404 | 419 | ||
405 | static void __exit dsa_cleanup_module(void) | 420 | static 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 | } |
409 | module_exit(dsa_cleanup_module); | 433 | module_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 */ |
139 | netdev_tx_t dsa_xmit(struct sk_buff *skb, struct net_device *dev); | 139 | netdev_tx_t dsa_xmit(struct sk_buff *skb, struct net_device *dev); |
140 | extern struct packet_type dsa_packet_type; | ||
140 | 141 | ||
141 | /* tag_edsa.c */ | 142 | /* tag_edsa.c */ |
142 | netdev_tx_t edsa_xmit(struct sk_buff *skb, struct net_device *dev); | 143 | netdev_tx_t edsa_xmit(struct sk_buff *skb, struct net_device *dev); |
144 | extern struct packet_type edsa_packet_type; | ||
143 | 145 | ||
144 | /* tag_trailer.c */ | 146 | /* tag_trailer.c */ |
145 | netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev); | 147 | netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev); |
148 | extern 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 | ||
189 | static struct packet_type dsa_packet_type __read_mostly = { | 189 | struct 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 | |||
194 | static int __init dsa_init_module(void) | ||
195 | { | ||
196 | dev_add_pack(&dsa_packet_type); | ||
197 | return 0; | ||
198 | } | ||
199 | module_init(dsa_init_module); | ||
200 | |||
201 | static void __exit dsa_cleanup_module(void) | ||
202 | { | ||
203 | dev_remove_pack(&dsa_packet_type); | ||
204 | } | ||
205 | module_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 | ||
208 | static struct packet_type edsa_packet_type __read_mostly = { | 208 | struct 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 | |||
213 | static int __init edsa_init_module(void) | ||
214 | { | ||
215 | dev_add_pack(&edsa_packet_type); | ||
216 | return 0; | ||
217 | } | ||
218 | module_init(edsa_init_module); | ||
219 | |||
220 | static void __exit edsa_cleanup_module(void) | ||
221 | { | ||
222 | dev_remove_pack(&edsa_packet_type); | ||
223 | } | ||
224 | module_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 | ||
117 | static struct packet_type trailer_packet_type __read_mostly = { | 117 | struct 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 | |||
122 | static int __init trailer_init_module(void) | ||
123 | { | ||
124 | dev_add_pack(&trailer_packet_type); | ||
125 | return 0; | ||
126 | } | ||
127 | module_init(trailer_init_module); | ||
128 | |||
129 | static void __exit trailer_cleanup_module(void) | ||
130 | { | ||
131 | dev_remove_pack(&trailer_packet_type); | ||
132 | } | ||
133 | module_exit(trailer_cleanup_module); | ||