summaryrefslogtreecommitdiff
path: root/chip/lm4
diff options
context:
space:
mode:
authorShamile Khan <shamile.khan@intel.com>2015-11-24 13:27:01 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-12-01 18:52:53 -0800
commitf748a7fbd5c72c659b60d772db1c3d398a746455 (patch)
tree92bc49f36b53b26ac1a91cec920200334b4c994c /chip/lm4
parent9167ce023260fa089e9aa741eb36902484c33154 (diff)
downloadchrome-ec-f748a7fbd5c72c659b60d772db1c3d398a746455.tar.gz
common: adc/i2c: Mark task_waiting volatile
When Link Time Optimization is turned on, functions that set task_waiting multiple times have one of the sets removed by the linker leading to undesired results. Marking task_waiting volatile alleviates this issue. BUG=chrome-os-partner:46063 TEST=Manually tested on Kunimitsu. Console command adc shows correct value of approx 20000 mV for VBUS. BRANCH=none Change-Id: I85a6e5c9688ae72c45d90fb58296f94b74a301aa Signed-off-by: Shamile Khan <shamile.khan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/314233 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/lm4')
-rw-r--r--chip/lm4/adc.c2
-rw-r--r--chip/lm4/i2c.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/chip/lm4/adc.c b/chip/lm4/adc.c
index 69338c61b0..40d5b3770d 100644
--- a/chip/lm4/adc.c
+++ b/chip/lm4/adc.c
@@ -21,7 +21,7 @@
/* Maximum time we allow for an ADC conversion */
#define ADC_TIMEOUT_US SECOND
-static task_id_t task_waiting_on_ss[LM4_ADC_SEQ_COUNT];
+static volatile task_id_t task_waiting_on_ss[LM4_ADC_SEQ_COUNT];
static void configure_gpio(void)
{
diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c
index 9f3db7426f..6f3efb700e 100644
--- a/chip/lm4/i2c.c
+++ b/chip/lm4/i2c.c
@@ -65,7 +65,7 @@ struct i2c_port_data {
uint32_t timeout_us; /* Transaction timeout, or 0 to use default */
/* Task waiting on port, or TASK_ID_INVALID if none. */
- int task_waiting;
+ volatile int task_waiting;
};
static struct i2c_port_data pdata[I2C_PORT_COUNT];