Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3250976pxj; Mon, 7 Jun 2021 06:16:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziItJ3XsjDdGWD9aWVCv6HIInPzNd2wiDKI1qVLX5dl+KbJgMaZTNmHBBWoKExC7sk1eo6 X-Received: by 2002:aa7:d550:: with SMTP id u16mr19816704edr.72.1623071780036; Mon, 07 Jun 2021 06:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623071780; cv=none; d=google.com; s=arc-20160816; b=m+R4xzOWVRLn3GOnkH4ZC2OSGv8LyIrJxzpxXnTOyDa/aitwzyu5nMaErOslc7Cgil 6RaItQznPd66hgbSeN5NmzLj4Yum1dNMbjTW1izC30kv/acIbKIJuMrXCIG2l8t6mNBX +Ori7sEgUYtmTHGGuVPq2ut61HjcPyaRcG68wDGpe7QJ9ocdU3uHVBmUyduqG2edTRvN wKve4i79GUbDpJN5GoOqhyigPtv/PTrrdOPx50EvbiOYbyZSw3ElE7VsnJmkY67XV3NK Tp3iT2/+WKyx2oupJnTc2K631dlXB1Zjs5fCcf3FdeASGBXigUl0UU5WbTfkPIIOCAaP 6eTw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=mYjvQK48Xkjs/+1S/re4dT7CmKcXRS5XR9ecsG/eNRA=; b=BGReALJS0jPleck//z9rpwkIWfwAt40uqNIHhnjpj5+LLqdwRj0aq0/bnKbL9N5ULP WlnOfkjKr0xpTpXMDPvM/0PbcBoH93zFSuZkKPBkNnbhNE+rNiUDViRsnavGrKiYu/59 u00A01HTs8UV9ckiiyuSpJ6VENyVbj/OqGLhiiISxNxLSfQ/EcbcWUNIoADP/DM2j2JR F6mzURWpiPSl/oQZoUYKPuahBnJR8ihS55h7aE4fFtse0Na+I5ShB1RWnIAl+aGoGh4M 9M9xXGl1iW4At5ehgyS/7yQybkOE6FV1lsjluUMiiHBPSmQkyazLW524ITwcFsm40KLm upgg== 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 w22si13261581edi.259.2021.06.07.06.15.57; Mon, 07 Jun 2021 06:16:20 -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 S230264AbhFGNQO (ORCPT + 99 others); Mon, 7 Jun 2021 09:16:14 -0400 Received: from mga06.intel.com ([134.134.136.31]:17596 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230251AbhFGNQN (ORCPT ); Mon, 7 Jun 2021 09:16:13 -0400 IronPort-SDR: a3K+hAc73OG/NL63kfVXQB6Zz3sHE83JNv7U+coQlrBKWCTWh5RyEmCTMbLVHmw78B6tpRPG7x GIMg7Nh6gtLA== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="265773969" X-IronPort-AV: E=Sophos;i="5.83,255,1616482800"; d="scan'208";a="265773969" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2021 06:14:22 -0700 IronPort-SDR: o9mg1kFB2+hwleThD7WQw8LP9AsfAFCj7Ac5ibTq0UtEZQdBuQaGM+wNdb7XLq+nhOS2dKIAvj 9dUF+K2Xw5Zw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,255,1616482800"; d="scan'208";a="551881864" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 07 Jun 2021 06:14:20 -0700 From: Heikki Krogerus To: Benjamin Berg Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/7] usb: typec: ucsi: Always cancel the command if PPM reports BUSY condition Date: Mon, 7 Jun 2021 16:14:36 +0300 Message-Id: <20210607131442.20121-2-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210607131442.20121-1-heikki.krogerus@linux.intel.com> References: <20210607131442.20121-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes it possible to execute next command immediately after the busy condition. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/ucsi/ucsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 4e1973fbdf0dc..366c8a468bc18 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -128,8 +128,10 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd) if (ret) return ret; - if (cci & UCSI_CCI_BUSY) + if (cci & UCSI_CCI_BUSY) { + ucsi->ops->async_write(ucsi, UCSI_CANCEL, NULL, 0); return -EBUSY; + } if (!(cci & UCSI_CCI_COMMAND_COMPLETE)) return -EIO; -- 2.30.2