Skip to content

Commit ce4c8d2

Browse files
Christian A. Ehrhardtgregkh
authored andcommitted
usb: typec: ucsi: Fix connector check on init
Fix issues when initially checking for a connector change: - Use the correct connector number not the entire CCI. - Call ->read under the PPM lock. - Remove a bogus READ_ONCE. Fixes: 808a8b9 ("usb: typec: ucsi: Check for notifications after init") Cc: [email protected] Signed-off-by: Christian A. Ehrhardt <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3f03e77 commit ce4c8d2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/usb/typec/ucsi/ucsi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,11 +1736,13 @@ static int ucsi_init(struct ucsi *ucsi)
17361736
ucsi->connector = connector;
17371737
ucsi->ntfy = ntfy;
17381738

1739+
mutex_lock(&ucsi->ppm_lock);
17391740
ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci));
1741+
mutex_unlock(&ucsi->ppm_lock);
17401742
if (ret)
17411743
return ret;
1742-
if (UCSI_CCI_CONNECTOR(READ_ONCE(cci)))
1743-
ucsi_connector_change(ucsi, cci);
1744+
if (UCSI_CCI_CONNECTOR(cci))
1745+
ucsi_connector_change(ucsi, UCSI_CCI_CONNECTOR(cci));
17441746

17451747
return 0;
17461748

0 commit comments

Comments
 (0)