Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

OMAPDSS: remove uses of __init/__exit

The following patches will add component handling to omapdss, improving
the handling of deferred probing. However, at the moment we're using
quite a lot of __inits and __exits in the driver, which prevent normal
dynamic probing and removal.

This patch removes most of the uses of __init and __exit, so that we can
register drivers after module init, and so that we can unregister
drivers even if the module is built-in.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

+69 -69
+10 -10
drivers/video/fbdev/omap2/dss/dispc.c
··· 3692 3692 dispc_init_mflag(); 3693 3693 } 3694 3694 3695 - static const struct dispc_features omap24xx_dispc_feats __initconst = { 3695 + static const struct dispc_features omap24xx_dispc_feats = { 3696 3696 .sw_start = 5, 3697 3697 .fp_start = 15, 3698 3698 .bp_start = 27, ··· 3711 3711 .set_max_preload = false, 3712 3712 }; 3713 3713 3714 - static const struct dispc_features omap34xx_rev1_0_dispc_feats __initconst = { 3714 + static const struct dispc_features omap34xx_rev1_0_dispc_feats = { 3715 3715 .sw_start = 5, 3716 3716 .fp_start = 15, 3717 3717 .bp_start = 27, ··· 3731 3731 .set_max_preload = false, 3732 3732 }; 3733 3733 3734 - static const struct dispc_features omap34xx_rev3_0_dispc_feats __initconst = { 3734 + static const struct dispc_features omap34xx_rev3_0_dispc_feats = { 3735 3735 .sw_start = 7, 3736 3736 .fp_start = 19, 3737 3737 .bp_start = 31, ··· 3751 3751 .set_max_preload = false, 3752 3752 }; 3753 3753 3754 - static const struct dispc_features omap44xx_dispc_feats __initconst = { 3754 + static const struct dispc_features omap44xx_dispc_feats = { 3755 3755 .sw_start = 7, 3756 3756 .fp_start = 19, 3757 3757 .bp_start = 31, ··· 3771 3771 .set_max_preload = true, 3772 3772 }; 3773 3773 3774 - static const struct dispc_features omap54xx_dispc_feats __initconst = { 3774 + static const struct dispc_features omap54xx_dispc_feats = { 3775 3775 .sw_start = 7, 3776 3776 .fp_start = 19, 3777 3777 .bp_start = 31, ··· 3792 3792 .set_max_preload = true, 3793 3793 }; 3794 3794 3795 - static int __init dispc_init_features(struct platform_device *pdev) 3795 + static int dispc_init_features(struct platform_device *pdev) 3796 3796 { 3797 3797 const struct dispc_features *src; 3798 3798 struct dispc_features *dst; ··· 3882 3882 EXPORT_SYMBOL(dispc_free_irq); 3883 3883 3884 3884 /* DISPC HW IP initialisation */ 3885 - static int __init omap_dispchw_probe(struct platform_device *pdev) 3885 + static int omap_dispchw_probe(struct platform_device *pdev) 3886 3886 { 3887 3887 u32 rev; 3888 3888 int r = 0; ··· 3955 3955 return r; 3956 3956 } 3957 3957 3958 - static int __exit omap_dispchw_remove(struct platform_device *pdev) 3958 + static int omap_dispchw_remove(struct platform_device *pdev) 3959 3959 { 3960 3960 pm_runtime_disable(&pdev->dev); 3961 3961 ··· 4013 4013 }; 4014 4014 4015 4015 static struct platform_driver omap_dispchw_driver = { 4016 - .remove = __exit_p(omap_dispchw_remove), 4016 + .remove = omap_dispchw_remove, 4017 4017 .driver = { 4018 4018 .name = "omapdss_dispc", 4019 4019 .pm = &dispc_pm_ops, ··· 4027 4027 return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe); 4028 4028 } 4029 4029 4030 - void __exit dispc_uninit_platform_driver(void) 4030 + void dispc_uninit_platform_driver(void) 4031 4031 { 4032 4032 platform_driver_unregister(&omap_dispchw_driver); 4033 4033 }
+7 -7
drivers/video/fbdev/omap2/dss/dpi.c
··· 731 731 omapdss_register_output(out); 732 732 } 733 733 734 - static void __exit dpi_uninit_output(struct platform_device *pdev) 734 + static void dpi_uninit_output(struct platform_device *pdev) 735 735 { 736 736 struct dpi_data *dpi = dpi_get_data_from_pdev(pdev); 737 737 struct omap_dss_device *out = &dpi->output; ··· 775 775 omapdss_register_output(out); 776 776 } 777 777 778 - static void __exit dpi_uninit_output_port(struct device_node *port) 778 + static void dpi_uninit_output_port(struct device_node *port) 779 779 { 780 780 struct dpi_data *dpi = port->data; 781 781 struct omap_dss_device *out = &dpi->output; ··· 802 802 return 0; 803 803 } 804 804 805 - static int __exit omap_dpi_remove(struct platform_device *pdev) 805 + static int omap_dpi_remove(struct platform_device *pdev) 806 806 { 807 807 dpi_uninit_output(pdev); 808 808 ··· 811 811 812 812 static struct platform_driver omap_dpi_driver = { 813 813 .probe = omap_dpi_probe, 814 - .remove = __exit_p(omap_dpi_remove), 814 + .remove = omap_dpi_remove, 815 815 .driver = { 816 816 .name = "omapdss_dpi", 817 817 .suppress_bind_attrs = true, ··· 823 823 return platform_driver_register(&omap_dpi_driver); 824 824 } 825 825 826 - void __exit dpi_uninit_platform_driver(void) 826 + void dpi_uninit_platform_driver(void) 827 827 { 828 828 platform_driver_unregister(&omap_dpi_driver); 829 829 } 830 830 831 - int __init dpi_init_port(struct platform_device *pdev, struct device_node *port) 831 + int dpi_init_port(struct platform_device *pdev, struct device_node *port) 832 832 { 833 833 struct dpi_data *dpi; 834 834 struct device_node *ep; ··· 870 870 return r; 871 871 } 872 872 873 - void __exit dpi_uninit_port(struct device_node *port) 873 + void dpi_uninit_port(struct device_node *port) 874 874 { 875 875 struct dpi_data *dpi = port->data; 876 876
+3 -3
drivers/video/fbdev/omap2/dss/dsi.c
··· 5484 5484 return r; 5485 5485 } 5486 5486 5487 - static int __exit omap_dsihw_remove(struct platform_device *dsidev) 5487 + static int omap_dsihw_remove(struct platform_device *dsidev) 5488 5488 { 5489 5489 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 5490 5490 ··· 5570 5570 5571 5571 static struct platform_driver omap_dsihw_driver = { 5572 5572 .probe = omap_dsihw_probe, 5573 - .remove = __exit_p(omap_dsihw_remove), 5573 + .remove = omap_dsihw_remove, 5574 5574 .driver = { 5575 5575 .name = "omapdss_dsi", 5576 5576 .pm = &dsi_pm_ops, ··· 5584 5584 return platform_driver_register(&omap_dsihw_driver); 5585 5585 } 5586 5586 5587 - void __exit dsi_uninit_platform_driver(void) 5587 + void dsi_uninit_platform_driver(void) 5588 5588 { 5589 5589 platform_driver_unregister(&omap_dsihw_driver); 5590 5590 }
+13 -13
drivers/video/fbdev/omap2/dss/dss.c
··· 819 819 OMAP_DISPLAY_TYPE_DPI, 820 820 }; 821 821 822 - static const struct dss_features omap24xx_dss_feats __initconst = { 822 + static const struct dss_features omap24xx_dss_feats = { 823 823 /* 824 824 * fck div max is really 16, but the divider range has gaps. The range 825 825 * from 1 to 6 has no gaps, so let's use that as a max. ··· 832 832 .num_ports = ARRAY_SIZE(omap2plus_ports), 833 833 }; 834 834 835 - static const struct dss_features omap34xx_dss_feats __initconst = { 835 + static const struct dss_features omap34xx_dss_feats = { 836 836 .fck_div_max = 16, 837 837 .dss_fck_multiplier = 2, 838 838 .parent_clk_name = "dpll4_ck", ··· 841 841 .num_ports = ARRAY_SIZE(omap34xx_ports), 842 842 }; 843 843 844 - static const struct dss_features omap3630_dss_feats __initconst = { 844 + static const struct dss_features omap3630_dss_feats = { 845 845 .fck_div_max = 32, 846 846 .dss_fck_multiplier = 1, 847 847 .parent_clk_name = "dpll4_ck", ··· 850 850 .num_ports = ARRAY_SIZE(omap2plus_ports), 851 851 }; 852 852 853 - static const struct dss_features omap44xx_dss_feats __initconst = { 853 + static const struct dss_features omap44xx_dss_feats = { 854 854 .fck_div_max = 32, 855 855 .dss_fck_multiplier = 1, 856 856 .parent_clk_name = "dpll_per_x2_ck", ··· 859 859 .num_ports = ARRAY_SIZE(omap2plus_ports), 860 860 }; 861 861 862 - static const struct dss_features omap54xx_dss_feats __initconst = { 862 + static const struct dss_features omap54xx_dss_feats = { 863 863 .fck_div_max = 64, 864 864 .dss_fck_multiplier = 1, 865 865 .parent_clk_name = "dpll_per_x2_ck", ··· 868 868 .num_ports = ARRAY_SIZE(omap2plus_ports), 869 869 }; 870 870 871 - static const struct dss_features am43xx_dss_feats __initconst = { 871 + static const struct dss_features am43xx_dss_feats = { 872 872 .fck_div_max = 0, 873 873 .dss_fck_multiplier = 0, 874 874 .parent_clk_name = NULL, ··· 877 877 .num_ports = ARRAY_SIZE(omap2plus_ports), 878 878 }; 879 879 880 - static const struct dss_features dra7xx_dss_feats __initconst = { 880 + static const struct dss_features dra7xx_dss_feats = { 881 881 .fck_div_max = 64, 882 882 .dss_fck_multiplier = 1, 883 883 .parent_clk_name = "dpll_per_x2_ck", ··· 886 886 .num_ports = ARRAY_SIZE(dra7xx_ports), 887 887 }; 888 888 889 - static int __init dss_init_features(struct platform_device *pdev) 889 + static int dss_init_features(struct platform_device *pdev) 890 890 { 891 891 const struct dss_features *src; 892 892 struct dss_features *dst; ··· 940 940 return 0; 941 941 } 942 942 943 - static int __init dss_init_ports(struct platform_device *pdev) 943 + static int dss_init_ports(struct platform_device *pdev) 944 944 { 945 945 struct device_node *parent = pdev->dev.of_node; 946 946 struct device_node *port; ··· 984 984 return 0; 985 985 } 986 986 987 - static void __exit dss_uninit_ports(struct platform_device *pdev) 987 + static void dss_uninit_ports(struct platform_device *pdev) 988 988 { 989 989 struct device_node *parent = pdev->dev.of_node; 990 990 struct device_node *port; ··· 1088 1088 } 1089 1089 1090 1090 /* DSS HW IP initialisation */ 1091 - static int __init omap_dsshw_probe(struct platform_device *pdev) 1091 + static int omap_dsshw_probe(struct platform_device *pdev) 1092 1092 { 1093 1093 struct resource *dss_mem; 1094 1094 u32 rev; ··· 1182 1182 return r; 1183 1183 } 1184 1184 1185 - static int __exit omap_dsshw_remove(struct platform_device *pdev) 1185 + static int omap_dsshw_remove(struct platform_device *pdev) 1186 1186 { 1187 1187 dss_initialized = false; 1188 1188 ··· 1243 1243 MODULE_DEVICE_TABLE(of, dss_of_match); 1244 1244 1245 1245 static struct platform_driver omap_dsshw_driver = { 1246 - .remove = __exit_p(omap_dsshw_remove), 1246 + .remove = omap_dsshw_remove, 1247 1247 .driver = { 1248 1248 .name = "omapdss_dss", 1249 1249 .pm = &dss_pm_ops,
+16 -16
drivers/video/fbdev/omap2/dss/dss.h
··· 309 309 310 310 /* SDI */ 311 311 int sdi_init_platform_driver(void) __init; 312 - void sdi_uninit_platform_driver(void) __exit; 312 + void sdi_uninit_platform_driver(void); 313 313 314 314 #ifdef CONFIG_OMAP2_DSS_SDI 315 - int sdi_init_port(struct platform_device *pdev, struct device_node *port) __init; 316 - void sdi_uninit_port(struct device_node *port) __exit; 315 + int sdi_init_port(struct platform_device *pdev, struct device_node *port); 316 + void sdi_uninit_port(struct device_node *port); 317 317 #else 318 - static inline int __init sdi_init_port(struct platform_device *pdev, 318 + static inline int sdi_init_port(struct platform_device *pdev, 319 319 struct device_node *port) 320 320 { 321 321 return 0; 322 322 } 323 - static inline void __exit sdi_uninit_port(struct device_node *port) 323 + static inline void sdi_uninit_port(struct device_node *port) 324 324 { 325 325 } 326 326 #endif ··· 333 333 struct file_operations; 334 334 335 335 int dsi_init_platform_driver(void) __init; 336 - void dsi_uninit_platform_driver(void) __exit; 336 + void dsi_uninit_platform_driver(void); 337 337 338 338 void dsi_dump_clocks(struct seq_file *s); 339 339 ··· 350 350 351 351 /* DPI */ 352 352 int dpi_init_platform_driver(void) __init; 353 - void dpi_uninit_platform_driver(void) __exit; 353 + void dpi_uninit_platform_driver(void); 354 354 355 355 #ifdef CONFIG_OMAP2_DSS_DPI 356 - int dpi_init_port(struct platform_device *pdev, struct device_node *port) __init; 357 - void dpi_uninit_port(struct device_node *port) __exit; 356 + int dpi_init_port(struct platform_device *pdev, struct device_node *port); 357 + void dpi_uninit_port(struct device_node *port); 358 358 #else 359 - static inline int __init dpi_init_port(struct platform_device *pdev, 359 + static inline int dpi_init_port(struct platform_device *pdev, 360 360 struct device_node *port) 361 361 { 362 362 return 0; 363 363 } 364 - static inline void __exit dpi_uninit_port(struct device_node *port) 364 + static inline void dpi_uninit_port(struct device_node *port) 365 365 { 366 366 } 367 367 #endif 368 368 369 369 /* DISPC */ 370 370 int dispc_init_platform_driver(void) __init; 371 - void dispc_uninit_platform_driver(void) __exit; 371 + void dispc_uninit_platform_driver(void); 372 372 void dispc_dump_clocks(struct seq_file *s); 373 373 374 374 void dispc_enable_sidle(void); ··· 418 418 419 419 /* VENC */ 420 420 int venc_init_platform_driver(void) __init; 421 - void venc_uninit_platform_driver(void) __exit; 421 + void venc_uninit_platform_driver(void); 422 422 423 423 /* HDMI */ 424 424 int hdmi4_init_platform_driver(void) __init; 425 - void hdmi4_uninit_platform_driver(void) __exit; 425 + void hdmi4_uninit_platform_driver(void); 426 426 427 427 int hdmi5_init_platform_driver(void) __init; 428 - void hdmi5_uninit_platform_driver(void) __exit; 428 + void hdmi5_uninit_platform_driver(void); 429 429 430 430 /* RFBI */ 431 431 int rfbi_init_platform_driver(void) __init; 432 - void rfbi_uninit_platform_driver(void) __exit; 432 + void rfbi_uninit_platform_driver(void); 433 433 434 434 435 435 #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+3 -3
drivers/video/fbdev/omap2/dss/hdmi4.c
··· 713 713 return r; 714 714 } 715 715 716 - static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) 716 + static int omapdss_hdmihw_remove(struct platform_device *pdev) 717 717 { 718 718 if (hdmi.audio_pdev) 719 719 platform_device_unregister(hdmi.audio_pdev); ··· 757 757 758 758 static struct platform_driver omapdss_hdmihw_driver = { 759 759 .probe = omapdss_hdmihw_probe, 760 - .remove = __exit_p(omapdss_hdmihw_remove), 760 + .remove = omapdss_hdmihw_remove, 761 761 .driver = { 762 762 .name = "omapdss_hdmi", 763 763 .pm = &hdmi_pm_ops, ··· 771 771 return platform_driver_register(&omapdss_hdmihw_driver); 772 772 } 773 773 774 - void __exit hdmi4_uninit_platform_driver(void) 774 + void hdmi4_uninit_platform_driver(void) 775 775 { 776 776 platform_driver_unregister(&omapdss_hdmihw_driver); 777 777 }
+3 -3
drivers/video/fbdev/omap2/dss/hdmi5.c
··· 748 748 return r; 749 749 } 750 750 751 - static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) 751 + static int omapdss_hdmihw_remove(struct platform_device *pdev) 752 752 { 753 753 if (hdmi.audio_pdev) 754 754 platform_device_unregister(hdmi.audio_pdev); ··· 793 793 794 794 static struct platform_driver omapdss_hdmihw_driver = { 795 795 .probe = omapdss_hdmihw_probe, 796 - .remove = __exit_p(omapdss_hdmihw_remove), 796 + .remove = omapdss_hdmihw_remove, 797 797 .driver = { 798 798 .name = "omapdss_hdmi5", 799 799 .pm = &hdmi_pm_ops, ··· 807 807 return platform_driver_register(&omapdss_hdmihw_driver); 808 808 } 809 809 810 - void __exit hdmi5_uninit_platform_driver(void) 810 + void hdmi5_uninit_platform_driver(void) 811 811 { 812 812 platform_driver_unregister(&omapdss_hdmihw_driver); 813 813 }
+4 -4
drivers/video/fbdev/omap2/dss/rfbi.c
··· 938 938 omapdss_register_output(out); 939 939 } 940 940 941 - static void __exit rfbi_uninit_output(struct platform_device *pdev) 941 + static void rfbi_uninit_output(struct platform_device *pdev) 942 942 { 943 943 struct omap_dss_device *out = &rfbi.output; 944 944 ··· 1005 1005 return r; 1006 1006 } 1007 1007 1008 - static int __exit omap_rfbihw_remove(struct platform_device *pdev) 1008 + static int omap_rfbihw_remove(struct platform_device *pdev) 1009 1009 { 1010 1010 rfbi_uninit_output(pdev); 1011 1011 ··· 1039 1039 1040 1040 static struct platform_driver omap_rfbihw_driver = { 1041 1041 .probe = omap_rfbihw_probe, 1042 - .remove = __exit_p(omap_rfbihw_remove), 1042 + .remove = omap_rfbihw_remove, 1043 1043 .driver = { 1044 1044 .name = "omapdss_rfbi", 1045 1045 .pm = &rfbi_pm_ops, ··· 1052 1052 return platform_driver_register(&omap_rfbihw_driver); 1053 1053 } 1054 1054 1055 - void __exit rfbi_uninit_platform_driver(void) 1055 + void rfbi_uninit_platform_driver(void) 1056 1056 { 1057 1057 platform_driver_unregister(&omap_rfbihw_driver); 1058 1058 }
+6 -6
drivers/video/fbdev/omap2/dss/sdi.c
··· 350 350 omapdss_register_output(out); 351 351 } 352 352 353 - static void __exit sdi_uninit_output(struct platform_device *pdev) 353 + static void sdi_uninit_output(struct platform_device *pdev) 354 354 { 355 355 struct omap_dss_device *out = &sdi.output; 356 356 ··· 366 366 return 0; 367 367 } 368 368 369 - static int __exit omap_sdi_remove(struct platform_device *pdev) 369 + static int omap_sdi_remove(struct platform_device *pdev) 370 370 { 371 371 sdi_uninit_output(pdev); 372 372 ··· 375 375 376 376 static struct platform_driver omap_sdi_driver = { 377 377 .probe = omap_sdi_probe, 378 - .remove = __exit_p(omap_sdi_remove), 378 + .remove = omap_sdi_remove, 379 379 .driver = { 380 380 .name = "omapdss_sdi", 381 381 .suppress_bind_attrs = true, ··· 387 387 return platform_driver_register(&omap_sdi_driver); 388 388 } 389 389 390 - void __exit sdi_uninit_platform_driver(void) 390 + void sdi_uninit_platform_driver(void) 391 391 { 392 392 platform_driver_unregister(&omap_sdi_driver); 393 393 } 394 394 395 - int __init sdi_init_port(struct platform_device *pdev, struct device_node *port) 395 + int sdi_init_port(struct platform_device *pdev, struct device_node *port) 396 396 { 397 397 struct device_node *ep; 398 398 u32 datapairs; ··· 426 426 return r; 427 427 } 428 428 429 - void __exit sdi_uninit_port(struct device_node *port) 429 + void sdi_uninit_port(struct device_node *port) 430 430 { 431 431 if (!sdi.port_initialized) 432 432 return;
+4 -4
drivers/video/fbdev/omap2/dss/venc.c
··· 802 802 omapdss_register_output(out); 803 803 } 804 804 805 - static void __exit venc_uninit_output(struct platform_device *pdev) 805 + static void venc_uninit_output(struct platform_device *pdev) 806 806 { 807 807 struct omap_dss_device *out = &venc.output; 808 808 ··· 912 912 return r; 913 913 } 914 914 915 - static int __exit omap_venchw_remove(struct platform_device *pdev) 915 + static int omap_venchw_remove(struct platform_device *pdev) 916 916 { 917 917 venc_uninit_output(pdev); 918 918 ··· 960 960 961 961 static struct platform_driver omap_venchw_driver = { 962 962 .probe = omap_venchw_probe, 963 - .remove = __exit_p(omap_venchw_remove), 963 + .remove = omap_venchw_remove, 964 964 .driver = { 965 965 .name = "omapdss_venc", 966 966 .pm = &venc_pm_ops, ··· 974 974 return platform_driver_register(&omap_venchw_driver); 975 975 } 976 976 977 - void __exit venc_uninit_platform_driver(void) 977 + void venc_uninit_platform_driver(void) 978 978 { 979 979 platform_driver_unregister(&omap_venchw_driver); 980 980 }