Skip to content

Commit a17d9e7

Browse files
innovaralag-linaro
authored andcommitted
leds: leds-st1202: Initialize hardware before DT node child operations
Arguably, there are more chances of errors occurring during the initialization of the hardware, so this should complete successfully before the devicetree node's children are initialized. st1202_dt_init() fills the led_classdev struct. st1202_setup() initializes the hardware. Specifically, resets the chip, enables its phase-shift delay feature, enables the device and disables all the LEDs channels. All that writing to registers, with no input from st1202_dt_init(). Real-world testing corroborates that calling st1202_setup() before st1202_dt_init() doesn't cause any issue during initialization. Switch the order of st1202_dt_init() and st1202_setup() to ensure the hardware is correctly initialized before the led_classdev struct is filled. Signed-off-by: Manuel Fombuena <[email protected]> Link: https://lore.kernel.org/r/CWLP123MB54731877A8DC54EDD33F0229C5C22@CWLP123MB5473.GBRP123.PROD.OUTLOOK.COM Signed-off-by: Lee Jones <[email protected]>
1 parent 6d91124 commit a17d9e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/leds/leds-st1202.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,11 @@ static int st1202_probe(struct i2c_client *client)
360360
return ret;
361361
chip->client = client;
362362

363-
ret = st1202_dt_init(chip);
363+
ret = st1202_setup(chip);
364364
if (ret < 0)
365365
return ret;
366366

367-
ret = st1202_setup(chip);
367+
ret = st1202_dt_init(chip);
368368
if (ret < 0)
369369
return ret;
370370

0 commit comments

Comments
 (0)