From patchwork Thu Mar 21 14:19:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 781689 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 D4D9F85264 for ; Thu, 21 Mar 2024 14:19:44 +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=1711030786; cv=none; b=N7weIshhoUoec2n7Or8dQ2kBMyCM6tKxr97ZwdbdN6SI0RNPeg+4QOyZhBKoIeJ59GSP9/OTAu6426v95KX/DGI7t4tNWfqJOs1l+CRRFI+zGlEu4JZO3gWARPoObGBkzuvH+3wv8isjZPvBAWBYBCCESonb/sikfyWooLEkLrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711030786; c=relaxed/simple; bh=E42ll9dERYQeDCitci5NhXmUs/W94JnbCK8poS4Ofx4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=BPSsZbElZEPPznC2S6nOOabIYkxG3rU3gSo3uHlZ4BqJbdItjh+fTmNCA/G9QLTsrQMzDOj/BtH2dvPS6huA8yTg+GadAfFxkJ348mHLCOeZ8ZREnrY0Rls1DcWbePVPSeE7BlhUSGQjRvHo/apuclndUZ8M/ofmKr5jgvoOFSI= 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=DmWwiZe/; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DmWwiZe/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711030783; 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=DmWwiZe/sNVx493aXCxgGi6uHBgbxqBEN56upcLzob/w8WkjWSKRHJP6FTbRXKrtRTajOc IgF2X6pENE0P6geX94V1SGmKJ+I/PHTJ3ZaaaYBdwMP/EjGltiSQqur0fqPECLNjpPgv0o Wlpp2OnjuJW8kSL17iHp5+ab5+MG1VM= 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-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Reviewed-by: Heiner Kallweit --- 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++)