led-class: change back LEDS_CLASS to tristate instead of bool
authorBryan Wu <bryan.wu@canonical.com>
Fri, 23 Mar 2012 22:02:14 +0000 (15:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Mar 2012 23:58:35 +0000 (16:58 -0700)
After moving some core functions to led-core.c, led-class.c can be built
as module again.

Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Acked-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/leds/Kconfig
drivers/leds/led-class.c
drivers/leds/led-core.c

index e2ac190df528d72f903d07f6da5902e3abaaed89..589ba02d65a243ade195f0fe8cb1d3032fbf7e6b 100644 (file)
@@ -17,7 +17,7 @@ menuconfig NEW_LEDS
 if NEW_LEDS
 
 config LEDS_CLASS
-       bool "LED Class Support"
+       tristate "LED Class Support"
        help
          This option enables the led sysfs class in /sys/class/leds.  You'll
          need this to do anything useful with LEDs.  If unsure, say N.
index 0c8739c448b1ebfe20edfa0868696b3b8e9d50e5..5bff8439dc68a7e8c6424f0cbed3746cd9820efb 100644 (file)
@@ -110,50 +110,6 @@ static void led_timer_function(unsigned long data)
        mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay));
 }
 
-static void led_stop_software_blink(struct led_classdev *led_cdev)
-{
-       /* deactivate previous settings */
-       del_timer_sync(&led_cdev->blink_timer);
-       led_cdev->blink_delay_on = 0;
-       led_cdev->blink_delay_off = 0;
-}
-
-static void led_set_software_blink(struct led_classdev *led_cdev,
-                                  unsigned long delay_on,
-                                  unsigned long delay_off)
-{
-       int current_brightness;
-
-       current_brightness = led_get_brightness(led_cdev);
-       if (current_brightness)
-               led_cdev->blink_brightness = current_brightness;
-       if (!led_cdev->blink_brightness)
-               led_cdev->blink_brightness = led_cdev->max_brightness;
-
-       if (led_get_trigger_data(led_cdev) &&
-           delay_on == led_cdev->blink_delay_on &&
-           delay_off == led_cdev->blink_delay_off)
-               return;
-
-       led_stop_software_blink(led_cdev);
-
-       led_cdev->blink_delay_on = delay_on;
-       led_cdev->blink_delay_off = delay_off;
-
-       /* never on - don't blink */
-       if (!delay_on)
-               return;
-
-       /* never off - just set to brightness */
-       if (!delay_off) {
-               led_set_brightness(led_cdev, led_cdev->blink_brightness);
-               return;
-       }
-
-       mod_timer(&led_cdev->blink_timer, jiffies + 1);
-}
-
-
 /**
  * led_classdev_suspend - suspend an led_classdev.
  * @led_cdev: the led_classdev to suspend.
@@ -262,32 +218,6 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
 }
 EXPORT_SYMBOL_GPL(led_classdev_unregister);
 
-void led_blink_set(struct led_classdev *led_cdev,
-                  unsigned long *delay_on,
-                  unsigned long *delay_off)
-{
-       del_timer_sync(&led_cdev->blink_timer);
-
-       if (led_cdev->blink_set &&
-           !led_cdev->blink_set(led_cdev, delay_on, delay_off))
-               return;
-
-       /* blink with 1 Hz as default if nothing specified */
-       if (!*delay_on && !*delay_off)
-               *delay_on = *delay_off = 500;
-
-       led_set_software_blink(led_cdev, *delay_on, *delay_off);
-}
-EXPORT_SYMBOL(led_blink_set);
-
-void led_brightness_set(struct led_classdev *led_cdev,
-                       enum led_brightness brightness)
-{
-       led_stop_software_blink(led_cdev);
-       led_cdev->brightness_set(led_cdev, brightness);
-}
-EXPORT_SYMBOL(led_brightness_set);
-
 static int __init leds_init(void)
 {
        leds_class = class_create(THIS_MODULE, "leds");
index 016d19f5486f2bd7cf9ea93df863f7d5c8a8cd1a..d6860043f6f99f1fc0e4f819681d8fed9089c542 100644 (file)
@@ -23,3 +23,73 @@ EXPORT_SYMBOL_GPL(leds_list_lock);
 
 LIST_HEAD(leds_list);
 EXPORT_SYMBOL_GPL(leds_list);
+
+static void led_stop_software_blink(struct led_classdev *led_cdev)
+{
+       /* deactivate previous settings */
+       del_timer_sync(&led_cdev->blink_timer);
+       led_cdev->blink_delay_on = 0;
+       led_cdev->blink_delay_off = 0;
+}
+
+static void led_set_software_blink(struct led_classdev *led_cdev,
+                                  unsigned long delay_on,
+                                  unsigned long delay_off)
+{
+       int current_brightness;
+
+       current_brightness = led_get_brightness(led_cdev);
+       if (current_brightness)
+               led_cdev->blink_brightness = current_brightness;
+       if (!led_cdev->blink_brightness)
+               led_cdev->blink_brightness = led_cdev->max_brightness;
+
+       if (led_get_trigger_data(led_cdev) &&
+           delay_on == led_cdev->blink_delay_on &&
+           delay_off == led_cdev->blink_delay_off)
+               return;
+
+       led_stop_software_blink(led_cdev);
+
+       led_cdev->blink_delay_on = delay_on;
+       led_cdev->blink_delay_off = delay_off;
+
+       /* never on - don't blink */
+       if (!delay_on)
+               return;
+
+       /* never off - just set to brightness */
+       if (!delay_off) {
+               led_set_brightness(led_cdev, led_cdev->blink_brightness);
+               return;
+       }
+
+       mod_timer(&led_cdev->blink_timer, jiffies + 1);
+}
+
+
+void led_blink_set(struct led_classdev *led_cdev,
+                  unsigned long *delay_on,
+                  unsigned long *delay_off)
+{
+       del_timer_sync(&led_cdev->blink_timer);
+
+       if (led_cdev->blink_set &&
+           !led_cdev->blink_set(led_cdev, delay_on, delay_off))
+               return;
+
+       /* blink with 1 Hz as default if nothing specified */
+       if (!*delay_on && !*delay_off)
+               *delay_on = *delay_off = 500;
+
+       led_set_software_blink(led_cdev, *delay_on, *delay_off);
+}
+EXPORT_SYMBOL(led_blink_set);
+
+void led_brightness_set(struct led_classdev *led_cdev,
+                       enum led_brightness brightness)
+{
+       led_stop_software_blink(led_cdev);
+       led_cdev->brightness_set(led_cdev, brightness);
+}
+EXPORT_SYMBOL(led_brightness_set);