diff options
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r-- | net/dsa/dsa.c | 26 |
1 files changed, 25 insertions, 1 deletions
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); |