Commit d66c36a3 authored by Andrew F. Davis's avatar Andrew F. Davis Committed by Tomi Valkeinen

drm: omapdrm: Simplify platform registration

Currently, calls into each file are used to register the various
platform drivers. Change this to a table of pointers to platform_driver
structs to allow using platform_register_drivers.
Signed-off-by: default avatarAndrew F. Davis <afd@ti.com>
parent bb5cdf8d
...@@ -28,52 +28,33 @@ ...@@ -28,52 +28,33 @@
#include "dss.h" #include "dss.h"
/* INIT */ /* INIT */
static int (*dss_output_drv_reg_funcs[])(void) __initdata = { static struct platform_driver * const omap_dss_drivers[] = {
dss_init_platform_driver, &omap_dsshw_driver,
dispc_init_platform_driver, &omap_dispchw_driver,
#ifdef CONFIG_OMAP2_DSS_DSI #ifdef CONFIG_OMAP2_DSS_DSI
dsi_init_platform_driver, &omap_dsihw_driver,
#endif #endif
#ifdef CONFIG_OMAP2_DSS_VENC #ifdef CONFIG_OMAP2_DSS_VENC
venc_init_platform_driver, &omap_venchw_driver,
#endif #endif
#ifdef CONFIG_OMAP4_DSS_HDMI #ifdef CONFIG_OMAP4_DSS_HDMI
hdmi4_init_platform_driver, &omapdss_hdmi4hw_driver,
#endif #endif
#ifdef CONFIG_OMAP5_DSS_HDMI #ifdef CONFIG_OMAP5_DSS_HDMI
hdmi5_init_platform_driver, &omapdss_hdmi5hw_driver,
#endif #endif
}; };
static void (*dss_output_drv_unreg_funcs[])(void) = {
#ifdef CONFIG_OMAP5_DSS_HDMI
hdmi5_uninit_platform_driver,
#endif
#ifdef CONFIG_OMAP4_DSS_HDMI
hdmi4_uninit_platform_driver,
#endif
#ifdef CONFIG_OMAP2_DSS_VENC
venc_uninit_platform_driver,
#endif
#ifdef CONFIG_OMAP2_DSS_DSI
dsi_uninit_platform_driver,
#endif
dispc_uninit_platform_driver,
dss_uninit_platform_driver,
};
static struct platform_device *omap_drm_device; static struct platform_device *omap_drm_device;
static int __init omap_dss_init(void) static int __init omap_dss_init(void)
{ {
int r; int r;
int i;
for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) { r = platform_register_drivers(omap_dss_drivers,
r = dss_output_drv_reg_funcs[i](); ARRAY_SIZE(omap_dss_drivers));
if (r) if (r)
goto err_reg; goto err_reg;
}
omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0); omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0);
if (IS_ERR(omap_drm_device)) { if (IS_ERR(omap_drm_device)) {
...@@ -84,22 +65,18 @@ static int __init omap_dss_init(void) ...@@ -84,22 +65,18 @@ static int __init omap_dss_init(void)
return 0; return 0;
err_reg: err_reg:
for (i = ARRAY_SIZE(dss_output_drv_reg_funcs) - i; platform_unregister_drivers(omap_dss_drivers,
i < ARRAY_SIZE(dss_output_drv_reg_funcs); ARRAY_SIZE(omap_dss_drivers));
++i)
dss_output_drv_unreg_funcs[i]();
return r; return r;
} }
static void __exit omap_dss_exit(void) static void __exit omap_dss_exit(void)
{ {
int i;
platform_device_unregister(omap_drm_device); platform_device_unregister(omap_drm_device);
for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) platform_unregister_drivers(omap_dss_drivers,
dss_output_drv_unreg_funcs[i](); ARRAY_SIZE(omap_dss_drivers));
} }
module_init(omap_dss_init); module_init(omap_dss_init);
......
...@@ -4696,7 +4696,7 @@ static const struct dev_pm_ops dispc_pm_ops = { ...@@ -4696,7 +4696,7 @@ static const struct dev_pm_ops dispc_pm_ops = {
.runtime_resume = dispc_runtime_resume, .runtime_resume = dispc_runtime_resume,
}; };
static struct platform_driver omap_dispchw_driver = { struct platform_driver omap_dispchw_driver = {
.probe = dispc_probe, .probe = dispc_probe,
.remove = dispc_remove, .remove = dispc_remove,
.driver = { .driver = {
...@@ -4706,13 +4706,3 @@ static struct platform_driver omap_dispchw_driver = { ...@@ -4706,13 +4706,3 @@ static struct platform_driver omap_dispchw_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
}; };
int __init dispc_init_platform_driver(void)
{
return platform_driver_register(&omap_dispchw_driver);
}
void dispc_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dispchw_driver);
}
...@@ -5658,7 +5658,7 @@ static const struct dev_pm_ops dsi_pm_ops = { ...@@ -5658,7 +5658,7 @@ static const struct dev_pm_ops dsi_pm_ops = {
.runtime_resume = dsi_runtime_resume, .runtime_resume = dsi_runtime_resume,
}; };
static struct platform_driver omap_dsihw_driver = { struct platform_driver omap_dsihw_driver = {
.probe = dsi_probe, .probe = dsi_probe,
.remove = dsi_remove, .remove = dsi_remove,
.driver = { .driver = {
...@@ -5668,13 +5668,3 @@ static struct platform_driver omap_dsihw_driver = { ...@@ -5668,13 +5668,3 @@ static struct platform_driver omap_dsihw_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
}; };
int __init dsi_init_platform_driver(void)
{
return platform_driver_register(&omap_dsihw_driver);
}
void dsi_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dsihw_driver);
}
...@@ -1534,7 +1534,7 @@ static const struct dev_pm_ops dss_pm_ops = { ...@@ -1534,7 +1534,7 @@ static const struct dev_pm_ops dss_pm_ops = {
.runtime_resume = dss_runtime_resume, .runtime_resume = dss_runtime_resume,
}; };
static struct platform_driver omap_dsshw_driver = { struct platform_driver omap_dsshw_driver = {
.probe = dss_probe, .probe = dss_probe,
.remove = dss_remove, .remove = dss_remove,
.shutdown = dss_shutdown, .shutdown = dss_shutdown,
...@@ -1545,13 +1545,3 @@ static struct platform_driver omap_dsshw_driver = { ...@@ -1545,13 +1545,3 @@ static struct platform_driver omap_dsshw_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
}; };
int __init dss_init_platform_driver(void)
{
return platform_driver_register(&omap_dsshw_driver);
}
void dss_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dsshw_driver);
}
...@@ -262,9 +262,6 @@ static inline int dss_debugfs_create_file(const char *name, ...@@ -262,9 +262,6 @@ static inline int dss_debugfs_create_file(const char *name,
} }
#endif /* CONFIG_OMAP2_DSS_DEBUGFS */ #endif /* CONFIG_OMAP2_DSS_DEBUGFS */
int dss_init_platform_driver(void) __init;
void dss_uninit_platform_driver(void);
int dss_runtime_get(void); int dss_runtime_get(void);
void dss_runtime_put(void); void dss_runtime_put(void);
...@@ -326,9 +323,6 @@ static inline void sdi_uninit_port(struct device_node *port) ...@@ -326,9 +323,6 @@ static inline void sdi_uninit_port(struct device_node *port)
struct dentry; struct dentry;
struct file_operations; struct file_operations;
int dsi_init_platform_driver(void) __init;
void dsi_uninit_platform_driver(void);
void dsi_dump_clocks(struct seq_file *s); void dsi_dump_clocks(struct seq_file *s);
void dsi_irq_handler(void); void dsi_irq_handler(void);
...@@ -352,8 +346,6 @@ static inline void dpi_uninit_port(struct device_node *port) ...@@ -352,8 +346,6 @@ static inline void dpi_uninit_port(struct device_node *port)
#endif #endif
/* DISPC */ /* DISPC */
int dispc_init_platform_driver(void) __init;
void dispc_uninit_platform_driver(void);
void dispc_dump_clocks(struct seq_file *s); void dispc_dump_clocks(struct seq_file *s);
int dispc_runtime_get(void); int dispc_runtime_get(void);
...@@ -397,18 +389,6 @@ void dispc_wb_set_channel_in(enum dss_writeback_channel channel); ...@@ -397,18 +389,6 @@ void dispc_wb_set_channel_in(enum dss_writeback_channel channel);
int dispc_wb_setup(const struct omap_dss_writeback_info *wi, int dispc_wb_setup(const struct omap_dss_writeback_info *wi,
bool mem_to_mem, const struct videomode *vm); bool mem_to_mem, const struct videomode *vm);
/* VENC */
int venc_init_platform_driver(void) __init;
void venc_uninit_platform_driver(void);
/* HDMI */
int hdmi4_init_platform_driver(void) __init;
void hdmi4_uninit_platform_driver(void);
int hdmi5_init_platform_driver(void) __init;
void hdmi5_uninit_platform_driver(void);
#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr) static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr)
{ {
...@@ -452,4 +432,19 @@ int dss_pll_write_config_type_b(struct dss_pll *pll, ...@@ -452,4 +432,19 @@ int dss_pll_write_config_type_b(struct dss_pll *pll,
const struct dss_pll_clock_info *cinfo); const struct dss_pll_clock_info *cinfo);
int dss_pll_wait_reset_done(struct dss_pll *pll); int dss_pll_wait_reset_done(struct dss_pll *pll);
extern struct platform_driver omap_dsshw_driver;
extern struct platform_driver omap_dispchw_driver;
#ifdef CONFIG_OMAP2_DSS_DSI
extern struct platform_driver omap_dsihw_driver;
#endif
#ifdef CONFIG_OMAP2_DSS_VENC
extern struct platform_driver omap_venchw_driver;
#endif
#ifdef CONFIG_OMAP4_DSS_HDMI
extern struct platform_driver omapdss_hdmi4hw_driver;
#endif
#ifdef CONFIG_OMAP5_DSS_HDMI
extern struct platform_driver omapdss_hdmi5hw_driver;
#endif
#endif #endif
...@@ -845,7 +845,7 @@ static const struct of_device_id hdmi_of_match[] = { ...@@ -845,7 +845,7 @@ static const struct of_device_id hdmi_of_match[] = {
{}, {},
}; };
static struct platform_driver omapdss_hdmihw_driver = { struct platform_driver omapdss_hdmi4hw_driver = {
.probe = hdmi4_probe, .probe = hdmi4_probe,
.remove = hdmi4_remove, .remove = hdmi4_remove,
.driver = { .driver = {
...@@ -855,13 +855,3 @@ static struct platform_driver omapdss_hdmihw_driver = { ...@@ -855,13 +855,3 @@ static struct platform_driver omapdss_hdmihw_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
}; };
int __init hdmi4_init_platform_driver(void)
{
return platform_driver_register(&omapdss_hdmihw_driver);
}
void hdmi4_uninit_platform_driver(void)
{
platform_driver_unregister(&omapdss_hdmihw_driver);
}
...@@ -841,7 +841,7 @@ static const struct of_device_id hdmi_of_match[] = { ...@@ -841,7 +841,7 @@ static const struct of_device_id hdmi_of_match[] = {
{}, {},
}; };
static struct platform_driver omapdss_hdmihw_driver = { struct platform_driver omapdss_hdmi5hw_driver = {
.probe = hdmi5_probe, .probe = hdmi5_probe,
.remove = hdmi5_remove, .remove = hdmi5_remove,
.driver = { .driver = {
...@@ -851,13 +851,3 @@ static struct platform_driver omapdss_hdmihw_driver = { ...@@ -851,13 +851,3 @@ static struct platform_driver omapdss_hdmihw_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
}; };
int __init hdmi5_init_platform_driver(void)
{
return platform_driver_register(&omapdss_hdmihw_driver);
}
void hdmi5_uninit_platform_driver(void)
{
platform_driver_unregister(&omapdss_hdmihw_driver);
}
...@@ -984,7 +984,7 @@ static const struct of_device_id venc_of_match[] = { ...@@ -984,7 +984,7 @@ static const struct of_device_id venc_of_match[] = {
{}, {},
}; };
static struct platform_driver omap_venchw_driver = { struct platform_driver omap_venchw_driver = {
.probe = venc_probe, .probe = venc_probe,
.remove = venc_remove, .remove = venc_remove,
.driver = { .driver = {
...@@ -994,13 +994,3 @@ static struct platform_driver omap_venchw_driver = { ...@@ -994,13 +994,3 @@ static struct platform_driver omap_venchw_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
}; };
int __init venc_init_platform_driver(void)
{
return platform_driver_register(&omap_venchw_driver);
}
void venc_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_venchw_driver);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment