Commit 36b9ddd5 authored by Thierry Reding's avatar Thierry Reding Committed by David S. Miller

net: bfin_mac: 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 681b4d88
...@@ -1912,21 +1912,21 @@ static struct platform_driver bfin_mac_driver = { ...@@ -1912,21 +1912,21 @@ static struct platform_driver bfin_mac_driver = {
}, },
}; };
static struct platform_driver * const drivers[] = {
&bfin_mii_bus_driver,
&bfin_mac_driver,
};
static int __init bfin_mac_init(void) static int __init bfin_mac_init(void)
{ {
int ret; return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
ret = platform_driver_register(&bfin_mii_bus_driver);
if (!ret)
return platform_driver_register(&bfin_mac_driver);
return -ENODEV;
} }
module_init(bfin_mac_init); module_init(bfin_mac_init);
static void __exit bfin_mac_cleanup(void) static void __exit bfin_mac_cleanup(void)
{ {
platform_driver_unregister(&bfin_mac_driver); platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
platform_driver_unregister(&bfin_mii_bus_driver);
} }
module_exit(bfin_mac_cleanup); module_exit(bfin_mac_cleanup);
......
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