Commit 437a4240 authored by Jacek Anaszewski's avatar Jacek Anaszewski

leds: Rename brightness_set_sync op to brightness_set_blocking

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: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
Acked-by: default avatarAndrew Lunn <andrew@lunn.ch>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
parent f1e80c07
...@@ -298,7 +298,7 @@ int led_classdev_flash_register(struct device *parent, ...@@ -298,7 +298,7 @@ int led_classdev_flash_register(struct device *parent,
led_cdev = &fled_cdev->led_cdev; led_cdev = &fled_cdev->led_cdev;
if (led_cdev->flags & LED_DEV_CAP_FLASH) { if (led_cdev->flags & LED_DEV_CAP_FLASH) {
if (!led_cdev->brightness_set_sync) if (!led_cdev->brightness_set_blocking)
return -EINVAL; return -EINVAL;
ops = fled_cdev->ops; ops = fled_cdev->ops;
......
...@@ -510,7 +510,7 @@ static int aat1290_led_probe(struct platform_device *pdev) ...@@ -510,7 +510,7 @@ static int aat1290_led_probe(struct platform_device *pdev)
/* Initialize LED Flash class device */ /* Initialize LED Flash class device */
led_cdev->brightness_set = aat1290_led_brightness_set; 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->max_brightness = led_cfg.max_brightness;
led_cdev->flags |= LED_DEV_CAP_FLASH; led_cdev->flags |= LED_DEV_CAP_FLASH;
INIT_WORK(&led->work_brightness_set, aat1290_brightness_set_work); INIT_WORK(&led->work_brightness_set, aat1290_brightness_set_work);
......
...@@ -382,7 +382,7 @@ static int ktd2692_probe(struct platform_device *pdev) ...@@ -382,7 +382,7 @@ static int ktd2692_probe(struct platform_device *pdev)
led_cdev->max_brightness = led_cfg.max_brightness; led_cdev->max_brightness = led_cfg.max_brightness;
led_cdev->brightness_set = ktd2692_led_brightness_set; 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; led_cdev->flags |= LED_CORE_SUSPENDRESUME | LED_DEV_CAP_FLASH;
mutex_init(&led->lock); mutex_init(&led->lock);
......
...@@ -932,7 +932,7 @@ static void max77693_init_fled_cdev(struct max77693_sub_led *sub_led, ...@@ -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->name = led_cfg->label[fled_id];
led_cdev->brightness_set = max77693_led_brightness_set; 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_cdev->max_brightness = (led->iout_joint ?
led_cfg->iout_torch_max[FLED1] + led_cfg->iout_torch_max[FLED1] +
led_cfg->iout_torch_max[FLED2] : led_cfg->iout_torch_max[FLED2] :
......
...@@ -34,7 +34,7 @@ static inline int led_set_brightness_sync(struct led_classdev *led_cdev, ...@@ -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); led_cdev->brightness = min(value, led_cdev->max_brightness);
if (!(led_cdev->flags & LED_SUSPENDED)) 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); led_cdev->brightness);
return ret; return ret;
} }
......
...@@ -59,7 +59,7 @@ struct led_classdev { ...@@ -59,7 +59,7 @@ struct led_classdev {
* Set LED brightness level immediately - it can block the caller for * Set LED brightness level immediately - it can block the caller for
* the time required for accessing a LED device register. * the time required for accessing a LED device register.
*/ */
int (*brightness_set_sync)(struct led_classdev *led_cdev, int (*brightness_set_blocking)(struct led_classdev *led_cdev,
enum led_brightness brightness); enum led_brightness brightness);
/* Get LED brightness level */ /* Get LED brightness level */
enum led_brightness (*brightness_get)(struct led_classdev *led_cdev); enum led_brightness (*brightness_get)(struct led_classdev *led_cdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment