diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-08 12:55:03 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-08 12:55:03 -0500 |
commit | 859cb7f2a4244ea6da206d3fe9cc8a6810947a68 (patch) | |
tree | 3389fe6c191418d6acc30d84e11a0760608f7431 /drivers/leds/leds-gpio.c | |
parent | 0081e8020ebd814a99e45720a10e869a54ee08a6 (diff) |
leds: Add suspend/resume to the core class
Add suspend/resume to the core class and remove all the now unneeded
code from various drivers. Originally the class code couldn't support
suspend/resume but since class_device can there is no reason for
each driver doing its own suspend/resume anymore.
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r-- | drivers/leds/leds-gpio.c | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index b13bd2950e95..2e3df08b649b 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
@@ -105,6 +105,7 @@ static int gpio_led_probe(struct platform_device *pdev) | |||
105 | } | 105 | } |
106 | led_dat->cdev.brightness_set = gpio_led_set; | 106 | led_dat->cdev.brightness_set = gpio_led_set; |
107 | led_dat->cdev.brightness = LED_OFF; | 107 | led_dat->cdev.brightness = LED_OFF; |
108 | led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; | ||
108 | 109 | ||
109 | gpio_direction_output(led_dat->gpio, led_dat->active_low); | 110 | gpio_direction_output(led_dat->gpio, led_dat->active_low); |
110 | 111 | ||
@@ -154,44 +155,9 @@ static int __devexit gpio_led_remove(struct platform_device *pdev) | |||
154 | return 0; | 155 | return 0; |
155 | } | 156 | } |
156 | 157 | ||
157 | #ifdef CONFIG_PM | ||
158 | static int gpio_led_suspend(struct platform_device *pdev, pm_message_t state) | ||
159 | { | ||
160 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; | ||
161 | struct gpio_led_data *leds_data; | ||
162 | int i; | ||
163 | |||
164 | leds_data = platform_get_drvdata(pdev); | ||
165 | |||
166 | for (i = 0; i < pdata->num_leds; i++) | ||
167 | led_classdev_suspend(&leds_data[i].cdev); | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | static int gpio_led_resume(struct platform_device *pdev) | ||
173 | { | ||
174 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; | ||
175 | struct gpio_led_data *leds_data; | ||
176 | int i; | ||
177 | |||
178 | leds_data = platform_get_drvdata(pdev); | ||
179 | |||
180 | for (i = 0; i < pdata->num_leds; i++) | ||
181 | led_classdev_resume(&leds_data[i].cdev); | ||
182 | |||
183 | return 0; | ||
184 | } | ||
185 | #else | ||
186 | #define gpio_led_suspend NULL | ||
187 | #define gpio_led_resume NULL | ||
188 | #endif | ||
189 | |||
190 | static struct platform_driver gpio_led_driver = { | 158 | static struct platform_driver gpio_led_driver = { |
191 | .probe = gpio_led_probe, | 159 | .probe = gpio_led_probe, |
192 | .remove = __devexit_p(gpio_led_remove), | 160 | .remove = __devexit_p(gpio_led_remove), |
193 | .suspend = gpio_led_suspend, | ||
194 | .resume = gpio_led_resume, | ||
195 | .driver = { | 161 | .driver = { |
196 | .name = "leds-gpio", | 162 | .name = "leds-gpio", |
197 | .owner = THIS_MODULE, | 163 | .owner = THIS_MODULE, |