From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Christian A. Ehrhardt" <lk@c--e.de>
Cc: linux-kernel@vger.kernel.org,
"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
stable@kernel.org,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Prashant Malani" <pmalani@chromium.org>,
"Jameson Thies" <jthies@google.com>,
"Abhishek Pandit-Subedi" <abhishekpandit@chromium.org>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Samuel Čavoj" <samuel@cavoj.net>,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: typec: ucsi: Fix connector check on init
Date: Wed, 3 Apr 2024 13:42:26 +0300 [thread overview]
Message-ID: <Zg0yksaQaGy+ZOaI@kuha.fi.intel.com> (raw)
In-Reply-To: <20240401210515.1902048-1-lk@c--e.de>
On Mon, Apr 01, 2024 at 11:05:15PM +0200, Christian A. Ehrhardt wrote:
> 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: 808a8b9e0b87 ("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>
> ---
> drivers/usb/typec/ucsi/ucsi.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index 31d8a46ae5e7..bd6ae92aa39e 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -1736,11 +1736,13 @@ static int ucsi_init(struct ucsi *ucsi)
> ucsi->connector = connector;
> ucsi->ntfy = ntfy;
>
> + mutex_lock(&ucsi->ppm_lock);
> ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci));
> + mutex_unlock(&ucsi->ppm_lock);
> if (ret)
> return ret;
> - if (UCSI_CCI_CONNECTOR(READ_ONCE(cci)))
> - ucsi_connector_change(ucsi, cci);
> + if (UCSI_CCI_CONNECTOR(cci))
> + ucsi_connector_change(ucsi, UCSI_CCI_CONNECTOR(cci));
>
> return 0;
>
> --
> 2.40.1
--
heikki
prev parent reply other threads:[~2024-04-03 10:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 21:05 Christian A. Ehrhardt
2024-04-03 10:42 ` Heikki Krogerus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zg0yksaQaGy+ZOaI@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=abhishekpandit@chromium.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jthies@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lk@c--e.de \
--cc=neil.armstrong@linaro.org \
--cc=pmalani@chromium.org \
--cc=samuel@cavoj.net \
--cc=stable@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®