Commit a7d2fa77 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Greg Kroah-Hartman

usb: typec: ucsi: move ucsi_acknowledge() from ucsi_read_error()

As a preparation for reworking UCSI command handling, move
ucsi_acknowledge() for the failed command from ucsi_read_error() to
ucsi_exec_command().
Tested-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20240627-ucsi-rework-interface-v4-1-289ddc6874c7@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f7697db8
...@@ -71,11 +71,6 @@ static int ucsi_read_error(struct ucsi *ucsi, u8 connector_num) ...@@ -71,11 +71,6 @@ static int ucsi_read_error(struct ucsi *ucsi, u8 connector_num)
u16 error; u16 error;
int ret; int ret;
/* Acknowledge the command that failed */
ret = ucsi_acknowledge(ucsi, false);
if (ret)
return ret;
command = UCSI_GET_ERROR_STATUS | UCSI_CONNECTOR_NUMBER(connector_num); command = UCSI_GET_ERROR_STATUS | UCSI_CONNECTOR_NUMBER(connector_num);
ret = ucsi_exec_command(ucsi, command); ret = ucsi_exec_command(ucsi, command);
if (ret < 0) if (ret < 0)
...@@ -182,13 +177,14 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd) ...@@ -182,13 +177,14 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd)
} }
if (cci & UCSI_CCI_ERROR) { if (cci & UCSI_CCI_ERROR) {
if (cmd == UCSI_GET_ERROR_STATUS) { /* Acknowledge the command that failed */
ret = ucsi_acknowledge(ucsi, false); ret = ucsi_acknowledge(ucsi, false);
if (ret) if (ret)
return ret; return ret;
if (cmd == UCSI_GET_ERROR_STATUS)
return -EIO; return -EIO;
}
return ucsi_read_error(ucsi, connector_num); return ucsi_read_error(ucsi, connector_num);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment