aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2011-11-25 09:36:19 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-26 14:48:15 -0500
commit98e673080bd90b9338428be92dd3597798aac3ed (patch)
treeaea557e2596565fae249712ba652cf6e36e7def5
parent7df899c36cf09678bdef1824ce591ef4ac0e9864 (diff)
mv88e6xxx: Combine mv88e6131 and mv88e612_61_65 drivers
These drivers share a lot of code, so if we make them modular they should 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>
-rw-r--r--net/dsa/Makefile7
-rw-r--r--net/dsa/mv88e6123_61_65.c15
-rw-r--r--net/dsa/mv88e6131.c15
-rw-r--r--net/dsa/mv88e6xxx.c23
-rw-r--r--net/dsa/mv88e6xxx.h3
5 files changed, 32 insertions, 31 deletions
diff --git a/net/dsa/Makefile b/net/dsa/Makefile
index 5431b4a43c13..5c48ac556997 100644
--- a/net/dsa/Makefile
+++ b/net/dsa/Makefile
@@ -8,7 +8,8 @@ dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
8dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o 8dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
9 9
10# switch drivers 10# switch drivers
11obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o
12obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o 11obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
13obj-$(CONFIG_NET_DSA_MV88E6123_61_65) += mv88e6123_61_65.o 12obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx_drv.o
14obj-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o 13mv88e6xxx_drv-y += mv88e6xxx.o
14mv88e6xxx_drv-$(CONFIG_NET_DSA_MV88E6123_61_65) += mv88e6123_61_65.o
15mv88e6xxx_drv-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o
diff --git a/net/dsa/mv88e6123_61_65.c b/net/dsa/mv88e6123_61_65.c
index 52faaa21a4d9..7951a6cc9bdc 100644
--- a/net/dsa/mv88e6123_61_65.c
+++ b/net/dsa/mv88e6123_61_65.c
@@ -419,7 +419,7 @@ static int mv88e6123_61_65_get_sset_count(struct dsa_switch *ds)
419 return ARRAY_SIZE(mv88e6123_61_65_hw_stats); 419 return ARRAY_SIZE(mv88e6123_61_65_hw_stats);
420} 420}
421 421
422static struct dsa_switch_driver mv88e6123_61_65_switch_driver = { 422struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
423 .tag_protocol = cpu_to_be16(ETH_P_EDSA), 423 .tag_protocol = cpu_to_be16(ETH_P_EDSA),
424 .priv_size = sizeof(struct mv88e6xxx_priv_state), 424 .priv_size = sizeof(struct mv88e6xxx_priv_state),
425 .probe = mv88e6123_61_65_probe, 425 .probe = mv88e6123_61_65_probe,
@@ -432,16 +432,3 @@ static struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
432 .get_ethtool_stats = mv88e6123_61_65_get_ethtool_stats, 432 .get_ethtool_stats = mv88e6123_61_65_get_ethtool_stats,
433 .get_sset_count = mv88e6123_61_65_get_sset_count, 433 .get_sset_count = mv88e6123_61_65_get_sset_count,
434}; 434};
435
436static int __init mv88e6123_61_65_init(void)
437{
438 register_switch_driver(&mv88e6123_61_65_switch_driver);
439 return 0;
440}
441module_init(mv88e6123_61_65_init);
442
443static void __exit mv88e6123_61_65_cleanup(void)
444{
445 unregister_switch_driver(&mv88e6123_61_65_switch_driver);
446}
447module_exit(mv88e6123_61_65_cleanup);
diff --git a/net/dsa/mv88e6131.c b/net/dsa/mv88e6131.c
index 9bd1061fa4ee..45f41239381c 100644
--- a/net/dsa/mv88e6131.c
+++ b/net/dsa/mv88e6131.c
@@ -415,7 +415,7 @@ static int mv88e6131_get_sset_count(struct dsa_switch *ds)
415 return ARRAY_SIZE(mv88e6131_hw_stats); 415 return ARRAY_SIZE(mv88e6131_hw_stats);
416} 416}
417 417
418static struct dsa_switch_driver mv88e6131_switch_driver = { 418struct dsa_switch_driver mv88e6131_switch_driver = {
419 .tag_protocol = cpu_to_be16(ETH_P_DSA), 419 .tag_protocol = cpu_to_be16(ETH_P_DSA),
420 .priv_size = sizeof(struct mv88e6xxx_priv_state), 420 .priv_size = sizeof(struct mv88e6xxx_priv_state),
421 .probe = mv88e6131_probe, 421 .probe = mv88e6131_probe,
@@ -428,16 +428,3 @@ static struct dsa_switch_driver mv88e6131_switch_driver = {
428 .get_ethtool_stats = mv88e6131_get_ethtool_stats, 428 .get_ethtool_stats = mv88e6131_get_ethtool_stats,
429 .get_sset_count = mv88e6131_get_sset_count, 429 .get_sset_count = mv88e6131_get_sset_count,
430}; 430};
431
432static int __init mv88e6131_init(void)
433{
434 register_switch_driver(&mv88e6131_switch_driver);
435 return 0;
436}
437module_init(mv88e6131_init);
438
439static void __exit mv88e6131_cleanup(void)
440{
441 unregister_switch_driver(&mv88e6131_switch_driver);
442}
443module_exit(mv88e6131_cleanup);
diff --git a/net/dsa/mv88e6xxx.c b/net/dsa/mv88e6xxx.c
index efe661a9def4..50fd86027969 100644
--- a/net/dsa/mv88e6xxx.c
+++ b/net/dsa/mv88e6xxx.c
@@ -520,3 +520,26 @@ void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds,
520 520
521 mutex_unlock(&ps->stats_mutex); 521 mutex_unlock(&ps->stats_mutex);
522} 522}
523
524static int __init mv88e6xxx_init(void)
525{
526#if IS_ENABLED(CONFIG_NET_DSA_MV88E6131)
527 register_switch_driver(&mv88e6131_switch_driver);
528#endif
529#if IS_ENABLED(CONFIG_NET_DSA_MV88E6123_61_65)
530 register_switch_driver(&mv88e6123_61_65_switch_driver);
531#endif
532 return 0;
533}
534module_init(mv88e6xxx_init);
535
536static void __exit mv88e6xxx_cleanup(void)
537{
538#if IS_ENABLED(CONFIG_NET_DSA_MV88E6123_61_65)
539 unregister_switch_driver(&mv88e6123_61_65_switch_driver);
540#endif
541#if IS_ENABLED(CONFIG_NET_DSA_MV88E6131)
542 unregister_switch_driver(&mv88e6131_switch_driver);
543#endif
544}
545module_exit(mv88e6xxx_cleanup);
diff --git a/net/dsa/mv88e6xxx.h b/net/dsa/mv88e6xxx.h
index 61156ca26a0d..fc2cd7b90e8d 100644
--- a/net/dsa/mv88e6xxx.h
+++ b/net/dsa/mv88e6xxx.h
@@ -71,6 +71,9 @@ void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds,
71 int nr_stats, struct mv88e6xxx_hw_stat *stats, 71 int nr_stats, struct mv88e6xxx_hw_stat *stats,
72 int port, uint64_t *data); 72 int port, uint64_t *data);
73 73
74extern struct dsa_switch_driver mv88e6131_switch_driver;
75extern struct dsa_switch_driver mv88e6123_61_65_switch_driver;
76
74#define REG_READ(addr, reg) \ 77#define REG_READ(addr, reg) \
75 ({ \ 78 ({ \
76 int __ret; \ 79 int __ret; \