Message ID | 20231016154632.2851957-5-Frank.Li@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3552164vqb; Mon, 16 Oct 2023 08:47:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF64LxnZteBhzXoesCSUOmF4xsghIjpUIALx66RaQIhk5sdxYxK1hXR7JAcjoZzNI7fmKWS X-Received: by 2002:a05:6a20:3d85:b0:163:f945:42c4 with SMTP id s5-20020a056a203d8500b00163f94542c4mr40929957pzi.1.1697471249870; Mon, 16 Oct 2023 08:47:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697471249; cv=pass; d=google.com; s=arc-20160816; b=0Lb4HDefJd2UaUU5G+j4J4aix6jgIwxnrbAEjYLuc9FQ2DIImKxWMc87QcaeuCFUEM fQo7lUcnBVsPk6T5KKyevQznbQmb2C+W3+vDNYYADa4PnPY79E4+7UYG/0etisCEOhB9 kq3eYBFOpMxa6mgFLelUQqUah4d9Xc/BwvNr8QQjiQ84bCR0Ie1Rm7m0rX9G9LvjMQFD c25sDuQwwAQiG88v9cU9RosgSu+cIXLRifBMkzrXmfTmOCPfojgT8sun7aHQQeExCKPo rVXTOM8nRbDaW8kVieiP1/7ewcMjjmJjqqTlVb3NJLOynr69kGUQqoqBssQv5i9b+Uhm keHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=4JvC4g+VD60esWxTBSv5RI8lGH6ctutNh7mqUTggFg4=; fh=Ti0qdvZV/i089alSarny0opSonFaCxJFklfGvdi8roA=; b=CTyvQlN0xJbuT0VTKncDCFQuAkJ5RJqFga82+WO+P29cpFHrceT6jEwrPu3ts5AKi2 I3+tG1sdtuMtY4ZC0MPlKMsEYOnoACPtxmSgrRvfp0gIFAgFqpfwZ0ZhfV3W6t4mkOQM 0srfZWh1+Z4a1mKZMhCsPd23rn0HVtRgLW1XDGViYZkz+3d77J6d0+8JggloYrFv+94a 5v9PPmPYWGCZ60iJPtAo3IZfrTsX0JyebfDL7Xc27smjwzd67p2mZ+93LYB9/l5HipzU B9wobm/rdH/o6B8vGBWl0AQ0FM84i8Cv0wb6pz8OuIHfM1smKQeFBsDRExI+nQovEVHP tXbA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=LsDggOlD; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id o3-20020a170902bcc300b001c5fc13fb2dsi10617664pls.294.2023.10.16.08.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 08:47:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=LsDggOlD; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 97ECB808EE76; Mon, 16 Oct 2023 08:47:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233848AbjJPPrJ (ORCPT <rfc822;hjfbswb@gmail.com> + 18 others); Mon, 16 Oct 2023 11:47:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233738AbjJPPrD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Oct 2023 11:47:03 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2068.outbound.protection.outlook.com [40.107.105.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F6C2F5 for <linux-kernel@vger.kernel.org>; Mon, 16 Oct 2023 08:47:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YC63Vy8RV0HVKD9Y9X1Yyt11DQjTsNyAoj0VzoR+2DflTQOffgGlzhovZkfiigPJjVlhH0f1ZHNmWbVnqQ92f8sCSvHjDke9op9EJh11/olcq19hqljYHQ4O01bWnJ9L+w6RGQhaXB3L+mLm5AH4JABao6E+/f3Peht5zikMtcxVBShH4EK/IPb8JaGrXs9Hajg6qCHMDfuryd4PAX4bAyDCn6WtmwVyKvkrFY9jp3rQCWpp+shBihnNatLN3VUyCEZSsojmfbY9a+r3rXudjikK/TYaHR0EIT17TMe/v3WdGMCC+YwjrA8WjgdcZR2TOcH6u+ncw7ba3Su8OGLTqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4JvC4g+VD60esWxTBSv5RI8lGH6ctutNh7mqUTggFg4=; b=Q3cxx1j+5BWyV8Xxc34x5VZjQ5z7ykhEqk79pt3M/ekZOgW1SNk3rpHAfHyBzPrWqOrTV+HHdT6cSeEQn2/I9lFlGbqya23LkeGOLvDYBRxWoGU8eaJD9qWeOZuoZ0HJnfKLOSsI3cWflYBZRaWFJsEyrSBE/TI2/faK5d17QCKZgkKvtO7VuUy7UmahwVNB2qRH2w5DNZQLQrHdjQ2XIQ0Aa0DLem9LQ9JPT3pcSVx/+r6X/4PP26myzOI2wff4fVEMpEVejNZSzu2BZlTpTGrFZRQcEHvbcqvOMs4kT7HppKatViJ6DKfZyDAHAhrQlMoHcgmcy1UZApGdGxKRNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4JvC4g+VD60esWxTBSv5RI8lGH6ctutNh7mqUTggFg4=; b=LsDggOlDpdF0D5PC7RDi556E7dlhJCMvdMhLUOEpim4v7GobtHQW34vnHaA8eDjLZBj/VYBiKjStYxsTYlkeSsRZhF1lAxV/3ECexolwrePCw3xFfPZFzj4q2bgRFGk36t/gd5HfV9QK9Zy/zbQ2Ra8DodiNEx4LEBztsBBx2nI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB8329.eurprd04.prod.outlook.com (2603:10a6:10:24c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.47; Mon, 16 Oct 2023 15:46:57 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2%4]) with mapi id 15.20.6886.034; Mon, 16 Oct 2023 15:46:56 +0000 From: Frank Li <Frank.Li@nxp.com> To: alexandre.belloni@bootlin.com, miquel.raynal@bootlin.com, conor.culhane@silvaco.com, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH 4/5] i3c: master: svc return actual transfer data len Date: Mon, 16 Oct 2023 11:46:31 -0400 Message-Id: <20231016154632.2851957-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016154632.2851957-1-Frank.Li@nxp.com> References: <20231016154632.2851957-1-Frank.Li@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0089.namprd03.prod.outlook.com (2603:10b6:a03:331::34) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB8329:EE_ X-MS-Office365-Filtering-Correlation-Id: 161f0a0d-488c-4f24-6797-08dbce5f20a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aZP4zi1TXB2RW3tc0UjLWEfyIfKkJGYn6XJgWeEq+B8tpUDrOcTqGTObIV+sxrggL1v1Tn5V2FwE0ketkYHN6flV1Pht0MWZq8uSNlmxl0lN/s/WiaJkX//WqHdDxuQmP5H/BJ8bOt1j4EeJjrlVf/hM/5PIg+qDupIqIgx6uXpBTjZbeNuw0TP5zKkxOhpHvpS74s3Byi0seNM04XTNY4Nb2Exj8Q7jGLSJ2zbDnTpQgOHMaTDtJ2Ok0nVvJuDJVNt3Z9XzvYtiMBgX1N4B0MdRZIJXTVkwC0Y0u+GFYVlQboP/6z9xQivqzr2Lii8HPPSh0ia/vT3Hm6SP5mNVqoz1CPFve43YHU9SdZIQCmQZKfoLshcEnh2UhYq15zIylX9YxsTqbiHw4+Ie+/XzqqQxp/LRenXmS1h2zeWSQRA37TJO0scN/5cIsO1Si1ZmOATwZsyE3IAkFSUSh/3eVnFjUYnofpL4nlGLNCjLrDgBa9u46vXBJlmDLqMuo9ZeFrJoyqC7Mn7pjThmHE5IPxi/j7ouUY8elJFoXRL75NLDwASd4KxcN5JeHuU3JLb7ne2hxs1Xu4PdLrRLycClhkBCRGz9D5duFtHIA5toIj8OwQOw0I1GKW0qI4L+3b94 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(366004)(136003)(346002)(376002)(396003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(6666004)(6512007)(6506007)(52116002)(5660300002)(8936002)(8676002)(38350700005)(478600001)(6486002)(1076003)(83380400001)(2616005)(26005)(66476007)(66556008)(66946007)(316002)(41300700001)(86362001)(38100700002)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: s55BwbT+di1ygJjsy++c9ZIyg1r/4g2JZ7mx7+jNLH/zoaNOzFDiYouvX6LskWibhokFdEudYhG3xAz4VaP+7gD3s5H7DjLW0UHAFI9EvG9di5VunkHD0YajlBTrrfCWXIhzoCaKL0Y9ASrkzsD+xZ/AVzZttxggqgKG+eRvdvqH2b1p+OxVbFQk7ceMzKEzN7zCXrzdZdeIIdt2PzXRt91dQbh1up+hOtLHsJSPkG+0EbeJlGyWYfQTj1NmPJF9Tqxcuyl7kOStRGd86mtpy3Te2aTgpaF5nH03PnpYzK4eLfGRy2g98YiQQ3IxNrVIL5EbFK2msV+kvKQbY0Ze7IdS0cHcGPlPaOdRkCNKnvfFXhB1KpKRwEqnVURrayr4+yiGEI2WuYiCJVfpyc9baoKsc9kGCU4NbSCkj2+2DfFiX6HemkcGJhr1C43uS6QvzjN+E2vT0fqS5+o/ivS8GJIuiIhvEcvHmdmgsFdZDGD/X3vI73kkxxhobQQMQCbxhTh+4HwH1RguUef/M6vVeqJEvRQQ7SSPWjRd7hKGCmlWC+hIRncg8UuKQpnxB3IJ5rTzDJZRFavBiOA/j8lv6wnTQWSbgp0M4ISyjA6/J30rhQTdawGFtElGMUh2RlI0jzqetESWhwz6r1GWSJahNRwphUxL6g+rYXyNRiQHC+vYvVbta8VnRi7AInUKmKuZLN02zEPJzJ540az4Wazz04/FtT6KlSxxDfRuuezsUgVzZ/T4LPunWYeeVJi/S8BH4bt9tWJivwEGqoFXIz5C6DQ7sYb3gdiJA4agpjU2rNOi8YKxapOyP4hiakTaDQrUhj258OFU+zppjE4QhXrn+plHpqdZ38N1/krQh/X4IigIr7bGtOs23seWbIDoasVHh2esTYa9AWc5Kf9q4U/tagVww+4iRkHgh679RnmKcDJg6hZhqhktn6d5/yi4xkA5DtwU4yKK+ScwB44AUsQHKllfQKxSx7gthKtm01H4NKdT8LddgUus+2RuHzSG8iLk0kSP1X946/zbBmE+gAdAKY5BH4tEjpEdYUKILDTZtErjgBGmIDG20i8V5eSBwxZthKpyDnu6ci5OrqHLWILVCgAtVVGE7ySnKCsGn1XE7R/tFuJQbZBsgfe554D7rgI0v6ifdxGEq8JmsEAKduhdL6tYFsBrxJXTJ00eHIJVssrypV+m38mNS8f0O9fb3kQECTCx2k1mqObeh/coXNYJvXWMptZHDFKcHk25J+1vu05gpogCU2gqULyKZixpDD1HajOIxXIytq7ZT2xQl/axGKTQ3C9M/RDHVqQouISmOZVM+VIw3HAeShXv3c/cNS/j0Zr9qFOTi1ofq2u83XAARentOjobLXKOPQLKvnV4vrIcA4xnWi198l5h4q9OEsi4kS30LEr8Oj6p0vySiDjR+88aXgyIDQH3IxfJT4q18yNiWiOPZVn93cw/i4uzP3rRj8gYhGNo2v86uWwF5JlOV5mP6/hcn4N4zs9VxJ2DywBCy8UpZuDl7LYljTJGtatNljuBvrEIcL4NX1rFJNkoAml9d3Q8tPUP9EtO7qnK8qc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 161f0a0d-488c-4f24-6797-08dbce5f20a4 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 15:46:56.9398 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VCx1GMDBNUymHlGT9sARvJMbYQ3aHpIjC74ifTcRNHCBehZTlK4FOyogFMYFMPVGefxyjrSW+ZxTT+yjThZVCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8329 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 16 Oct 2023 08:47:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779927613199435846 X-GMAIL-MSGID: 1779927613199435846 |
Series |
i3c: master: some improvment for i3c master
|
|
Commit Message
Frank Li
Oct. 16, 2023, 3:46 p.m. UTC
I3C allow devices early terminate data transfer. So set "actual" to
indicate how much data get by i3c_priv_xfer.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
drivers/i3c/master/svc-i3c-master.c | 7 +++++++
1 file changed, 7 insertions(+)
Comments
Hi On 10/16/23 18:46, Frank Li wrote: > I3C allow devices early terminate data transfer. So set "actual" to > indicate how much data get by i3c_priv_xfer. > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > --- > drivers/i3c/master/svc-i3c-master.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c > index 3570b709cf60..444825aafa6f 100644 > --- a/drivers/i3c/master/svc-i3c-master.c > +++ b/drivers/i3c/master/svc-i3c-master.c > @@ -138,6 +138,7 @@ struct svc_i3c_cmd { > const void *out; > unsigned int len; > unsigned int actual_len; > + struct i3c_priv_xfer *xfer; > bool continued; > }; > I'm thinking would it make sense to combine this and previous patch by removing the read_len/actual_len variable from this structure and use the added one (by the patch 2/5) from "struct i3c_priv_xfer" directly?
Hi Frank, Frank.Li@nxp.com wrote on Mon, 16 Oct 2023 11:46:31 -0400: > I3C allow devices early terminate data transfer. So set "actual" to > indicate how much data get by i3c_priv_xfer. > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > --- > drivers/i3c/master/svc-i3c-master.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c > index 3570b709cf60..444825aafa6f 100644 > --- a/drivers/i3c/master/svc-i3c-master.c > +++ b/drivers/i3c/master/svc-i3c-master.c > @@ -138,6 +138,7 @@ struct svc_i3c_cmd { > const void *out; > unsigned int len; > unsigned int actual_len; > + struct i3c_priv_xfer *xfer; > bool continued; > }; > > @@ -1045,6 +1046,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, > > if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) { > ret = -ENXIO; > + *actual_len = 0; > goto emit_stop; > } > > @@ -1062,6 +1064,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, > */ > if (SVC_I3C_MSTATUS_IBIWON(reg)) { > ret = -ENXIO; > + *actual_len = 0; > goto emit_stop; > } > > @@ -1157,6 +1160,9 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) > cmd->addr, cmd->in, cmd->out, > cmd->len, &cmd->actual_len, > cmd->continued); > + if (cmd->xfer) > + cmd->xfer->actual = cmd->actual_len; Just to be sure, wouldn't it be more natural to always fill cmd->xfer rather than checking it here? > + > if (ret) > break; > } > @@ -1344,6 +1350,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, > for (i = 0; i < nxfers; i++) { > struct svc_i3c_cmd *cmd = &xfer->cmds[i]; > > + cmd->xfer = xfers + i; Please follow the same pattern as below: = &xfers[i] > cmd->addr = master->addrs[data->index]; > cmd->rnw = xfers[i].rnw; > cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL; Thanks, Miquèl
On Tue, Oct 17, 2023 at 11:33:34AM +0300, Jarkko Nikula wrote: > Hi > > On 10/16/23 18:46, Frank Li wrote: > > I3C allow devices early terminate data transfer. So set "actual" to > > indicate how much data get by i3c_priv_xfer. > > > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > > --- > > drivers/i3c/master/svc-i3c-master.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c > > index 3570b709cf60..444825aafa6f 100644 > > --- a/drivers/i3c/master/svc-i3c-master.c > > +++ b/drivers/i3c/master/svc-i3c-master.c > > @@ -138,6 +138,7 @@ struct svc_i3c_cmd { > > const void *out; > > unsigned int len; > > unsigned int actual_len; > > + struct i3c_priv_xfer *xfer; > > bool continued; > > }; > I'm thinking would it make sense to combine this and previous patch by > removing the read_len/actual_len variable from this structure and use the > added one (by the patch 2/5) from "struct i3c_priv_xfer" directly? Some I2C transfer and CCC use svc_i3c_cmd, in such case xfer is NULL. Keep len/actual_len is more simple. Frank
On Tue, Oct 17, 2023 at 04:10:07PM +0200, Miquel Raynal wrote: > Hi Frank, > > Frank.Li@nxp.com wrote on Mon, 16 Oct 2023 11:46:31 -0400: > > > I3C allow devices early terminate data transfer. So set "actual" to > > indicate how much data get by i3c_priv_xfer. > > > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > > --- > > drivers/i3c/master/svc-i3c-master.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c > > index 3570b709cf60..444825aafa6f 100644 > > --- a/drivers/i3c/master/svc-i3c-master.c > > +++ b/drivers/i3c/master/svc-i3c-master.c > > @@ -138,6 +138,7 @@ struct svc_i3c_cmd { > > const void *out; > > unsigned int len; > > unsigned int actual_len; > > + struct i3c_priv_xfer *xfer; > > bool continued; > > }; > > > > @@ -1045,6 +1046,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, > > > > if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) { > > ret = -ENXIO; > > + *actual_len = 0; > > goto emit_stop; > > } > > > > @@ -1062,6 +1064,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, > > */ > > if (SVC_I3C_MSTATUS_IBIWON(reg)) { > > ret = -ENXIO; > > + *actual_len = 0; > > goto emit_stop; > > } > > > > @@ -1157,6 +1160,9 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) > > cmd->addr, cmd->in, cmd->out, > > cmd->len, &cmd->actual_len, > > cmd->continued); > > + if (cmd->xfer) > > + cmd->xfer->actual = cmd->actual_len; > > Just to be sure, wouldn't it be more natural to always fill cmd->xfer > rather than checking it here? cmd->xfer is NULL for i2c and ccc transfer. So need check it. I will add comments here Frank > > > + > > if (ret) > > break; > > } > > @@ -1344,6 +1350,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, > > for (i = 0; i < nxfers; i++) { > > struct svc_i3c_cmd *cmd = &xfer->cmds[i]; > > > > + cmd->xfer = xfers + i; > > Please follow the same pattern as below: = &xfers[i] > > > cmd->addr = master->addrs[data->index]; > > cmd->rnw = xfers[i].rnw; > > cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL; > > > Thanks, > Miquèl
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 3570b709cf60..444825aafa6f 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -138,6 +138,7 @@ struct svc_i3c_cmd { const void *out; unsigned int len; unsigned int actual_len; + struct i3c_priv_xfer *xfer; bool continued; }; @@ -1045,6 +1046,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) { ret = -ENXIO; + *actual_len = 0; goto emit_stop; } @@ -1062,6 +1064,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, */ if (SVC_I3C_MSTATUS_IBIWON(reg)) { ret = -ENXIO; + *actual_len = 0; goto emit_stop; } @@ -1157,6 +1160,9 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) cmd->addr, cmd->in, cmd->out, cmd->len, &cmd->actual_len, cmd->continued); + if (cmd->xfer) + cmd->xfer->actual = cmd->actual_len; + if (ret) break; } @@ -1344,6 +1350,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, for (i = 0; i < nxfers; i++) { struct svc_i3c_cmd *cmd = &xfer->cmds[i]; + cmd->xfer = xfers + i; cmd->addr = master->addrs[data->index]; cmd->rnw = xfers[i].rnw; cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL;