Skip to content

Commit

Permalink
usb: typec: ucsi: Clear EVENT_PENDING under PPM lock
Browse files Browse the repository at this point in the history
commit 15b2e71 upstream.

Suppose we sleep on the PPM lock after clearing the EVENT_PENDING
bit because the thread for another connector is executing a command.
In this case the command completion of the other command will still
report the connector change for our connector.

Clear the EVENT_PENDING bit under the PPM lock to avoid another
useless call to ucsi_handle_connector_change() in this case.

Fixes: c9aed03 ("usb: ucsi: Add missing ppm_lock")
Cc: stable <stable@kernel.org>
Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Link: https://lore.kernel.org/r/20240320073927.1641788-2-lk@c--e.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Christian A. Ehrhardt authored and gregkh committed Apr 3, 2024
1 parent 9a103ca commit d463304
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/typec/ucsi/ucsi.c
Expand Up @@ -933,11 +933,11 @@ static void ucsi_handle_connector_change(struct work_struct *work)
if (con->status.change & UCSI_CONSTAT_CAM_CHANGE)
ucsi_partner_task(con, ucsi_check_altmodes, 1, 0);

clear_bit(EVENT_PENDING, &con->ucsi->flags);

mutex_lock(&ucsi->ppm_lock);
clear_bit(EVENT_PENDING, &con->ucsi->flags);
ret = ucsi_acknowledge_connector_change(ucsi);
mutex_unlock(&ucsi->ppm_lock);

if (ret)
dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret);

Expand Down

0 comments on commit d463304

Please sign in to comment.