summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/pci.c')
-rw-r--r--drivers/gpu/nvgpu/pci.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/pci.c b/drivers/gpu/nvgpu/pci.c
index 0ba36a30..7cc058e4 100644
--- a/drivers/gpu/nvgpu/pci.c
+++ b/drivers/gpu/nvgpu/pci.c
@@ -356,10 +356,25 @@ static void nvgpu_pci_remove(struct pci_dev *pdev)
356 struct gk20a_platform *platform = gk20a_get_platform(&pdev->dev); 356 struct gk20a_platform *platform = gk20a_get_platform(&pdev->dev);
357 struct gk20a *g = get_gk20a(&pdev->dev); 357 struct gk20a *g = get_gk20a(&pdev->dev);
358 358
359 if (g->remove_support) 359 gk20a_dbg(gpu_dbg_shutdown, "Removing nvgpu driver!\n");
360 g->remove_support(g->dev); 360 gk20a_driver_start_unload(g);
361
362 disable_irq(g->irq_stall);
363 devm_free_irq(&pdev->dev, g->irq_stall, g);
364 gk20a_dbg(gpu_dbg_shutdown, "IRQs disabled.\n");
365
366 /*
367 * Wait for the driver to finish up all the IOCTLs it's working on
368 * before cleaning up the driver's data structures.
369 */
370 gk20a_wait_for_idle(&pdev->dev);
371 gk20a_dbg(gpu_dbg_shutdown, "Driver idle.\n");
361 372
362 gk20a_user_deinit(g->dev, &nvgpu_pci_class); 373 gk20a_user_deinit(g->dev, &nvgpu_pci_class);
374 gk20a_dbg(gpu_dbg_shutdown, "User de-init done.\b");
375
376 if (g->remove_support)
377 g->remove_support(g->dev);
363 378
364 debugfs_remove_recursive(platform->debugfs); 379 debugfs_remove_recursive(platform->debugfs);
365 debugfs_remove_recursive(platform->debugfs_alias); 380 debugfs_remove_recursive(platform->debugfs_alias);
@@ -368,6 +383,7 @@ static void nvgpu_pci_remove(struct pci_dev *pdev)
368 383
369 if (platform->remove) 384 if (platform->remove)
370 platform->remove(g->dev); 385 platform->remove(g->dev);
386 gk20a_dbg(gpu_dbg_shutdown, "Platform remove done.\b");
371 387
372 kfree(g); 388 kfree(g);
373} 389}