diff options
-rw-r--r-- | drivers/leds/led-class.c | 22 | ||||
-rw-r--r-- | drivers/leds/leds-alix2.c | 30 | ||||
-rw-r--r-- | drivers/leds/leds-ams-delta.c | 29 | ||||
-rw-r--r-- | drivers/leds/leds-clevo-mail.c | 21 | ||||
-rw-r--r-- | drivers/leds/leds-fsg.c | 37 | ||||
-rw-r--r-- | drivers/leds/leds-gpio.c | 36 | ||||
-rw-r--r-- | drivers/leds/leds-hp-disk.c | 20 | ||||
-rw-r--r-- | drivers/leds/leds-hp6xx.c | 22 | ||||
-rw-r--r-- | drivers/leds/leds-net48xx.c | 21 | ||||
-rw-r--r-- | drivers/leds/leds-s3c24xx.c | 25 | ||||
-rw-r--r-- | drivers/leds/leds-wm8350.c | 24 | ||||
-rw-r--r-- | drivers/leds/leds-wrap.c | 27 | ||||
-rw-r--r-- | include/linux/leds.h | 3 |
13 files changed, 44 insertions, 273 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 1553d93b8c65..52f82e3ea13a 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -91,6 +91,26 @@ void led_classdev_resume(struct led_classdev *led_cdev) | |||
91 | } | 91 | } |
92 | EXPORT_SYMBOL_GPL(led_classdev_resume); | 92 | EXPORT_SYMBOL_GPL(led_classdev_resume); |
93 | 93 | ||
94 | static int led_suspend(struct device *dev, pm_message_t state) | ||
95 | { | ||
96 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
97 | |||
98 | if (led_cdev->flags & LED_CORE_SUSPENDRESUME) | ||
99 | led_classdev_suspend(led_cdev); | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static int led_resume(struct device *dev) | ||
105 | { | ||
106 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
107 | |||
108 | if (led_cdev->flags & LED_CORE_SUSPENDRESUME) | ||
109 | led_classdev_resume(led_cdev); | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
94 | /** | 114 | /** |
95 | * led_classdev_register - register a new object of led_classdev class. | 115 | * led_classdev_register - register a new object of led_classdev class. |
96 | * @parent: The device to register. | 116 | * @parent: The device to register. |
@@ -174,6 +194,8 @@ static int __init leds_init(void) | |||
174 | leds_class = class_create(THIS_MODULE, "leds"); | 194 | leds_class = class_create(THIS_MODULE, "leds"); |
175 | if (IS_ERR(leds_class)) | 195 | if (IS_ERR(leds_class)) |
176 | return PTR_ERR(leds_class); | 196 | return PTR_ERR(leds_class); |
197 | leds_class->suspend = led_suspend; | ||
198 | leds_class->resume = led_resume; | ||
177 | return 0; | 199 | return 0; |
178 | } | 200 | } |
179 | 201 | ||
diff --git a/drivers/leds/leds-alix2.c b/drivers/leds/leds-alix2.c index d7666e6cb425..ddbd7730dfc8 100644 --- a/drivers/leds/leds-alix2.c +++ b/drivers/leds/leds-alix2.c | |||
@@ -65,39 +65,13 @@ static struct alix_led alix_leds[] = { | |||
65 | }, | 65 | }, |
66 | }; | 66 | }; |
67 | 67 | ||
68 | #ifdef CONFIG_PM | ||
69 | |||
70 | static int alix_led_suspend(struct platform_device *dev, pm_message_t state) | ||
71 | { | ||
72 | int i; | ||
73 | |||
74 | for (i = 0; i < ARRAY_SIZE(alix_leds); i++) | ||
75 | led_classdev_suspend(&alix_leds[i].cdev); | ||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | static int alix_led_resume(struct platform_device *dev) | ||
80 | { | ||
81 | int i; | ||
82 | |||
83 | for (i = 0; i < ARRAY_SIZE(alix_leds); i++) | ||
84 | led_classdev_resume(&alix_leds[i].cdev); | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | #else | ||
89 | |||
90 | #define alix_led_suspend NULL | ||
91 | #define alix_led_resume NULL | ||
92 | |||
93 | #endif | ||
94 | |||
95 | static int __init alix_led_probe(struct platform_device *pdev) | 68 | static int __init alix_led_probe(struct platform_device *pdev) |
96 | { | 69 | { |
97 | int i; | 70 | int i; |
98 | int ret; | 71 | int ret; |
99 | 72 | ||
100 | for (i = 0; i < ARRAY_SIZE(alix_leds); i++) { | 73 | for (i = 0; i < ARRAY_SIZE(alix_leds); i++) { |
74 | alix_leds[i].cdev.flags |= LED_CORE_SUSPENDRESUME; | ||
101 | ret = led_classdev_register(&pdev->dev, &alix_leds[i].cdev); | 75 | ret = led_classdev_register(&pdev->dev, &alix_leds[i].cdev); |
102 | if (ret < 0) | 76 | if (ret < 0) |
103 | goto fail; | 77 | goto fail; |
@@ -121,8 +95,6 @@ static int alix_led_remove(struct platform_device *pdev) | |||
121 | 95 | ||
122 | static struct platform_driver alix_led_driver = { | 96 | static struct platform_driver alix_led_driver = { |
123 | .remove = alix_led_remove, | 97 | .remove = alix_led_remove, |
124 | .suspend = alix_led_suspend, | ||
125 | .resume = alix_led_resume, | ||
126 | .driver = { | 98 | .driver = { |
127 | .name = KBUILD_MODNAME, | 99 | .name = KBUILD_MODNAME, |
128 | .owner = THIS_MODULE, | 100 | .owner = THIS_MODULE, |
diff --git a/drivers/leds/leds-ams-delta.c b/drivers/leds/leds-ams-delta.c index 072157c3ba72..446050759b4d 100644 --- a/drivers/leds/leds-ams-delta.c +++ b/drivers/leds/leds-ams-delta.c | |||
@@ -79,37 +79,12 @@ static struct ams_delta_led ams_delta_leds[] = { | |||
79 | }, | 79 | }, |
80 | }; | 80 | }; |
81 | 81 | ||
82 | #ifdef CONFIG_PM | ||
83 | static int ams_delta_led_suspend(struct platform_device *dev, | ||
84 | pm_message_t state) | ||
85 | { | ||
86 | int i; | ||
87 | |||
88 | for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++) | ||
89 | led_classdev_suspend(&ams_delta_leds[i].cdev); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | static int ams_delta_led_resume(struct platform_device *dev) | ||
95 | { | ||
96 | int i; | ||
97 | |||
98 | for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++) | ||
99 | led_classdev_resume(&ams_delta_leds[i].cdev); | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | #else | ||
104 | #define ams_delta_led_suspend NULL | ||
105 | #define ams_delta_led_resume NULL | ||
106 | #endif | ||
107 | |||
108 | static int ams_delta_led_probe(struct platform_device *pdev) | 82 | static int ams_delta_led_probe(struct platform_device *pdev) |
109 | { | 83 | { |
110 | int i, ret; | 84 | int i, ret; |
111 | 85 | ||
112 | for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++) { | 86 | for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++) { |
87 | ams_delta_leds[i].cdev.flags |= LED_CORE_SUSPENDRESUME; | ||
113 | ret = led_classdev_register(&pdev->dev, | 88 | ret = led_classdev_register(&pdev->dev, |
114 | &ams_delta_leds[i].cdev); | 89 | &ams_delta_leds[i].cdev); |
115 | if (ret < 0) | 90 | if (ret < 0) |
@@ -136,8 +111,6 @@ static int ams_delta_led_remove(struct platform_device *pdev) | |||
136 | static struct platform_driver ams_delta_led_driver = { | 111 | static struct platform_driver ams_delta_led_driver = { |
137 | .probe = ams_delta_led_probe, | 112 | .probe = ams_delta_led_probe, |
138 | .remove = ams_delta_led_remove, | 113 | .remove = ams_delta_led_remove, |
139 | .suspend = ams_delta_led_suspend, | ||
140 | .resume = ams_delta_led_resume, | ||
141 | .driver = { | 114 | .driver = { |
142 | .name = "ams-delta-led", | 115 | .name = "ams-delta-led", |
143 | .owner = THIS_MODULE, | 116 | .owner = THIS_MODULE, |
diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c index eb3415e88f43..1813c84ea5fc 100644 --- a/drivers/leds/leds-clevo-mail.c +++ b/drivers/leds/leds-clevo-mail.c | |||
@@ -142,6 +142,7 @@ static struct led_classdev clevo_mail_led = { | |||
142 | .name = "clevo::mail", | 142 | .name = "clevo::mail", |
143 | .brightness_set = clevo_mail_led_set, | 143 | .brightness_set = clevo_mail_led_set, |
144 | .blink_set = clevo_mail_led_blink, | 144 | .blink_set = clevo_mail_led_blink, |
145 | .flags = LED_CORE_SUSPENDRESUME, | ||
145 | }; | 146 | }; |
146 | 147 | ||
147 | static int __init clevo_mail_led_probe(struct platform_device *pdev) | 148 | static int __init clevo_mail_led_probe(struct platform_device *pdev) |
@@ -155,29 +156,9 @@ static int clevo_mail_led_remove(struct platform_device *pdev) | |||
155 | return 0; | 156 | return 0; |
156 | } | 157 | } |
157 | 158 | ||
158 | #ifdef CONFIG_PM | ||
159 | static int clevo_mail_led_suspend(struct platform_device *dev, | ||
160 | pm_message_t state) | ||
161 | { | ||
162 | led_classdev_suspend(&clevo_mail_led); | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | static int clevo_mail_led_resume(struct platform_device *dev) | ||
167 | { | ||
168 | led_classdev_resume(&clevo_mail_led); | ||
169 | return 0; | ||
170 | } | ||
171 | #else | ||
172 | #define clevo_mail_led_suspend NULL | ||
173 | #define clevo_mail_led_resume NULL | ||
174 | #endif | ||
175 | |||
176 | static struct platform_driver clevo_mail_led_driver = { | 159 | static struct platform_driver clevo_mail_led_driver = { |
177 | .probe = clevo_mail_led_probe, | 160 | .probe = clevo_mail_led_probe, |
178 | .remove = clevo_mail_led_remove, | 161 | .remove = clevo_mail_led_remove, |
179 | .suspend = clevo_mail_led_suspend, | ||
180 | .resume = clevo_mail_led_resume, | ||
181 | .driver = { | 162 | .driver = { |
182 | .name = KBUILD_MODNAME, | 163 | .name = KBUILD_MODNAME, |
183 | .owner = THIS_MODULE, | 164 | .owner = THIS_MODULE, |
diff --git a/drivers/leds/leds-fsg.c b/drivers/leds/leds-fsg.c index 34935155c1c0..5f7c9c5c09b1 100644 --- a/drivers/leds/leds-fsg.c +++ b/drivers/leds/leds-fsg.c | |||
@@ -99,64 +99,43 @@ static void fsg_led_ring_set(struct led_classdev *led_cdev, | |||
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | |||
103 | static struct led_classdev fsg_wlan_led = { | 102 | static struct led_classdev fsg_wlan_led = { |
104 | .name = "fsg:blue:wlan", | 103 | .name = "fsg:blue:wlan", |
105 | .brightness_set = fsg_led_wlan_set, | 104 | .brightness_set = fsg_led_wlan_set, |
105 | .flags = LED_CORE_SUSPENDRESUME, | ||
106 | }; | 106 | }; |
107 | 107 | ||
108 | static struct led_classdev fsg_wan_led = { | 108 | static struct led_classdev fsg_wan_led = { |
109 | .name = "fsg:blue:wan", | 109 | .name = "fsg:blue:wan", |
110 | .brightness_set = fsg_led_wan_set, | 110 | .brightness_set = fsg_led_wan_set, |
111 | .flags = LED_CORE_SUSPENDRESUME, | ||
111 | }; | 112 | }; |
112 | 113 | ||
113 | static struct led_classdev fsg_sata_led = { | 114 | static struct led_classdev fsg_sata_led = { |
114 | .name = "fsg:blue:sata", | 115 | .name = "fsg:blue:sata", |
115 | .brightness_set = fsg_led_sata_set, | 116 | .brightness_set = fsg_led_sata_set, |
117 | .flags = LED_CORE_SUSPENDRESUME, | ||
116 | }; | 118 | }; |
117 | 119 | ||
118 | static struct led_classdev fsg_usb_led = { | 120 | static struct led_classdev fsg_usb_led = { |
119 | .name = "fsg:blue:usb", | 121 | .name = "fsg:blue:usb", |
120 | .brightness_set = fsg_led_usb_set, | 122 | .brightness_set = fsg_led_usb_set, |
123 | .flags = LED_CORE_SUSPENDRESUME, | ||
121 | }; | 124 | }; |
122 | 125 | ||
123 | static struct led_classdev fsg_sync_led = { | 126 | static struct led_classdev fsg_sync_led = { |
124 | .name = "fsg:blue:sync", | 127 | .name = "fsg:blue:sync", |
125 | .brightness_set = fsg_led_sync_set, | 128 | .brightness_set = fsg_led_sync_set, |
129 | .flags = LED_CORE_SUSPENDRESUME, | ||
126 | }; | 130 | }; |
127 | 131 | ||
128 | static struct led_classdev fsg_ring_led = { | 132 | static struct led_classdev fsg_ring_led = { |
129 | .name = "fsg:blue:ring", | 133 | .name = "fsg:blue:ring", |
130 | .brightness_set = fsg_led_ring_set, | 134 | .brightness_set = fsg_led_ring_set, |
135 | .flags = LED_CORE_SUSPENDRESUME, | ||
131 | }; | 136 | }; |
132 | 137 | ||
133 | 138 | ||
134 | |||
135 | #ifdef CONFIG_PM | ||
136 | static int fsg_led_suspend(struct platform_device *dev, pm_message_t state) | ||
137 | { | ||
138 | led_classdev_suspend(&fsg_wlan_led); | ||
139 | led_classdev_suspend(&fsg_wan_led); | ||
140 | led_classdev_suspend(&fsg_sata_led); | ||
141 | led_classdev_suspend(&fsg_usb_led); | ||
142 | led_classdev_suspend(&fsg_sync_led); | ||
143 | led_classdev_suspend(&fsg_ring_led); | ||
144 | return 0; | ||
145 | } | ||
146 | |||
147 | static int fsg_led_resume(struct platform_device *dev) | ||
148 | { | ||
149 | led_classdev_resume(&fsg_wlan_led); | ||
150 | led_classdev_resume(&fsg_wan_led); | ||
151 | led_classdev_resume(&fsg_sata_led); | ||
152 | led_classdev_resume(&fsg_usb_led); | ||
153 | led_classdev_resume(&fsg_sync_led); | ||
154 | led_classdev_resume(&fsg_ring_led); | ||
155 | return 0; | ||
156 | } | ||
157 | #endif | ||
158 | |||
159 | |||
160 | static int fsg_led_probe(struct platform_device *pdev) | 139 | static int fsg_led_probe(struct platform_device *pdev) |
161 | { | 140 | { |
162 | int ret; | 141 | int ret; |
@@ -232,10 +211,6 @@ static int fsg_led_remove(struct platform_device *pdev) | |||
232 | static struct platform_driver fsg_led_driver = { | 211 | static struct platform_driver fsg_led_driver = { |
233 | .probe = fsg_led_probe, | 212 | .probe = fsg_led_probe, |
234 | .remove = fsg_led_remove, | 213 | .remove = fsg_led_remove, |
235 | #ifdef CONFIG_PM | ||
236 | .suspend = fsg_led_suspend, | ||
237 | .resume = fsg_led_resume, | ||
238 | #endif | ||
239 | .driver = { | 214 | .driver = { |
240 | .name = "fsg-led", | 215 | .name = "fsg-led", |
241 | }, | 216 | }, |
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, |
diff --git a/drivers/leds/leds-hp-disk.c b/drivers/leds/leds-hp-disk.c index 44fa757d8254..d786adc8c5e3 100644 --- a/drivers/leds/leds-hp-disk.c +++ b/drivers/leds/leds-hp-disk.c | |||
@@ -68,25 +68,9 @@ static struct led_classdev hpled_led = { | |||
68 | .name = "hp:red:hddprotection", | 68 | .name = "hp:red:hddprotection", |
69 | .default_trigger = "heartbeat", | 69 | .default_trigger = "heartbeat", |
70 | .brightness_set = hpled_set, | 70 | .brightness_set = hpled_set, |
71 | .flags = LED_CORE_SUSPENDRESUME, | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | #ifdef CONFIG_PM | ||
74 | static int hpled_suspend(struct acpi_device *dev, pm_message_t state) | ||
75 | { | ||
76 | led_classdev_suspend(&hpled_led); | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static int hpled_resume(struct acpi_device *dev) | ||
81 | { | ||
82 | led_classdev_resume(&hpled_led); | ||
83 | return 0; | ||
84 | } | ||
85 | #else | ||
86 | #define hpled_suspend NULL | ||
87 | #define hpled_resume NULL | ||
88 | #endif | ||
89 | |||
90 | static int hpled_add(struct acpi_device *device) | 74 | static int hpled_add(struct acpi_device *device) |
91 | { | 75 | { |
92 | int ret; | 76 | int ret; |
@@ -121,8 +105,6 @@ static struct acpi_driver leds_hp_driver = { | |||
121 | .ops = { | 105 | .ops = { |
122 | .add = hpled_add, | 106 | .add = hpled_add, |
123 | .remove = hpled_remove, | 107 | .remove = hpled_remove, |
124 | .suspend = hpled_suspend, | ||
125 | .resume = hpled_resume, | ||
126 | } | 108 | } |
127 | }; | 109 | }; |
128 | 110 | ||
diff --git a/drivers/leds/leds-hp6xx.c b/drivers/leds/leds-hp6xx.c index e8fb1baf8a50..e4ce1fd46338 100644 --- a/drivers/leds/leds-hp6xx.c +++ b/drivers/leds/leds-hp6xx.c | |||
@@ -45,30 +45,16 @@ static struct led_classdev hp6xx_red_led = { | |||
45 | .name = "hp6xx:red", | 45 | .name = "hp6xx:red", |
46 | .default_trigger = "hp6xx-charge", | 46 | .default_trigger = "hp6xx-charge", |
47 | .brightness_set = hp6xxled_red_set, | 47 | .brightness_set = hp6xxled_red_set, |
48 | .flags = LED_CORE_SUSPENDRESUME, | ||
48 | }; | 49 | }; |
49 | 50 | ||
50 | static struct led_classdev hp6xx_green_led = { | 51 | static struct led_classdev hp6xx_green_led = { |
51 | .name = "hp6xx:green", | 52 | .name = "hp6xx:green", |
52 | .default_trigger = "ide-disk", | 53 | .default_trigger = "ide-disk", |
53 | .brightness_set = hp6xxled_green_set, | 54 | .brightness_set = hp6xxled_green_set, |
55 | .flags = LED_CORE_SUSPENDRESUME, | ||
54 | }; | 56 | }; |
55 | 57 | ||
56 | #ifdef CONFIG_PM | ||
57 | static int hp6xxled_suspend(struct platform_device *dev, pm_message_t state) | ||
58 | { | ||
59 | led_classdev_suspend(&hp6xx_red_led); | ||
60 | led_classdev_suspend(&hp6xx_green_led); | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static int hp6xxled_resume(struct platform_device *dev) | ||
65 | { | ||
66 | led_classdev_resume(&hp6xx_red_led); | ||
67 | led_classdev_resume(&hp6xx_green_led); | ||
68 | return 0; | ||
69 | } | ||
70 | #endif | ||
71 | |||
72 | static int hp6xxled_probe(struct platform_device *pdev) | 58 | static int hp6xxled_probe(struct platform_device *pdev) |
73 | { | 59 | { |
74 | int ret; | 60 | int ret; |
@@ -98,10 +84,6 @@ MODULE_ALIAS("platform:hp6xx-led"); | |||
98 | static struct platform_driver hp6xxled_driver = { | 84 | static struct platform_driver hp6xxled_driver = { |
99 | .probe = hp6xxled_probe, | 85 | .probe = hp6xxled_probe, |
100 | .remove = hp6xxled_remove, | 86 | .remove = hp6xxled_remove, |
101 | #ifdef CONFIG_PM | ||
102 | .suspend = hp6xxled_suspend, | ||
103 | .resume = hp6xxled_resume, | ||
104 | #endif | ||
105 | .driver = { | 87 | .driver = { |
106 | .name = "hp6xx-led", | 88 | .name = "hp6xx-led", |
107 | .owner = THIS_MODULE, | 89 | .owner = THIS_MODULE, |
diff --git a/drivers/leds/leds-net48xx.c b/drivers/leds/leds-net48xx.c index 054360473c94..93987a12da49 100644 --- a/drivers/leds/leds-net48xx.c +++ b/drivers/leds/leds-net48xx.c | |||
@@ -33,26 +33,9 @@ static void net48xx_error_led_set(struct led_classdev *led_cdev, | |||
33 | static struct led_classdev net48xx_error_led = { | 33 | static struct led_classdev net48xx_error_led = { |
34 | .name = "net48xx::error", | 34 | .name = "net48xx::error", |
35 | .brightness_set = net48xx_error_led_set, | 35 | .brightness_set = net48xx_error_led_set, |
36 | .flags = LED_CORE_SUSPENDRESUME, | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | #ifdef CONFIG_PM | ||
39 | static int net48xx_led_suspend(struct platform_device *dev, | ||
40 | pm_message_t state) | ||
41 | { | ||
42 | led_classdev_suspend(&net48xx_error_led); | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static int net48xx_led_resume(struct platform_device *dev) | ||
47 | { | ||
48 | led_classdev_resume(&net48xx_error_led); | ||
49 | return 0; | ||
50 | } | ||
51 | #else | ||
52 | #define net48xx_led_suspend NULL | ||
53 | #define net48xx_led_resume NULL | ||
54 | #endif | ||
55 | |||
56 | static int net48xx_led_probe(struct platform_device *pdev) | 39 | static int net48xx_led_probe(struct platform_device *pdev) |
57 | { | 40 | { |
58 | return led_classdev_register(&pdev->dev, &net48xx_error_led); | 41 | return led_classdev_register(&pdev->dev, &net48xx_error_led); |
@@ -67,8 +50,6 @@ static int net48xx_led_remove(struct platform_device *pdev) | |||
67 | static struct platform_driver net48xx_led_driver = { | 50 | static struct platform_driver net48xx_led_driver = { |
68 | .probe = net48xx_led_probe, | 51 | .probe = net48xx_led_probe, |
69 | .remove = net48xx_led_remove, | 52 | .remove = net48xx_led_remove, |
70 | .suspend = net48xx_led_suspend, | ||
71 | .resume = net48xx_led_resume, | ||
72 | .driver = { | 53 | .driver = { |
73 | .name = DRVNAME, | 54 | .name = DRVNAME, |
74 | .owner = THIS_MODULE, | 55 | .owner = THIS_MODULE, |
diff --git a/drivers/leds/leds-s3c24xx.c b/drivers/leds/leds-s3c24xx.c index 25a07f2643ad..4d81131542ae 100644 --- a/drivers/leds/leds-s3c24xx.c +++ b/drivers/leds/leds-s3c24xx.c | |||
@@ -82,6 +82,7 @@ static int s3c24xx_led_probe(struct platform_device *dev) | |||
82 | led->cdev.brightness_set = s3c24xx_led_set; | 82 | led->cdev.brightness_set = s3c24xx_led_set; |
83 | led->cdev.default_trigger = pdata->def_trigger; | 83 | led->cdev.default_trigger = pdata->def_trigger; |
84 | led->cdev.name = pdata->name; | 84 | led->cdev.name = pdata->name; |
85 | led->cdev.flags |= LED_CORE_SUSPENDRESUME; | ||
85 | 86 | ||
86 | led->pdata = pdata; | 87 | led->pdata = pdata; |
87 | 88 | ||
@@ -111,33 +112,9 @@ static int s3c24xx_led_probe(struct platform_device *dev) | |||
111 | return ret; | 112 | return ret; |
112 | } | 113 | } |
113 | 114 | ||
114 | |||
115 | #ifdef CONFIG_PM | ||
116 | static int s3c24xx_led_suspend(struct platform_device *dev, pm_message_t state) | ||
117 | { | ||
118 | struct s3c24xx_gpio_led *led = pdev_to_gpio(dev); | ||
119 | |||
120 | led_classdev_suspend(&led->cdev); | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | static int s3c24xx_led_resume(struct platform_device *dev) | ||
125 | { | ||
126 | struct s3c24xx_gpio_led *led = pdev_to_gpio(dev); | ||
127 | |||
128 | led_classdev_resume(&led->cdev); | ||
129 | return 0; | ||
130 | } | ||
131 | #else | ||
132 | #define s3c24xx_led_suspend NULL | ||
133 | #define s3c24xx_led_resume NULL | ||
134 | #endif | ||
135 | |||
136 | static struct platform_driver s3c24xx_led_driver = { | 115 | static struct platform_driver s3c24xx_led_driver = { |
137 | .probe = s3c24xx_led_probe, | 116 | .probe = s3c24xx_led_probe, |
138 | .remove = s3c24xx_led_remove, | 117 | .remove = s3c24xx_led_remove, |
139 | .suspend = s3c24xx_led_suspend, | ||
140 | .resume = s3c24xx_led_resume, | ||
141 | .driver = { | 118 | .driver = { |
142 | .name = "s3c24xx_led", | 119 | .name = "s3c24xx_led", |
143 | .owner = THIS_MODULE, | 120 | .owner = THIS_MODULE, |
diff --git a/drivers/leds/leds-wm8350.c b/drivers/leds/leds-wm8350.c index 846ed978103f..38c6bcb07e6c 100644 --- a/drivers/leds/leds-wm8350.c +++ b/drivers/leds/leds-wm8350.c | |||
@@ -184,27 +184,6 @@ static void wm8350_led_set(struct led_classdev *led_cdev, | |||
184 | spin_unlock_irqrestore(&led->value_lock, flags); | 184 | spin_unlock_irqrestore(&led->value_lock, flags); |
185 | } | 185 | } |
186 | 186 | ||
187 | #ifdef CONFIG_PM | ||
188 | static int wm8350_led_suspend(struct platform_device *pdev, pm_message_t state) | ||
189 | { | ||
190 | struct wm8350_led *led = platform_get_drvdata(pdev); | ||
191 | |||
192 | led_classdev_suspend(&led->cdev); | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | static int wm8350_led_resume(struct platform_device *pdev) | ||
197 | { | ||
198 | struct wm8350_led *led = platform_get_drvdata(pdev); | ||
199 | |||
200 | led_classdev_resume(&led->cdev); | ||
201 | return 0; | ||
202 | } | ||
203 | #else | ||
204 | #define wm8350_led_suspend NULL | ||
205 | #define wm8350_led_resume NULL | ||
206 | #endif | ||
207 | |||
208 | static void wm8350_led_shutdown(struct platform_device *pdev) | 187 | static void wm8350_led_shutdown(struct platform_device *pdev) |
209 | { | 188 | { |
210 | struct wm8350_led *led = platform_get_drvdata(pdev); | 189 | struct wm8350_led *led = platform_get_drvdata(pdev); |
@@ -255,6 +234,7 @@ static int wm8350_led_probe(struct platform_device *pdev) | |||
255 | led->cdev.brightness_set = wm8350_led_set; | 234 | led->cdev.brightness_set = wm8350_led_set; |
256 | led->cdev.default_trigger = pdata->default_trigger; | 235 | led->cdev.default_trigger = pdata->default_trigger; |
257 | led->cdev.name = pdata->name; | 236 | led->cdev.name = pdata->name; |
237 | led->cdev.flags |= LED_CORE_SUSPENDRESUME; | ||
258 | led->enabled = regulator_is_enabled(isink); | 238 | led->enabled = regulator_is_enabled(isink); |
259 | led->isink = isink; | 239 | led->isink = isink; |
260 | led->dcdc = dcdc; | 240 | led->dcdc = dcdc; |
@@ -311,8 +291,6 @@ static struct platform_driver wm8350_led_driver = { | |||
311 | .probe = wm8350_led_probe, | 291 | .probe = wm8350_led_probe, |
312 | .remove = wm8350_led_remove, | 292 | .remove = wm8350_led_remove, |
313 | .shutdown = wm8350_led_shutdown, | 293 | .shutdown = wm8350_led_shutdown, |
314 | .suspend = wm8350_led_suspend, | ||
315 | .resume = wm8350_led_resume, | ||
316 | }; | 294 | }; |
317 | 295 | ||
318 | static int __devinit wm8350_led_init(void) | 296 | static int __devinit wm8350_led_init(void) |
diff --git a/drivers/leds/leds-wrap.c b/drivers/leds/leds-wrap.c index 2f3aa87f2a1f..2982c86ac4cf 100644 --- a/drivers/leds/leds-wrap.c +++ b/drivers/leds/leds-wrap.c | |||
@@ -56,40 +56,21 @@ static struct led_classdev wrap_power_led = { | |||
56 | .name = "wrap::power", | 56 | .name = "wrap::power", |
57 | .brightness_set = wrap_power_led_set, | 57 | .brightness_set = wrap_power_led_set, |
58 | .default_trigger = "default-on", | 58 | .default_trigger = "default-on", |
59 | .flags = LED_CORE_SUSPENDRESUME, | ||
59 | }; | 60 | }; |
60 | 61 | ||
61 | static struct led_classdev wrap_error_led = { | 62 | static struct led_classdev wrap_error_led = { |
62 | .name = "wrap::error", | 63 | .name = "wrap::error", |
63 | .brightness_set = wrap_error_led_set, | 64 | .brightness_set = wrap_error_led_set, |
65 | .flags = LED_CORE_SUSPENDRESUME, | ||
64 | }; | 66 | }; |
65 | 67 | ||
66 | static struct led_classdev wrap_extra_led = { | 68 | static struct led_classdev wrap_extra_led = { |
67 | .name = "wrap::extra", | 69 | .name = "wrap::extra", |
68 | .brightness_set = wrap_extra_led_set, | 70 | .brightness_set = wrap_extra_led_set, |
71 | .flags = LED_CORE_SUSPENDRESUME, | ||
69 | }; | 72 | }; |
70 | 73 | ||
71 | #ifdef CONFIG_PM | ||
72 | static int wrap_led_suspend(struct platform_device *dev, | ||
73 | pm_message_t state) | ||
74 | { | ||
75 | led_classdev_suspend(&wrap_power_led); | ||
76 | led_classdev_suspend(&wrap_error_led); | ||
77 | led_classdev_suspend(&wrap_extra_led); | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static int wrap_led_resume(struct platform_device *dev) | ||
82 | { | ||
83 | led_classdev_resume(&wrap_power_led); | ||
84 | led_classdev_resume(&wrap_error_led); | ||
85 | led_classdev_resume(&wrap_extra_led); | ||
86 | return 0; | ||
87 | } | ||
88 | #else | ||
89 | #define wrap_led_suspend NULL | ||
90 | #define wrap_led_resume NULL | ||
91 | #endif | ||
92 | |||
93 | static int wrap_led_probe(struct platform_device *pdev) | 74 | static int wrap_led_probe(struct platform_device *pdev) |
94 | { | 75 | { |
95 | int ret; | 76 | int ret; |
@@ -127,8 +108,6 @@ static int wrap_led_remove(struct platform_device *pdev) | |||
127 | static struct platform_driver wrap_led_driver = { | 108 | static struct platform_driver wrap_led_driver = { |
128 | .probe = wrap_led_probe, | 109 | .probe = wrap_led_probe, |
129 | .remove = wrap_led_remove, | 110 | .remove = wrap_led_remove, |
130 | .suspend = wrap_led_suspend, | ||
131 | .resume = wrap_led_resume, | ||
132 | .driver = { | 111 | .driver = { |
133 | .name = DRVNAME, | 112 | .name = DRVNAME, |
134 | .owner = THIS_MODULE, | 113 | .owner = THIS_MODULE, |
diff --git a/include/linux/leds.h b/include/linux/leds.h index 3c1a8ce6a5ea..24489da701e3 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -32,7 +32,10 @@ struct led_classdev { | |||
32 | int brightness; | 32 | int brightness; |
33 | int flags; | 33 | int flags; |
34 | 34 | ||
35 | /* Lower 16 bits reflect status */ | ||
35 | #define LED_SUSPENDED (1 << 0) | 36 | #define LED_SUSPENDED (1 << 0) |
37 | /* Upper 16 bits reflect control information */ | ||
38 | #define LED_CORE_SUSPENDRESUME (1 << 16) | ||
36 | 39 | ||
37 | /* Set LED brightness level */ | 40 | /* Set LED brightness level */ |
38 | /* Must not sleep, use a workqueue if needed */ | 41 | /* Must not sleep, use a workqueue if needed */ |