summaryrefslogtreecommitdiff
path: root/graphics/nvidia-drm-61-kmod/files/patch-nvidia-drm-freebsd-lkpi.c-20250918-01
blob: c703950a0c88a228b7a908e29c258f6df6e13d2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- nvidia-drm-freebsd-lkpi.c.orig	2025-08-27 17:59:14 UTC
+++ nvidia-drm-freebsd-lkpi.c
@@ -104,6 +104,35 @@ lkpinew_pci_dev(device_t dev)
  * FreeBSD linuxkpi based loading support code.
  *************************************************************************/
 
+static int
+dummy_nv_pci_probe(struct pci_dev *pci_dev __unused,
+    const struct pci_device_id *id_table __unused)
+{
+	return (0);
+}
+
+static void
+dummy_nv_pci_remove(struct pci_dev *pci_dev __unused)
+{
+}
+
+static void
+dummy_nv_pci_shutdown(struct pci_dev *pci_dev __unused)
+{
+}
+
+struct pci_driver nv_pci_driver = {
+	.name =		"drmn",
+	.id_table =	nv_pci_table,
+	.probe =	dummy_nv_pci_probe,
+	.remove =	dummy_nv_pci_remove,
+	.shutdown =	dummy_nv_pci_shutdown,
+#if defined(__FreeBSD__)
+	/* FreeBSD internal/specifc. */
+	.isdrm =	true,
+#endif
+};
+
 static struct pci_dev *nv_lkpi_pci_devs[NV_MAX_DEVICES];
 
 int nv_drm_probe_devices(void)
@@ -153,7 +182,7 @@ int nv_drm_probe_devices(void)
             return -ENOMEM;
         }
 
-        if (linux_pci_attach_device(sc->dev, NULL, NULL, pdev)) {
+        if (linux_pci_attach_device(sc->dev, &nv_pci_driver, NULL, pdev)) {
             NV_DRM_LOG_ERR("Failed to attach linuxkpi PCI device");
             free(pdev, M_DEVBUF);
             return -ENOMEM;