mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 00:21:17 +00:00
net: mv643xx: 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: Thierry Reding <treding@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8c7d3972fd
commit
3b5dde70b1
1 changed files with 7 additions and 12 deletions
|
@ -3257,25 +3257,20 @@ static struct platform_driver mv643xx_eth_driver = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct platform_driver * const drivers[] = {
|
||||||
|
&mv643xx_eth_shared_driver,
|
||||||
|
&mv643xx_eth_driver,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init mv643xx_eth_init_module(void)
|
static int __init mv643xx_eth_init_module(void)
|
||||||
{
|
{
|
||||||
int rc;
|
return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
|
||||||
|
|
||||||
rc = platform_driver_register(&mv643xx_eth_shared_driver);
|
|
||||||
if (!rc) {
|
|
||||||
rc = platform_driver_register(&mv643xx_eth_driver);
|
|
||||||
if (rc)
|
|
||||||
platform_driver_unregister(&mv643xx_eth_shared_driver);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
module_init(mv643xx_eth_init_module);
|
module_init(mv643xx_eth_init_module);
|
||||||
|
|
||||||
static void __exit mv643xx_eth_cleanup_module(void)
|
static void __exit mv643xx_eth_cleanup_module(void)
|
||||||
{
|
{
|
||||||
platform_driver_unregister(&mv643xx_eth_driver);
|
platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
|
||||||
platform_driver_unregister(&mv643xx_eth_shared_driver);
|
|
||||||
}
|
}
|
||||||
module_exit(mv643xx_eth_cleanup_module);
|
module_exit(mv643xx_eth_cleanup_module);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue