From patchwork Tue Jun 25 14:54:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13711298 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8C82C2BBCA for ; Tue, 25 Jun 2024 14:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=JAfmKGbaHSRN3BDyb2Ps0ChAgC9WErixxC6u5jSyHcs=; b=gbe8O0X1bD4RnCnn5V6SFrL0as 1azbSwSB+z9+ZfQi65FMbZoyBU9ycBFLvBSNLGJ4fgP/J24VFc3dGDzZ4D34JCUtLDe82AwQP/BMZ nSvPCJtxk4xomQm3iJgsGra5U2ONiXbaOV9ER7JY8fAi9u6LJX5Q/BX/G3Ed7QEow/DMtjCSYY5ME fxRHh7xmjdLlwkxl2GoxoXfx0p0Phaiuc4NpoRUnBynkDL884KSzcuZBnN7eCrSw0mcsy4TWFN6cx UKyINsE+z49xCvNGuMgj/BJc028ir9UCQAJ5JZRteRM0u+6u/dYEqutZtdfEgJR/q5AqseZpEh9HI qnzb173w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM7ZA-00000003H0e-2kO4; Tue, 25 Jun 2024 14:54:40 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM7Z2-00000003GvQ-2Ry2 for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 14:54:34 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-52cd9f9505cso4608809e87.0 for ; Tue, 25 Jun 2024 07:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719327270; x=1719932070; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=JAfmKGbaHSRN3BDyb2Ps0ChAgC9WErixxC6u5jSyHcs=; b=u49abPHJDRgDyavZdVLfXJZsviRZSt53hHMoph5JCBQtsrWHWcZQxorj7nCu6YzVpT qetaAUdZMd5Lb3cE1pHi2QqUrKbyFvJEkgdqQi3fH5o34WTffKHCi8a1+dOG8vuvlKoO 0bkGGnAV3xUpREOoBwsTcg2Rz9VKqHtilzBE4O67kJnRhN7rAHbeyuk1ZtGOTFBbwiNS dL0m44jg7WSNa4fcPBs+9dn2oeouaqKZ5zM/mOmKawGkr9cyrMQaPdHrTrGT8RfU4vkK Kdr0e5+QXP4N5GV75Jz5BMuxLioZXnFqmEva7e56bHF09njILIAjWx19Y8K2Af+CafzR e62w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719327270; x=1719932070; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JAfmKGbaHSRN3BDyb2Ps0ChAgC9WErixxC6u5jSyHcs=; b=dtcz2WWozQIrpBqrZOR3W0LnqwjpbvkxyTD+nYYt9DgCktoWg/FmAsWa0yRj/oUH4x a6KRaHo5Gti+yPC9bsanMupVwIYBdOoKFwlsnVI6HmHJmFDJZsHPx57+HZjAQ7xkKQNE XPQmDTfyPqtNmT2o+pd5FruvIbDdL/aY1OYui0xplNZtG53cdmqzZv77UN6UgSMehj8I mYJvDRq/539KgeXlhfp1xnHhX0/PzxJZIgnTaj252dNrx/FX1tlZLKoKb9/+fcp13+Ur lkNpbvHoHWqneDLAkTpz9gaqbdhSpYD69yFi6y69XoobJsai3xU/9Ly1IndG0iYXRU1c ccRA== X-Forwarded-Encrypted: i=1; AJvYcCWntEO2ihDVd+BAXrqthqFezpCz/JWAod13OiK7vG0pOPmfxFsO5QlZUWtEGTNCKxTJdPXEI9q1tZ5lWh9kf7HXGfvZGQhDt6HI3ajdFYGzZKoFpWc= X-Gm-Message-State: AOJu0YxZeO8zkz1RyMFMDrPnszG7DNrvRgNicPv+XybZFYvklUmkIG9D esqAN8XAS2hyY1pCnuHUqGDHx4rQ1Ehv/IwtvbZTQOjaadY+VKwqMG5D/XrH36I= X-Google-Smtp-Source: AGHT+IGZFf/nSGa2e2d62pxL5I+qOFEUEnjG9EKzs41xvEO8rAlHlgWJuddbGqx0uxqUQDIYsbz3Rw== X-Received: by 2002:a05:6512:453:b0:52c:d943:300f with SMTP id 2adb3069b0e04-52cdf7f6705mr5392914e87.38.1719327270161; Tue, 25 Jun 2024 07:54:30 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd64328b7sm1251877e87.221.2024.06.25.07.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 07:54:29 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 25 Jun 2024 17:54:26 +0300 Subject: [PATCH v3 1/7] usb: typec: ucsi: move ucsi_acknowledge() from ucsi_read_error() MIME-Version: 1.0 Message-Id: <20240625-ucsi-rework-interface-v3-1-7a6c8e17be3a@linaro.org> References: <20240625-ucsi-rework-interface-v3-0-7a6c8e17be3a@linaro.org> In-Reply-To: <20240625-ucsi-rework-interface-v3-0-7a6c8e17be3a@linaro.org> To: Heikki Krogerus , Greg Kroah-Hartman , Maxime Coquelin , Alexandre Torgue Cc: Nikita Travkin , Neil Armstrong , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1294; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=E+vOJjv2UvdlrXvKnRgzVGWs8xl24PgUq84JxgbpN+M=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmetojmtp4D7cmDhXFyPFb6rzvpO9SqHUmDn68o x84cE4DSNWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnraIwAKCRCLPIo+Aiko 1dsqB/wKU/73Da/F7fXX3mKihmmgqnEt8z5DsYc/2Ek86sZ2QOVH5pcoOyQjGE2tEHJM1A460DU fniZ9SvZ17LHTf335zpqrqK1baAzCc7as/KU5FPsnsANZRV0di+AWzepIIFaNaN3bkEDgvyhGv3 D9plJZY56ZqgzDBYL4OkX/69YyQk2ndc/DcQOa6sbOSLN+5tjeH9gnPwh9coPGY9Cf2n3auuqJz 1jSXserA6xSdR0TK2kuorPqnD+k9K6yufTUWdeB5SNheTQwuDx4uTO2SUb42q1522ZwVKmxA7Bp KSyWF53xjvQ5qHB3NY1c+iU9Gf62IqbUUg5WbVjtBFRAZ1HM X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240625_075432_702527_26DFCF46 X-CRM114-Status: GOOD ( 11.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As a preparation for reworking UCSI command handling, move ucsi_acknowledge() for the failed command from ucsi_read_error() to ucsi_exec_command(). Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/ucsi/ucsi.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 76c48d873b2a..297d939e8da8 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -70,11 +70,6 @@ static int ucsi_read_error(struct ucsi *ucsi) u16 error; int ret; - /* Acknowledge the command that failed */ - ret = ucsi_acknowledge(ucsi, false); - if (ret) - return ret; - ret = ucsi_exec_command(ucsi, UCSI_GET_ERROR_STATUS); if (ret < 0) return ret; @@ -153,13 +148,14 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd) } if (cci & UCSI_CCI_ERROR) { - if (cmd == UCSI_GET_ERROR_STATUS) { - ret = ucsi_acknowledge(ucsi, false); - if (ret) - return ret; + /* Acknowledge the command that failed */ + ret = ucsi_acknowledge(ucsi, false); + if (ret) + return ret; + if (cmd == UCSI_GET_ERROR_STATUS) return -EIO; - } + return ucsi_read_error(ucsi); }