Skip to contentSkip to conversation

drm: merge nouveau_platform.ko into nouveau.ko

PATCH In review Alexandre Courbot 4 participants 4 messages Jan 15, 2015 3 messages not in the archive Tegra architecture support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: merge nouveau_platform.ko into nouveau.ko

Having the two modules separated causes various unneeded complications, including having to export symbols accessed between the modules. Make things simpler by compiling platform device support into nouveau.ko. Platform device support remains optional and is only compiled on Tegra.

---
Vince, with this you won't have to export new functions for PM. I ended up writing it myself because I hit the same issue (nv_device() would now need to be exported on Ben's master branch).

Be careful that when compiling against a kernel, CONFIG_NOUVEAU_PLATFORM_DRIVER now *must* be equal to 'y'. It is 'm' currently, so you will need to change it from tristate to bool in the kernel's Kconfig. For this reason it might be good to get this patch into -next quickly.

 drm/Kbuild             |  3 +--
 drm/Kconfig            |  2 +-
 drm/nouveau_drm.c      | 11 +++++++++--
 drm/nouveau_platform.c |  6 ------
 drm/nouveau_platform.h |  3 +++
 5 files changed, 14 insertions(+), 11 deletions(-)
drm/Kbuild +1 -2
index ba6b660d3316..1febf6ec0b69 100644
@@ -394,8 +394,7 @@ nouveau-$(CONFIG_ACPI) += nouveau_acpi.o
 endif
 nouveau-$(CONFIG_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o
 nouveau-$(CONFIG_DEBUG_FS) += nouveau_debugfs.o
+nouveau-$(CONFIG_NOUVEAU_PLATFORM_DRIVER) += nouveau_platform.o
 
 obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o
 
-# platform driver
-obj-$(CONFIG_NOUVEAU_PLATFORM_DRIVER) += nouveau_platform.o
drm/Kconfig +1 -1
index 40afc69a3778..5ab13e7939db 100644
@@ -26,7 +26,7 @@ config DRM_NOUVEAU
 	  Choose this option for open-source NVIDIA support.
 
 config NOUVEAU_PLATFORM_DRIVER
-	tristate "Nouveau (NVIDIA) SoC GPUs"
+	bool "Nouveau (NVIDIA) SoC GPUs"
 	depends on DRM_NOUVEAU && ARCH_TEGRA
 	default y
 	help
drm/nouveau_drm.c +9 -2
index 65910e3aed0c..1118efa56817 100644
@@ -52,6 +52,7 @@
 #include "nouveau_debugfs.h"
 #include "nouveau_usif.h"
 #include "nouveau_connector.h"
+#include "nouveau_platform.h"
 
 MODULE_PARM_DESC(config, "option string to pass to driver core");
 static char *nouveau_config;
@@ -533,7 +534,6 @@ nouveau_drm_device_remove(struct drm_device *dev)
 	nouveau_object_ref(NULL, &device);
 	nouveau_object_debug();
 }
-EXPORT_SYMBOL(nouveau_drm_device_remove);
 
 static void
 nouveau_drm_remove(struct pci_dev *pdev)
@@ -1083,7 +1083,6 @@ err_free:
 
 	return ERR_PTR(err);
 }
-EXPORT_SYMBOL(nouveau_platform_device_create_);
 
 static int __init
 nouveau_drm_init(void)
@@ -1105,6 +1104,10 @@ nouveau_drm_init(void)
 	if (!nouveau_modeset)
 		return 0;
 
+#ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
+	platform_driver_register(&nouveau_platform_driver);
+#endif
+
 	nouveau_register_dsm_handler();
 	return drm_pci_init(&driver_pci, &nouveau_drm_pci_driver);
 }
@@ -1117,6 +1120,10 @@ nouveau_drm_exit(void)
 
 	drm_pci_exit(&driver_pci, &nouveau_drm_pci_driver);
 	nouveau_unregister_dsm_handler();
+
+#ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
+	platform_driver_unregister(&nouveau_platform_driver);
+#endif
 }
 
 module_init(nouveau_drm_init);
drm/nouveau_platform.c +0 -6
index b307bbedd4c4..34d78b288f97 100644
@@ -177,9 +177,3 @@ struct platform_driver nouveau_platform_driver = {
 	.probe = nouveau_platform_probe,
 	.remove = nouveau_platform_remove,
 };
