summaryrefslogtreecommitdiff
path: root/common/i2c_controller.c
diff options
context:
space:
mode:
authorPatryk Duda <pdk@semihalf.com>2021-06-16 09:56:56 +0000
committerCommit Bot <commit-bot@chromium.org>2021-06-17 11:04:48 +0000
commit2219c2267a301978877fd17f5e60ed850bf7956d (patch)
tree721e2a7ba3caffe0b37250bf335b1cee85e7afd9 /common/i2c_controller.c
parentf767b8ebaa0b304aa79167c2407d1d1fc5618c63 (diff)
downloadchrome-ec-2219c2267a301978877fd17f5e60ed850bf7956d.tar.gz
Fix compilation issues with nocturne SDK
Compiler in nocturne cros SDK doesn't allow for variable declaration inside for loop. This patch removes variable declaration inside for loop in code which is used by nocturne board. This patch doesn't introduce any logical changes. BUG=b:160676144 BRANCH=none TEST=Make sure EC points to commit on cros/main. On nocturne SDK: cros_workon-nocturne start chromeos-ec emerge-nocturne chromeos-ec chromeos-bootimage Make sure that firmware compiles Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I75ff21d966d5e353d1f7873695127bac4357fb32 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2965922 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
Diffstat (limited to 'common/i2c_controller.c')
-rw-r--r--common/i2c_controller.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/i2c_controller.c b/common/i2c_controller.c
index e2fa3ec28f..09eb255a22 100644
--- a/common/i2c_controller.c
+++ b/common/i2c_controller.c
@@ -152,7 +152,9 @@ static int i2c_xfer_no_retry(const int port,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
- for (int offset = 0; offset < out_size; ) {
+ int offset;
+
+ for (offset = 0; offset < out_size; ) {
int chunk_size = MIN(out_size - offset,
CONFIG_I2C_CHIP_MAX_TRANSFER_SIZE);
int out_flags = 0;
@@ -167,7 +169,7 @@ static int i2c_xfer_no_retry(const int port,
out_flags));
offset += chunk_size;
}
- for (int offset = 0; offset < in_size; ) {
+ for (offset = 0; offset < in_size; ) {
int chunk_size = MIN(in_size - offset,
CONFIG_I2C_CHIP_MAX_TRANSFER_SIZE);
int in_flags = 0;