Skip to content

Commit

Permalink
leds: Rename brightness_set_sync op to brightness_set_blocking
Browse files Browse the repository at this point in the history
The initial purpose of brightness_set_sync op, introduced along with
the LED flash class extension, was to add a means for setting torch LED
brightness as soon as possible, which couldn't have been guaranteed by
brightness_set op. This patch renames the op to brightness_set_blocking,
which describes its purpose in a more generic way. It is beneficial
in view of the prospective changes in the LED core, aiming at removing
the need for using work queues in LED class drivers that can sleep
or use delays while setting brightness.

Signed-off-by: Jacek Anaszewski <[email protected]>
Acked-by: Andrew Lunn <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Acked-by: Sakari Ailus <[email protected]>
  • Loading branch information
janaszewski committed Jan 4, 2016
1 parent f1e80c0 commit 437a424
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion drivers/leds/led-class-flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ int led_classdev_flash_register(struct device *parent,
led_cdev = &fled_cdev->led_cdev;

if (led_cdev->flags & LED_DEV_CAP_FLASH) {
if (!led_cdev->brightness_set_sync)
if (!led_cdev->brightness_set_blocking)
return -EINVAL;

ops = fled_cdev->ops;
Expand Down
2 changes: 1 addition & 1 deletion drivers/leds/leds-aat1290.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ static int aat1290_led_probe(struct platform_device *pdev)

/* Initialize LED Flash class device */
led_cdev->brightness_set = aat1290_led_brightness_set;
led_cdev->brightness_set_sync = aat1290_led_brightness_set_sync;
led_cdev->brightness_set_blocking = aat1290_led_brightness_set_sync;
led_cdev->max_brightness = led_cfg.max_brightness;
led_cdev->flags |= LED_DEV_CAP_FLASH;
INIT_WORK(&led->work_brightness_set, aat1290_brightness_set_work);
Expand Down
2 changes: 1 addition & 1 deletion drivers/leds/leds-ktd2692.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ static int ktd2692_probe(struct platform_device *pdev)

led_cdev->max_brightness = led_cfg.max_brightness;
led_cdev->brightness_set = ktd2692_led_brightness_set;
led_cdev->brightness_set_sync = ktd2692_led_brightness_set_sync;
led_cdev->brightness_set_blocking = ktd2692_led_brightness_set_sync;
led_cdev->flags |= LED_CORE_SUSPENDRESUME | LED_DEV_CAP_FLASH;

mutex_init(&led->lock);
Expand Down
2 changes: 1 addition & 1 deletion drivers/leds/leds-max77693.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ static void max77693_init_fled_cdev(struct max77693_sub_led *sub_led,
led_cdev->name = led_cfg->label[fled_id];

led_cdev->brightness_set = max77693_led_brightness_set;
led_cdev->brightness_set_sync = max77693_led_brightness_set_sync;
led_cdev->brightness_set_blocking = max77693_led_brightness_set_sync;
led_cdev->max_brightness = (led->iout_joint ?
led_cfg->iout_torch_max[FLED1] +
led_cfg->iout_torch_max[FLED2] :
Expand Down
2 changes: 1 addition & 1 deletion drivers/leds/leds.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static inline int led_set_brightness_sync(struct led_classdev *led_cdev,
led_cdev->brightness = min(value, led_cdev->max_brightness);

if (!(led_cdev->flags & LED_SUSPENDED))
ret = led_cdev->brightness_set_sync(led_cdev,
ret = led_cdev->brightness_set_blocking(led_cdev,
led_cdev->brightness);
return ret;
}
Expand Down
4 changes: 2 additions & 2 deletions include/linux/leds.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ struct led_classdev {
* Set LED brightness level immediately - it can block the caller for
* the time required for accessing a LED device register.
*/
int (*brightness_set_sync)(struct led_classdev *led_cdev,
enum led_brightness brightness);
int (*brightness_set_blocking)(struct led_classdev *led_cdev,
enum led_brightness brightness);
/* Get LED brightness level */
enum led_brightness (*brightness_get)(struct led_classdev *led_cdev);

Expand Down

0 comments on commit 437a424

Please sign in to comment.