From 1deb73b9c6512c6f0a296e35145c49233ea47f74 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Wed, 5 Nov 2014 17:40:07 +0200 Subject: gpu: nvgpu: clean up module deinitialization Fix gk20a module removal so that the driver can be correctly removed when built as a module (CONFIG_GK20A=m). Reinsertion correctly will need more missing deinit calls, which are not yet implemented. This change has no effect yet on any builds since the module is built in by the defconfig. - don't free threaded irqs that are bound to the device - destroy cde if it is enabled - remove all debugfs entries recursively generated directly and by cde, pmu, clk etc. - free secure buffer if it exists - remove pm_runtime_put, since it doesn't have a pairing get - pm_runtime defines proper function stubs if it is not enabled, so remove ifdefs and query pm_runtime_enabled() - null and free gk20a only after all deinit has been done Bug 1476801 Change-Id: I73ad72832bdb501fd7071d6ac68d461ee63a760d Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/594442 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 91cd5834..ab9dd037 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -598,10 +598,7 @@ static void gk20a_remove_support(struct platform_device *dev) release_firmware(g->pmu_fw); - free_irq(g->irq_stall, g); - free_irq(g->irq_nonstall, g); - - /* free mappings to registers, etc*/ + /* free mappings to registers, etc */ if (g->regs) { iounmap(g->regs); @@ -1455,6 +1452,9 @@ static int __exit gk20a_remove(struct platform_device *dev) if (platform->virtual_dev) return vgpu_remove(dev); + if (platform->has_cde) + gk20a_cde_destroy(g); + #ifdef CONFIG_INPUT_CFBOOST if (g->boost_added) cfb_remove_device(&dev->dev); @@ -1465,23 +1465,23 @@ static int __exit gk20a_remove(struct platform_device *dev) gk20a_user_deinit(dev); - set_gk20a(dev, NULL); -#ifdef CONFIG_DEBUG_FS - debugfs_remove(g->debugfs_ltc_enabled); - debugfs_remove(g->debugfs_gr_idle_timeout_default); - debugfs_remove(g->debugfs_timeouts_enabled); -#endif + debugfs_remove_recursive(platform->debugfs); gk20a_remove_sysfs(&dev->dev); + if (platform->secure_buffer.destroy) + platform->secure_buffer.destroy(dev, + &platform->secure_buffer); + + if (pm_runtime_enabled(&dev->dev)) + pm_runtime_disable(&dev->dev); + else + gk20a_pm_disable_clk(&dev->dev); + + set_gk20a(dev, NULL); kfree(g); -#ifdef CONFIG_PM_RUNTIME - pm_runtime_put(&dev->dev); - pm_runtime_disable(&dev->dev); -#else - gk20a_pm_disable_clk(&dev->dev); -#endif + gk20a_dbg_fn("removed"); return 0; } -- cgit v1.2.2