-
-module_platform_driver(nouveau_platform_driver);
-
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE("GPL and additional rights");
drm/nouveau_platform.h +3 -0
index 58c28b5653d5..ca22c525329a 100644
@@ -28,6 +28,7 @@
 struct reset_control;
 struct clk;
 struct regulator;
+struct platform_driver;
 
 struct nouveau_platform_gpu {
 	struct reset_control *rst;
@@ -48,4 +49,6 @@ struct nouveau_platform_device {
 #define nv_device_to_platform(d)                                               \
 	container_of(d, struct nouveau_platform_device, device)
 
+extern struct platform_driver nouveau_platform_driver;
+
 #endif
Signature · 6 lines
2.2.1

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 1421303396-11867-1-git-send-email-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

#2 lore raw
Quoted 11 lines · Alexandre Courbot

Having the two modules separated causes various unneeded complications, including having to export symbols accessed between the modules. Make things simpler by compiling platform device support into nouveau.ko. Platform device support remains optional and is only compiled on Tegra.

---
Vince, with this you won't have to export new functions for PM. I ended up writing it myself because I hit the same issue (nv_device() would now need to be exported on Ben's master branch).

Quoted 4 lines

Be careful that when compiling against a kernel, CONFIG_NOUVEAU_PLATFORM_DRIVER now *must* be equal to 'y'. It is 'm' currently, so you will need to change it from tristate to bool in the kernel's Kconfig. For this reason it might be good to get this patch into -next quickly.

I've got a huge chunk of churn (finally finished the "rename to nvidia names for stuff" thing) pending too which I want to get to Dave (ASAP, separately from my other pending work) to avoid having to keep fixing conflicts in the meantime :)

So, if you guys both agree on the patch, I'll send it along early with those.

Ben.

Quoted 121 lines
 drm/Kbuild             |  3 +--
 drm/Kconfig            |  2 +-
 drm/nouveau_drm.c      | 11 +++++++++--
 drm/nouveau_platform.c |  6 ------
 drm/nouveau_platform.h |  3 +++
 5 files changed, 14 insertions(+), 11 deletions(-)
drm/Kbuild +1 -2
index ba6b660d3316..1febf6ec0b69 100644
@@ -394,8 +394,7 @@ nouveau-$(CONFIG_ACPI) += nouveau_acpi.o
 endif
 nouveau-$(CONFIG_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o
 nouveau-$(CONFIG_DEBUG_FS) += nouveau_debugfs.o
+nouveau-$(CONFIG_NOUVEAU_PLATFORM_DRIVER) += nouveau_platform.o
 
 obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o
 
-# platform driver
-obj-$(CONFIG_NOUVEAU_PLATFORM_DRIVER) += nouveau_platform.o
drm/Kconfig +1 -1
index 40afc69a3778..5ab13e7939db 100644
@@ -26,7 +26,7 @@ config DRM_NOUVEAU
          Choose this option for open-source NVIDIA support.
 
 config NOUVEAU_PLATFORM_DRIVER
-       tristate "Nouveau (NVIDIA) SoC GPUs"
+       bool "Nouveau (NVIDIA) SoC GPUs"
        depends on DRM_NOUVEAU && ARCH_TEGRA
        default y
        help
drm/nouveau_drm.c +9 -2
index 65910e3aed0c..1118efa56817 100644
@@ -52,6 +52,7 @@
 #include "nouveau_debugfs.h"
 #include "nouveau_usif.h"
 #include "nouveau_connector.h"
+#include "nouveau_platform.h"
 
 MODULE_PARM_DESC(config, "option string to pass to driver core");
 static char *nouveau_config;
@@ -533,7 +534,6 @@ nouveau_drm_device_remove(struct drm_device *dev)
        nouveau_object_ref(NULL, &device);
        nouveau_object_debug();
 }
-EXPORT_SYMBOL(nouveau_drm_device_remove);
 
 static void
 nouveau_drm_remove(struct pci_dev *pdev)
@@ -1083,7 +1083,6 @@ err_free:
 
        return ERR_PTR(err);
 }
-EXPORT_SYMBOL(nouveau_platform_device_create_);
 
 static int __init
 nouveau_drm_init(void)
