Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2123293iob; Fri, 20 May 2022 02:31:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN6nQKSr1XtFy5j4iLnBh7ccpxLWRBbvxZGFSr1eT93DrrBd9h3EOzrNcvmcm9d0jhXMg1 X-Received: by 2002:a05:6402:90e:b0:425:a4bc:db86 with SMTP id g14-20020a056402090e00b00425a4bcdb86mr9725155edz.98.1653039083319; Fri, 20 May 2022 02:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653039083; cv=none; d=google.com; s=arc-20160816; b=PkNvmUhSV1iKEYDtG/ZlXVbzj6wrw+oZgIdj77DP7muJYX7+FDp7oOOdvhCvZdBJFB redSj3ON7Q4vaW4iFnqLxZOKIv3+ZgBwstFlDumSIJkmtHWJVLgLfBJC/UlH7E8mrLth eA3/ltrwZGvF+GpfepxmAOZAgaHctGDnAqX57zArb5TZixIuPKzCr48pKH3M0V7Z5I/W 7xWofElV+uPG6NshHKN6WkGgKimROpFT3/muq+oqZkP4V6Umc8nMb7RiYfEuJGx5BaD8 X/OFCoU4wyHL48Q3KLpUK6aeEX/FOKWcIjERsD8Amirpj+lrDXrhRycVYdLnJP7OFwqj IJjA== 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:references:in-reply-to:message-id:subject:reply-to:cc :from:dkim-signature:date; bh=s+PX3ttgd2pqhf/X4X6oI+ne2p0Lx6BzbzmdfFsmb+E=; b=dUMJ6iw5mxaIzKFIt3chg3MCZHKFjJCLKYY3fIo3TsbxYzQn/9DZSYR+kIipxV03fI MUwxLZOl2DXl2HyR7iw3FEL+Iha98tDHmVLTaIl7xFsG1EaO4fPyw1ZF8L6pVizQsgVg D8zI0LCCSPJuzmbC6JUIU+scocaGkdS3VVNfjheiIPW7QzuTN8PVaq/2UyAxux2/igPh w/arfVt522ixD4/d8cOgf2y58bZx72VFYsfQZkmQGQ8y/Bn/VEr1OQoaUdsnFeG1yj/W D3hf/Jl8H79sxg2E1gZt8J4HJeDqg3HY5aWU5waJdP0IlWTRjNS1sDa/NPWwVvFiU3iu rxFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wujek.eu header.s=protonmail2 header.b=P0jXOg7x; 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 eo12-20020a056402530c00b00427b096f4dcsi7659267edb.525.2022.05.20.02.30.54; Fri, 20 May 2022 02:31:23 -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=P0jXOg7x; 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 S245685AbiESXLj (ORCPT + 99 others); Thu, 19 May 2022 19:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231533AbiESXLh (ORCPT ); Thu, 19 May 2022 19:11:37 -0400 Received: from mail-4018.proton.ch (mail-4018.proton.ch [185.70.40.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3751EC1EE2 for ; Thu, 19 May 2022 16:11:35 -0700 (PDT) Date: Thu, 19 May 2022 23:11:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wujek.eu; s=protonmail2; t=1653001892; x=1653261092; bh=s+PX3ttgd2pqhf/X4X6oI+ne2p0Lx6BzbzmdfFsmb+E=; h=Date:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=P0jXOg7xBd7b1w+1w+YFAYZXxdDQwSRLFCpOewLBpEudkFpgNttzjtSQSY2EjkW5d QyFb82nQWuwPzl+m1GsNkuMS1tCv9B3tMX67z3bVidP32RGGO33ELd5C2Qf42SAmJh xlNQGELN5h6FELEbPlIfGNSWjxYX7kB3ywt1L6fV4IEgvH5jV+mVeWVlTwDoXXrBll syIfjrDzkFg9sFFOPyqNXqPokR5IyL75nxM8HTq5KpSpx2h/vufvedK+sJGi2m9GR4 VemUaFxIUHWWTRL4ZPpAi5u8utBWw0Is1SMvB3g/1mv55QvHfYHOESk/mBKXSxpBaf 9SGNrfRmHFDLQ== 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 v2] i2c: busses: i2c-cadence: fix message length when receive block message Message-ID: <20220519231058.437365-1-dev_public@wujek.eu> In-Reply-To: <20220519124946.387373-1-dev_public@wujek.eu> References: <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 calculate PEC correctly. The hwmon/pmbus_core driver relies on bus drivers to update the message length of receive block transfers. Only in this type of smbus transfer the length is not known before the transfer is started. Signed-off-by: Adam Wujek --- Notes: Changes in v2: - fix multiline comment drivers/i2c/busses/i2c-cadence.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cade= nce.c index 805c77143a0f..a679eb390ef5 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -794,6 +794,13 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, s= truct i2c_msg *msg, =09=09return -ETIMEDOUT; =09} +=09/* +=09 * Update message len, as i2c/smbus driver (function +=09 * i2c_smbus_xfer_emulated) relies on i2c device drivers to do this. +=09 */ +=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