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>
This commit is contained in:

committed by
David S. Miller

parent
567990cfcc
commit
d5bf9071e7
@@ -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);
|
||||
|
Reference in New Issue
Block a user