@@ -71,10 +71,6 @@ enum {
71
71
#define MT6360_STRBTO_STEPUS 32000
72
72
#define MT6360_STRBTO_MAXUS 2432000
73
73
74
- #define STATE_OFF 0
75
- #define STATE_KEEP 1
76
- #define STATE_ON 2
77
-
78
74
struct mt6360_led {
79
75
union {
80
76
struct led_classdev isnk ;
@@ -84,7 +80,7 @@ struct mt6360_led {
84
80
struct v4l2_flash * v4l2_flash ;
85
81
struct mt6360_priv * priv ;
86
82
u32 led_no ;
87
- u32 default_state ;
83
+ enum led_default_state default_state ;
88
84
};
89
85
90
86
struct mt6360_priv {
@@ -405,10 +401,10 @@ static int mt6360_isnk_init_default_state(struct mt6360_led *led)
405
401
level = LED_OFF ;
406
402
407
403
switch (led -> default_state ) {
408
- case STATE_ON :
404
+ case LEDS_DEFSTATE_ON :
409
405
led -> isnk .brightness = led -> isnk .max_brightness ;
410
406
break ;
411
- case STATE_KEEP :
407
+ case LEDS_DEFSTATE_KEEP :
412
408
led -> isnk .brightness = min (level , led -> isnk .max_brightness );
413
409
break ;
414
410
default :
@@ -443,10 +439,10 @@ static int mt6360_flash_init_default_state(struct mt6360_led *led)
443
439
level = LED_OFF ;
444
440
445
441
switch (led -> default_state ) {
446
- case STATE_ON :
442
+ case LEDS_DEFSTATE_ON :
447
443
flash -> led_cdev .brightness = flash -> led_cdev .max_brightness ;
448
444
break ;
449
- case STATE_KEEP :
445
+ case LEDS_DEFSTATE_KEEP :
450
446
flash -> led_cdev .brightness =
451
447
min (level , flash -> led_cdev .max_brightness );
452
448
break ;
@@ -760,25 +756,6 @@ static int mt6360_init_flash_properties(struct mt6360_led *led,
760
756
return 0 ;
761
757
}
762
758
763
- static int mt6360_init_common_properties (struct mt6360_led * led ,
764
- struct led_init_data * init_data )
765
- {
766
- const char * const states [] = { "off" , "keep" , "on" };
767
- const char * str ;
768
- int ret ;
769
-
770
- if (!fwnode_property_read_string (init_data -> fwnode ,
771
- "default-state" , & str )) {
772
- ret = match_string (states , ARRAY_SIZE (states ), str );
773
- if (ret < 0 )
774
- ret = STATE_OFF ;
775
-
776
- led -> default_state = ret ;
777
- }
778
-
779
- return 0 ;
780
- }
781
-
782
759
static void mt6360_v4l2_flash_release (struct mt6360_priv * priv )
783
760
{
784
761
int i ;
@@ -852,10 +829,7 @@ static int mt6360_led_probe(struct platform_device *pdev)
852
829
853
830
led -> led_no = reg ;
854
831
led -> priv = priv ;
855
-
856
- ret = mt6360_init_common_properties (led , & init_data );
857
- if (ret )
858
- goto out_flash_release ;
832
+ led -> default_state = led_init_default_state_get (child );
859
833
860
834
if (reg == MT6360_VIRTUAL_MULTICOLOR ||
861
835
reg <= MT6360_LED_ISNKML )
0 commit comments