[PATCH 06/21] drm/nouveau/nvkm: add init()/exit()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]<

 



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@xxxxxxxxxx>
---
 .../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

diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/module.h b/drivers/gpu/drm/nouveau/include/nvkm/core/module.h
new file mode 100644
index 000000000000..5cf80e4deb90
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/module.h
@@ -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
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 09947790f677..0bf39b05926f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -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);
diff --git a/drivers/gpu/drm/nouveau/nvkm/Kbuild b/drivers/gpu/drm/nouveau/nvkm/Kbuild
index f68c19586b53..9e1a6ab937e1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/Kbuild
@@ -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
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/Kbuild b/drivers/gpu/drm/nouveau/nvkm/core/Kbuild
index 50ff041ecdf0..70cec7bbb018 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/core/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
diff --git a/drivers/gpu/drm/nouveau/nvkm/module.c b/drivers/gpu/drm/nouveau/nvkm/module.c
new file mode 100644
index 000000000000..66d28465514b
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/module.c
@@ -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;
+}
-- 
2.44.0




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux