Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1650940iob; Thu, 19 May 2022 11:06:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPl7G7zSHbWIOGFzN9549uSV5C+ad6tbCQUvTVggKMaxl5QWu3KUZdXh2tPF29i8ZkzZ7A X-Received: by 2002:a17:907:c02:b0:6df:fb64:2770 with SMTP id ga2-20020a1709070c0200b006dffb642770mr5669902ejc.221.1652983605379; Thu, 19 May 2022 11:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652983605; cv=none; d=google.com; s=arc-20160816; b=YHMMwIODv1/vQJXwNM7bUPCOQICMfzPEDXoK6CQYdJwkRtil0K9fKPqSsfJIy6cKGO LG/V9khnqv24f2+07czHQwqFjGKaeGqgb6574Qk/+0YNVfvkzCgULhw/Qb8nzx0Dc06g QmLruno/1oSLd/BnU1K2ub8LAkrAW6SLjW7yc1W9TUrxqz1cUpJiw9BwI1iyHk1ZnWkW 5MnbN7tFY4dzAgLiFps0sALgRlcv8ELCbIUyyiN+pClroIQrkXVfyF0ZbbGIfOydZzTP CcHR9lXaf2ezf+JbpFUt22/CagAt2QoY84DCQZ2oIquMMf1rHn3rYtzBu0q7URA/6GS8 VKEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :feedback-id:message-id:subject:reply-to:cc:from:dkim-signature:date; bh=+6dbY/snU3b6uCWUgyekqmraArOZDE0O1Do6Z1g28TA=; b=MiJyZeS1xrjpmBTKuuBrBWSNI1/ndvbHP7o0mugqr6P5F1q3/5AIIiKUmVrAx1q98e 66hM1kJ1VIb+aREEqS2jXRSgooHchyq/PSrcJyaKndbd+kbWd/HF2KofPAvyUEO7wYjG IdQk7D7rouv836hKrxwZhvPxJMSk5KraDzDz8SFw1NN2ji9yUHv4UWvuRWcXBPPNgzYO 5JvVyyuNfa8CryG/p344p4aZ8tduNvshsFhFUpOP6bwLxEBhnI5umRK2wuhgLqi0FwfP 7i+5Phmx31AG6R/6CDnw5Afc94DtI0D9jB+zPBfBy4rhsJgsVZZaH2vYM0DU0e1tETcb tz2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wujek.eu header.s=protonmail2 header.b=M9q70UMj; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf11-20020a1709077f0b00b006ef57f5e94esi5902765ejc.1006.2022.05.19.11.06.16; Thu, 19 May 2022 11:06:44 -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=fail header.i=@wujek.eu header.s=protonmail2 header.b=M9q70UMj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238178AbiESMur (ORCPT + 99 others); Thu, 19 May 2022 08:50:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238164AbiESMuk (ORCPT ); Thu, 19 May 2022 08:50:40 -0400 Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD258BA57A; Thu, 19 May 2022 05:50:31 -0700 (PDT) Date: Thu, 19 May 2022 12:50:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wujek.eu; s=protonmail2; t=1652964628; x=1653223828; bh=+6dbY/snU3b6uCWUgyekqmraArOZDE0O1Do6Z1g28TA=; h=Date:From:Cc:Reply-To:Subject:Message-ID:Feedback-ID:From:To:Cc: Date:Subject:Reply-To:Feedback-ID:Message-ID; b=M9q70UMjUe+S50Y/XwA+mERO7Nex8c1Hfssapd9f1q2X5Y8u1lPglwRW4oiT6eSkW XZCXD+90cYbj6MNmAV/e6yY+kIvzw+IqHoNNcBTn8tvm/Ndczy5zpr483sxcdQR2vk 0Onx+5I5Dw5zMO4jwGh9OvMeF3sZ1gfhko4sPMjczBMmT8qHjV5mYuZ5av7p/yE++C Cd8C3caxWD5msQw+QTk79j0wbYqIbky4Pet2Y/+71TXc586ADxOC5L9jGKYzUfo0Zn 3MlrvVHS6XDpzH0Lk8QUhjmPZanmRUt63X5zNFKRomF/uaNDv3J+BUvxBUzZx1tj5h +cBxBPZDJr1sw== From: Adam Wujek Cc: Adam Wujek , Michal Simek , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Adam Wujek Subject: [PATCH] i2c: busses: i2c-cadence: fix message length when receive block message Message-ID: <20220519124946.387373-1-dev_public@wujek.eu> Feedback-ID: 23425257:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MISSING_HEADERS,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Needed by hwmon/pmbus_core driver to correctly calculate PEC. The hwmon/pmbus_core driver relies on bus drivers to update the message len= gth of received block transfers. Only in this type of smbus transfer, in which = the length is not known before the transfer is started. Signed-off-by: Adam Wujek --- drivers/i2c/busses/i2c-cadence.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cade= nce.c index 20ac432a37ea..65f1979d4e6f 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -830,6 +830,11 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, s= truct i2c_msg *msg, =09=09return -ETIMEDOUT; =09} +=09/* Update message len, as i2c/smbus driver (function +=09 * i2c_smbus_xfer_emulated) relies on i2c device drivers to do this */ +=09if ((msg->flags & I2C_M_RECV_LEN) && (msg->flags & I2C_M_RD)) +=09=09msg->len =3D msg->buf[0] + 2; /* add len byte + PEC byte */ + =09cdns_i2c_writereg(CDNS_I2C_IXR_ALL_INTR_MASK, =09=09=09 CDNS_I2C_IDR_OFFSET); -- 2.17.1