diff mbox

[3/3] drm/nouveau/runpm: fix module unload

Message ID 1410723200-16121-3-git-send-email-alexander.deucher@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Deucher Sept. 14, 2014, 7:33 p.m. UTC
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

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Cc: Ben Skeggs <bskeggs@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_vga.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Alex Deucher Sept. 18, 2014, 5:13 p.m. UTC | #1
On Sun, Sep 14, 2014 at 3:33 PM, Alex Deucher <alexdeucher@gmail.com> wrote:
> 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
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: stable@vger.kernel.org
> Cc: Ben Skeggs <bskeggs@redhat.com>

Dave or Ben any comment on this patch?  I'd like the merge the radeon
parts for -fixes and this one seems logic too.

Alex

> ---
>  drivers/gpu/drm/nouveau/nouveau_vga.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
> index 18d55d4..c7592ec 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_vga.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
> @@ -108,7 +108,16 @@ void
>  nouveau_vga_fini(struct nouveau_drm *drm)
>  {
>         struct drm_device *dev = drm->dev;
> +       bool runtime = false;
> +
> +       if (nouveau_runtime_pm == 1)
> +               runtime = true;
> +       if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm()))
> +               runtime = true;
> +
>         vga_switcheroo_unregister_client(dev->pdev);
> +       if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
> +               vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
>         vga_client_register(dev->pdev, NULL, NULL, NULL);
>  }
>
> --
> 1.8.3.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
index 18d55d4..c7592ec 100644
--- a/drivers/gpu/drm/nouveau/nouveau_vga.c
+++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
@@ -108,7 +108,16 @@  void
 nouveau_vga_fini(struct nouveau_drm *drm)
 {
 	struct drm_device *dev = drm->dev;
+	bool runtime = false;
+
+	if (nouveau_runtime_pm == 1)
+		runtime = true;
+	if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm()))
+		runtime = true;
+
 	vga_switcheroo_unregister_client(dev->pdev);
+	if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
+		vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
 	vga_client_register(dev->pdev, NULL, NULL, NULL);
 }