diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2014-02-15 00:56:24 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-02-28 05:35:28 -0500 |
commit | de5013627fba6a9135a9aee1418ee927bbfdd8c8 (patch) | |
tree | 3fce212d8594b73a1c5e2b8ccf8b779a1b804de8 | |
parent | b7d2d37276c1dce86d9a55239f0686e1bd81a37f (diff) |
video: imxfb: Use module_platform_driver()
We have no reason to call fb_get_options() when registering module,
so move this call in the probe() and convert the driver to use
module_platform_driver() macro.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/imxfb.c | 65 |
1 files changed, 26 insertions, 39 deletions
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 5b07053bbd01..3137a69fdfd0 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -874,6 +874,26 @@ static struct lcd_ops imxfb_lcd_ops = { | |||
874 | .set_power = imxfb_lcd_set_power, | 874 | .set_power = imxfb_lcd_set_power, |
875 | }; | 875 | }; |
876 | 876 | ||
877 | static int imxfb_setup(void) | ||
878 | { | ||
879 | char *opt, *options = NULL; | ||
880 | |||
881 | if (fb_get_options("imxfb", &options)) | ||
882 | return -ENODEV; | ||
883 | |||
884 | if (!options || !*options) | ||
885 | return 0; | ||
886 | |||
887 | while ((opt = strsep(&options, ",")) != NULL) { | ||
888 | if (!*opt) | ||
889 | continue; | ||
890 | else | ||
891 | fb_mode = opt; | ||
892 | } | ||
893 | |||
894 | return 0; | ||
895 | } | ||
896 | |||
877 | static int imxfb_probe(struct platform_device *pdev) | 897 | static int imxfb_probe(struct platform_device *pdev) |
878 | { | 898 | { |
879 | struct imxfb_info *fbi; | 899 | struct imxfb_info *fbi; |
@@ -888,6 +908,10 @@ static int imxfb_probe(struct platform_device *pdev) | |||
888 | 908 | ||
889 | dev_info(&pdev->dev, "i.MX Framebuffer driver\n"); | 909 | dev_info(&pdev->dev, "i.MX Framebuffer driver\n"); |
890 | 910 | ||
911 | ret = imxfb_setup(); | ||
912 | if (ret < 0) | ||
913 | return ret; | ||
914 | |||
891 | of_id = of_match_device(imxfb_of_dev_id, &pdev->dev); | 915 | of_id = of_match_device(imxfb_of_dev_id, &pdev->dev); |
892 | if (of_id) | 916 | if (of_id) |
893 | pdev->id_entry = of_id->data; | 917 | pdev->id_entry = of_id->data; |
@@ -1113,6 +1137,7 @@ static void imxfb_shutdown(struct platform_device *dev) | |||
1113 | static struct platform_driver imxfb_driver = { | 1137 | static struct platform_driver imxfb_driver = { |
1114 | .suspend = imxfb_suspend, | 1138 | .suspend = imxfb_suspend, |
1115 | .resume = imxfb_resume, | 1139 | .resume = imxfb_resume, |
1140 | .probe = imxfb_probe, | ||
1116 | .remove = imxfb_remove, | 1141 | .remove = imxfb_remove, |
1117 | .shutdown = imxfb_shutdown, | 1142 | .shutdown = imxfb_shutdown, |
1118 | .driver = { | 1143 | .driver = { |
@@ -1121,45 +1146,7 @@ static struct platform_driver imxfb_driver = { | |||
1121 | }, | 1146 | }, |
1122 | .id_table = imxfb_devtype, | 1147 | .id_table = imxfb_devtype, |
1123 | }; | 1148 | }; |
1124 | 1149 | module_platform_driver(imxfb_driver); | |
1125 | static int imxfb_setup(void) | ||
1126 | { | ||
1127 | #ifndef MODULE | ||
1128 | char *opt, *options = NULL; | ||
1129 | |||
1130 | if (fb_get_options("imxfb", &options)) | ||
1131 | return -ENODEV; | ||
1132 | |||
1133 | if (!options || !*options) | ||
1134 | return 0; | ||
1135 | |||
1136 | while ((opt = strsep(&options, ",")) != NULL) { | ||
1137 | if (!*opt) | ||
1138 | continue; | ||
1139 | else | ||
1140 | fb_mode = opt; | ||
1141 | } | ||
1142 | #endif | ||
1143 | return 0; | ||
1144 | } | ||
1145 | |||
1146 | static int __init imxfb_init(void) | ||
1147 | { | ||
1148 | int ret = imxfb_setup(); | ||
1149 | |||
1150 | if (ret < 0) | ||
1151 | return ret; | ||
1152 | |||
1153 | return platform_driver_probe(&imxfb_driver, imxfb_probe); | ||
1154 | } | ||
1155 | |||
1156 | static void __exit imxfb_cleanup(void) | ||
1157 | { | ||
1158 | platform_driver_unregister(&imxfb_driver); | ||
1159 | } | ||
1160 | |||
1161 | module_init(imxfb_init); | ||
1162 | module_exit(imxfb_cleanup); | ||
1163 | 1150 | ||
1164 | MODULE_DESCRIPTION("Freescale i.MX framebuffer driver"); | 1151 | MODULE_DESCRIPTION("Freescale i.MX framebuffer driver"); |
1165 | MODULE_AUTHOR("Sascha Hauer, Pengutronix"); | 1152 | MODULE_AUTHOR("Sascha Hauer, Pengutronix"); |