From 38cf4fccfbd01235979641dfe4ee67da7b60fbdb Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Tue, 4 Oct 2016 17:04:30 -0700 Subject: [PATCH] npcx: i2c: Remove needless controller state pre-check We're now locking i2c at the controller (not port) level, so it's not necessary to check if a given controller is busy before doing an i2c transaction. BUG=None TEST=Manual on kevin, verify i2c is still functional. BRANCH=gru Signed-off-by: Shawn Nematbakhsh Change-Id: Ic0cda34f9a58c76083699990a0dc3e761bcdec4f Reviewed-on: https://chromium-review.googlesource.com/393107 Reviewed-by: Aseda Aboagye Reviewed-by: Mulin Chao (cherry picked from commit 7d2e2f565b79a035a270ca083af97c6a14983739) Reviewed-on: https://chromium-review.googlesource.com/396138 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Shawn N --- chip/npcx/i2c.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/chip/npcx/i2c.c b/chip/npcx/i2c.c index 7598fd8b02..993b3565e4 100644 --- a/chip/npcx/i2c.c +++ b/chip/npcx/i2c.c @@ -79,7 +79,7 @@ enum smb_oper_state_t { }; /* IRQ for each port */ -const uint32_t i2c_irqs[I2C_CONTROLLER_COUNT] = { +static const uint32_t i2c_irqs[I2C_CONTROLLER_COUNT] = { NPCX_IRQ_SMB1, NPCX_IRQ_SMB2, NPCX_IRQ_SMB3, NPCX_IRQ_SMB4}; BUILD_ASSERT(ARRAY_SIZE(i2c_irqs) == I2C_CONTROLLER_COUNT); @@ -616,16 +616,8 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size, p_status = i2c_stsobjs + ctrl; - interrupt_disable(); - /* make sure bus is not occupied by the other task */ - if (p_status->task_waiting != TASK_ID_INVALID) { - interrupt_enable(); - return EC_ERROR_BUSY; - } - /* Assign current task ID */ p_status->task_waiting = task_get_current(); - interrupt_enable(); /* Select port for multi-ports i2c controller */ i2c_select_port(port);