Skip to content

Commit 16ac5b2

Browse files
diandersdaeinki
authored andcommitted
drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time
Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() at system shutdown time and at driver unbind time. Among other things, this means that if a panel is in use that it won't be cleanly powered off at system shutdown time. The fact that we should call drm_atomic_helper_shutdown() in the case of OS shutdown/restart and at driver remove (or unbind) time comes straight out of the kernel doc "driver instance overview" in drm_drv.c. A few notes about this fix: - When adding drm_atomic_helper_shutdown() to the unbind path, I added it after drm_kms_helper_poll_fini() since that's when other drivers seemed to have it. - Technically with a previous patch, ("drm/atomic-helper: drm_atomic_helper_shutdown(NULL) should be a noop"), we don't actually need to check to see if our "drm" pointer is NULL before calling drm_atomic_helper_shutdown(). We'll leave the "if" test in, though, so that this patch can land without any dependencies. It could potentially be removed later. - This patch also makes sure to set the drvdata to NULL in the case of bind errors to make sure that shutdown can't access freed data. Suggested-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
1 parent a2f8994 commit 16ac5b2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/gpu/drm/exynos/exynos_drm_drv.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ static int exynos_drm_bind(struct device *dev)
300300
drm_mode_config_cleanup(drm);
301301
exynos_drm_cleanup_dma(drm);
302302
kfree(private);
303+
dev_set_drvdata(dev, NULL);
303304
err_free_drm:
304305
drm_dev_put(drm);
305306

@@ -313,6 +314,7 @@ static void exynos_drm_unbind(struct device *dev)
313314
drm_dev_unregister(drm);
314315

315316
drm_kms_helper_poll_fini(drm);
317+
drm_atomic_helper_shutdown(drm);
316318

317319
component_unbind_all(drm->dev, drm);
318320
drm_mode_config_cleanup(drm);
@@ -350,9 +352,18 @@ static int exynos_drm_platform_remove(struct platform_device *pdev)
350352
return 0;
351353
}
352354

355+
static void exynos_drm_platform_shutdown(struct platform_device *pdev)
356+
{
357+
struct drm_device *drm = platform_get_drvdata(pdev);
358+
359+
if (drm)
360+
drm_atomic_helper_shutdown(drm);
361+
}
362+
353363
static struct platform_driver exynos_drm_platform_driver = {
354364
.probe = exynos_drm_platform_probe,
355365
.remove = exynos_drm_platform_remove,
366+
.shutdown = exynos_drm_platform_shutdown,
356367
.driver = {
357368
.name = "exynos-drm",
358369
.pm = &exynos_drm_pm_ops,

0 commit comments

Comments
 (0)