drm/omap: 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: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:

committed by
Tomi Valkeinen

parent
d4182e35aa
commit
e1c49bdcdb
@@ -928,35 +928,23 @@ static struct platform_driver pdev = {
|
|||||||
.remove = pdev_remove,
|
.remove = pdev_remove,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct platform_driver * const drivers[] = {
|
||||||
|
&omap_dmm_driver,
|
||||||
|
&pdev,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init omap_drm_init(void)
|
static int __init omap_drm_init(void)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
|
|
||||||
DBG("init");
|
DBG("init");
|
||||||
|
|
||||||
r = platform_driver_register(&omap_dmm_driver);
|
return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
|
||||||
if (r) {
|
|
||||||
pr_err("DMM driver registration failed\n");
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = platform_driver_register(&pdev);
|
|
||||||
if (r) {
|
|
||||||
pr_err("omapdrm driver registration failed\n");
|
|
||||||
platform_driver_unregister(&omap_dmm_driver);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit omap_drm_fini(void)
|
static void __exit omap_drm_fini(void)
|
||||||
{
|
{
|
||||||
DBG("fini");
|
DBG("fini");
|
||||||
|
|
||||||
platform_driver_unregister(&pdev);
|
platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
|
||||||
|
|
||||||
platform_driver_unregister(&omap_dmm_driver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* need late_initcall() so we load after dss_driver's are loaded */
|
/* need late_initcall() so we load after dss_driver's are loaded */
|
||||||
|
Reference in New Issue
Block a user