aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/ledtrig-timer.c
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-07-08 18:19:31 -0400
committerRichard Purdie <rpurdie@rpsys.net>2007-07-15 20:15:51 -0400
commitf8a7c6fe14f556ca8eeddce258cb21392d0c3a2f (patch)
tree517e178330a46186e6bbd09ba60e453ce32ca485 /drivers/leds/ledtrig-timer.c
parentf9f451d9cac24b9bd49947d1c6971f3d689381fa (diff)
leds: Convert from struct class_device to struct device
Convert the LEDs class from struct class_device to struct device since class_device is scheduled for removal. Signed-off-by: Richard Purdie <rpurdie@rpsys.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/leds/ledtrig-timer.c')
-rw-r--r--drivers/leds/ledtrig-timer.c49
1 files changed, 23 insertions, 26 deletions
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c
index d756bdb01c59..ed9ff02c77ea 100644
--- a/drivers/leds/ledtrig-timer.c
+++ b/drivers/leds/ledtrig-timer.c
@@ -52,9 +52,10 @@ static void led_timer_function(unsigned long data)
52 mod_timer(&timer_data->timer, jiffies + msecs_to_jiffies(delay)); 52 mod_timer(&timer_data->timer, jiffies + msecs_to_jiffies(delay));
53} 53}
54 54
55static ssize_t led_delay_on_show(struct class_device *dev, char *buf) 55static ssize_t led_delay_on_show(struct device *dev,
56 struct device_attribute *attr, char *buf)
56{ 57{
57 struct led_classdev *led_cdev = class_get_devdata(dev); 58 struct led_classdev *led_cdev = dev_get_drvdata(dev);
58 struct timer_trig_data *timer_data = led_cdev->trigger_data; 59 struct timer_trig_data *timer_data = led_cdev->trigger_data;
59 60
60 sprintf(buf, "%lu\n", timer_data->delay_on); 61 sprintf(buf, "%lu\n", timer_data->delay_on);
@@ -62,10 +63,10 @@ static ssize_t led_delay_on_show(struct class_device *dev, char *buf)
62 return strlen(buf) + 1; 63 return strlen(buf) + 1;
63} 64}
64 65
65static ssize_t led_delay_on_store(struct class_device *dev, const char *buf, 66static ssize_t led_delay_on_store(struct device *dev,
66 size_t size) 67 struct device_attribute *attr, const char *buf, size_t size)
67{ 68{
68 struct led_classdev *led_cdev = class_get_devdata(dev); 69 struct led_classdev *led_cdev = dev_get_drvdata(dev);
69 struct timer_trig_data *timer_data = led_cdev->trigger_data; 70 struct timer_trig_data *timer_data = led_cdev->trigger_data;
70 int ret = -EINVAL; 71 int ret = -EINVAL;
71 char *after; 72 char *after;
@@ -84,9 +85,10 @@ static ssize_t led_delay_on_store(struct class_device *dev, const char *buf,
84 return ret; 85 return ret;
85} 86}
86 87
87static ssize_t led_delay_off_show(struct class_device *dev, char *buf) 88static ssize_t led_delay_off_show(struct device *dev,
89 struct device_attribute *attr, char *buf)
88{ 90{
89 struct led_classdev *led_cdev = class_get_devdata(dev); 91 struct led_classdev *led_cdev = dev_get_drvdata(dev);
90 struct timer_trig_data *timer_data = led_cdev->trigger_data; 92 struct timer_trig_data *timer_data = led_cdev->trigger_data;
91 93
92 sprintf(buf, "%lu\n", timer_data->delay_off); 94 sprintf(buf, "%lu\n", timer_data->delay_off);
@@ -94,10 +96,10 @@ static ssize_t led_delay_off_show(struct class_device *dev, char *buf)
94 return strlen(buf) + 1; 96 return strlen(buf) + 1;
95} 97}
96 98
97static ssize_t led_delay_off_store(struct class_device *dev, const char *buf, 99static ssize_t led_delay_off_store(struct device *dev,
98 size_t size) 100 struct device_attribute *attr, const char *buf, size_t size)
99{ 101{
100 struct led_classdev *led_cdev = class_get_devdata(dev); 102 struct led_classdev *led_cdev = dev_get_drvdata(dev);
101 struct timer_trig_data *timer_data = led_cdev->trigger_data; 103 struct timer_trig_data *timer_data = led_cdev->trigger_data;
102 int ret = -EINVAL; 104 int ret = -EINVAL;
103 char *after; 105 char *after;
@@ -116,10 +118,8 @@ static ssize_t led_delay_off_store(struct class_device *dev, const char *buf,
116 return ret; 118 return ret;
117} 119}
118 120
119static CLASS_DEVICE_ATTR(delay_on, 0644, led_delay_on_show, 121static DEVICE_ATTR(delay_on, 0644, led_delay_on_show, led_delay_on_store);
120 led_delay_on_store); 122static DEVICE_ATTR(delay_off, 0644, led_delay_off_show, led_delay_off_store);
121static CLASS_DEVICE_ATTR(delay_off, 0644, led_delay_off_show,
122 led_delay_off_store);
123 123
124static void timer_trig_activate(struct led_classdev *led_cdev) 124static void timer_trig_activate(struct led_classdev *led_cdev)
125{ 125{
@@ -136,18 +136,17 @@ static void timer_trig_activate(struct led_classdev *led_cdev)
136 timer_data->timer.function = led_timer_function; 136 timer_data->timer.function = led_timer_function;
137 timer_data->timer.data = (unsigned long) led_cdev; 137 timer_data->timer.data = (unsigned long) led_cdev;
138 138
139 rc = class_device_create_file(led_cdev->class_dev, 139 rc = device_create_file(led_cdev->dev, &dev_attr_delay_on);
140 &class_device_attr_delay_on); 140 if (rc)
141 if (rc) goto err_out; 141 goto err_out;
142 rc = class_device_create_file(led_cdev->class_dev, 142 rc = device_create_file(led_cdev->dev, &dev_attr_delay_off);
143 &class_device_attr_delay_off); 143 if (rc)
144 if (rc) goto err_out_delayon; 144 goto err_out_delayon;
145 145
146 return; 146 return;
147 147
148err_out_delayon: 148err_out_delayon:
149 class_device_remove_file(led_cdev->class_dev, 149 device_remove_file(led_cdev->dev, &dev_attr_delay_on);
150 &class_device_attr_delay_on);
151err_out: 150err_out:
152 led_cdev->trigger_data = NULL; 151 led_cdev->trigger_data = NULL;
153 kfree(timer_data); 152 kfree(timer_data);
@@ -158,10 +157,8 @@ static void timer_trig_deactivate(struct led_classdev *led_cdev)
158 struct timer_trig_data *timer_data = led_cdev->trigger_data; 157 struct timer_trig_data *timer_data = led_cdev->trigger_data;
159 158
160 if (timer_data) { 159 if (timer_data) {
161 class_device_remove_file(led_cdev->class_dev, 160 device_remove_file(led_cdev->dev, &dev_attr_delay_on);
162 &class_device_attr_delay_on); 161 device_remove_file(led_cdev->dev, &dev_attr_delay_off);
163 class_device_remove_file(led_cdev->class_dev,
164 &class_device_attr_delay_off);
165 del_timer_sync(&timer_data->timer); 162 del_timer_sync(&timer_data->timer);
166 kfree(timer_data); 163 kfree(timer_data);
167 } 164 }