mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 04:11:49 +00:00
gpu: host1x: 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>
This commit is contained in:
parent
663a233eef
commit
28fae81f93
@ -212,6 +212,11 @@ static struct platform_driver tegra_host1x_driver = {
|
|||||||
.remove = host1x_remove,
|
.remove = host1x_remove,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct platform_driver * const drivers[] = {
|
||||||
|
&tegra_host1x_driver,
|
||||||
|
&tegra_mipi_driver,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init tegra_host1x_init(void)
|
static int __init tegra_host1x_init(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@ -220,28 +225,17 @@ static int __init tegra_host1x_init(void)
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = platform_driver_register(&tegra_host1x_driver);
|
err = platform_register_drivers(drivers, ARRAY_SIZE(drivers));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto unregister_bus;
|
|
||||||
|
|
||||||
err = platform_driver_register(&tegra_mipi_driver);
|
|
||||||
if (err < 0)
|
|
||||||
goto unregister_host1x;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
unregister_host1x:
|
|
||||||
platform_driver_unregister(&tegra_host1x_driver);
|
|
||||||
unregister_bus:
|
|
||||||
bus_unregister(&host1x_bus_type);
|
bus_unregister(&host1x_bus_type);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
module_init(tegra_host1x_init);
|
module_init(tegra_host1x_init);
|
||||||
|
|
||||||
static void __exit tegra_host1x_exit(void)
|
static void __exit tegra_host1x_exit(void)
|
||||||
{
|
{
|
||||||
platform_driver_unregister(&tegra_mipi_driver);
|
platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
|
||||||
platform_driver_unregister(&tegra_host1x_driver);
|
|
||||||
bus_unregister(&host1x_bus_type);
|
bus_unregister(&host1x_bus_type);
|
||||||
}
|
}
|
||||||
module_exit(tegra_host1x_exit);
|
module_exit(tegra_host1x_exit);
|
||||||
|
Loading…
Reference in New Issue
Block a user