From 793adf40240c93b49ab87dd04e94ab37ce594f3f Mon Sep 17 00:00:00 2001 From: Keith Short Date: Thu, 18 Nov 2021 16:54:54 -0700 Subject: i2c: Use declared initializers for i2c_ports: kukui boards Convert all instances of i2c_ports[] to use declared initializers. This allows the fields to be reordered without breaking code. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short Change-Id: I326bd6efef5cdfdf8bbd2c68dda268dca543b9d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3300185 Reviewed-by: Jack Rosenthal --- board/cerise/board.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'board/cerise') diff --git a/board/cerise/board.c b/board/cerise/board.c index 78ab8f6de8..4430d22533 100644 --- a/board/cerise/board.c +++ b/board/cerise/board.c @@ -67,13 +67,32 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /******************************************************************************/ /* I2C ports */ const struct i2c_port_t i2c_ports[] = { - {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA}, - {"other", 1, 100, GPIO_I2C2_SCL, GPIO_I2C2_SDA}, + { + .name = "typec", + .port = 0, + .kbps = 400, + .scl = GPIO_I2C1_SCL, + .sda = GPIO_I2C1_SDA + }, + { + .name = "other", + .port = 1, + .kbps = 100, + .scl = GPIO_I2C2_SCL, + .sda = GPIO_I2C2_SDA + }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct i2c_port_t i2c_bitbang_ports[] = { - {"battery", 2, 100, GPIO_I2C3_SCL, GPIO_I2C3_SDA, .drv = &bitbang_drv}, + { + .name = "battery", + .port = 2, + .kbps = 100, + .scl = GPIO_I2C3_SCL, + .sda = GPIO_I2C3_SDA, + .drv = &bitbang_drv + }, }; const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports); -- cgit v1.2.1