aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/led-class.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/leds/led-class.c')
-rw-r--r--drivers/leds/led-class.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index aa29198fca3e..7440c58b8e6f 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -9,26 +9,21 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/module.h> 12#include <linux/ctype.h>
13#include <linux/kernel.h> 13#include <linux/device.h>
14#include <linux/err.h>
14#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/leds.h>
15#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/module.h>
20#include <linux/slab.h>
16#include <linux/spinlock.h> 21#include <linux/spinlock.h>
17#include <linux/device.h>
18#include <linux/timer.h> 22#include <linux/timer.h>
19#include <linux/err.h>
20#include <linux/ctype.h>
21#include <linux/leds.h>
22#include "leds.h" 23#include "leds.h"
23 24
24static struct class *leds_class; 25static struct class *leds_class;
25 26
26static void led_update_brightness(struct led_classdev *led_cdev)
27{
28 if (led_cdev->brightness_get)
29 led_cdev->brightness = led_cdev->brightness_get(led_cdev);
30}
31
32static ssize_t brightness_show(struct device *dev, 27static ssize_t brightness_show(struct device *dev,
33 struct device_attribute *attr, char *buf) 28 struct device_attribute *attr, char *buf)
34{ 29{
@@ -59,14 +54,14 @@ static ssize_t brightness_store(struct device *dev,
59} 54}
60static DEVICE_ATTR_RW(brightness); 55static DEVICE_ATTR_RW(brightness);
61 56
62static ssize_t led_max_brightness_show(struct device *dev, 57static ssize_t max_brightness_show(struct device *dev,
63 struct device_attribute *attr, char *buf) 58 struct device_attribute *attr, char *buf)
64{ 59{
65 struct led_classdev *led_cdev = dev_get_drvdata(dev); 60 struct led_classdev *led_cdev = dev_get_drvdata(dev);
66 61
67 return sprintf(buf, "%u\n", led_cdev->max_brightness); 62 return sprintf(buf, "%u\n", led_cdev->max_brightness);
68} 63}
69static DEVICE_ATTR(max_brightness, 0444, led_max_brightness_show, NULL); 64static DEVICE_ATTR_RO(max_brightness);
70 65
71#ifdef CONFIG_LEDS_TRIGGERS 66#ifdef CONFIG_LEDS_TRIGGERS
72static DEVICE_ATTR(trigger, 0644, led_trigger_show, led_trigger_store); 67static DEVICE_ATTR(trigger, 0644, led_trigger_show, led_trigger_store);