Commit e5479239 authored by Olof Johansson's avatar Olof Johansson Committed by Jeff Garzik

phylib: cleanup marvell.c a bit

Simplify the marvell driver init a bit: Make the supported devices an
array instead of explicitly registering each structure. This makes it
considerably easier to add new devices down the road.
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 825a2ff1
...@@ -254,7 +254,8 @@ static int m88e1145_config_init(struct phy_device *phydev) ...@@ -254,7 +254,8 @@ static int m88e1145_config_init(struct phy_device *phydev)
return 0; return 0;
} }
static struct phy_driver m88e1101_driver = { static struct phy_driver marvell_drivers[] = {
{
.phy_id = 0x01410c60, .phy_id = 0x01410c60,
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Marvell 88E1101", .name = "Marvell 88E1101",
...@@ -265,23 +266,21 @@ static struct phy_driver m88e1101_driver = { ...@@ -265,23 +266,21 @@ static struct phy_driver m88e1101_driver = {
.ack_interrupt = &marvell_ack_interrupt, .ack_interrupt = &marvell_ack_interrupt,
.config_intr = &marvell_config_intr, .config_intr = &marvell_config_intr,
.driver = {.owner = THIS_MODULE,}, .driver = {.owner = THIS_MODULE,},
}; },
{
static struct phy_driver m88e1111_driver = {
.phy_id = 0x01410cc0, .phy_id = 0x01410cc0,
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Marvell 88E1111", .name = "Marvell 88E1111",
.features = PHY_GBIT_FEATURES, .features = PHY_GBIT_FEATURES,
.flags = PHY_HAS_INTERRUPT, .flags = PHY_HAS_INTERRUPT,
.config_init = &m88e1111_config_init,
.config_aneg = &marvell_config_aneg, .config_aneg = &marvell_config_aneg,
.read_status = &genphy_read_status, .read_status = &genphy_read_status,
.ack_interrupt = &marvell_ack_interrupt, .ack_interrupt = &marvell_ack_interrupt,
.config_intr = &marvell_config_intr, .config_intr = &marvell_config_intr,
.config_init = &m88e1111_config_init,
.driver = {.owner = THIS_MODULE,}, .driver = {.owner = THIS_MODULE,},
}; },
{
static struct phy_driver m88e1145_driver = {
.phy_id = 0x01410cd0, .phy_id = 0x01410cd0,
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Marvell 88E1145", .name = "Marvell 88E1145",
...@@ -293,38 +292,33 @@ static struct phy_driver m88e1145_driver = { ...@@ -293,38 +292,33 @@ static struct phy_driver m88e1145_driver = {
.ack_interrupt = &marvell_ack_interrupt, .ack_interrupt = &marvell_ack_interrupt,
.config_intr = &marvell_config_intr, .config_intr = &marvell_config_intr,
.driver = {.owner = THIS_MODULE,}, .driver = {.owner = THIS_MODULE,},
}
}; };
static int __init marvell_init(void) static int __init marvell_init(void)
{ {
int ret; int ret;
int i;
ret = phy_driver_register(&m88e1101_driver); for (i = 0; i < ARRAY_SIZE(marvell_drivers); i++) {
if (ret) ret = phy_driver_register(&marvell_drivers[i]);
return ret;
ret = phy_driver_register(&m88e1111_driver); if (ret) {
if (ret) while (i-- > 0)
goto err1111; phy_driver_unregister(&marvell_drivers[i]);
return ret;
ret = phy_driver_register(&m88e1145_driver); }
if (ret) }
goto err1145;
return 0; return 0;
err1145:
phy_driver_unregister(&m88e1111_driver);
err1111:
phy_driver_unregister(&m88e1101_driver);
return ret;
} }
static void __exit marvell_exit(void) static void __exit marvell_exit(void)
{ {
phy_driver_unregister(&m88e1101_driver); int i;
phy_driver_unregister(&m88e1111_driver);
phy_driver_unregister(&m88e1145_driver); for (i = 0; i < ARRAY_SIZE(marvell_drivers); i++)
phy_driver_unregister(&marvell_drivers[i]);
} }
module_init(marvell_init); module_init(marvell_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment