diff mbox series

[2/2] drm/nouveau/nvkm: separate out into nvkm.ko

Message ID 20240613170211.88779-3-bskeggs@nvidia.com (mailing list archive)
State New
Headers show
Series [1/2] drm/nouveau/nvkm: export symbols needed by the drm driver | expand

Commit Message

Ben Skeggs June 13, 2024, 5:02 p.m. UTC
Signed-off-by: Ben Skeggs <bskeggs@nvidia.com>
---
 drivers/gpu/drm/nouveau/Kbuild                     |  4 ++--
 drivers/gpu/drm/nouveau/include/nvkm/core/module.h |  3 ---
 drivers/gpu/drm/nouveau/nouveau_drm.c              | 10 +---------
 drivers/gpu/drm/nouveau/nvkm/module.c              |  8 ++++++--
 4 files changed, 9 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/Kbuild b/drivers/gpu/drm/nouveau/Kbuild
index cc471ab6a7ec..b62c6858fb7b 100644
--- a/drivers/gpu/drm/nouveau/Kbuild
+++ b/drivers/gpu/drm/nouveau/Kbuild
@@ -8,11 +8,11 @@  ccflags-y += -I $(NOUVEAU_PATH)/$(src)
 
 # NVKM - HW resource manager
 include $(src)/nvkm/Kbuild
-nouveau-y := $(nvkm-y)
+obj-$(CONFIG_DRM_NOUVEAU) += nvkm.o
 
 # NVIF - NVKM interface library (NVKM user interface also defined here)
 include $(src)/nvif/Kbuild
-nouveau-y += $(nvif-y)
+nouveau-y := $(nvif-y)
 
 # DRM - general
 ifdef CONFIG_X86
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/module.h b/drivers/gpu/drm/nouveau/include/nvkm/core/module.h
index fc42ace93a1c..d1ad6aae9911 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/module.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/module.h
@@ -3,8 +3,5 @@ 
 #define __NVKM_MODULE_H__
 #include <linux/module.h>
 
-int __init nvkm_init(void);
-void __exit nvkm_exit(void);
-
 extern int nvkm_runpm;
 #endif
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 7e77e950eba2..4f55cd73d1b3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1174,7 +1174,7 @@  static const struct dev_pm_ops nouveau_pm_ops = {
 
 static const struct auxiliary_device_id
 nouveau_drm_id_table[] = {
-	{ .name = "nouveau.device" },
+	{ .name = "nvkm.device" },
 	{}
 };
 
@@ -1190,8 +1190,6 @@  nouveau_auxdrv = {
 static int __init
 nouveau_drm_init(void)
 {
-	int ret;
-
 	nouveau_display_options();
 
 	if (nouveau_modeset == -1) {
@@ -1202,10 +1200,6 @@  nouveau_drm_init(void)
 	if (!nouveau_modeset)
 		return 0;
 
-	ret = nvkm_init();
-	if (ret)
-		return ret;
-
 	nouveau_backlight_ctor();
 
 	return auxiliary_driver_register(&nouveau_auxdrv);
@@ -1223,8 +1217,6 @@  nouveau_drm_exit(void)
 
 	if (IS_ENABLED(CONFIG_DRM_NOUVEAU_SVM))
 		mmu_notifier_synchronize();
-
-	nvkm_exit();
 }
 
 module_init(nouveau_drm_init);
diff --git a/drivers/gpu/drm/nouveau/nvkm/module.c b/drivers/gpu/drm/nouveau/nvkm/module.c
index c14dd7fa15c2..d0ae023cdc74 100644
--- a/drivers/gpu/drm/nouveau/nvkm/module.c
+++ b/drivers/gpu/drm/nouveau/nvkm/module.c
@@ -26,7 +26,7 @@ 
 
 int nvkm_runpm = -1;
 
-void __exit
+static void __exit
 nvkm_exit(void)
 {
 #ifdef CONFIG_PCI
@@ -39,7 +39,7 @@  nvkm_exit(void)
 #endif
 }
 
-int __init
+static int __init
 nvkm_init(void)
 {
 	int ret;
@@ -60,3 +60,7 @@  nvkm_init(void)
 
 	return 0;
 }
+
+MODULE_LICENSE("GPL and additional rights");
+module_init(nvkm_init);
+module_exit(nvkm_exit);