From patchwork Sun Jun 2 23:24:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13683128 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 0DC1CC25B74 for ; Sun, 2 Jun 2024 23:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :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=cjwNF4rLuioh0DTyOboyi+ZcUrbamG3gnck168L/hlU=; b=omqpfw3fvITt2E 722C+LmGc1UidUgzXgEZ9Ogxnc0n7UJrFa7pNOqFWypChVuf8cNPpFDQ3sz25d2A/Id9FtphMw6o7 XApZqxPmjBY0xYYMWWhTrN4NUrwiiaMhUg1OAM2pjrlo8lU7UNyQXjX5povWzgOXxeBkslY/v/FI0 MpaM1BYWKNEQz9QMFNxGy7xGkEb3LYHddkirL2kruTBgjUMYE7zAf6SfOZSEv1WK/NPJaN3bHAVnU 9cLkl8YPdu8bqT5pZwWjgwuZ3YPdtUd9swEJLl+YULm3RzjZ6S5vdzx93Mv7bRiamL1+9BAmNbEWY z7RZMXwQQWO30hxxl4TQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sDuZS-0000000F64s-3WJA; Sun, 02 Jun 2024 23:25:02 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sDuZQ-0000000F63F-02MW for linux-arm-kernel@lists.infradead.org; Sun, 02 Jun 2024 23:25:01 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-52b93370ad0so1654606e87.2 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=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=/H9omkcKfSMWKhyxE8ouaq15vBQZtQgKk2aVI95FWUU=; b=XKvQtyFRuWfS5DN+eaMJD9aHV9dk2cLijHKvhu2kItqH1EhYVsNqPutURNONJpcCZI oGoVgQLSOZFLpPZ/VJ+AAeAYzeSc6o0jCfsMccqws7+SiMpxm/ECZLzMQCBRMMsk4HJA kcPvw9SX0GeQQrMTNgtevJtreYr1TpvZomYZYbrCvEwJdAmiiaxnsi0CeMqAqnKnytQP kh3w+3e8Zx2hkmYgoGXDpr3ft1yu052rC3UpoB/4MnVz7c9I5vFDI7hQVW2pT4HsNVjG o4e66QuvzhK5qy5OV5Jc2qser2VmXhS5IDhYO57tiHwthAxQBxm2IULxFxUVAmYE4tsM Rqxg== 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=d7oTOdaENkJFbGD4pjgQQLBGw7gOU6gaDhr/He7jGQLMjKnFbT7sSNXoGEjeDPisYl ND9uMHWcECGrHZGojNTebkGIgBhHXldcxzdiutGN/gmI6qv9NikqLvWiaKVq0U3VFFw0 LfGuxFMvvzWFAOrs+MhSo5g1qgP/YHS8AT21ZJPTrZ1sC8Q9Swk7Kwy3TJC7VB4WkPtn OHJB+endK9SWF+aed0LMXIMcH5rIk/212/s2LxUhRhP6V6GPPnzPQ2JmJYI6i50/0VQo 3xT6impNa58AHJ6GRJ1V7ScP66oP8AlK4Vn4emo5Ps8gxOsWZP9URsduOCBJt4fuWIkj pu4A== X-Forwarded-Encrypted: i=1; AJvYcCU6/s4ioYKlLsT7j9spyEdZ+Fs4iH9ba3lcK8uaO1qvjIDUgJukSDukkD5zyZAljixKl8ojbVfXFfo+3gfHpPGrjAi64qn1u5J26aXZewBUJi7itq4= X-Gm-Message-State: AOJu0YzuGvPHw1rbliLEHU3yyB2B+afP6w0kKoNToeuMegfj6Y1+Halb 3sIMfuuFjn/JWNRtkppZ5bpqxRfPQCzuHoLrq5hZbxtpxo4ctMX2S/ybpobloic= X-Google-Smtp-Source: AGHT+IE2CkuVfuEeWibh2syHVvCT2BYHUAnYl4Dc3HsXN2GwvEWq+MuVV84p30lXkZjv/MWuXo6EyQ== 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() MIME-Version: 1.0 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240602_162500_102356_E5C10F04 X-CRM114-Status: GOOD ( 11.56 ) 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 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); }