Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jacek Anaszewski and committed by
Bryan Wu
94fdec76 ca1bb4ee

-97
-82
drivers/leds/led-class-flash.c
··· 216 216 } 217 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 219 static struct attribute *led_flash_strobe_attrs[] = { 289 220 &dev_attr_flash_strobe.attr, 290 221 NULL, ··· 238 307 NULL, 239 308 }; 240 309 241 - static struct attribute *led_flash_sync_strobe_attrs[] = { 242 - &dev_attr_available_sync_leds.attr, 243 - &dev_attr_flash_sync_strobe.attr, 244 - NULL, 245 - }; 246 - 247 310 static const struct attribute_group led_flash_strobe_group = { 248 311 .attrs = led_flash_strobe_attrs, 249 312 }; ··· 252 327 253 328 static const struct attribute_group led_flash_fault_group = { 254 329 .attrs = led_flash_fault_attrs, 255 - }; 256 - 257 - static const struct attribute_group led_flash_sync_strobe_group = { 258 - .attrs = led_flash_sync_strobe_attrs, 259 330 }; 260 331 261 332 static void led_flash_resume(struct led_classdev *led_cdev) ··· 281 360 282 361 if (ops->fault_get) 283 362 flash_groups[num_sysfs_groups++] = &led_flash_fault_group; 284 - 285 - if (led_cdev->flags & LED_DEV_CAP_SYNC_STROBE) 286 - flash_groups[num_sysfs_groups++] = &led_flash_sync_strobe_group; 287 363 288 364 led_cdev->groups = flash_groups; 289 365 }
-14
include/linux/led-class-flash.h
··· 81 81 82 82 /* LED Flash class sysfs groups */ 83 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 86 static inline struct led_classdev_flash *lcdev_to_flcdev(
-1
include/linux/leds.h
··· 47 47 #define SET_BRIGHTNESS_ASYNC (1 << 21) 48 48 #define SET_BRIGHTNESS_SYNC (1 << 22) 49 49 #define LED_DEV_CAP_FLASH (1 << 23) 50 - #define LED_DEV_CAP_SYNC_STROBE (1 << 24) 51 50 52 51 /* Set LED brightness level */ 53 52 /* Must not sleep, use a workqueue if needed */