[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zf1VEimCKdRIKPXQ@kuha.fi.intel.com>
Date: Fri, 22 Mar 2024 11:53:22 +0200
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: "Christian A. Ehrhardt" <lk@...e.de>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Prashant Malani <pmalani@...omium.org>,
Jameson Thies <jthies@...gle.com>,
Abhishek Pandit-Subedi <abhishekpandit@...omium.org>,
Neil Armstrong <neil.armstrong@...aro.org>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Samuel Čavoj <samuel@...oj.net>,
linux-usb@...r.kernel.org, Kenneth Crudup <kenny@...ix.com>
Subject: Re: [PATCH 1/5] usb: typec: ucsi: Clear EVENT_PENDING under PPM lock
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@...e.de>
Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.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
Powered by blists - more mailing lists