Skip to content

Commit

Permalink
drm/omap: Use platform_register/unregister_drivers()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thierry Reding authored and Tomi Valkeinen committed Dec 31, 2015
1 parent d4182e3 commit e1c49bd
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions drivers/gpu/drm/omapdrm/omap_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,35 +928,23 @@ static struct platform_driver pdev = {
.remove = pdev_remove,
};

static struct platform_driver * const drivers[] = {
&omap_dmm_driver,
&pdev,
};

static int __init omap_drm_init(void)
{
int r;

DBG("init");

r = platform_driver_register(&omap_dmm_driver);
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;
return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
}

static void __exit omap_drm_fini(void)
{
DBG("fini");

platform_driver_unregister(&pdev);

platform_driver_unregister(&omap_dmm_driver);
platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
}

/* need late_initcall() so we load after dss_driver's are loaded */
Expand Down

0 comments on commit e1c49bd

Please sign in to comment.