aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-gpio.c
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2009-02-02 18:04:42 -0500
committerRichard Purdie <rpurdie@linux.intel.com>2009-04-06 11:06:26 -0400
commitb2bdc3e7130001804f27e7c1254930143119f435 (patch)
tree389a878d3e427bdb424685e87d1eb9f04416b5e2 /drivers/leds/leds-gpio.c
parentac2dd0f110d5ab0359de7786e88e9971954ac7ee (diff)
leds: Fix leds-gpio driver multiple module_init/exit usage
You can't have multiple module_init()/module_exit calls so resort to messy ifdefs potentially pending some code refactoring. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r--drivers/leds/leds-gpio.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index f8bcf98fc15c..0daa2d21cbde 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -178,19 +178,6 @@ static struct platform_driver gpio_led_driver = {
178 }, 178 },
179}; 179};
180 180
181static int __init gpio_led_init(void)
182{
183 return platform_driver_register(&gpio_led_driver);
184}
185
186static void __exit gpio_led_exit(void)
187{
188 platform_driver_unregister(&gpio_led_driver);
189}
190
191module_init(gpio_led_init);
192module_exit(gpio_led_exit);
193
194MODULE_ALIAS("platform:leds-gpio"); 181MODULE_ALIAS("platform:leds-gpio");
195#endif /* CONFIG_LEDS_GPIO_PLATFORM */ 182#endif /* CONFIG_LEDS_GPIO_PLATFORM */
196 183
@@ -283,19 +270,40 @@ static struct of_platform_driver of_gpio_leds_driver = {
283 .probe = of_gpio_leds_probe, 270 .probe = of_gpio_leds_probe,
284 .remove = __devexit_p(of_gpio_leds_remove), 271 .remove = __devexit_p(of_gpio_leds_remove),
285}; 272};
273#endif
286 274
287static int __init of_gpio_leds_init(void) 275static int __init gpio_led_init(void)
288{ 276{
289 return of_register_platform_driver(&of_gpio_leds_driver); 277 int ret;
278
279#ifdef CONFIG_LEDS_GPIO_PLATFORM
280 ret = platform_driver_register(&gpio_led_driver);
281 if (ret)
282 return ret;
283#endif
284#ifdef CONFIG_LEDS_GPIO_OF
285 ret = of_register_platform_driver(&of_gpio_leds_driver);
286#endif
287#ifdef CONFIG_LEDS_GPIO_PLATFORM
288 if (ret)
289 platform_driver_unregister(&gpio_led_driver);
290#endif
291
292 return ret;
290} 293}
291module_init(of_gpio_leds_init);
292 294
293static void __exit of_gpio_leds_exit(void) 295static void __exit gpio_led_exit(void)
294{ 296{
297#ifdef CONFIG_LEDS_GPIO_PLATFORM
298 platform_driver_unregister(&gpio_led_driver);
299#endif
300#ifdef CONFIG_LEDS_GPIO_OF
295 of_unregister_platform_driver(&of_gpio_leds_driver); 301 of_unregister_platform_driver(&of_gpio_leds_driver);
296}
297module_exit(of_gpio_leds_exit);
298#endif 302#endif
303}
304
305module_init(gpio_led_init);
306module_exit(gpio_led_exit);
299 307
300MODULE_AUTHOR("Raphael Assenat <raph@8d.com>, Trent Piepho <tpiepho@freescale.com>"); 308MODULE_AUTHOR("Raphael Assenat <raph@8d.com>, Trent Piepho <tpiepho@freescale.com>");
301MODULE_DESCRIPTION("GPIO LED driver"); 309MODULE_DESCRIPTION("GPIO LED driver");