diff options
author | Jacek Anaszewski <j.anaszewski@samsung.com> | 2015-03-04 11:14:22 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2015-03-09 20:16:23 -0400 |
commit | 94fdec768dc72a6993479f59a17daa413f30029e (patch) | |
tree | 6495761c9d3b3dc36a4aa27229d70914e48b1dc0 | |
parent | ca1bb4ee4c3a017bb66840d11d5efdf4e8f3f66d (diff) |
leds: flash: Remove synchronized flash strobe feature
Synchronized flash strobe feature has been considered not fitting
for LED subsystem sysfs interface and thus is being removed.
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
-rw-r--r-- | drivers/leds/led-class-flash.c | 82 | ||||
-rw-r--r-- | include/linux/led-class-flash.h | 14 | ||||
-rw-r--r-- | include/linux/leds.h | 1 |
3 files changed, 0 insertions, 97 deletions
diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c index 4a19fd44f93f..3b2573411a37 100644 --- a/drivers/leds/led-class-flash.c +++ b/drivers/leds/led-class-flash.c | |||
@@ -216,75 +216,6 @@ static ssize_t flash_fault_show(struct device *dev, | |||
216 | } | 216 | } |
217 | static DEVICE_ATTR_RO(flash_fault); | 217 | static DEVICE_ATTR_RO(flash_fault); |
218 | 218 | ||
219 | static ssize_t available_sync_leds_show(struct device *dev, | ||
220 | struct device_attribute *attr, char *buf) | ||
221 | { | ||
222 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
223 | struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); | ||
224 | char *pbuf = buf; | ||
225 | int i, buf_len; | ||
226 | |||
227 | buf_len = sprintf(pbuf, "[0: none] "); | ||
228 | pbuf += buf_len; | ||
229 | |||
230 | for (i = 0; i < fled_cdev->num_sync_leds; ++i) { | ||
231 | buf_len = sprintf(pbuf, "[%d: %s] ", i + 1, | ||
232 | fled_cdev->sync_leds[i]->led_cdev.name); | ||
233 | pbuf += buf_len; | ||
234 | } | ||
235 | |||
236 | return sprintf(buf, "%s\n", buf); | ||
237 | } | ||
238 | static DEVICE_ATTR_RO(available_sync_leds); | ||
239 | |||
240 | static ssize_t flash_sync_strobe_store(struct device *dev, | ||
241 | struct device_attribute *attr, const char *buf, size_t size) | ||
242 | { | ||
243 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
244 | struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); | ||
245 | unsigned long led_id; | ||
246 | ssize_t ret; | ||
247 | |||
248 | mutex_lock(&led_cdev->led_access); | ||
249 | |||
250 | if (led_sysfs_is_disabled(led_cdev)) { | ||
251 | ret = -EBUSY; | ||
252 | goto unlock; | ||
253 | } | ||
254 | |||
255 | ret = kstrtoul(buf, 10, &led_id); | ||
256 | if (ret) | ||
257 | goto unlock; | ||
258 | |||
259 | if (led_id > fled_cdev->num_sync_leds) { | ||
260 | ret = -ERANGE; | ||
261 | goto unlock; | ||
262 | } | ||
263 | |||
264 | fled_cdev->sync_led_id = led_id; | ||
265 | |||
266 | ret = size; | ||
267 | unlock: | ||
268 | mutex_unlock(&led_cdev->led_access); | ||
269 | return ret; | ||
270 | } | ||
271 | |||
272 | static ssize_t flash_sync_strobe_show(struct device *dev, | ||
273 | struct device_attribute *attr, char *buf) | ||
274 | { | ||
275 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
276 | struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); | ||
277 | int sled_id = fled_cdev->sync_led_id; | ||
278 | char *sync_led_name = "none"; | ||
279 | |||
280 | if (fled_cdev->sync_led_id > 0) | ||
281 | sync_led_name = (char *) | ||
282 | fled_cdev->sync_leds[sled_id - 1]->led_cdev.name; | ||
283 | |||
284 | return sprintf(buf, "[%d: %s]\n", sled_id, sync_led_name); | ||
285 | } | ||
286 | static DEVICE_ATTR_RW(flash_sync_strobe); | ||
287 | |||
288 | static struct attribute *led_flash_strobe_attrs[] = { | 219 | static struct attribute *led_flash_strobe_attrs[] = { |
289 | &dev_attr_flash_strobe.attr, | 220 | &dev_attr_flash_strobe.attr, |
290 | NULL, | 221 | NULL, |
@@ -307,12 +238,6 @@ static struct attribute *led_flash_fault_attrs[] = { | |||
307 | NULL, | 238 | NULL, |
308 | }; | 239 | }; |
309 | 240 | ||
310 | static struct attribute *led_flash_sync_strobe_attrs[] = { | ||
311 | &dev_attr_available_sync_leds.attr, | ||
312 | &dev_attr_flash_sync_strobe.attr, | ||
313 | NULL, | ||
314 | }; | ||
315 | |||
316 | static const struct attribute_group led_flash_strobe_group = { | 241 | static const struct attribute_group led_flash_strobe_group = { |
317 | .attrs = led_flash_strobe_attrs, | 242 | .attrs = led_flash_strobe_attrs, |
318 | }; | 243 | }; |
@@ -329,10 +254,6 @@ static const struct attribute_group led_flash_fault_group = { | |||
329 | .attrs = led_flash_fault_attrs, | 254 | .attrs = led_flash_fault_attrs, |
330 | }; | 255 | }; |
331 | 256 | ||
332 | static const struct attribute_group led_flash_sync_strobe_group = { | ||
333 | .attrs = led_flash_sync_strobe_attrs, | ||
334 | }; | ||
335 | |||
336 | static void led_flash_resume(struct led_classdev *led_cdev) | 257 | static void led_flash_resume(struct led_classdev *led_cdev) |
337 | { | 258 | { |
338 | struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); | 259 | struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); |
@@ -361,9 +282,6 @@ static void led_flash_init_sysfs_groups(struct led_classdev_flash *fled_cdev) | |||
361 | if (ops->fault_get) | 282 | if (ops->fault_get) |
362 | flash_groups[num_sysfs_groups++] = &led_flash_fault_group; | 283 | flash_groups[num_sysfs_groups++] = &led_flash_fault_group; |
363 | 284 | ||
364 | if (led_cdev->flags & LED_DEV_CAP_SYNC_STROBE) | ||
365 | flash_groups[num_sysfs_groups++] = &led_flash_sync_strobe_group; | ||
366 | |||
367 | led_cdev->groups = flash_groups; | 285 | led_cdev->groups = flash_groups; |
368 | } | 286 | } |
369 | 287 | ||
diff --git a/include/linux/led-class-flash.h b/include/linux/led-class-flash.h index 3b5b9643cea1..21ec91e13c47 100644 --- a/include/linux/led-class-flash.h +++ b/include/linux/led-class-flash.h | |||
@@ -81,20 +81,6 @@ struct led_classdev_flash { | |||
81 | 81 | ||
82 | /* LED Flash class sysfs groups */ | 82 | /* LED Flash class sysfs groups */ |
83 | const struct attribute_group *sysfs_groups[LED_FLASH_MAX_SYSFS_GROUPS]; | 83 | const struct attribute_group *sysfs_groups[LED_FLASH_MAX_SYSFS_GROUPS]; |
84 | |||
85 | /* LEDs available for flash strobe synchronization */ | ||
86 | struct led_classdev_flash **sync_leds; | ||
87 | |||
88 | /* Number of LEDs available for flash strobe synchronization */ | ||
89 | int num_sync_leds; | ||
90 | |||
91 | /* | ||
92 | * The identifier of the sub-led to synchronize the flash strobe with. | ||
93 | * Identifiers start from 1, which reflects the first element from the | ||
94 | * sync_leds array. 0 means that the flash strobe should not be | ||
95 | * synchronized. | ||
96 | */ | ||
97 | u32 sync_led_id; | ||
98 | }; | 84 | }; |
99 | 85 | ||
100 | static inline struct led_classdev_flash *lcdev_to_flcdev( | 86 | static inline struct led_classdev_flash *lcdev_to_flcdev( |
diff --git a/include/linux/leds.h b/include/linux/leds.h index ed634279062e..9a2b000094cf 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -47,7 +47,6 @@ struct led_classdev { | |||
47 | #define SET_BRIGHTNESS_ASYNC (1 << 21) | 47 | #define SET_BRIGHTNESS_ASYNC (1 << 21) |
48 | #define SET_BRIGHTNESS_SYNC (1 << 22) | 48 | #define SET_BRIGHTNESS_SYNC (1 << 22) |
49 | #define LED_DEV_CAP_FLASH (1 << 23) | 49 | #define LED_DEV_CAP_FLASH (1 << 23) |
50 | #define LED_DEV_CAP_SYNC_STROBE (1 << 24) | ||
51 | 50 | ||
52 | /* Set LED brightness level */ | 51 | /* Set LED brightness level */ |
53 | /* Must not sleep, use a workqueue if needed */ | 52 | /* Must not sleep, use a workqueue if needed */ |