[PATCH v2 13/20] drm/tilcdc: Remove the useless module list support

Kory Maincent (TI.com)
2025-12-11T16:40:22Z

The tilcdc driver previously supported a sub-module system where
external display drivers (panels, encoders) could register themselves
through tilcdc_module_init() and be automatically initialized through
a module list. This infrastructure became unused after the component
framework support and panel driver was removed.

Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
---
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 48 +------------------------------------
drivers/gpu/drm/tilcdc/tilcdc_drv.h | 27 ---------------------
2 files changed, 1 insertion(+), 74 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 6a08f50762af9..4630e56c3f028 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -7,7 +7,6 @@
/* LCDC DRM driver, based on da8xx-fb */

#include <linux/mod_devicetable.h>
-#include <linux/module.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
@@ -34,8 +33,6 @@ enum {
DA850_TILCDC,
};

-static LIST_HEAD(module_list);
-
static const u32 tilcdc_rev1_formats[] = { DRM_FORMAT_RGB565 };

static const u32 tilcdc_straight_formats[] = { DRM_FORMAT_RGB565,
@@ -50,20 +47,6 @@ static const u32 tilcdc_legacy_formats[] = { DRM_FORMAT_RGB565,
DRM_FORMAT_RGB888,
DRM_FORMAT_XRGB8888 };

-void tilcdc_module_init(struct tilcdc_module *mod, const char *name,
- const struct tilcdc_module_ops *funcs)
-{
- mod->name = name;
- mod->funcs = funcs;
- INIT_LIST_HEAD(&mod->list);
- list_add(&mod->list, &module_list);
-}
-
-void tilcdc_module_cleanup(struct tilcdc_module *mod)
-{
- list_del(&mod->list);
-}
-
static int tilcdc_atomic_check(struct drm_device *dev,
struct drm_atomic_state *state)
{
@@ -97,12 +80,6 @@ static const struct drm_mode_config_funcs mode_config_funcs = {
static void modeset_init(struct drm_device *dev)
{
struct tilcdc_drm_private *priv = dev->dev_private;
- struct tilcdc_module *mod;
-
- list_for_each_entry(mod, &module_list, list) {
- DBG("loading module: %s", mod->name);
- mod->funcs->modeset_init(mod, dev);
- }

dev->mode_config.min_width = 0;
dev->mode_config.min_height = 0;
@@ -474,15 +451,9 @@ static struct drm_info_list tilcdc_debugfs_list[] = {

static void tilcdc_debugfs_init(struct drm_minor *minor)
{
- struct tilcdc_module *mod;
-
drm_debugfs_create_files(tilcdc_debugfs_list,
ARRAY_SIZE(tilcdc_debugfs_list),
minor->debugfs_root, minor);
-
- list_for_each_entry(mod, &module_list, list)
- if (mod->funcs->debugfs_init)
- mod->funcs->debugfs_init(mod, minor);
}
#endif

@@ -562,24 +533,7 @@ static struct platform_driver tilcdc_platform_driver = {
.of_match_table = tilcdc_of_match,
},
};
-
-static int __init tilcdc_drm_init(void)
-{
- if (drm_firmware_drivers_only())
- return -ENODEV;
-
- DBG("init");
- return platform_driver_register(&tilcdc_platform_driver);
-}
-
-static void __exit tilcdc_drm_fini(void)
-{
- DBG("fini");
- platform_driver_unregister(&tilcdc_platform_driver);
-}
-
-module_init(tilcdc_drm_init);
-module_exit(tilcdc_drm_fini);
+module_platform_driver(tilcdc_platform_driver);

MODULE_AUTHOR("Rob Clark <robdclark@gmail.com");
MODULE_DESCRIPTION("TI LCD Controller DRM Driver");
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index dafb00908d1d4..60e85e29b1063 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -81,33 +81,6 @@ struct tilcdc_drm_private {
bool irq_enabled;
};

-/* Sub-module for display. Since we don't know at compile time what panels
- * or display adapter(s) might be present (for ex, off chip dvi/tfp410,
- * hdmi encoder, various lcd panels), the connector/encoder(s) are split into
- * separate drivers. If they are probed and found to be present, they
- * register themselves with tilcdc_register_module().
- */
-struct tilcdc_module;
-
-struct tilcdc_module_ops {
- /* create appropriate encoders/connectors: */
- int (*modeset_init)(struct tilcdc_module *mod, struct drm_device *dev);
-#ifdef CONFIG_DEBUG_FS
- /* create debugfs nodes (can be NULL): */
- int (*debugfs_init)(struct tilcdc_module *mod, struct drm_minor *minor);
-#endif
-};
-
-struct tilcdc_module {
- const char *name;
- struct list_head list;
- const struct tilcdc_module_ops *funcs;
-};
-
-void tilcdc_module_init(struct tilcdc_module *mod, const char *name,
- const struct tilcdc_module_ops *funcs);
-void tilcdc_module_cleanup(struct tilcdc_module *mod);
-
#define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__)

int tilcdc_crtc_create(struct drm_device *dev);

--
2.43.0