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:
Christian Hohnstaedt
2012-07-04 05:44:34 +00:00
committed by David S. Miller
parent 567990cfcc
commit d5bf9071e7
16 changed files with 159 additions and 431 deletions

View File

@@ -81,7 +81,8 @@ static int ste10Xp_ack_interrupt(struct phy_device *phydev)
return 0;
}
static struct phy_driver ste101p_pdriver = {
static struct phy_driver ste10xp_pdriver[] = {
{
.phy_id = STE101P_PHY_ID,
.phy_id_mask = 0xfffffff0,
.name = "STe101p",
@@ -95,9 +96,7 @@ static struct phy_driver ste101p_pdriver = {
.suspend = genphy_suspend,
.resume = genphy_resume,
.driver = {.owner = THIS_MODULE,}
};
static struct phy_driver ste100p_pdriver = {
}, {
.phy_id = STE100P_PHY_ID,
.phy_id_mask = 0xffffffff,
.name = "STe100p",
@@ -111,22 +110,18 @@ static struct phy_driver ste100p_pdriver = {
.suspend = genphy_suspend,
.resume = genphy_resume,
.driver = {.owner = THIS_MODULE,}
};
} };
static int __init ste10Xp_init(void)
{
int retval;
retval = phy_driver_register(&ste100p_pdriver);
if (retval < 0)
return retval;
return phy_driver_register(&ste101p_pdriver);
return phy_drivers_register(ste10xp_pdriver,
ARRAY_SIZE(ste10xp_pdriver));
}
static void __exit ste10Xp_exit(void)
{
phy_driver_unregister(&ste100p_pdriver);
phy_driver_unregister(&ste101p_pdriver);
phy_drivers_unregister(ste10xp_pdriver,
ARRAY_SIZE(ste10xp_pdriver));
}
module_init(ste10Xp_init);