From patchwork Thu Jun 27 14:44:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13714505 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 CB1ABC3064D for ; Thu, 27 Jun 2024 14:45:17 +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=gWQEDBR2cvKHd61KPN3Oc0zu2avyS++NhmAlrTQ8dMU=; b=ruh2PjUvxS4mQrP5rf/rJYD4aC lKfO4a3XuTVPwtpLihJ9FEz5n8LVbCXyx/vwnkeB8Ke+o9ZqZ/S5EwHK7PLEOUEiKM3ZZ2B3w3lFR dLHuaZ0nFuwnZHvnBVMJsViLemVexIo8DDwXepLL/kbMWrsoidNB4xBHmc8bGB6G636h6uOzmTfuy peXuDmTHk+axwNwyzhRD4GambGSP6dmN60GJraQ84Gtw5+/RfUTQPnmktj3bn7ZW+GUCtS9ymR3WF fI64faPeDT6Y3XLYzaWSNfEWcRObzcVUTFQ6fce0Gyr7hskFKlUljjIJNBD5xhDYYGCtKOyig0CqY dTRLe0FA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMqN2-0000000AgSR-0zWV; Thu, 27 Jun 2024 14:45:08 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMqMn-0000000AgLi-2qHn for linux-arm-kernel@lists.infradead.org; Thu, 27 Jun 2024 14:44:56 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2eaafda3b5cso81727291fa.3 for ; Thu, 27 Jun 2024 07:44:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719499484; x=1720104284; 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=gWQEDBR2cvKHd61KPN3Oc0zu2avyS++NhmAlrTQ8dMU=; b=qWLhM0HA+4Zx49Z+1riWWJkE0GevNydYg8MwwiBRsEHJev0VzELtdzJPPLsRzsJt3c npBBdOhnZUd1ZcWNQ4HqEDnRcWWRPkJ0uq2Sv3oPqy5yYoYiOaxI6jS/xFLsHJDC6wYG oqJ/FeFLQDfHISGshB1lE78nnitVrgo8hIq0E2BWG7EhS/RLaD4SxiBtgmmdwkgxonXm HSfAEuiHICn+4zgQ97p6BL5RVmb0lRqaKFIhP5WVgD3k2wh6HwRY9tzIhBgMQ5AR6fus kcPcDZ+2xjX8sgYfz7IXl4BYRvSnRAxJ6r0VYJUNBiU7CbGkkzfiZbYBkdFUKqUlMgeS 5TGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719499484; x=1720104284; 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=gWQEDBR2cvKHd61KPN3Oc0zu2avyS++NhmAlrTQ8dMU=; b=ubFQdzEWc6TtXts38HB+X7Pnfgtkx/xbDf+xHVXyAKadyM6D8jEPWhmsYxLaPgYdJb vCQb13o4/9gsPEliu6Y5StlYQlEpwIIf4a+IFtByKjpTsKS2kNiHgPJT32uR89WFMqtb vw+1ppr/u6RBSdU/TEC+5c8eeVmD+AEDeQ2K71jl6A2tGcow4RYs/RzrtmNU2Ix4dcrD 2Tib3qedTJu+NH+dClYXe5nyVyYClRIrfc4jJJdqKMVUgA8vcUAw4YqMBNStH49ea/qk xGQkm/Gy1v2xj+MOOrWnDjTJNEZDGdhtqlWtFMw6CfjmNKOqqRWb2qxrSBotMwdo58Di tf2A== X-Forwarded-Encrypted: i=1; AJvYcCXEHjgA1hhTelgkdVydr7MFDIRG7zsQj/yfsL4EBZh862IQkrJszmYYCvCZe2Z4wY0wyMOHuo07kIxS2MDQqMpaoxsFGF/N0HV4kIUdxBwb2hkdV1c= X-Gm-Message-State: AOJu0YxdPyXBkP3rMxMUMabfIKNdpEwXvm/5pDoO9DxTHNym1MbNp7ws DMCRnw6HjjrUM/oAKL/cQrTXN9pJ2gRIfaiTeLG8UUxPfzK6hhBcTEwdkznQ/YE= X-Google-Smtp-Source: AGHT+IF8lRY4yxVYxkR4RRTjf0SHogAEtg76W/F0NnLyvHUeyA8JM9QhKMO2Pbyo9TObJ219yDtmqA== X-Received: by 2002:a2e:9d81:0:b0:2ec:57ff:92c7 with SMTP id 38308e7fff4ca-2ec593d8613mr85645941fa.14.1719499483920; Thu, 27 Jun 2024 07:44:43 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ee4a34447fsm2775911fa.11.2024.06.27.07.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 07:44:43 -0700 (PDT) From: Dmitry Baryshkov Date: Thu, 27 Jun 2024 17:44:40 +0300 Subject: [PATCH v4 1/7] usb: typec: ucsi: move ucsi_acknowledge() from ucsi_read_error() MIME-Version: 1.0 Message-Id: <20240627-ucsi-rework-interface-v4-1-289ddc6874c7@linaro.org> References: <20240627-ucsi-rework-interface-v4-0-289ddc6874c7@linaro.org> In-Reply-To: <20240627-ucsi-rework-interface-v4-0-289ddc6874c7@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=1498; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=RCY/4C0+GrYFBzSYId6jLzfsNK5WXotKJnVh4nnnjG0=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmfXrZ1Gmvzxm4i0ZRKQCtxunw01G50Fjio700n 1wqd1wu/bqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZn162QAKCRCLPIo+Aiko 1eSUB/0RSAnq/bhc3trWD1uYPal7bW48CKzEDX0qEHMDzyjk1GJlHlUnP0d00i2vy8nmi4Y1sGn JAiSOJ/lwWBwJjTPJX+SM9WsqCMpMe+OhNP0pqyWhqupbTGR/xgmDHGDJN2LlgU/i9TwEYv+syQ JtwlhKuXilFvwSmQC0JHXxvdRzCHZ6YbtmckLEsqLLKsM8LmjI52G/ak/FSYcgemaKyXQs/iinQ bGgfFtTdVreI1ds55pjr1dCQ02q4k0RWJlgpVVqNAa43/P04n3jC5shcezrTu99ROP34Y0ORwxe +6Z9pQxIEgaq8/bd0vT5Eeas2kReYuVdzwWPirdh2qdhBySr 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-20240627_074453_825381_671CDF1A X-CRM114-Status: GOOD ( 11.48 ) 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(). Tested-by: Heikki Krogerus Reviewed-by: Heikki Krogerus 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 59eaa49042f4..651c22473472 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -71,11 +71,6 @@ static int ucsi_read_error(struct ucsi *ucsi, u8 connector_num) u16 error; int ret; - /* Acknowledge the command that failed */ - ret = ucsi_acknowledge(ucsi, false); - if (ret) - return ret; - command = UCSI_GET_ERROR_STATUS | UCSI_CONNECTOR_NUMBER(connector_num); ret = ucsi_exec_command(ucsi, command); if (ret < 0) @@ -182,13 +177,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, connector_num); }