drm/radeon/px: fix module unload
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 12 Sep 2014 22:00:53 +0000 (18:00 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 18 Sep 2014 23:22:09 +0000 (19:22 -0400)
Use the new vga_switcheroo_fini_domain_pm_ops function
to unregister the pm ops.

Based on a patch from:
Pali Rohár <pali.rohar@gmail.com>

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=84431

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/radeon/radeon_device.c

index 6a219bcee66d2d8a5d7b8bf49f2344584a0a36fd..75223dd3a8a35e5c5930942140c91f2a42416bad 100644 (file)
@@ -1393,7 +1393,7 @@ int radeon_device_init(struct radeon_device *rdev,
 
        r = radeon_init(rdev);
        if (r)
-               return r;
+               goto failed;
 
        r = radeon_ib_ring_tests(rdev);
        if (r)
@@ -1413,7 +1413,7 @@ int radeon_device_init(struct radeon_device *rdev,
                radeon_agp_disable(rdev);
                r = radeon_init(rdev);
                if (r)
-                       return r;
+                       goto failed;
        }
 
        if ((radeon_testing & 1)) {
@@ -1435,6 +1435,11 @@ int radeon_device_init(struct radeon_device *rdev,
                        DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n");
        }
        return 0;
+
+failed:
+       if (runtime)
+               vga_switcheroo_fini_domain_pm_ops(rdev->dev);
+       return r;
 }
 
 static void radeon_debugfs_remove_files(struct radeon_device *rdev);
@@ -1455,6 +1460,8 @@ void radeon_device_fini(struct radeon_device *rdev)
        radeon_bo_evict_vram(rdev);
        radeon_fini(rdev);
        vga_switcheroo_unregister_client(rdev->pdev);
+       if (rdev->flags & RADEON_IS_PX)
+               vga_switcheroo_fini_domain_pm_ops(rdev->dev);
        vga_client_register(rdev->pdev, NULL, NULL, NULL);
        if (rdev->rio_mem)
                pci_iounmap(rdev->pdev, rdev->rio_mem);