From patchwork Thu Jun 20 22:55:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13706464 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 D9D01C27C79 for ; Thu, 20 Jun 2024 22:55:44 +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=59oHXNpi12pYEsSfaS8SpC7edflQWBXEOYjnnm2ogho=; b=Jr9luzN/lKkcSW4f9n1JsHXGnI 2sHGtVokqFIWSZsxbb8Y0Je3nX2a250Oi8KGURmZnq02ZRXq/rKUzhoCFOkW691NgkR596kUgA7Yi c6gTTcE8+nHv9snPrlnnN2zZyBFQFX8u51BC4H2JpQqZ8Utq3Yi0Brnu7/p0wQKMA97CKX2kOr1aY wBuxKKDcnETor0DRePYPb7jiQdqyFUtqk7EZHU/w1GW1+6fpY43HkUecuPvq+vd1iA4RT7EIXQ2CC y9sIsqh9BI4gUg/RAkzb2IGYMbK4s/mpyaehZtXv1+IX8hf/E5SJT5zb3BflXFTP8p6hCSRWSgne+ OWi5swMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKQgl-000000070mO-2gv5; Thu, 20 Jun 2024 22:55:31 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKQgf-000000070hP-2JzJ for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2024 22:55:27 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2e724bc466fso15616811fa.3 for ; Thu, 20 Jun 2024 15:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718924124; x=1719528924; 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=59oHXNpi12pYEsSfaS8SpC7edflQWBXEOYjnnm2ogho=; b=z5VPSz9bxvpQCMDTs2gKP95HyT+y0EkK9s/HhdUV86gxp03FXRtf+ntUSI3AA6bpEQ xueCjtHpzH1857z/woQIL7ZRbNkcQ3CEx+YpRZDe9XHRzG3e0Y5z8O8D7tbXH4RLXb/T 87Ae9ofvO698jkJdNzAcJiSQWPkssriFKRgufFdroKuDMLMaWM3d5rLHanfvjnn/g5ST BqFF9xksrN7Y2qzyByphWX5zPR/aCd/U7Tf8dIm49dhCcl44SGyNot3DLE7EiDrPI2Tb cYz0cGRBDKDgTdRNhhOciNyNYsBBPFFYAt6KWoXrTOdPh7RtaUPoAbE+gyrjPCL3/Wbb sH1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718924124; x=1719528924; 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=59oHXNpi12pYEsSfaS8SpC7edflQWBXEOYjnnm2ogho=; b=Gcvs28+MfYHuB5Uvq0j9TXH4XizxVyMTfsuSrnWHhuJwF4OE3jNHn9hJgpWA3JF3bg Yr+r11mvQfQ9Pfwp3cR8Bi0boW1OcnEyZ+WSuZ40HdzEeq8cdqmIkUlXG6iDd5IY75qa ARBeM5lXaSZA2BWfy385Z6qqia7//vYth4MeMv+cT7k4Pe4tzdRYTL8omB5NKtBjhxK2 7IxUVTzw6jQ6ox3CsERKTXQL7w19eCjynbUMNaNE1pw7GDq9GwhUNBf/p01V3DkCji5R 6iWZpZaMMcmseaL5znkHdJPk2dD06eTWcsEDswd0smfqdgoTLfUQuuanY99mEDKNaqzF v3SA== X-Forwarded-Encrypted: i=1; AJvYcCVEQs7K3Lpt4sGUof9EY+PIfkQaro+n14DthaoHr3VLPM0W5sdTDA4diVRg6JurxylPbHePDWgvOy3AtziZH5FVwHIbg9EeysV4dupqJ1JnOcnjcAY= X-Gm-Message-State: AOJu0Yy4hrvizXwgslz61Txl5KNYD1NRzGrrGgX18wNEwey5IO4zwfVH SKlLJqaW1ApaT6+PKzi0SzcxS2zXLqeDbFeq4qoFt4Sn43KmXVEmtpto25cG1sM= X-Google-Smtp-Source: AGHT+IEDyGBKz3t3wGE2QIBNprd46E5kie6qSIewKgUjN4f5gzLvwrTF8H7FN9Rdja49NN2RywJamg== X-Received: by 2002:a2e:8904:0:b0:2ec:eee:f197 with SMTP id 38308e7fff4ca-2ec3ce7e058mr46393111fa.9.1718924123766; Thu, 20 Jun 2024 15:55:23 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec4d60126fsm510461fa.20.2024.06.20.15.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 15:55:23 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 21 Jun 2024 01:55:20 +0300 Subject: [PATCH v2 1/7] usb: typec: ucsi: move ucsi_acknowledge() from ucsi_read_error() MIME-Version: 1.0 Message-Id: <20240621-ucsi-rework-interface-v2-1-a399ff96bf88@linaro.org> References: <20240621-ucsi-rework-interface-v2-0-a399ff96bf88@linaro.org> In-Reply-To: <20240621-ucsi-rework-interface-v2-0-a399ff96bf88@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=7E3v+0gLqGBn3XeWvM8WTYb4Nd3klVpPD6SOrvO9a+g=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmdLNZ45oT6EY8DYlITEu+W5ykCaKw3FQHbQSiU G+9rz60uKWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnSzWQAKCRCLPIo+Aiko 1V0oB/97hJGoKKWHK/VtNc0gAJ9+nbCucdeyixOoQ2IAHqQRbB406Sz9CIG2dlvR1ljV2fhUjol /TLxEA2QJgN9N9Z7o8gdFY1TmCtgB6XEVYKMA1be5fzzCDE0OA4lMHTTItT4VKvzWIBWsgGfsqI tn9C2ze2WpNKnVTFGIHOmY83R6J2BvHTk7lOPFYxdaA33oFYNt6Tw63jl11XXwJ/MKvkIlFG557 rwjeWarTd7Xygqco4AX5c0cGdU5uRoPZ3kZ02bDFHoGekzqlOuVC42XxqGYZgBYRHJdEUngqAj0 CJtDpxRPtZAH3K1yS8Seke4+5pQ/bXf2ij+VZI4/tJLS4vGz 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-20240620_155525_668281_63CBF743 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(). 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 134ef4e17d85..8e4d92cbd6e2 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); }