diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-02-02 18:04:42 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-04-06 11:06:26 -0400 |
commit | b2bdc3e7130001804f27e7c1254930143119f435 (patch) | |
tree | 389a878d3e427bdb424685e87d1eb9f04416b5e2 /drivers/leds | |
parent | ac2dd0f110d5ab0359de7786e88e9971954ac7ee (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')
-rw-r--r-- | drivers/leds/leds-gpio.c | 46 |
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 | ||
181 | static int __init gpio_led_init(void) | ||
182 | { | ||
183 | return platform_driver_register(&gpio_led_driver); | ||
184 | } | ||
185 | |||
186 | static void __exit gpio_led_exit(void) | ||
187 | { | ||
188 | platform_driver_unregister(&gpio_led_driver); | ||
189 | } | ||
190 | |||
191 | module_init(gpio_led_init); | ||
192 | module_exit(gpio_led_exit); | ||
193 | |||
194 | MODULE_ALIAS("platform:leds-gpio"); | 181 | MODULE_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 | ||
287 | static int __init of_gpio_leds_init(void) | 275 | static 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 | } |
291 | module_init(of_gpio_leds_init); | ||
292 | 294 | ||
293 | static void __exit of_gpio_leds_exit(void) | 295 | static 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 | } | ||
297 | module_exit(of_gpio_leds_exit); | ||
298 | #endif | 302 | #endif |
303 | } | ||
304 | |||
305 | module_init(gpio_led_init); | ||
306 | module_exit(gpio_led_exit); | ||
299 | 307 | ||
300 | MODULE_AUTHOR("Raphael Assenat <raph@8d.com>, Trent Piepho <tpiepho@freescale.com>"); | 308 | MODULE_AUTHOR("Raphael Assenat <raph@8d.com>, Trent Piepho <tpiepho@freescale.com>"); |
301 | MODULE_DESCRIPTION("GPIO LED driver"); | 309 | MODULE_DESCRIPTION("GPIO LED driver"); |