public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Christian A. Ehrhardt" <lk@c--e.de>
Cc: linux-kernel@vger.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, "Kenneth Crudup" <kenny@panix.com>
Subject: Re: [PATCH 1/5] usb: typec: ucsi: Clear EVENT_PENDING under PPM lock
Date: Fri, 22 Mar 2024 11:53:22 +0200	[thread overview]
Message-ID: <Zf1VEimCKdRIKPXQ@kuha.fi.intel.com> (raw)
In-Reply-To: <20240320073927.1641788-2-lk@c--e.de>

On Wed, Mar 20, 2024 at 08:39:22AM +0100, Christian A. Ehrhardt wrote:
> 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: c9aed03a0a68 ("usb: ucsi: Add missing ppm_lock")
> 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 | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index cf52cb34d285..8a6645ffd938 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -1215,11 +1215,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);
>  
> -- 
> 2.40.1

-- 
heikki

  reply	other threads:[~2024-03-22  9:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20  7:39 [PATCH 0/5] Fix various races in UCSI Christian A. Ehrhardt
2024-03-20  7:39 ` [PATCH 1/5] usb: typec: ucsi: Clear EVENT_PENDING under PPM lock Christian A. Ehrhardt
2024-03-22  9:53   ` Heikki Krogerus [this message]
2024-03-20  7:39 ` [PATCH 2/5] usb: typec: ucsi: Check for notifications after init Christian A. Ehrhardt
2024-03-22  9:54   ` Heikki Krogerus
2024-03-29 16:21   ` Dmitry Baryshkov
2024-04-01 20:11     ` Christian A. Ehrhardt
2024-03-20  7:39 ` [PATCH 3/5] usb: typec: ucsi: Ack unsupported commands Christian A. Ehrhardt
2024-03-22 10:04   ` Heikki Krogerus
2024-03-20  7:39 ` [PATCH 4/5] usb: typec: ucsi_acpi: Refactor and fix DELL quirk Christian A. Ehrhardt
2024-03-22 10:00   ` Heikki Krogerus
2024-03-20  7:39 ` [PATCH 5/5] usb: typec: ucsi: Clear UCSI_CCI_RESET_COMPLETE before reset Christian A. Ehrhardt
2024-03-22 10:06   ` Heikki Krogerus
2024-12-15 18:34   ` Sasha Levin
2024-12-16 21:47     ` Christian A. Ehrhardt
2024-12-17  4:24       ` Gopal, Saranya
2024-12-18 13:58         ` Gopal, Saranya
2025-01-19 13:23       ` Fedor Pchelkin
2025-01-22 21:11         ` Christian A. Ehrhardt
2025-01-28 13:58           ` Fedor Pchelkin
2025-01-28 14:04             ` Fedor Pchelkin
2024-03-20 10:53 ` [PATCH 0/5] Fix various races in UCSI Kenneth Crudup
2024-03-22 10:57   ` Neil Armstrong
2024-03-22 10:02 ` Heikki Krogerus

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=Zf1VEimCKdRIKPXQ@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=abhishekpandit@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jthies@google.com \
    --cc=kenny@panix.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=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