Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp189501pxu; Wed, 2 Dec 2020 19:22:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZOVVG1euIW8a3N9YB53za1frf3IJldgcVHoBN0dEfHuZIVMwlRzFYF/FqCkt9n3u+QwS0 X-Received: by 2002:a17:906:4944:: with SMTP id f4mr787547ejt.231.1606965746322; Wed, 02 Dec 2020 19:22:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606965746; cv=none; d=google.com; s=arc-20160816; b=GTadOrkc2tt9fZaVbE44eU8CPqwJGBIlO/YAfDKLI5Dkv9egVZ/EqWR4PJtX6lJITk lPfMixHa+bvG03tv2SwyBYeulPuyJHQtZxSVKm87/w2qNJQ3HhkYg1A/h96u1NXLmLVn AWDXGrytG2jTG+MUAs34A5VhMPDZ3dovskwpHDL5IXWBUh1I6opEqyFDCWwNvep4ze62 BEyhq6PC6s8ZKAKK5u4XUwrUxAV3XpAoEvBS8KNi7Nb1mfrX91cBR3BCn5HluFAdxuMm w3BkT5oujolyvOsVGrAvPIGNdKrbRasn+oVnKbsSVqg01X/x+gV4k3PPIMe+9AIHvgs4 Cjyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=aVI0c4MQz9foni25ng7Y69WIZ6p+uDOXMFX4qOhpuAk=; b=OYFtPtQATSz8Gq/7IIgTLOLANlXp+i8+0F/yH+WYQSzklhCEmsHw/g5wrwTHLv7RIA xNtjQzNZ1I2HgozY9Ann3auwWrdSQURi/cZDjITjX/YZ/o5KykClpwv+tu1qGvqhyUFg rIsZEPpncZDNbYTZ5VUFLWobWIieFMROVpe/Wow3YSDonjKfjOdpYNDR3fQMgB1z4rJa OLmwaI4cI3+Y0NjjRSZyoZDNido5dXP9KU03l100gY6JYw+tolAIja0GSiF04nJ03syt l1CkEyXHtyArKjHf/iMFZDzDJmWupwXJ6QZV1Y2OXTXBz/lBZabaeahzro8vGtElLOaO LWaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NkIn+mcN; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn23si167734edb.27.2020.12.02.19.22.03; Wed, 02 Dec 2020 19:22:26 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=NkIn+mcN; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729761AbgLCDTy (ORCPT + 99 others); Wed, 2 Dec 2020 22:19:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729751AbgLCDTy (ORCPT ); Wed, 2 Dec 2020 22:19:54 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D09ECC061A4E for ; Wed, 2 Dec 2020 19:19:13 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id 4so368512pla.6 for ; Wed, 02 Dec 2020 19:19:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=aVI0c4MQz9foni25ng7Y69WIZ6p+uDOXMFX4qOhpuAk=; b=NkIn+mcN47DbJuzIZJhgN3zy20b//ayDYIx0oyuIu3zBT6nac8suDDKbYAarCdyf0H 1xFhkmpTVt2l+TnGSXI/WMoF0/bjT1wN/3beiAsyE3zke5+XYD1ofDA2G2JQprAX0Iqc 7vjQnIiEyl1y1pHwUbEoMpfB10adu4kLIBtaejt337VPKwthcQfRdPzA1EaKgWMAxdws OANpPljB4DaUsgDh6r7rYFUdkAtD59z0qJcaNsvmbuCryUabecl/GWeomDB8RjkvUDDR Q8ti84ucd4GCGrbZ7/YxyaD6q5ZjpUUsJXCzmlB/09TeLXC9JXVbIm5Y0ZrxdV2V4YIk Kbug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=aVI0c4MQz9foni25ng7Y69WIZ6p+uDOXMFX4qOhpuAk=; b=jOtOCNGMX+joedsKDYwmfTSgL/LH+TnOO0/HWcZTkg4YdKvpxBemp+U1bS3VRkmWxx BeXZuIpVBQcRGbCsNq9KNDVEV/ByBXpIZJl6+YfvnikKMJxu+ITMJjgmN4tbexCiVJgl 2MpwAb3aRyxBKYMU4qY/o1Np15aNkeZeyWPQvWhG1qV73bFima9zluQv9oPG3/1V5Jcg o7yRL/prwHjrg50GYRdRwk0wIg2TSp2p6hWx+EAoo5O9rZviOUvwo8aRO1FmAIq8cK5n QKZSIROMLPbet7MGMTuSZYCxezj+WeKnIiFYzK/YN7tajez8IsHqclqJocQlWCMvr2YH KYQw== X-Gm-Message-State: AOAM531mNnF7R9awbNkC9Zmhy/EAu+7KXr7k6oKhLMSc6mGSemdDwVte uilAFO49FSCrRa/BdcqB7PaYIODmiIo= Sender: "badhri via sendgmr" X-Received: from badhri.mtv.corp.google.com ([2620:15c:211:201:f292:1cff:fee0:66cf]) (user=badhri job=sendgmr) by 2002:a17:90a:460a:: with SMTP id w10mr500462pjg.1.1606965552918; Wed, 02 Dec 2020 19:19:12 -0800 (PST) Date: Wed, 2 Dec 2020 19:19:08 -0800 Message-Id: <20201203031908.1491542-1-badhri@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog Subject: [PATCH v1] usb: typec: tcpm: Clear send_discover in tcpm_check_send_discover From: Badhri Jagan Sridharan To: Guenter Roeck , Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Badhri Jagan Sridharan Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tcpm_check_send_discover does not clear the send_discover flag when any of the following conditions are not met. 1. data_role is TYPEC_HOST 2. link is pd_capable Discovery indentity would anyways not be attempted during the current session anymore when the above conditions are not met. Hence clear the send_discover flag here to prevent tcpm_enable_frs_work from rescheduling indefinetly. Signed-off-by: Badhri Jagan Sridharan --- drivers/usb/typec/tcpm/tcpm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 3bbc1f10af49..012135ade7b1 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -3035,10 +3035,9 @@ static inline enum tcpm_state unattached_state(struct tcpm_port *port) static void tcpm_check_send_discover(struct tcpm_port *port) { if (port->data_role == TYPEC_HOST && port->send_discover && - port->pd_capable) { + port->pd_capable) tcpm_send_vdm(port, USB_SID_PD, CMD_DISCOVER_IDENT, NULL, 0); - port->send_discover = false; - } + port->send_discover = false; } static void tcpm_swap_complete(struct tcpm_port *port, int result) -- 2.29.2.576.ga3fc446d84-goog