Commit 99cade83 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Lee Jones

leds: mt6323: Get rid of custom led_init_default_state_get()

LED core provides a helper to parse default state from firmware node.
Use it instead of custom implementation.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: default avatarLee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230103131256.33894-7-andriy.shevchenko@linux.intel.com
parent e41ff817
...@@ -339,23 +339,23 @@ static int mt6323_led_set_dt_default(struct led_classdev *cdev, ...@@ -339,23 +339,23 @@ static int mt6323_led_set_dt_default(struct led_classdev *cdev,
struct device_node *np) struct device_node *np)
{ {
struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev); struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev);
const char *state; enum led_default_state state;
int ret = 0; int ret = 0;
state = of_get_property(np, "default-state", NULL); state = led_init_default_state_get(of_fwnode_handle(np));
if (state) { switch (state) {
if (!strcmp(state, "keep")) { case LEDS_DEFSTATE_ON:
ret = mt6323_get_led_hw_brightness(cdev); ret = mt6323_led_set_brightness(cdev, cdev->max_brightness);
if (ret < 0) break;
return ret; case LEDS_DEFSTATE_KEEP:
led->current_brightness = ret; ret = mt6323_get_led_hw_brightness(cdev);
ret = 0; if (ret < 0)
} else if (!strcmp(state, "on")) { return ret;
ret = led->current_brightness = ret;
mt6323_led_set_brightness(cdev, cdev->max_brightness); ret = 0;
} else { break;
ret = mt6323_led_set_brightness(cdev, LED_OFF); default:
} ret = mt6323_led_set_brightness(cdev, LED_OFF);
} }
return ret; return ret;
......
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