Module Name:    src
Committed By:   riastradh
Date:           Mon Aug  7 16:34:57 UTC 2023

Modified Files:
        src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: Suspend ioctls while device is suspended.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.37 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.38
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.37	Wed Mar  1 08:42:34 2023
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Mon Aug  7 16:34:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.37 2023/03/01 08:42:34 riastradh Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.38 2023/08/07 16:34:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.37 2023/03/01 08:42:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.38 2023/08/07 16:34:57 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "genfb.h"
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_pci.
 #include <dev/wsfb/genfbvar.h>
 #endif
 
+#include <drm/drm_ioctl.h>
 #include <drm/drm_pci.h>
 
 #include <core/device.h>
@@ -316,16 +317,31 @@ static bool
 nouveau_pci_suspend(device_t self, const pmf_qual_t *qual __unused)
 {
 	struct nouveau_pci_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc->sc_drm_dev;
+	int ret;
+
+	drm_suspend_ioctl(dev);
+
+	ret = nouveau_pmops_suspend(dev);
+	if (ret)
+		return false;
 
-	return nouveau_pmops_suspend(sc->sc_drm_dev) == 0;
+	return true;
 }
 
 static bool
 nouveau_pci_resume(device_t self, const pmf_qual_t *qual)
 {
 	struct nouveau_pci_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc->sc_drm_dev;
+	int ret;
+
+	ret = nouveau_pmops_resume(sc->sc_drm_dev);
+	if (ret)
+		goto out;
 
-	return nouveau_pmops_resume(sc->sc_drm_dev) == 0;
+out:	drm_resume_ioctl(dev);
+	return ret == 0;
 }
 
 static void

Reply via email to