Skip to content

Commit 8c9b3ca

Browse files
anderssongregkh
authored andcommitted
usb: typec: ucsi: Clear pending after acking connector change
It's possible that the interrupt handler for the UCSI driver signals a connector changes after the handler clears the PENDING bit, but before it has sent the acknowledge request. The result is that the handler is invoked yet again, to ack the same connector change. At least some versions of the Qualcomm UCSI firmware will not handle the second - "spurious" - acknowledgment gracefully. So make sure to not clear the pending flag until the change is acknowledged. Any connector changes coming in after the acknowledgment, that would have the pending flag incorrectly cleared, would afaict be covered by the subsequent connector status check. Fixes: 217504a ("usb: typec: ucsi: Work around PPM losing change information") Cc: stable <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Acked-By: Benjamin Berg <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent acf5631 commit 8c9b3ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/typec/ucsi/ucsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,8 @@ static void ucsi_handle_connector_change(struct work_struct *work)
717717
ucsi_send_command(con->ucsi, command, NULL, 0);
718718

719719
/* 3. ACK connector change */
720-
clear_bit(EVENT_PENDING, &ucsi->flags);
721720
ret = ucsi_acknowledge_connector_change(ucsi);
721+
clear_bit(EVENT_PENDING, &ucsi->flags);
722722
if (ret) {
723723
dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret);
724724
goto out_unlock;

0 commit comments

Comments
 (0)