Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp490905lqp; Thu, 21 Mar 2024 07:19:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQsrG/Lu4OHC4XxVguDTEGmmb++UrrqLIX8dUF4c9F25XozhPgK00nguaD5uPWqYiJGczBaejXxGhmPn7c75fnOLm4q0ohrUYXsem3LA== X-Google-Smtp-Source: AGHT+IElCc2TXOj3KwENM1rYPuMDkMYWRlR0L/809p2/FAy6gCT+T60k5/gGZ4TSpiXMD89p42DW X-Received: by 2002:ac8:5cc3:0:b0:431:2306:6149 with SMTP id s3-20020ac85cc3000000b0043123066149mr1749513qta.57.1711030793954; Thu, 21 Mar 2024 07:19:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711030793; cv=pass; d=google.com; s=arc-20160816; b=rtj8I9zn4asdD4CSMYv1pwCVJ1iMXTBY5ExSuL85898DO4KHt7Q+c9cqLfxYaAmGWs 1QddDEUuZYch2fbDfQqq6QfJlJ/i1RFx+WgDn97Dfjv4dgiAs7wlNjVo7KT+vix2ETw8 67BkQOjDS335vluTCX9As9FidlS6kGtDHBmTTaDA44bI+FRM82TF6GdRTUDi89IHJvrj V7As8x44OqDcJfIv/BK2kQTwxPJr4E7D3bA0NSK9v2DSxy6frCW78G9rOPh0VUYmBrCM sw+r6SOFu0fThW406pXE4ktfaqkRcTkQ54nhNvQUofdKwNXdYb74dU0qXvnHhcH/ZRhZ /t3Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=eqo+fR/qcUeO6cSXAqMCj6s8RG+XUPe+vPrRfJcqycY=; fh=FdVn+hupXUoDO5F3RhwWWaquCziAmhDSsZ3uzfuO20w=; b=EFKc9tPaU7f/aeD2TObHkfABO96NqHaiIniINgQ/zCmrsyr05nggMJGUyWT0Tx1YIP uQKdIbpuIrwLawMBptBGGaiRzzZEUp4waDUkRP4dRm9beJC5H/QDBfYQGRsy5B3NuqyL APbGm4x5s4WpHePopOIvSRtOdqgo3Epq0AWFfVQVn+HytkzJt1eJcq3lU2gDgSqwc/PH hpcLHulrilA1Krf+nZbs+JE3ASAyD0SqrgOICpRKz9wFaAgA+11TZPDud8WXZGbNOwJI Q8HuFp5uWRde42OFQq0g5jq5Ko7myQ/WGcb6pcrxzAiJjZw6fsFkd5MOyF4N4PtHvbM9 l3Xw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d+1X1M+J; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-110140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v8-20020a05622a188800b00430d4a1a5d3si8286343qtc.598.2024.03.21.07.19.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 07:19:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d+1X1M+J; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-110140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8D5251C2143D for ; Thu, 21 Mar 2024 14:19:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CE698526E; Thu, 21 Mar 2024 14:19:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="d+1X1M+J" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28C7484A50 for ; Thu, 21 Mar 2024 14:19:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711030787; cv=none; b=PI1CAHaqiB48RGTXBIiP1F+e79qYEJ3ph7+RU8GaI+vbJz5jm3fcjGBi6yA+t5ks7N244MuWBYBAig22uqYGmXAL5YoI7VE+PUB+oL8Ga4CTpf5Ok+LRujfvrsbRHJseIGQ+QvlF22/USwbK4etrftwjKnMYYTIH2rzZOqxXh2g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711030787; c=relaxed/simple; bh=E42ll9dERYQeDCitci5NhXmUs/W94JnbCK8poS4Ofx4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=EppCR5HzHAjzrK2gEtzzG42p0PlbE3BZa0NFN92Rk8lq7l9P+WgSHjcyjcc4TiILEM9dGaqSZSWpPNCUuxZCyp/Wj4BRE6vyde1qXMC1IJx+ZaD8xQ05Tm2nC5V+TgVdIP0f8vqMTlUwj/WhCSo4I6TRLaBuJPIycbHl9s/ufMM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=d+1X1M+J; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711030785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=eqo+fR/qcUeO6cSXAqMCj6s8RG+XUPe+vPrRfJcqycY=; b=d+1X1M+JfdzZlhE4FO3oEBuIMH6BZ5GXZ86y7pCbNlouGI8/hJ532S5jUMdq4FZE3OE/N8 H2ZxBIaYs0bC6BoskccgkTIEJSsFLH9lFumJFrEtoOfNTa6lgtFFQhBLkq9ykAWg5Bij/j kU92tziFu4a+ZA0QBgxsBbbBjkM6vMM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-447--R_GO4aHOrWVblsLQcqPuQ-1; Thu, 21 Mar 2024 10:19:40 -0400 X-MC-Unique: -R_GO4aHOrWVblsLQcqPuQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E59A53801FFF; Thu, 21 Mar 2024 14:19:39 +0000 (UTC) Received: from intellaptop.redhat.com (unknown [10.22.32.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9762F3C54; Thu, 21 Mar 2024 14:19:39 +0000 (UTC) From: Maxim Levitsky To: linux-kernel@vger.kernel.org Cc: Jean Delvare , Andi Shyti , Heiner Kallweit , linux-i2c@vger.kernel.org, Maxim Levitsky Subject: [PATCH] i2c: i801: Fix a refactoring that broke a touchpad on Lenovo P1 Date: Thu, 21 Mar 2024 10:19:19 -0400 Message-Id: <20240321141919.26844-1-mlevitsk@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 Commit 857cc04cdf50 ("i2c: i801: Add helper i801_get_block_len") introduced a slight functional change: the status variable is now overwritten with the length of an SMBUS tranasaction, even in case of success. This breaks the touchpad on at least my Lenovo P1: rmi4_physical rmi4-00: Read PDT entry at 0x00e9 failed, code: -6. rmi4_physical rmi4-00: RMI initial reset failed! Continuing in spite of this. rmi4_physical rmi4-00: Read PDT entry at 0x00e9 failed, code: -6. rmi4_physical rmi4-00: IRQ counting failed with code -6. Fixes: 857cc04cdf50 ("i2c: i801: Add helper i801_get_block_len") Signed-off-by: Maxim Levitsky --- drivers/i2c/busses/i2c-i801.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index a6861660cb8c..79870dd7a014 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -536,11 +536,12 @@ static int i801_block_transaction_by_block(struct i801_priv *priv, if (read_write == I2C_SMBUS_READ || command == I2C_SMBUS_BLOCK_PROC_CALL) { - status = i801_get_block_len(priv); - if (status < 0) + len = i801_get_block_len(priv); + if (len < 0) { + status = len; goto out; + } - len = status; data->block[0] = len; inb_p(SMBHSTCNT(priv)); /* reset the data buffer index */ for (i = 0; i < len; i++) -- 2.40.1