@@ -1105,6 +1104,10 @@ nouveau_drm_init(void)
        if (!nouveau_modeset)
                return 0;
 
+#ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
+       platform_driver_register(&nouveau_platform_driver);
+#endif
+
        nouveau_register_dsm_handler();
        return drm_pci_init(&driver_pci, &nouveau_drm_pci_driver);
 }
@@ -1117,6 +1120,10 @@ nouveau_drm_exit(void)
 
        drm_pci_exit(&driver_pci, &nouveau_drm_pci_driver);
        nouveau_unregister_dsm_handler();
+
+#ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
+       platform_driver_unregister(&nouveau_platform_driver);
+#endif
 }
 
 module_init(nouveau_drm_init);
drm/nouveau_platform.c +0 -6
index b307bbedd4c4..34d78b288f97 100644
@@ -177,9 +177,3 @@ struct platform_driver nouveau_platform_driver = {
        .probe = nouveau_platform_probe,
        .remove = nouveau_platform_remove,
 };
-
-module_platform_driver(nouveau_platform_driver);
-
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE("GPL and additional rights");
drm/nouveau_platform.h +3 -1
index 58c28b5653d5..ca22c525329a 100644
@@ -28,6 +28,7 @@
 struct reset_control;
 struct clk;
 struct regulator;
+struct platform_driver;
 
 struct nouveau_platform_gpu {
        struct reset_control *rst;
@@ -48,4 +49,6 @@ struct nouveau_platform_device {
 #define nv_device_to_platform(d)                                               \
        container_of(d, struct nouveau_platform_device, device)
 
+extern struct platform_driver nouveau_platform_driver;
+
 #endif
--

2.2.1

Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): CACAvsv6zHMizeA-r2qnngUaMXnorNfOXg6+998UWA4GzfFBOSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 16 lines · Ben Skeggs
Quoted 11 lines · Alexandre Courbot

Having the two modules separated causes various unneeded complications, including having to export symbols accessed between the modules. Make things simpler by compiling platform device support into nouveau.ko. Platform device support remains optional and is only compiled on Tegra.

---
Vince, with this you won't have to export new functions for PM. I ended up writing it myself because I hit the same issue (nv_device() would now need to be exported on Ben's master branch).

Quoted 4 lines

Be careful that when compiling against a kernel, CONFIG_NOUVEAU_PLATFORM_DRIVER now *must* be equal to 'y'. It is 'm' currently, so you will need to change it from tristate to bool in the kernel's Kconfig. For this reason it might be good to get this patch into -next quickly.

Quoted 6 lines

I've got a huge chunk of churn (finally finished the "rename to nvidia names for stuff" thing) pending too which I want to get to Dave (ASAP, separately from my other pending work) to avoid having to keep fixing conflicts in the meantime :)

So, if you guys both agree on the patch, I'll send it along early with those.

That would be just perfect.

Vince, do you have anything against this patch?

A message that is not in the archive (sent off-list or not yet received): CAAVeFu+=-FQSGiL0Wqt2of1nYHd8qnXBw2jFUB6Z8+_p3kOr4w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw
Quoted 22 lines · Alexandre Courbot
Quoted 21 lines · Ben Skeggs
Quoted 11 lines · Alexandre Courbot

Having the two modules separated causes various unneeded complications, including having to export symbols accessed between the modules. Make things simpler by compiling platform device support into nouveau.ko. Platform device support remains optional and is only compiled on Tegra.

---
Vince, with this you won't have to export new functions for PM. I ended up writing it myself because I hit the same issue (nv_device() would now need to be exported on Ben's master branch).

Quoted 4 lines

Be careful that when compiling against a kernel, CONFIG_NOUVEAU_PLATFORM_DRIVER now *must* be equal to 'y'. It is 'm' currently, so you will need to change it from tristate to bool in the kernel's Kconfig. For this reason it might be good to get this patch into -next quickly.

I've got a huge chunk of churn (finally finished the "rename to nvidia names for stuff" thing) pending too which I want to get to Dave (ASAP, separately from my other pending work) to avoid having to keep fixing conflicts in the meantime :)

Quoted 4 lines
Quoted 1 line

So, if you guys both agree on the patch, I'll send it along early with those.

That would be just perfect.

Vince, do you have anything against this patch?

Of course not. I just tested it and it worked as good as expected. Thanks for sending this.

Vince

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau