]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
platform/chrome: cros_ec_lpc - Use existing function to check EC result
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Mon, 22 Jun 2015 06:27:18 +0000 (08:27 +0200)
committerOlof Johansson <olof@lixom.net>
Wed, 7 Oct 2015 21:34:26 +0000 (14:34 -0700)
Commit 6db07b633658 ("mfd: cros_ec: Check result code from EC messages")
added a common cros_ec_check_result() function that can be used to check
the ec_msg->result for errors and warns about them.

Use the existing function instead of duplicating same check in the driver.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
drivers/platform/chrome/cros_ec_lpc.c

index bdd77ce45f0512494fa775dba51fc8655be1a8c4..ca7cdc6eef0b278bafda19d25202e45e41eb7e2b 100644 (file)
@@ -166,19 +166,9 @@ static int cros_ec_cmd_xfer_lpc(struct cros_ec_device *ec,
 
        /* Check result */
        msg->result = inb(EC_LPC_ADDR_HOST_DATA);
-
-       switch (msg->result) {
-       case EC_RES_SUCCESS:
-               break;
-       case EC_RES_IN_PROGRESS:
-               ret = -EAGAIN;
-               dev_dbg(ec->dev, "command 0x%02x in progress\n",
-                       msg->command);
+       ret = cros_ec_check_result(ec, msg);
+       if (ret)
                goto done;
-       default:
-               dev_dbg(ec->dev, "command 0x%02x returned %d\n",
-                       msg->command, msg->result);
-       }
 
        /* Read back args */
        args.flags = inb(EC_LPC_ADDR_HOST_ARGS);