Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp656490lqj; Sun, 2 Jun 2024 16:25:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmDAH3orih1Ch9iP2eiT0bTX0HUDv67NsBZFWPPcl0/KM83YgMtCu+buejpMtorP+/SrRihajE7dYgjOqEgqHY+q7BI5SV/eLsy8YqSQ== X-Google-Smtp-Source: AGHT+IHvSBwuiju3gaO8VccL1FWE4HtTmxR6iGwbdqsvxDX+sKuPinW8XGktrCytAnt9GPPJtWtT X-Received: by 2002:a19:6449:0:b0:521:cc8a:46dd with SMTP id 2adb3069b0e04-52b895218f2mr5737572e87.11.1717370717214; Sun, 02 Jun 2024 16:25:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717370717; cv=pass; d=google.com; s=arc-20160816; b=A18juWdCePOgDArDLmHmQL/Uu/ZK6zTbDKPDXTMde+vtPkBYn7sf8IWctXmLVMLpDq YG9mrSDpRnOW5SkZplqDarBAh5DWhVBqKXB0I59bAzzVFhzR7F1ogcHtKqr+xf0mENhF OvgoKUez75fyErahiGlQ9w/e2mtxYKcbY03QtUWicnfpab8CwMmBn7YpFoHGBRzOrS8b lYWiUzXUD7tgukJORTqHTZ2XNG3HXDO1kYSKKbSK9iDeG7/5e+iE0h12cPmyN3PAc5Qd UDRZCcRPvRw8xCLil1VWM0KLUMvxg0mtlYvr4rg+15CNDVAZuqrWqfqbCfUmFWsRyDBP WX7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=/H9omkcKfSMWKhyxE8ouaq15vBQZtQgKk2aVI95FWUU=; fh=KpbnpuESSXcn1yA+494h/ctG5sthKL1h/aFSyLfsTUQ=; b=Sbnr3V0YZxRC+EYzKmbV8CQ+6irgypJ14KLhXPh8KXOctlcOTb9Makdwwcgk3BgkQx cLTiH/GGIDw8RraZkW4HrGdEpDYFOEmYQ32redeg6sZue4jb7U5+h+ZzdQZVu9Jjac4J hdWBb8aACcVxcuQdspiZ/DOz0NboYIKfMdF/xARZLINIGkRzPmPqV5EY1j3HRc2ntgi/ W3MUZKpcAlnQaQvP8Z0jOVcLHa4iSdgugXyVZvNgD5UIlZ1MVgQjqSSRK2vyZtDN11Hr SMCwRMPXABHz9Ch0oPy1Qm2yQgr6n+7cOCpgd+pq6oxTYuWfF02z4b5vGkI52dFBm4Ts nWAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yNaX5mD+; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-198475-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a67ea886beasi355304966b.572.2024.06.02.16.25.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 16:25:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198475-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yNaX5mD+; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-198475-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CB2DD1F21713 for ; Sun, 2 Jun 2024 23:25:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F1357F481; Sun, 2 Jun 2024 23:25:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yNaX5mD+" Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF56977115 for ; Sun, 2 Jun 2024 23:24:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717370701; cv=none; b=Zugs/FGcNGd5IrohVN5EI/iDa3eMJVGFR8DsmV2woDr9N6E2LyterKhGAjVajHAJKCSs7WKK9k6Z8TPXWmCNuT0reVZgWpn/LeFSmZh3aOUqm5rD+mtZ3hVHhbDe9hg4rUV87Md5eMUV68jCeGAGeY5QyFM5r4xxSwXUV5r4JbI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717370701; c=relaxed/simple; bh=J3HQOCyfSVpr1YUtYQZItLe+bN2QWt7En48aq2hwcDQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jKqheodsYAawRISBS6YfNronRnfsKG6pN94JmriKlNxKALdiX3KvLS66FV0Ob85WhO7gnqkXXn62BeGlL5n0S8ndvtqFIixNAGKWvYFGPVzMBpfcAKj/Htq0dzyg2HwmxlJrQDjIOfhIGGVbTdO6i3PvBdDOJTddrOi19D7XRXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=yNaX5mD+; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2eaa80cb4d3so15728541fa.1 for ; Sun, 02 Jun 2024 16:24:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717370698; x=1717975498; darn=vger.kernel.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=/H9omkcKfSMWKhyxE8ouaq15vBQZtQgKk2aVI95FWUU=; b=yNaX5mD+ZHcJG2x0A5zcsz3WYkYeb/zQ4hQl/Mv61tOdX4y3na1tySyveXCJerKUbn WinAsn0wNpO+iGcfvIVYWuWOvUKh9APKVvTUtFVN4XYHydJTSpSrLthLVfmLc+tfKTfL GvEgjCfSYdPP0EzkRfiYpVOgBnT013WIax4BkoT9sQdvjC9y/YIteodT3YFURHwrTpel sX7LFopmtMfwrcw2Vuk0l4LRh+J09DN33oXCTO+fRN2qf4XNgELLdUFf7B16WjfiyKDC pLiye5PknEsd0vYtXngFdpi27EcUvEx2zFeFL3K/JnoPbvoPlSkKU219Tang11FhO+4b fQoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717370698; x=1717975498; 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=/H9omkcKfSMWKhyxE8ouaq15vBQZtQgKk2aVI95FWUU=; b=niiStDlMCzsChKUTG8cGcqOuKkuYRkAORJvBf5spp7cPVEGzbYeDTA358x6BOxLqd6 /KXFno29TjDvAGd++tttwssXH9eYrYiQ0RGP2umBeQMsNyHK8rXU9q70JUJnwb32NQXT QokUulU6lHO97KFsD+T5ny660Kvootkn/iJJ+w+kEhaFmt6ew/5VjGJnfuHP0NDXpTBF D40qZ++I4LSE1l+2XuohJeXGhbGY0hqKfPx7ad5OtSwwJxjXxuukNSTJvXxjh7zjK0Vi 7XvbI5jRT8qvpelEY4pQKCM1+5R+5KG1rDJePdbg0gPSDgsmVCSBiIVCH2zfd6KlhHsZ WTYQ== X-Forwarded-Encrypted: i=1; AJvYcCVjypt+UwojQnHFjB48rDHll7JQYC5pEgg1K4H1Soa+mRFDcUzgREG9f0lLH/DXNOpd4Z0jHXZ3ku48yJEmN5CH5z1EzEOjs1Ty2nLB X-Gm-Message-State: AOJu0YxwB3BLYzHpasJ2LUo1CEmthooiO3pae7oEoZ87bEzP8y4mFY3i igatDLkdwgb36I0s86PQMYJV0c03vOTWyTcYYeGFbpQm3tt88GAjlk732LU3P8SWRPBCf1s1VCh 2 X-Received: by 2002:a19:2d14:0:b0:52b:9046:c44c with SMTP id 2adb3069b0e04-52b9046c59amr4014987e87.58.1717370697587; Sun, 02 Jun 2024 16:24:57 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b959008aasm392369e87.269.2024.06.02.16.24.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 16:24:57 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 03 Jun 2024 02:24:54 +0300 Subject: [PATCH RFC 1/7] usb: typec: ucsi: move ucsi_acknowledge() from ucsi_read_error() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240603-ucsi-rework-interface-v1-1-99a6d544cec8@linaro.org> References: <20240603-ucsi-rework-interface-v1-0-99a6d544cec8@linaro.org> In-Reply-To: <20240603-ucsi-rework-interface-v1-0-99a6d544cec8@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=J3HQOCyfSVpr1YUtYQZItLe+bN2QWt7En48aq2hwcDQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmXP9H/f3ba1SNbSVuQnOo1uz7VMfWjPKCe7tix noDzdNH6tGJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlz/RwAKCRCLPIo+Aiko 1d7IB/9MbaRNYHyugOOeccBgAd/6xgYFC8GC5EoakGOk+XO8fa4kUcKuCnypn9hKPcv5XYKagzt bPXUTZq47XUYgE1J2OW32LsWJ8dMV6Cw2Ue2hziAmhcMgc89R453njTxTc3eKF40ARb3FTptROQ xs3VZx2ERK741nPOXeoCPU79RmeSG7uMAZT9UFFi2yHZrrTfXV2g/IgAAmuNd0jQLCUQvGyFOcc G5i9jn4wNWURcR3K/mq8HTwfFr/kw5JW8Jtpeu3j1UTNSiRxVZMEjOH57d8d6thIm5tobzMtC0P e0YbXHJ8z8bldV5HBiq8FkRuTzcIgMVoIFCmG4pGI6WE2/w8 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 2cc7aedd490f..953196ca35a3 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); } -- 2.39.2