summaryrefslogtreecommitdiff
path: root/drivers/net/phy/bcm87xx.c
diff options
context:
space:
mode:
authorChristian Hohnstaedt <chohnstaedt@innominate.com>2012-07-04 05:44:34 +0000
committerDavid S. Miller <davem@davemloft.net>2012-07-09 00:10:56 -0700
commitd5bf9071e71a4db85a0eea6236ef94a29fc3eec9 (patch)
treecf91cd107a5eda19dc8a1024b0c9b2115edf4988 /drivers/net/phy/bcm87xx.c
parent567990cfccafc580b03b1fb501adf63132c12dcc (diff)
phylib: Support registering a bunch of drivers
If registering of one of them fails, all already registered drivers of this module will be unregistered. Use the new register/unregister functions in all drivers registering more than one driver. amd.c, realtek.c: Simplify: directly return registration result. Tested with broadcom.c All others compile-tested. Signed-off-by: Christian Hohnstaedt <chohnstaedt@innominate.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/bcm87xx.c')
-rw-r--r--drivers/net/phy/bcm87xx.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
index 9a90dcf31156..2167ce51818e 100644
--- a/drivers/net/phy/bcm87xx.c
+++ b/drivers/net/phy/bcm87xx.c
@@ -187,7 +187,8 @@ static int bcm8727_match_phy_device(struct phy_device *phydev)
return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8727;
}
-static struct phy_driver bcm8706_driver = {
+static struct phy_driver bcm87xx_driver[] = {
+{
.phy_id = PHY_ID_BCM8706,
.phy_id_mask = 0xffffffff,
.name = "Broadcom BCM8706",
@@ -200,9 +201,7 @@ static struct phy_driver bcm8706_driver = {
.did_interrupt = bcm87xx_did_interrupt,
.match_phy_device = bcm8706_match_phy_device,
.driver = { .owner = THIS_MODULE },
-};
-
-static struct phy_driver bcm8727_driver = {
+}, {
.phy_id = PHY_ID_BCM8727,
.phy_id_mask = 0xffffffff,
.name = "Broadcom BCM8727",
@@ -215,25 +214,18 @@ static struct phy_driver bcm8727_driver = {
.did_interrupt = bcm87xx_did_interrupt,
.match_phy_device = bcm8727_match_phy_device,
.driver = { .owner = THIS_MODULE },
-};
+} };
static int __init bcm87xx_init(void)
{
- int ret;
-
- ret = phy_driver_register(&bcm8706_driver);
- if (ret)
- goto err;
-
- ret = phy_driver_register(&bcm8727_driver);
-err:
- return ret;
+ return phy_drivers_register(bcm87xx_driver,
+ ARRAY_SIZE(bcm87xx_driver));
}
module_init(bcm87xx_init);
static void __exit bcm87xx_exit(void)
{
- phy_driver_unregister(&bcm8706_driver);
- phy_driver_unregister(&bcm8727_driver);
+ phy_drivers_unregister(bcm87xx_driver,
+ ARRAY_SIZE(bcm87xx_driver));
}
module_exit(bcm87xx_exit);