@@ -935,7 +935,9 @@ static void ucsi_handle_connector_change(struct work_struct *work)
clear_bit(EVENT_PENDING, &con->ucsi->flags);
+ mutex_lock(&ucsi->ppm_lock);
ret = ucsi_acknowledge_connector_change(ucsi);
+ mutex_unlock(&ucsi->ppm_lock);
if (ret)
dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret);
@@ -75,6 +75,8 @@ static int ucsi_acpi_sync_write(struct ucsi *ucsi, unsigned int offset,
struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
int ret;
+ WARN_ON(test_bit(COMMAND_PENDING, &ua->flags));
+
set_bit(COMMAND_PENDING, &ua->flags);
ret = ucsi_acpi_async_write(ucsi, offset, val, val_len);
Calling ->sync_write must be done while holding the PPM lock as the mailbox logic does not support concurrent commands. Add a missing lock around the only call to ucsi_acknowledge_connector_change. Additionally, warn in ucsi_acpi.c if a command is started while the COMMAND_PENDING bit is already set. Signed-off-by: Christian A. Ehrhardt <lk@c--e.de> --- drivers/usb/typec/ucsi/ucsi.c | 2 ++ drivers/usb/typec/ucsi/ucsi_acpi.c | 2 ++ 2 files changed, 4 insertions(+)