Skip to content

Commit a7d2fa7

Browse files
lumaggregkh
authored andcommitted
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: Heikki Krogerus <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f7697db commit a7d2fa7

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

drivers/usb/typec/ucsi/ucsi.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ static int ucsi_read_error(struct ucsi *ucsi, u8 connector_num)
7171
u16 error;
7272
int ret;
7373

74-
/* Acknowledge the command that failed */
75-
ret = ucsi_acknowledge(ucsi, false);
76-
if (ret)
77-
return ret;
78-
7974
command = UCSI_GET_ERROR_STATUS | UCSI_CONNECTOR_NUMBER(connector_num);
8075
ret = ucsi_exec_command(ucsi, command);
8176
if (ret < 0)
@@ -182,13 +177,14 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd)
182177
}
183178

184179
if (cci & UCSI_CCI_ERROR) {
185-
if (cmd == UCSI_GET_ERROR_STATUS) {
186-
ret = ucsi_acknowledge(ucsi, false);
187-
if (ret)
188-
return ret;
180+
/* Acknowledge the command that failed */
181+
ret = ucsi_acknowledge(ucsi, false);
182+
if (ret)
183+
return ret;
189184

185+
if (cmd == UCSI_GET_ERROR_STATUS)
190186
return -EIO;
191-
}
187+
192188
return ucsi_read_error(ucsi, connector_num);
193189
}
194190

0 commit comments

Comments
 (0)