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
@@ -826,28 +826,14 @@ static struct phy_driver marvell_drivers[] = {
|
||||
|
||||
static int __init marvell_init(void)
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(marvell_drivers); i++) {
|
||||
ret = phy_driver_register(&marvell_drivers[i]);
|
||||
|
||||
if (ret) {
|
||||
while (i-- > 0)
|
||||
phy_driver_unregister(&marvell_drivers[i]);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return phy_drivers_register(marvell_drivers,
|
||||
ARRAY_SIZE(marvell_drivers));
|
||||
}
|
||||
|
||||
static void __exit marvell_exit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(marvell_drivers); i++)
|
||||
phy_driver_unregister(&marvell_drivers[i]);
|
||||
phy_drivers_unregister(marvell_drivers,
|
||||
ARRAY_SIZE(marvell_drivers));
|
||||
}
|
||||
|
||||
module_init(marvell_init);
|
||||
|
Reference in New Issue
Block a user