Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1674527pxj; Wed, 19 May 2021 11:10:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZqyHe/3u7Xckf5WPNCoMgLp/2jC0ytdqkjqvwkNLabzcNHSvueO013Sc43sfMpwS5WQ3v X-Received: by 2002:a02:a1dd:: with SMTP id o29mr233140jah.112.1621447842440; Wed, 19 May 2021 11:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621447842; cv=none; d=google.com; s=arc-20160816; b=zr25wZ1TRULqK5d33DEH26ZSRw0/gBUTow4FuQOGmSi1CqEEF1hsbAmG9+yIJYouE/ Bd76AC8IEIcxcRGgAE7XyrsoslnGrx0/ZD6DRYZnUwlfkyu5qEcssql3eTGGfGuKcqRZ fL3mi1bfmc5Rf9vu1RFKsvzEGi9r7b6UkL3cS6GJuaaXJuwaSPT0t0sa2eaKFE/jcQt8 T4QbnWcpRuLQvBgpWbT4wNmFXHuA2adb93Xcm15PzILbSYMAc4GVgxffxwZD2d/wjrCP ooyYGDJMxPIdgS6R2sVN3tHM86R/cFNwMMm4xYxF0VcV30DSEDpZb1ds7RdG+C4ZWFEA 72UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=UeDDTNLde1hpQ9dJYOE1/22aY5fGwuoMUakV5YZfEyc=; b=VsOcpdFQgXLNg5bhN8U6xCnSPhfZkKYxEJqs0pWqlSGQJIKMdFG9KkHvMokN/zCahA VFKeeWfdRr5PVAHcIjz2WgYS6rmhZc8ewok4cgxe+/i7WKZt8vrL7wE29wjV8A1KdGV1 lLq6hWH412dkJmmif8NdbfLKvm2umbvNg8yEfse8+lLxN4dbyuNj5HMsIy19d9GyKntA MBjFh7Bpwu+6In0iKlvH3zPGHZO72JOVEPva0yfgmU/wBsqgrlB5y3e74adBcqtKg3eQ 3IfFUKpTxqI64gc+y9cviAnjtV2t9jWSIkNzrN3YA1nGeoxxnVM/l6RLZNhFGVh48YlD 3/Xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i17si4832345iog.70.2021.05.19.11.10.30; Wed, 19 May 2021 11:10:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244341AbhERNXB (ORCPT + 99 others); Tue, 18 May 2021 09:23:01 -0400 Received: from mga09.intel.com ([134.134.136.24]:19852 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239145AbhERNXA (ORCPT ); Tue, 18 May 2021 09:23:00 -0400 IronPort-SDR: 23vcItRAxiDb891lccTU+SugZV76QngrXwMHEJX88s+uqJj1GNvyjyy2wOr4dxmNXtrb+Gh7H6 zSieIi4+AfVg== X-IronPort-AV: E=McAfee;i="6200,9189,9987"; a="200757601" X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="200757601" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 06:21:41 -0700 IronPort-SDR: 4bGDGseiObzXiKwHJf1DPK6x64dFnfXh/xvr7Wy75qwv4McYR4hcfrNR98GPwPdnwByyK9uMbH YruVNPhhvHiA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="541970157" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 18 May 2021 06:21:38 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 18 May 2021 16:21:37 +0300 Date: Tue, 18 May 2021 16:21:37 +0300 From: Heikki Krogerus To: Bjorn Andersson Cc: Greg Kroah-Hartman , Benjamin Berg , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: typec: ucsi: Clear pending after acking connector change Message-ID: References: <20210516040953.622409-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210516040953.622409-1-bjorn.andersson@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 15, 2021 at 09:09:53PM -0700, Bjorn Andersson wrote: > It's possible that the interrupt handler for the UCSI driver signals a > connector changes after the handler clears the PENDING bit, but before > it has sent the acknowledge request. The result is that the handler is > invoked yet again, to ack the same connector change. > > At least some versions of the Qualcomm UCSI firmware will not handle the > second - "spurious" - acknowledgment gracefully. So make sure to not > clear the pending flag until the change is acknowledged. > > Any connector changes coming in after the acknowledgment, that would > have the pending flag incorrectly cleared, would afaict be covered by > the subsequent connector status check. > > Fixes: 217504a05532 ("usb: typec: ucsi: Work around PPM losing change information") > Signed-off-by: Bjorn Andersson Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/ucsi/ucsi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c > index 282c3c825c13..f451ce0132a9 100644 > --- a/drivers/usb/typec/ucsi/ucsi.c > +++ b/drivers/usb/typec/ucsi/ucsi.c > @@ -694,8 +694,8 @@ static void ucsi_handle_connector_change(struct work_struct *work) > ucsi_send_command(con->ucsi, command, NULL, 0); > > /* 3. ACK connector change */ > - clear_bit(EVENT_PENDING, &ucsi->flags); > ret = ucsi_acknowledge_connector_change(ucsi); > + clear_bit(EVENT_PENDING, &ucsi->flags); > if (ret) { > dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret); > goto out_unlock; > -- > 2.29.2 -- heikki