Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/panfrost: Fix possible suspend in panfrost_remove

Calls to panfrost_device_fini() access the h/w, but we already done a
pm_runtime_put_sync_autosuspend() beforehand. This only works if the
autosuspend delay is long enough. A 0ms delay will hang the system when
removing the device. Fix this by moving the pm_runtime_put_sync_suspend()
after the panfrost_device_fini() call.

Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Steven Price <steven.price@arm.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190823021216.5862-2-robh@kernel.org

+4 -2
+4 -2
drivers/gpu/drm/panfrost/panfrost_drv.c
··· 570 570 571 571 drm_dev_unregister(ddev); 572 572 panfrost_gem_shrinker_cleanup(ddev); 573 + 573 574 pm_runtime_get_sync(pfdev->dev); 574 - pm_runtime_put_sync_autosuspend(pfdev->dev); 575 - pm_runtime_disable(pfdev->dev); 576 575 panfrost_devfreq_fini(pfdev); 577 576 panfrost_device_fini(pfdev); 577 + pm_runtime_put_sync_suspend(pfdev->dev); 578 + pm_runtime_disable(pfdev->dev); 579 + 578 580 drm_dev_put(ddev); 579 581 return 0; 580 582 }