Commit 0d1c744c authored by Thierry Reding's avatar Thierry Reding Committed by David S. Miller

net: bcm63xx: Use platform_register/unregister_drivers()

These new helpers simplify implementing multi-driver modules and
properly handle failure to register one driver by unregistering all
previously registered drivers.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 36b9ddd5
...@@ -2884,33 +2884,21 @@ struct platform_driver bcm63xx_enet_shared_driver = { ...@@ -2884,33 +2884,21 @@ struct platform_driver bcm63xx_enet_shared_driver = {
}, },
}; };
static struct platform_driver * const drivers[] = {
&bcm63xx_enet_shared_driver,
&bcm63xx_enet_driver,
&bcm63xx_enetsw_driver,
};
/* entry point */ /* entry point */
static int __init bcm_enet_init(void) static int __init bcm_enet_init(void)
{ {
int ret; return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
ret = platform_driver_register(&bcm63xx_enet_shared_driver);
if (ret)
return ret;
ret = platform_driver_register(&bcm63xx_enet_driver);
if (ret)
platform_driver_unregister(&bcm63xx_enet_shared_driver);
ret = platform_driver_register(&bcm63xx_enetsw_driver);
if (ret) {
platform_driver_unregister(&bcm63xx_enet_driver);
platform_driver_unregister(&bcm63xx_enet_shared_driver);
}
return ret;
} }
static void __exit bcm_enet_exit(void) static void __exit bcm_enet_exit(void)
{ {
platform_driver_unregister(&bcm63xx_enet_driver); platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
platform_driver_unregister(&bcm63xx_enetsw_driver);
platform_driver_unregister(&bcm63xx_enet_shared_driver);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment