diff options
author | Andrew F. Davis <afd@ti.com> | 2017-12-05 15:29:32 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2017-12-19 04:21:32 -0500 |
commit | d66c36a3ee79747e300ac68276ca1496b567df68 (patch) | |
tree | 72fe5e2202fbbaab0f6e0636d3aaa77e31a3375e | |
parent | bb5cdf8d1c76ea821af0ffa486337386a0ab66e7 (diff) |
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: Andrew F. Davis <afd@ti.com>
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/core.c | 53 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/dispc.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/dsi.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/dss.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/dss.h | 35 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/hdmi4.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/hdmi5.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/venc.c | 12 |
8 files changed, 36 insertions, 124 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c index 8b8477813864..acef7ece5783 100644 --- a/drivers/gpu/drm/omapdrm/dss/core.c +++ b/drivers/gpu/drm/omapdrm/dss/core.c | |||
@@ -28,52 +28,33 @@ | |||
28 | #include "dss.h" | 28 | #include "dss.h" |
29 | 29 | ||
30 | /* INIT */ | 30 | /* INIT */ |
31 | static int (*dss_output_drv_reg_funcs[])(void) __initdata = { | 31 | static struct platform_driver * const omap_dss_drivers[] = { |
32 | dss_init_platform_driver, | 32 | &omap_dsshw_driver, |
33 | dispc_init_platform_driver, | 33 | &omap_dispchw_driver, |
34 | #ifdef CONFIG_OMAP2_DSS_DSI | 34 | #ifdef CONFIG_OMAP2_DSS_DSI |
35 | dsi_init_platform_driver, | 35 | &omap_dsihw_driver, |
36 | #endif | 36 | #endif |
37 | #ifdef CONFIG_OMAP2_DSS_VENC | 37 | #ifdef CONFIG_OMAP2_DSS_VENC |
38 | venc_init_platform_driver, | 38 | &omap_venchw_driver, |
39 | #endif | 39 | #endif |
40 | #ifdef CONFIG_OMAP4_DSS_HDMI | 40 | #ifdef CONFIG_OMAP4_DSS_HDMI |
41 | hdmi4_init_platform_driver, | 41 | &omapdss_hdmi4hw_driver, |
42 | #endif | 42 | #endif |
43 | #ifdef CONFIG_OMAP5_DSS_HDMI | 43 | #ifdef CONFIG_OMAP5_DSS_HDMI |
44 | hdmi5_init_platform_driver, | 44 | &omapdss_hdmi5hw_driver, |
45 | #endif | 45 | #endif |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static void (*dss_output_drv_unreg_funcs[])(void) = { | ||
49 | #ifdef CONFIG_OMAP5_DSS_HDMI | ||
50 | hdmi5_uninit_platform_driver, | ||
51 | #endif | ||
52 | #ifdef CONFIG_OMAP4_DSS_HDMI | ||
53 | hdmi4_uninit_platform_driver, | ||
54 | #endif | ||
55 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
56 | venc_uninit_platform_driver, | ||
57 | #endif | ||
58 | #ifdef CONFIG_OMAP2_DSS_DSI | ||
59 | dsi_uninit_platform_driver, | ||
60 | #endif | ||
61 | dispc_uninit_platform_driver, | ||
62 | dss_uninit_platform_driver, | ||
63 | }; | ||
64 | |||
65 | static struct platform_device *omap_drm_device; | 48 | static struct platform_device *omap_drm_device; |
66 | 49 | ||
67 | static int __init omap_dss_init(void) | 50 | static int __init omap_dss_init(void) |
68 | { | 51 | { |
69 | int r; | 52 | int r; |
70 | int i; | ||
71 | 53 | ||
72 | for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) { | 54 | r = platform_register_drivers(omap_dss_drivers, |
73 | r = dss_output_drv_reg_funcs[i](); | 55 | ARRAY_SIZE(omap_dss_drivers)); |
74 | if (r) | 56 | if (r) |
75 | goto err_reg; | 57 | goto err_reg; |
76 | } | ||
77 | 58 | ||
78 | omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0); | 59 | omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0); |
79 | if (IS_ERR(omap_drm_device)) { | 60 | if (IS_ERR(omap_drm_device)) { |
@@ -84,22 +65,18 @@ static int __init omap_dss_init(void) | |||
84 | return 0; | 65 | return 0; |
85 | 66 | ||
86 | err_reg: | 67 | err_reg: |
87 | for (i = ARRAY_SIZE(dss_output_drv_reg_funcs) - i; | 68 | platform_unregister_drivers(omap_dss_drivers, |
88 | i < ARRAY_SIZE(dss_output_drv_reg_funcs); | 69 | ARRAY_SIZE(omap_dss_drivers)); |
89 | ++i) | ||
90 | dss_output_drv_unreg_funcs[i](); | ||
91 | 70 | ||
92 | return r; | 71 | return r; |
93 | } | 72 | } |
94 | 73 | ||
95 | static void __exit omap_dss_exit(void) | 74 | static void __exit omap_dss_exit(void) |
96 | { | 75 | { |
97 | int i; | ||
98 | |||
99 | platform_device_unregister(omap_drm_device); | 76 | platform_device_unregister(omap_drm_device); |
100 | 77 | ||
101 | for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) | 78 | platform_unregister_drivers(omap_dss_drivers, |
102 | dss_output_drv_unreg_funcs[i](); | 79 | ARRAY_SIZE(omap_dss_drivers)); |
103 | } | 80 | } |
104 | 81 | ||
105 | module_init(omap_dss_init); | 82 | module_init(omap_dss_init); |
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 34b4555d1223..4e8f68efd169 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c | |||
@@ -4696,7 +4696,7 @@ static const struct dev_pm_ops dispc_pm_ops = { | |||
4696 | .runtime_resume = dispc_runtime_resume, | 4696 | .runtime_resume = dispc_runtime_resume, |
4697 | }; | 4697 | }; |
4698 | 4698 | ||
4699 | static struct platform_driver omap_dispchw_driver = { | 4699 | struct platform_driver omap_dispchw_driver = { |
4700 | .probe = dispc_probe, | 4700 | .probe = dispc_probe, |
4701 | .remove = dispc_remove, | 4701 | .remove = dispc_remove, |
4702 | .driver = { | 4702 | .driver = { |
@@ -4706,13 +4706,3 @@ static struct platform_driver omap_dispchw_driver = { | |||
4706 | .suppress_bind_attrs = true, | 4706 | .suppress_bind_attrs = true, |
4707 | }, | 4707 | }, |
4708 | }; | 4708 | }; |
4709 | |||
4710 | int __init dispc_init_platform_driver(void) | ||
4711 | { | ||
4712 | return platform_driver_register(&omap_dispchw_driver); | ||
4713 | } | ||
4714 | |||
4715 | void dispc_uninit_platform_driver(void) | ||
4716 | { | ||
4717 | platform_driver_unregister(&omap_dispchw_driver); | ||
4718 | } | ||
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c index e13d2d2d7e61..80f1f3679a3c 100644 --- a/drivers/gpu/drm/omapdrm/dss/dsi.c +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c | |||
@@ -5658,7 +5658,7 @@ static const struct dev_pm_ops dsi_pm_ops = { | |||
5658 | .runtime_resume = dsi_runtime_resume, | 5658 | .runtime_resume = dsi_runtime_resume, |
5659 | }; | 5659 | }; |
5660 | 5660 | ||
5661 | static struct platform_driver omap_dsihw_driver = { | 5661 | struct platform_driver omap_dsihw_driver = { |
5662 | .probe = dsi_probe, | 5662 | .probe = dsi_probe, |
5663 | .remove = dsi_remove, | 5663 | .remove = dsi_remove, |
5664 | .driver = { | 5664 | .driver = { |
@@ -5668,13 +5668,3 @@ static struct platform_driver omap_dsihw_driver = { | |||
5668 | .suppress_bind_attrs = true, | 5668 | .suppress_bind_attrs = true, |
5669 | }, | 5669 | }, |
5670 | }; | 5670 | }; |
5671 | |||
5672 | int __init dsi_init_platform_driver(void) | ||
5673 | { | ||
5674 | return platform_driver_register(&omap_dsihw_driver); | ||
5675 | } | ||
5676 | |||
5677 | void dsi_uninit_platform_driver(void) | ||
5678 | { | ||
5679 | platform_driver_unregister(&omap_dsihw_driver); | ||
5680 | } | ||
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index 2290792e1adc..04300b2da1b1 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c | |||
@@ -1534,7 +1534,7 @@ static const struct dev_pm_ops dss_pm_ops = { | |||
1534 | .runtime_resume = dss_runtime_resume, | 1534 | .runtime_resume = dss_runtime_resume, |
1535 | }; | 1535 | }; |
1536 | 1536 | ||
1537 | static struct platform_driver omap_dsshw_driver = { | 1537 | struct platform_driver omap_dsshw_driver = { |
1538 | .probe = dss_probe, | 1538 | .probe = dss_probe, |
1539 | .remove = dss_remove, | 1539 | .remove = dss_remove, |
1540 | .shutdown = dss_shutdown, | 1540 | .shutdown = dss_shutdown, |
@@ -1545,13 +1545,3 @@ static struct platform_driver omap_dsshw_driver = { | |||
1545 | .suppress_bind_attrs = true, | 1545 | .suppress_bind_attrs = true, |
1546 | }, | 1546 | }, |
1547 | }; | 1547 | }; |
1548 | |||
1549 | int __init dss_init_platform_driver(void) | ||
1550 | { | ||
1551 | return platform_driver_register(&omap_dsshw_driver); | ||
1552 | } | ||
1553 | |||
1554 | void dss_uninit_platform_driver(void) | ||
1555 | { | ||
1556 | platform_driver_unregister(&omap_dsshw_driver); | ||
1557 | } | ||
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h index 9bed809bd15c..6374e57ed9da 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.h +++ b/drivers/gpu/drm/omapdrm/dss/dss.h | |||
@@ -262,9 +262,6 @@ static inline int dss_debugfs_create_file(const char *name, | |||
262 | } | 262 | } |
263 | #endif /* CONFIG_OMAP2_DSS_DEBUGFS */ | 263 | #endif /* CONFIG_OMAP2_DSS_DEBUGFS */ |
264 | 264 | ||
265 | int dss_init_platform_driver(void) __init; | ||
266 | void dss_uninit_platform_driver(void); | ||
267 | |||
268 | int dss_runtime_get(void); | 265 | int dss_runtime_get(void); |
269 | void dss_runtime_put(void); | 266 | void dss_runtime_put(void); |
270 | 267 | ||
@@ -326,9 +323,6 @@ static inline void sdi_uninit_port(struct device_node *port) | |||
326 | struct dentry; | 323 | struct dentry; |
327 | struct file_operations; | 324 | struct file_operations; |
328 | 325 | ||
329 | int dsi_init_platform_driver(void) __init; | ||
330 | void dsi_uninit_platform_driver(void); | ||
331 | |||
332 | void dsi_dump_clocks(struct seq_file *s); | 326 | void dsi_dump_clocks(struct seq_file *s); |
333 | 327 | ||
334 | void dsi_irq_handler(void); | 328 | void dsi_irq_handler(void); |
@@ -352,8 +346,6 @@ static inline void dpi_uninit_port(struct device_node *port) | |||
352 | #endif | 346 | #endif |
353 | 347 | ||
354 | /* DISPC */ | 348 | /* DISPC */ |
355 | int dispc_init_platform_driver(void) __init; | ||
356 | void dispc_uninit_platform_driver(void); | ||
357 | void dispc_dump_clocks(struct seq_file *s); | 349 | void dispc_dump_clocks(struct seq_file *s); |
358 | 350 | ||
359 | int dispc_runtime_get(void); | 351 | int dispc_runtime_get(void); |
@@ -397,18 +389,6 @@ void dispc_wb_set_channel_in(enum dss_writeback_channel channel); | |||
397 | int dispc_wb_setup(const struct omap_dss_writeback_info *wi, | 389 | int dispc_wb_setup(const struct omap_dss_writeback_info *wi, |
398 | bool mem_to_mem, const struct videomode *vm); | 390 | bool mem_to_mem, const struct videomode *vm); |
399 | 391 | ||
400 | /* VENC */ | ||
401 | int venc_init_platform_driver(void) __init; | ||
402 | void venc_uninit_platform_driver(void); | ||
403 | |||
404 | /* HDMI */ | ||
405 | int hdmi4_init_platform_driver(void) __init; | ||
406 | void hdmi4_uninit_platform_driver(void); | ||
407 | |||
408 | int hdmi5_init_platform_driver(void) __init; | ||
409 | void hdmi5_uninit_platform_driver(void); | ||
410 | |||
411 | |||
412 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | 392 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS |
413 | static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr) | 393 | static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr) |
414 | { | 394 | { |
@@ -452,4 +432,19 @@ int dss_pll_write_config_type_b(struct dss_pll *pll, | |||
452 | const struct dss_pll_clock_info *cinfo); | 432 | const struct dss_pll_clock_info *cinfo); |
453 | int dss_pll_wait_reset_done(struct dss_pll *pll); | 433 | int dss_pll_wait_reset_done(struct dss_pll *pll); |
454 | 434 | ||
435 | extern struct platform_driver omap_dsshw_driver; | ||
436 | extern struct platform_driver omap_dispchw_driver; | ||
437 | #ifdef CONFIG_OMAP2_DSS_DSI | ||
438 | extern struct platform_driver omap_dsihw_driver; | ||
439 | #endif | ||
440 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
441 | extern struct platform_driver omap_venchw_driver; | ||
442 | #endif | ||
443 | #ifdef CONFIG_OMAP4_DSS_HDMI | ||
444 | extern struct platform_driver omapdss_hdmi4hw_driver; | ||
445 | #endif | ||
446 | #ifdef CONFIG_OMAP5_DSS_HDMI | ||
447 | extern struct platform_driver omapdss_hdmi5hw_driver; | ||
448 | #endif | ||
449 | |||
455 | #endif | 450 | #endif |
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index 1f10123400d5..bf914f2ac99e 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c | |||
@@ -845,7 +845,7 @@ static const struct of_device_id hdmi_of_match[] = { | |||
845 | {}, | 845 | {}, |
846 | }; | 846 | }; |
847 | 847 | ||
848 | static struct platform_driver omapdss_hdmihw_driver = { | 848 | struct platform_driver omapdss_hdmi4hw_driver = { |
849 | .probe = hdmi4_probe, | 849 | .probe = hdmi4_probe, |
850 | .remove = hdmi4_remove, | 850 | .remove = hdmi4_remove, |
851 | .driver = { | 851 | .driver = { |
@@ -855,13 +855,3 @@ static struct platform_driver omapdss_hdmihw_driver = { | |||
855 | .suppress_bind_attrs = true, | 855 | .suppress_bind_attrs = true, |
856 | }, | 856 | }, |
857 | }; | 857 | }; |
858 | |||
859 | int __init hdmi4_init_platform_driver(void) | ||
860 | { | ||
861 | return platform_driver_register(&omapdss_hdmihw_driver); | ||
862 | } | ||
863 | |||
864 | void hdmi4_uninit_platform_driver(void) | ||
865 | { | ||
866 | platform_driver_unregister(&omapdss_hdmihw_driver); | ||
867 | } | ||
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c index 7091197da940..689cda41858b 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c | |||
@@ -841,7 +841,7 @@ static const struct of_device_id hdmi_of_match[] = { | |||
841 | {}, | 841 | {}, |
842 | }; | 842 | }; |
843 | 843 | ||
844 | static struct platform_driver omapdss_hdmihw_driver = { | 844 | struct platform_driver omapdss_hdmi5hw_driver = { |
845 | .probe = hdmi5_probe, | 845 | .probe = hdmi5_probe, |
846 | .remove = hdmi5_remove, | 846 | .remove = hdmi5_remove, |
847 | .driver = { | 847 | .driver = { |
@@ -851,13 +851,3 @@ static struct platform_driver omapdss_hdmihw_driver = { | |||
851 | .suppress_bind_attrs = true, | 851 | .suppress_bind_attrs = true, |
852 | }, | 852 | }, |
853 | }; | 853 | }; |
854 | |||
855 | int __init hdmi5_init_platform_driver(void) | ||
856 | { | ||
857 | return platform_driver_register(&omapdss_hdmihw_driver); | ||
858 | } | ||
859 | |||
860 | void hdmi5_uninit_platform_driver(void) | ||
861 | { | ||
862 | platform_driver_unregister(&omapdss_hdmihw_driver); | ||
863 | } | ||
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c index b3e0e5fba24d..6de9d734ddb9 100644 --- a/drivers/gpu/drm/omapdrm/dss/venc.c +++ b/drivers/gpu/drm/omapdrm/dss/venc.c | |||
@@ -984,7 +984,7 @@ static const struct of_device_id venc_of_match[] = { | |||
984 | {}, | 984 | {}, |
985 | }; | 985 | }; |
986 | 986 | ||
987 | static struct platform_driver omap_venchw_driver = { | 987 | struct platform_driver omap_venchw_driver = { |
988 | .probe = venc_probe, | 988 | .probe = venc_probe, |
989 | .remove = venc_remove, | 989 | .remove = venc_remove, |
990 | .driver = { | 990 | .driver = { |
@@ -994,13 +994,3 @@ static struct platform_driver omap_venchw_driver = { | |||
994 | .suppress_bind_attrs = true, | 994 | .suppress_bind_attrs = true, |
995 | }, | 995 | }, |
996 | }; | 996 | }; |
997 | |||
998 | int __init venc_init_platform_driver(void) | ||
999 | { | ||
1000 | return platform_driver_register(&omap_venchw_driver); | ||
1001 | } | ||
1002 | |||
1003 | void venc_uninit_platform_driver(void) | ||
1004 | { | ||
1005 | platform_driver_unregister(&omap_venchw_driver); | ||
1006 | } | ||