Input: sparcspkr - 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: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
0eea505058
commit
d352c0e1f3
|
@ -345,23 +345,19 @@ static struct platform_driver grover_beep_driver = {
|
||||||
.shutdown = sparcspkr_shutdown,
|
.shutdown = sparcspkr_shutdown,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct platform_driver * const drivers[] = {
|
||||||
|
&bbc_beep_driver,
|
||||||
|
&grover_beep_driver,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init sparcspkr_init(void)
|
static int __init sparcspkr_init(void)
|
||||||
{
|
{
|
||||||
int err = platform_driver_register(&bbc_beep_driver);
|
return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
|
||||||
|
|
||||||
if (!err) {
|
|
||||||
err = platform_driver_register(&grover_beep_driver);
|
|
||||||
if (err)
|
|
||||||
platform_driver_unregister(&bbc_beep_driver);
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit sparcspkr_exit(void)
|
static void __exit sparcspkr_exit(void)
|
||||||
{
|
{
|
||||||
platform_driver_unregister(&bbc_beep_driver);
|
platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
|
||||||
platform_driver_unregister(&grover_beep_driver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(sparcspkr_init);
|
module_init(sparcspkr_init);
|
||||||
|
|
Loading…
Reference in New Issue