From nobody Sun Feb 8 02:55:31 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 7CCD325CC6C for ; Fri, 6 Feb 2026 16:32:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770395569; cv=none; b=K34pFVF16zQqV/znYm7ZpXky9HcWZvxp97nIi/IUZK/5qReaTTifmDbo9QJEYDSzh8alEiCyKRvnjWhL6P0FSfkGkxnIV3dXpPpiA6Jwxov4jwkQvK09qQiJKSnSa2mUtxhyj4Xf1WoqqkYuJJb1PA+f+EOrDGE4kfvb8bp/QzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770395569; c=relaxed/simple; bh=HFRml0I30sOfMSOBJuy3htwbfWhcoKTQK9QrZLmCOEA=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Vd0N20E4e6c5mUIutdR1LSlEwneb67CyChL8KQghvqtZo/vo+g0AOR2kr4AFNGnXPk3N7AFM0v5p3PZnwoRgIde4+ViW6pk1oSuJ6lGJVLWsJSC/KPqD6eqv0gYO/uxLeb3CSryVTq1AF8953/FIPCEQiJYRQamOGibbz/tD8c4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=ncmcI2FR; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="ncmcI2FR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1770395570; x=1801931570; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=HFRml0I30sOfMSOBJuy3htwbfWhcoKTQK9QrZLmCOEA=; b=ncmcI2FRYIkx5HnLKz1aqjybHFyfPEWk+bnSWvFMHkYsx+CgU2ueVONX jmk9FYMa96zf2da/skyWPrJvYNi3O7OPs7OqOGBehNjxbqTlGSrYi/Igl J8L4ewpGqt6jPl1lBszcbUOnnHaKGHuI5Z9yoVccalWn99EC0BVmpaTYK SfWZNBb5VlwtkLdsI/F/FE0GEtFV5/2te+fFsKCA+YeVbM3rRD6SHSeGX TxRmqXI09h25aimeuxVvxCjZXneibAkFBruJwq14a6E082Ac9npqvPepJ XGdKtHQUwaj/hqGah3EBLVBCjTbtg7sXqNuxjJtEQhx6JSe7Qzh82PCQM g==; X-CSE-ConnectionGUID: lmFCmcBhQZimhLJo4MpsJw== X-CSE-MsgGUID: tICV8FinTWSRFuW7lvaziw== X-IronPort-AV: E=Sophos;i="6.21,276,1763449200"; d="scan'208";a="53047498" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2026 09:32:44 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.35; Fri, 6 Feb 2026 09:32:13 -0700 Received: from ROU-LL-M70749.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 6 Feb 2026 09:32:11 -0700 From: Romain Sioen To: CC: , , , Romain Sioen Subject: [PATCH] HID: mcp2221: use mcp_i2c_smbus_read for block reads Date: Fri, 6 Feb 2026 17:31:53 +0100 Message-ID: <20260206163153.130026-1-romain.sioen@microchip.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Refactor mcp_smbus_xfer() to use the mcp_i2c_smbus_read() helper function for I2C_SMBUS_BLOCK_DATA and I2C_SMBUS_I2C_BLOCK_DATA read operations. This replaces the manual setup of the receive buffer and explicit calls to mcp_send_data_req_status(), making the code cleaner and more consistent with other read paths in the driver. Signed-off-by: Romain Sioen Signed-off-by: Marius Cristea --- drivers/hid/hid-mcp2221.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c index 33603b019f975..64dcedbcc0fc9 100644 --- a/drivers/hid/hid-mcp2221.c +++ b/drivers/hid/hid-mcp2221.c @@ -534,10 +534,10 @@ static int mcp_smbus_xfer(struct i2c_adapter *adapter= , u16 addr, if (ret) goto exit; =20 - mcp->rxbuf_idx =3D 0; - mcp->rxbuf =3D data->block; - mcp->txbuf[0] =3D MCP2221_I2C_GET_DATA; - ret =3D mcp_send_data_req_status(mcp, mcp->txbuf, 1); + ret =3D mcp_i2c_smbus_read(mcp, NULL, + MCP2221_I2C_RD_RPT_START, + addr, data->block[0] + 1, + data->block); if (ret) goto exit; } else { @@ -553,14 +553,14 @@ static int mcp_smbus_xfer(struct i2c_adapter *adapter= , u16 addr, case I2C_SMBUS_I2C_BLOCK_DATA: if (read_write =3D=3D I2C_SMBUS_READ) { ret =3D mcp_smbus_write(mcp, addr, command, NULL, - 0, MCP2221_I2C_WR_NO_STOP, 1); + 0, MCP2221_I2C_WR_NO_STOP, 0); if (ret) goto exit; =20 - mcp->rxbuf_idx =3D 0; - mcp->rxbuf =3D data->block; - mcp->txbuf[0] =3D MCP2221_I2C_GET_DATA; - ret =3D mcp_send_data_req_status(mcp, mcp->txbuf, 1); + ret =3D mcp_i2c_smbus_read(mcp, NULL, + MCP2221_I2C_RD_RPT_START, + addr, data->block[0], + &data->block[1]); if (ret) goto exit; } else { --=20 2.53.0