File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -339,23 +339,23 @@ static int mt6323_led_set_dt_default(struct led_classdev *cdev,
339
339
struct device_node * np )
340
340
{
341
341
struct mt6323_led * led = container_of (cdev , struct mt6323_led , cdev );
342
- const char * state ;
342
+ enum led_default_state state ;
343
343
int ret = 0 ;
344
344
345
- state = of_get_property ( np , "default-state" , NULL );
346
- if (state ) {
347
- if (! strcmp ( state , "keep" )) {
348
- ret = mt6323_get_led_hw_brightness (cdev );
349
- if ( ret < 0 )
350
- return ret ;
351
- led -> current_brightness = ret ;
352
- ret = 0 ;
353
- } else if (! strcmp ( state , "on" )) {
354
- ret =
355
- mt6323_led_set_brightness ( cdev , cdev -> max_brightness ) ;
356
- } else {
357
- ret = mt6323_led_set_brightness ( cdev , LED_OFF );
358
- }
345
+ state = led_init_default_state_get ( of_fwnode_handle ( np ) );
346
+ switch (state ) {
347
+ case LEDS_DEFSTATE_ON :
348
+ ret = mt6323_led_set_brightness (cdev , cdev -> max_brightness );
349
+ break ;
350
+ case LEDS_DEFSTATE_KEEP :
351
+ ret = mt6323_get_led_hw_brightness ( cdev ) ;
352
+ if ( ret < 0 )
353
+ return ret ;
354
+ led -> current_brightness = ret ;
355
+ ret = 0 ;
356
+ break ;
357
+ default :
358
+ ret = mt6323_led_set_brightness ( cdev , LED_OFF );
359
359
}
360
360
361
361
return ret ;
You can’t perform that action at this time.
0 commit comments