From 1098aa7e1a7ed77a2611090c9ed4d8fd92e6fdac Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Feb 2009 23:04:42 +0000 Subject: [PATCH] --- yaml --- r: 142038 b: refs/heads/master c: b2bdc3e7130001804f27e7c1254930143119f435 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/leds/leds-gpio.c | 46 ++++++++++++++++++++-------------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/[refs] b/[refs] index 2e8ecb2b6769..cd6e5a4f5375 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ac2dd0f110d5ab0359de7786e88e9971954ac7ee +refs/heads/master: b2bdc3e7130001804f27e7c1254930143119f435 diff --git a/trunk/drivers/leds/leds-gpio.c b/trunk/drivers/leds/leds-gpio.c index f8bcf98fc15c..0daa2d21cbde 100644 --- a/trunk/drivers/leds/leds-gpio.c +++ b/trunk/drivers/leds/leds-gpio.c @@ -178,19 +178,6 @@ static struct platform_driver gpio_led_driver = { }, }; -static int __init gpio_led_init(void) -{ - return platform_driver_register(&gpio_led_driver); -} - -static void __exit gpio_led_exit(void) -{ - platform_driver_unregister(&gpio_led_driver); -} - -module_init(gpio_led_init); -module_exit(gpio_led_exit); - MODULE_ALIAS("platform:leds-gpio"); #endif /* CONFIG_LEDS_GPIO_PLATFORM */ @@ -283,19 +270,40 @@ static struct of_platform_driver of_gpio_leds_driver = { .probe = of_gpio_leds_probe, .remove = __devexit_p(of_gpio_leds_remove), }; +#endif -static int __init of_gpio_leds_init(void) +static int __init gpio_led_init(void) { - return of_register_platform_driver(&of_gpio_leds_driver); + int ret; + +#ifdef CONFIG_LEDS_GPIO_PLATFORM + ret = platform_driver_register(&gpio_led_driver); + if (ret) + return ret; +#endif +#ifdef CONFIG_LEDS_GPIO_OF + ret = of_register_platform_driver(&of_gpio_leds_driver); +#endif +#ifdef CONFIG_LEDS_GPIO_PLATFORM + if (ret) + platform_driver_unregister(&gpio_led_driver); +#endif + + return ret; } -module_init(of_gpio_leds_init); -static void __exit of_gpio_leds_exit(void) +static void __exit gpio_led_exit(void) { +#ifdef CONFIG_LEDS_GPIO_PLATFORM + platform_driver_unregister(&gpio_led_driver); +#endif +#ifdef CONFIG_LEDS_GPIO_OF of_unregister_platform_driver(&of_gpio_leds_driver); -} -module_exit(of_gpio_leds_exit); #endif +} + +module_init(gpio_led_init); +module_exit(gpio_led_exit); MODULE_AUTHOR("Raphael Assenat , Trent Piepho "); MODULE_DESCRIPTION("GPIO LED driver");