From patchwork Sun May 16 04:09:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 439833 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1313jac; Sat, 15 May 2021 21:10:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5wOjviDCOGenAcaBpX1jfk4ipAmA6bSxmy6gc7ihzROPqy3/x8CZDFPAtL5dgJ9T6xymB X-Received: by 2002:a92:d844:: with SMTP id h4mr10231033ilq.215.1621138216659; Sat, 15 May 2021 21:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621138216; cv=none; d=google.com; s=arc-20160816; b=m0aLr/RZGYWh2V1d9kmxyVnVGSObwiZXsH+8s/46N6asd7zlmRPNtYqhLb0LUNM9Yj MKe215YK3g6zZ6/K8+htZxq99xghHwTlZ5rjVhdesQ7jTFdHKg9XIXbiH2mEbTpY2tXa aI6TazKLjL7J74Xf6z21kpsPQCdPNypkD5yElsh00U947HtP8tdaTgyuV5vLn1jeGcHe 0s2oUtZVQxj5whicyVUuS9bSssHjqyL1bcQUJJxRMqtCgNa3uW52lp4K/yAgRmNNCuO7 dJj8mD2Cngp6HlU9davH0cVvsqy0FKDt00j6W0EKLPZ7qEFtMBquO3DEPr7XeA9xabYv liBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=p+n8knY1AhNlxa/4+sSt2iV2/z4kOsoddvvQNZinhOI=; b=jz2xkrShyOB0BjeC8ppbMYuW4wiyTzc2OKevP4dW3wq4mVSe+DnYJZUZHSamybHaYR Cld5WXr2U06IAf8IFQ81CLxSdqLl9y98zEEhgpVUB7LLbuFK58o8T/Bt2Zu6Nd/95xok KErOTmwuU38V8Z2JlBd73yL4J9v1ZbU4CFmiCtm0mJuU451iJSxRmFNX/QlH3atKo0g6 X0KLzOYSd/DeLK6J/GVnZSd3JarKl9NsCV7cYyFHwGcB1puV945ClvqKcvbJlHqwWKe9 knXvbjJeoWnjK+nW8EAvq5Psuq2nxjUWsUlhSkaplYk98YBj/AAAGNYZZ6wy1cpCw4Jq /I3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dIQD4Jg5; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c25si12905208iob.45.2021.05.15.21.10.15; Sat, 15 May 2021 21:10:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dIQD4Jg5; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230147AbhEPEL0 (ORCPT + 4 others); Sun, 16 May 2021 00:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbhEPEL0 (ORCPT ); Sun, 16 May 2021 00:11:26 -0400 Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6166C061573 for ; Sat, 15 May 2021 21:10:11 -0700 (PDT) Received: by mail-ot1-x334.google.com with SMTP id i23-20020a9d68d70000b02902dc19ed4c15so2844562oto.0 for ; Sat, 15 May 2021 21:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=p+n8knY1AhNlxa/4+sSt2iV2/z4kOsoddvvQNZinhOI=; b=dIQD4Jg5OvVLbM85iRn9Wdb6zWoSJHOTRqfAMo16awQaPc84wIm5fJKmUMkeXyoWPC u1ZSvTuvXkR2KGo7JUt1vlxp4GAI8jhmfhVlzBYKDzujdi8XYqvs7GUPL7rHAWGLboDX WWOSm2IcE3WwKNS9Kg8qBCPxrUqu4uWTFfXApERU8Ba9Z6BN9Q6WsxMTPnxZw4RYq7X2 SBju5rpw82tNnKdPGS9EGUmi59yjTTvv+8xxpfHlXYs7uM3bwp148OobiJGIVGSsU2od 1uHzsfJRsMU1kUit2KRvozOCC9aq29AeWAbEaB5NLP7/m+jcDWF7JQ1Zch4ora2UHdLk XSdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=p+n8knY1AhNlxa/4+sSt2iV2/z4kOsoddvvQNZinhOI=; b=KzHIRToB5pWixFnnjylC4Dx092JmSRci/xMCXEalvWMGMwV2YGhMq6IKvIAylwQNnk 9Pks9FE5JPgFK7SxVdYhxaLGJSAqa+wEuqTZzbd7Bv92hf5x0VPgXjHipDGtA//H/QwQ RvVeHzKHKVcWba6kFzzRGDqwheXsoB2FCwPZnqpf2D8KYSSqmyoWsOLx8qEnd86HybaU 1gdx0FxZDlbZWwyP/QEnG6ZSf+s6VASrhDmwSmdEAqHf6aMlWgoINPHUKzkv6KqsUNiC TZvXmTkYFVFYhIXVIbAGD/oUNp41PFsD5lkWV5LxmY6kwkzf91CHprqc0+hSla2i7lCE UOFA== X-Gm-Message-State: AOAM5337l2as0/BqO3nvYXAcrMnkwlNY4A3vpbVIrJiJDOkrnxbJ9KDA vnewzN5TMfx06R1oHL2IxZ9kgQ== X-Received: by 2002:a9d:491:: with SMTP id 17mr45588270otm.184.1621138210984; Sat, 15 May 2021 21:10:10 -0700 (PDT) Received: from localhost.localdomain (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id r19sm2358369ooj.5.2021.05.15.21.10.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 21:10:10 -0700 (PDT) From: Bjorn Andersson To: Heikki Krogerus , Greg Kroah-Hartman , Benjamin Berg Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: typec: ucsi: Clear pending after acking connector change Date: Sat, 15 May 2021 21:09:53 -0700 Message-Id: <20210516040953.622409-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 --- drivers/usb/typec/ucsi/ucsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.29.2 Signed-off-by: Heikki Krogerus Acked-By: Benjamin Berg Reviewed-by: Heikki Krogerus 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;