From 5fdf655b12f161f69b28e75f285a99f08a97d5f9 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Sun, 22 Jul 2012 12:24:14 -0700 Subject: Revert "i2c: Move host command processing into a function" This reverts commit b2772df970e422e7e31731d38813ee57635c8058 Dependent on reverted change. Change-Id: I353bc6826033c0681394f0c49701dd5678422a0c Reviewed-on: https://gerrit.chromium.org/gerrit/28137 Commit-Ready: Randall Spangler Reviewed-by: Randall Spangler Tested-by: Randall Spangler --- chip/stm32/i2c.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/chip/stm32/i2c.c b/chip/stm32/i2c.c index 31c5174c55..248eed7237 100644 --- a/chip/stm32/i2c.c +++ b/chip/stm32/i2c.c @@ -141,23 +141,6 @@ static void i2c_send_response(struct host_cmd_handler_args *args) i2c_write_raw(I2C2, host_buffer, out - host_buffer); } -/* Process the command in the i2c host buffer */ -static void i2c_process_command(void) -{ - /* we have an available command : execute it */ - host_cmd_args.command = host_buffer[0]; - host_cmd_args.result = EC_RES_SUCCESS; - host_cmd_args.send_response = i2c_send_response; - host_cmd_args.version = 0; - host_cmd_args.params = host_buffer + 1; - host_cmd_args.params_size = EC_HOST_PARAM_SIZE; - /* skip room for error code */ - host_cmd_args.response = host_buffer + 1; - host_cmd_args.response_max = EC_HOST_PARAM_SIZE; - host_cmd_args.response_size = 0; - host_command_received(&host_cmd_args); -} - static void i2c_event_handler(int port) { @@ -191,7 +174,19 @@ static void i2c_event_handler(int port) if (i2c_sr1[port] & (1 << 7)) { if (port == I2C2) { /* AP is waiting for EC response */ if (rx_index) { - i2c_process_command(); + /* we have an available command : execute it */ + host_cmd_args.command = host_buffer[0]; + host_cmd_args.result = EC_RES_SUCCESS; + host_cmd_args.send_response = + i2c_send_response; + host_cmd_args.version = 0; + host_cmd_args.params = host_buffer + 1; + host_cmd_args.params_size = EC_HOST_PARAM_SIZE; + /* skip room for error code */ + host_cmd_args.response = host_buffer + 1; + host_cmd_args.response_max = EC_HOST_PARAM_SIZE; + host_cmd_args.response_size = 0; + host_command_received(&host_cmd_args); /* reset host buffer after end of transfer */ rx_index = 0; } else { -- cgit v1.2.1