Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9255138rwr; Thu, 11 May 2023 12:09:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7k8badsDdxy418Vox0D0a8NCAFFUrr0STqE/a0P27JqNGvAXik+/JOeQ3O4yOch7cls+1Q X-Received: by 2002:a17:902:f9cd:b0:1a5:1e7:86d7 with SMTP id kz13-20020a170902f9cd00b001a501e786d7mr20918879plb.52.1683832144503; Thu, 11 May 2023 12:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683832144; cv=none; d=google.com; s=arc-20160816; b=XGDE98BcZ/Ql4zlil2hcsseHhBKRSe0uQS2agR3/TqPIJCYOhDlNZUthwaF/iL+Wst wE/KYOkPRJiHuPRXL/kyAmA0ZGL++R5VE1FSLPX91KAPFPjtvCYwLLKEqexlgIyHBlyG +NJzlDll7DnzqzCh+x8j5yus/Oce0Q8dR1XMxbiOM22nYoq5qGnPvM6KSZ0xsMVvbSGs Ts0blM4lE1djvgAFYuTziIlZGybCfQOYLitdhpK7cPx/PuiGTwqVYw+cCviJ8tjUOjwI aStmQUgupv0v5rdORd78inW4ZntOv3NBEPNQzotkWnqzm9c8BID1fae53i2fqSR7F96t Uzsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7o+RBiVTUR0DwkNdBEw9knQ1VGeDnk1pNXEP3ntY+eU=; b=FFS16qcFcX1YgQ68OFWGZ0oqXKh7KL7XchwrCUUybjm4RBl4XcB99cMD3yaZuG8yw7 LtvUXGOJnFajUFlD61W5KhJ+KrwP7gtdMksePgul1KV5XKsgOC0FsLkcn+D5q9NfdrKy NQ1IpHdCZ+KmNwonFGDBC2RlQthA2axqm4Zl06zlKJNBd4qWKfYSEe8d/ZdIPCd7vGi2 QwUkus0Zt1tz1W/cXet4/DsROq4n1GCkFoFhpLJIJTDjo2yYTqEZmvDYhQ1UIxLD9JGM sSur4FWpaIukTkDluwt8K+TQeNufAy/a/OeArXQLDfXEhhxavefT8mRrMjKDSJRp9OJn lfvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UqOBntZp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a170902ce8500b001ab0d2ca17asi3122403plg.457.2023.05.11.12.08.52; Thu, 11 May 2023 12:09:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UqOBntZp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239023AbjEKSxI (ORCPT + 99 others); Thu, 11 May 2023 14:53:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238932AbjEKSxB (ORCPT ); Thu, 11 May 2023 14:53:01 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E212240E0; Thu, 11 May 2023 11:53:00 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1ab1ce53ca6so65247925ad.0; Thu, 11 May 2023 11:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683831180; x=1686423180; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7o+RBiVTUR0DwkNdBEw9knQ1VGeDnk1pNXEP3ntY+eU=; b=UqOBntZpH/hTxsSnqz6tqittgDaSy8/jKh9JGoQD2vwaYlDE1I4i5F0jBM7KlIss6m GWh/4BzyyZnyi/Osozdzroc8kydLSG1vSH6ny+FmMdfkrQl0IFA6XiIazPxJ8ENZW8Re qtTUOSr4JLt8ChpKuMV9uIvLVb+SQylG9waLkaSbR2sSFUmo5GTT0KrCgaAE74e1lrr3 SCJI4yDXl2e92y5Fe3aUx+VrOe4s93XEWxbR7nE8ikb5BhMr1wTiCCpl2cntTtDHYOxV 0H6LFeoMC8d/vYo2eD+Q9VA4BYVRbfB2dyzTz9d/b/jLsGeY9vdJQp9calmojFD4b/O3 Mwuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683831180; x=1686423180; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7o+RBiVTUR0DwkNdBEw9knQ1VGeDnk1pNXEP3ntY+eU=; b=UKsANxMu33Qt9IsMG4WyCX804QeDoHTAK6NBT9uAY562BjBonJmnvuK+9PAFuJADJf R+fkXZv0qvMYURE1+bbW1i5gMTrwAAJIQWK2PXogpnPFP+qbtUM6qJ5gGAlP7wLUi2Va owu0IL0MAGNvWV1w3E7I5gUdOg69KQG6nCwoeJp9LYc58hPBNmy6jAKjCUlH5QapqQMW 857Gjqwal+OaFPjkHmsgd2AMztywiotD1dLoI+JyKeIpLTSsIbYhO5rqeov0DVIRrn/l x0sJRSJNFlAwV24UOAX4R/EWVGDvoJRdr4RRC0z/ZY6eYBpmrcIgOjLAJLY3g91kFZuA MrhQ== X-Gm-Message-State: AC+VfDw/feXdTrYzsFI6ncPc2vgzNCFeL8dawjsuyMwWVg1ncNNUm466 k3jM3X+k+JwKXodrLxfwK3xv+yUkR7M= X-Received: by 2002:a17:902:c40b:b0:1aa:fd48:f5e2 with SMTP id k11-20020a170902c40b00b001aafd48f5e2mr29678853plk.32.1683831179734; Thu, 11 May 2023 11:52:59 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:84a:ed9c:4024:c347]) by smtp.gmail.com with ESMTPSA id q5-20020a170902788500b001a980a23804sm6288995pll.4.2023.05.11.11.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 11:52:58 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Raul E Rangel , linux-kernel@vger.kernel.org Subject: [PATCH 2/7] Input: libps2 - remove special handling of ACK for command byte Date: Thu, 11 May 2023 11:52:42 -0700 Message-ID: <20230511185252.386941-3-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.40.1.606.ga4b1b128d6-goog In-Reply-To: <20230511185252.386941-1-dmitry.torokhov@gmail.com> References: <20230511185252.386941-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When getting unexpected data while waiting for an acknowledgement it does not matter what command phase is currently executed, and ps2_handle_ack() should indicate that no further processing is needed for the received data byte. Remove PS2_FLAG_ACK_CMD and associated handling. Note that while it is possible to make ps2_handle_ack (and ps2_handle_repsonse) return void, it will be done when the code will be converted to common PS/2 interrupt handler later. Signed-off-by: Dmitry Torokhov --- drivers/input/serio/libps2.c | 9 ++------- include/linux/libps2.h | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index 764990723847..399cda0d34f5 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c @@ -253,9 +253,6 @@ int __ps2_command(struct ps2dev *ps2dev, u8 *param, unsigned int command) for (i = 0; i < receive; i++) ps2dev->cmdbuf[(receive - 1) - i] = param[i]; - /* Signal that we are sending the command byte */ - ps2dev->flags |= PS2_FLAG_ACK_CMD; - /* * Some devices (Synaptics) peform the reset before * ACKing the reset command, and so it can take a long @@ -267,9 +264,7 @@ int __ps2_command(struct ps2dev *ps2dev, u8 *param, unsigned int command) if (rc) goto out_reset_flags; - /* Now we are sending command parameters, if any */ - ps2dev->flags &= ~PS2_FLAG_ACK_CMD; - + /* Send command parameters, if any. */ for (i = 0; i < send; i++) { rc = ps2_do_sendbyte(ps2dev, param[i], 200, 2); if (rc) @@ -436,7 +431,7 @@ bool ps2_handle_ack(struct ps2dev *ps2dev, u8 data) */ dev_dbg(&ps2dev->serio->dev, "unexpected %#02x\n", data); ps2dev->flags &= ~PS2_FLAG_WAITID; - return ps2dev->flags & PS2_FLAG_ACK_CMD; + return true; } if (!ps2dev->nak) { diff --git a/include/linux/libps2.h b/include/linux/libps2.h index 53f7e4d0f4b7..193dd53ad18b 100644 --- a/include/linux/libps2.h +++ b/include/linux/libps2.h @@ -28,7 +28,6 @@ #define PS2_FLAG_CMD1 BIT(2) /* Waiting for the first byte of command response */ #define PS2_FLAG_WAITID BIT(3) /* Command executing is GET ID */ #define PS2_FLAG_NAK BIT(4) /* Last transmission was NAKed */ -#define PS2_FLAG_ACK_CMD BIT(5) /* Waiting to ACK the command (first) byte */ struct ps2dev { struct serio *serio; -- 2.40.1.606.ga4b1b128d6-goog