summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2015-02-04 11:28:15 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-04 23:32:42 +0000
commitf956dc46fc20df0036bbb9f281c2ee6060fce62c (patch)
tree5eec1a1d1ad8d9a98c776c294cd1b1444de2b808
parent19b6e5da2391bb7f75cf3aa29dddddfad75ff7c8 (diff)
downloadchrome-ec-f956dc46fc20df0036bbb9f281c2ee6060fce62c.tar.gz
smbus: Don't use shared memory buffer for word writes
This is a waste of code, since it trades off a 5-byte buffer for a 4-byte pointer. BUG=chrome-os-partner:36362 BRANCH=none TEST=make buildall -j Change-Id: I2b3336ba2c4804f2781592d2c939ae28e83c846b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/246180 Reviewed-by: Vic Yang <victoryang@chromium.org>
-rw-r--r--common/smbus.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/common/smbus.c b/common/smbus.c
index aea915f54e..ea7ece7d59 100644
--- a/common/smbus.c
+++ b/common/smbus.c
@@ -143,18 +143,13 @@ int smbus_write_word(uint8_t i2c_port, uint8_t slave_addr,
uint8_t smbus_cmd, uint16_t d16)
{
int rv;
- struct smbus_wr_word *s;
- rv = shared_mem_acquire(sizeof(struct smbus_wr_word), (char **)&s);
- if (rv) {
- CPRINTF("smbus write wd[%02X] mem error\n", smbus_cmd);
- return rv;
- }
- s->slave_addr = slave_addr,
- s->smbus_cmd = smbus_cmd;
- s->data[0] = d16 & 0xFF;
- s->data[1] = (d16 >> 8) & 0xFF;
- rv = smbus_if_write(i2c_port, (struct smbus_wr_if *)s, 0, 2, 1);
- shared_mem_release(s);
+ struct smbus_wr_word s;
+
+ s.slave_addr = slave_addr,
+ s.smbus_cmd = smbus_cmd;
+ s.data[0] = d16 & 0xFF;
+ s.data[1] = (d16 >> 8) & 0xFF;
+ rv = smbus_if_write(i2c_port, (struct smbus_wr_if *)&s, 0, 2, 1);
return rv;
}