mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-11 11:55:28 +02:00
usb: typec: ucsi: Fix connector check on init
commitce4c8d2105
upstream. 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:808a8b9e0b
("usb: typec: ucsi: Check for notifications after init") Cc: stable@kernel.org Signed-off-by: Christian A. Ehrhardt <lk@c--e.de> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20240401210515.1902048-1-lk@c--e.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4184b7d854
commit
d5f0c5ea3f
|
@ -1457,11 +1457,13 @@ static int ucsi_init(struct ucsi *ucsi)
|
||||||
ucsi->connector = connector;
|
ucsi->connector = connector;
|
||||||
ucsi->ntfy = ntfy;
|
ucsi->ntfy = ntfy;
|
||||||
|
|
||||||
|
mutex_lock(&ucsi->ppm_lock);
|
||||||
ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci));
|
ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci));
|
||||||
|
mutex_unlock(&ucsi->ppm_lock);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
if (UCSI_CCI_CONNECTOR(READ_ONCE(cci)))
|
if (UCSI_CCI_CONNECTOR(cci))
|
||||||
ucsi_connector_change(ucsi, cci);
|
ucsi_connector_change(ucsi, UCSI_CCI_CONNECTOR(cci));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user