new file mode 100644
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: MIT */
+#ifndef __NVKM_MODULE_H__
+#define __NVKM_MODULE_H__
+#include <linux/module.h>
+
+int __init nvkm_init(void);
+void __exit nvkm_exit(void);
+#endif
@@ -39,6 +39,7 @@
#include <core/driver.h>
#include <core/gpuobj.h>
+#include <core/module.h>
#include <core/option.h>
#include <core/pci.h>
#include <core/tegra.h>
@@ -1375,6 +1376,8 @@ nouveau_platform_device_create(const struct nvkm_device_tegra_func *func,
static int __init
nouveau_drm_init(void)
{
+ int ret;
+
driver_pci = driver_stub;
driver_platform = driver_stub;
@@ -1388,6 +1391,10 @@ nouveau_drm_init(void)
if (!nouveau_modeset)
return 0;
+ ret = nvkm_init();
+ if (ret)
+ return ret;
+
#ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
platform_driver_register(&nouveau_platform_driver);
#endif
@@ -1419,6 +1426,8 @@ nouveau_drm_exit(void)
#endif
if (IS_ENABLED(CONFIG_DRM_NOUVEAU_SVM))
mmu_notifier_synchronize();
+
+ nvkm_exit();
}
module_init(nouveau_drm_init);
@@ -1,4 +1,7 @@
# SPDX-License-Identifier: MIT
+
+nvkm-y := nvkm/module.o
+
include $(src)/nvkm/core/Kbuild
include $(src)/nvkm/nvfw/Kbuild
include $(src)/nvkm/device/Kbuild
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: MIT
-nvkm-y := nvkm/core/client.o
+nvkm-y += nvkm/core/client.o
nvkm-y += nvkm/core/driver.o
nvkm-y += nvkm/core/engine.o
nvkm-y += nvkm/core/enum.o
new file mode 100644
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#include <core/module.h>
+
+void __exit
+nvkm_exit(void)
+{
+}
+
+int __init
+nvkm_init(void)
+{
+ return 0;
+}
Add stub init()/exit() functions that subsequent patches will use as they move the pci/platform-specific code out of the DRM driver. Signed-off-by: Ben Skeggs <bskeggs@nvidia.com> --- .../drm/nouveau/include/nvkm/core/module.h | 8 +++++ drivers/gpu/drm/nouveau/nouveau_drm.c | 9 +++++ drivers/gpu/drm/nouveau/nvkm/Kbuild | 3 ++ drivers/gpu/drm/nouveau/nvkm/core/Kbuild | 2 +- drivers/gpu/drm/nouveau/nvkm/module.c | 33 +++++++++++++++++++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/module.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/module.c