* [PATCH] [1/2] phylib: cleanup marvell.c a bit
@ 2007-07-03 21:23 Olof Johansson
2007-07-03 21:24 ` [PATCH] [2/2] phylib: Add Marvell 88E1112 phy id Olof Johansson
2007-07-10 16:41 ` [PATCH] [1/2] phylib: cleanup marvell.c a bit Jeff Garzik
0 siblings, 2 replies; 3+ messages in thread
From: Olof Johansson @ 2007-07-03 21:23 UTC (permalink / raw)
To: jgarzik; +Cc: afleming, netdev
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: Olof Johansson <olof@lixom.net>
Index: mainline/drivers/net/phy/marvell.c
===================================================================
--- mainline.orig/drivers/net/phy/marvell.c
+++ mainline/drivers/net/phy/marvell.c
@@ -238,77 +238,71 @@ static int m88e1145_config_init(struct p
return 0;
}
-static struct phy_driver m88e1101_driver = {
- .phy_id = 0x01410c60,
- .phy_id_mask = 0xfffffff0,
- .name = "Marvell 88E1101",
- .features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_INTERRUPT,
- .config_aneg = &marvell_config_aneg,
- .read_status = &genphy_read_status,
- .ack_interrupt = &marvell_ack_interrupt,
- .config_intr = &marvell_config_intr,
- .driver = {.owner = THIS_MODULE,},
-};
-
-static struct phy_driver m88e1111_driver = {
- .phy_id = 0x01410cc0,
- .phy_id_mask = 0xfffffff0,
- .name = "Marvell 88E1111",
- .features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_INTERRUPT,
- .config_aneg = &marvell_config_aneg,
- .read_status = &genphy_read_status,
- .ack_interrupt = &marvell_ack_interrupt,
- .config_intr = &marvell_config_intr,
- .config_init = &m88e1111_config_init,
- .driver = {.owner = THIS_MODULE,},
-};
-
-static struct phy_driver m88e1145_driver = {
- .phy_id = 0x01410cd0,
- .phy_id_mask = 0xfffffff0,
- .name = "Marvell 88E1145",
- .features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_INTERRUPT,
- .config_init = &m88e1145_config_init,
- .config_aneg = &marvell_config_aneg,
- .read_status = &genphy_read_status,
- .ack_interrupt = &marvell_ack_interrupt,
- .config_intr = &marvell_config_intr,
- .driver = {.owner = THIS_MODULE,},
+static struct phy_driver marvell_drivers[] = {
+ {
+ .phy_id = 0x01410c60,
+ .phy_id_mask = 0xfffffff0,
+ .name = "Marvell 88E1101",
+ .features = PHY_GBIT_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_aneg = &marvell_config_aneg,
+ .read_status = &genphy_read_status,
+ .ack_interrupt = &marvell_ack_interrupt,
+ .config_intr = &marvell_config_intr,
+ .driver = {.owner = THIS_MODULE,},
+ },
+ {
+ .phy_id = 0x01410cc0,
+ .phy_id_mask = 0xfffffff0,
+ .name = "Marvell 88E1111",
+ .features = PHY_GBIT_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_init = &m88e1111_config_init,
+ .config_aneg = &marvell_config_aneg,
+ .read_status = &genphy_read_status,
+ .ack_interrupt = &marvell_ack_interrupt,
+ .config_intr = &marvell_config_intr,
+ .driver = {.owner = THIS_MODULE,},
+ },
+ {
+ .phy_id = 0x01410cd0,
+ .phy_id_mask = 0xfffffff0,
+ .name = "Marvell 88E1145",
+ .features = PHY_GBIT_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_init = &m88e1145_config_init,
+ .config_aneg = &marvell_config_aneg,
+ .read_status = &genphy_read_status,
+ .ack_interrupt = &marvell_ack_interrupt,
+ .config_intr = &marvell_config_intr,
+ .driver = {.owner = THIS_MODULE,},
+ }
};
static int __init marvell_init(void)
{
int ret;
+ int i;
- ret = phy_driver_register(&m88e1101_driver);
- if (ret)
- return ret;
-
- ret = phy_driver_register(&m88e1111_driver);
- if (ret)
- goto err1111;
-
- ret = phy_driver_register(&m88e1145_driver);
- if (ret)
- goto err1145;
+ for (i = 0; i < ARRAY_SIZE(marvell_drivers); i++) {
+ ret = phy_driver_register(&marvell_drivers[i]);
- return 0;
+ if (ret) {
+ while (i-- > 0)
+ phy_driver_unregister(&marvell_drivers[i]);
+ return ret;
+ }
+ }
-err1145:
- phy_driver_unregister(&m88e1111_driver);
-err1111:
- phy_driver_unregister(&m88e1101_driver);
- return ret;
+ return 0;
}
static void __exit marvell_exit(void)
{
- phy_driver_unregister(&m88e1101_driver);
- phy_driver_unregister(&m88e1111_driver);
- phy_driver_unregister(&m88e1145_driver);
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(marvell_drivers); i++)
+ phy_driver_unregister(&marvell_drivers[i]);
}
module_init(marvell_init);
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] [2/2] phylib: Add Marvell 88E1112 phy id
2007-07-03 21:23 [PATCH] [1/2] phylib: cleanup marvell.c a bit Olof Johansson
@ 2007-07-03 21:24 ` Olof Johansson
2007-07-10 16:41 ` [PATCH] [1/2] phylib: cleanup marvell.c a bit Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2007-07-03 21:24 UTC (permalink / raw)
To: jgarzik; +Cc: afleming, netdev
Add 88E1112 PHY ID to the marvell driver. Seems to do fine with the
88E1111 inits.
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: mainline/drivers/net/phy/marvell.c
===================================================================
--- mainline.orig/drivers/net/phy/marvell.c
+++ mainline/drivers/net/phy/marvell.c
@@ -252,6 +252,19 @@ static struct phy_driver marvell_drivers
.driver = {.owner = THIS_MODULE,},
},
{
+ .phy_id = 0x01410c90,
+ .phy_id_mask = 0xfffffff0,
+ .name = "Marvell 88E1112",
+ .features = PHY_GBIT_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_init = &m88e1111_config_init,
+ .config_aneg = &marvell_config_aneg,
+ .read_status = &genphy_read_status,
+ .ack_interrupt = &marvell_ack_interrupt,
+ .config_intr = &marvell_config_intr,
+ .driver = {.owner = THIS_MODULE,},
+ },
+ {
.phy_id = 0x01410cc0,
.phy_id_mask = 0xfffffff0,
.name = "Marvell 88E1111",
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] [1/2] phylib: cleanup marvell.c a bit
2007-07-03 21:23 [PATCH] [1/2] phylib: cleanup marvell.c a bit Olof Johansson
2007-07-03 21:24 ` [PATCH] [2/2] phylib: Add Marvell 88E1112 phy id Olof Johansson
@ 2007-07-10 16:41 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2007-07-10 16:41 UTC (permalink / raw)
To: Olof Johansson; +Cc: afleming, netdev
Olof Johansson wrote:
> 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: Olof Johansson <olof@lixom.net>
applied 1-2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-10 16:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-03 21:23 [PATCH] [1/2] phylib: cleanup marvell.c a bit Olof Johansson
2007-07-03 21:24 ` [PATCH] [2/2] phylib: Add Marvell 88E1112 phy id Olof Johansson
2007-07-10 16:41 ` [PATCH] [1/2] phylib: cleanup marvell.c a bit Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).