From patchwork Wed Oct 18 20:59:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 155178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:8089:b0:164:83eb:24d7 with SMTP id re9csp5082523rwb; Wed, 18 Oct 2023 14:13:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdG7eWPwFfiL2KUxt1UDT69dPOxXoZUYvW8AxYATIsJ22PJaGdNQ9CuuGGg6E2RbDpD5YP X-Received: by 2002:a05:6a00:b46:b0:6be:265:1bf7 with SMTP id p6-20020a056a000b4600b006be02651bf7mr312564pfo.34.1697663601730; Wed, 18 Oct 2023 14:13:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697663601; cv=pass; d=google.com; s=arc-20160816; b=rq1Wseq3afzoWwPYUgZBKgrocVPKHuawPG31YrscfBYxeFzuXdarwzk6q8rcpnJ6LI ztki3d7emimgvlqtvumPGo999s8JqMUvs8lwCZ74vbJREqThhH1nSU7O7Vvzre9oC4FJ dFAltljJbj+eBAOyQKU4TjYXVuOerW2Q/HJKT6M1ExpmUXjVoj4IOCPilggXIYzLrf8d 86n7vqHyng3Jn8Zi8lqjy7nOnIfoGQ8sp4cV1MUYu9ssOmfLNr+HZLEX4DvKovYlOyLz EVd6W31C1VpCYIH93Vncpd2Oj5xRD4vd3ubBHsot2cpBe2kuj/xM64r+aApNcpbctKFx xgyw== 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:cc:to:from :dkim-signature; bh=WhDtfvRDJLQQEx6FBz1tV1+D+StUUIbatEyD1ujWtxY=; fh=sDe3TG6/b46JEOvF2xh0f1K4oYWCH8cpxTVfh1/w/G8=; b=xkX8FvQkP/9qizNeD7muQVX2Yi0cYEmPiYpoknsL1fIzq4kbwPWAFyDrToZZKxDF49 re2AQ/LHVMEWmhRLAymwEZvNChE2G2Xqgz2BC1Nfc/Z/2LWLZuMYUohYTUaSG0TtvAqp gfMjTnGbjwEX+N4C7qOJU2NxX8C4bm3JKUVzubLoxA/U3NSjzYg5hmdLyvQHz0ecHPmh 173/xUECKpq52Wflpkr4/1dENFZv6H11yXFeqhvn8buKiJFbLVLQlxK1KdGPW9OMpck8 7OvPI8UrMXkC5DkWGaf0NIb5oh3ikIh2tgmejCOEIToR/wkE95qZOmvm7cud/4neCiu6 yWxg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=HSogceWp; 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 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id bf13-20020a656d0d000000b00574166b7d34si2802968pgb.881.2023.10.18.14.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 14:13:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=HSogceWp; 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 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id AF1A08112ABD; Wed, 18 Oct 2023 14:13:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232053AbjJRVMx (ORCPT + 24 others); Wed, 18 Oct 2023 17:12:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235194AbjJRVMc (ORCPT ); Wed, 18 Oct 2023 17:12:32 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2045.outbound.protection.outlook.com [40.107.8.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7524D5C for ; Wed, 18 Oct 2023 14:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LAx9Fi/NUKnIk/97Ks0YcHayuAw0p9KDkeoNboD1OI6rlEidXnyIWjFxZBieKPiCzNCTqbEx2rouP1wXOt0oNA1omnqGBOvVwd83xRurFt3J3F//uGs+dI3ATL2POwHBM+xS5lyW2v+8aIwafXGfdq256R1YcWW0TMiqwUV8BlM8p1DIiUuG0FwsJNHm3x46XUm1GmR5SPcAt9tkDli4dys1MpsxrC2wChMCNZijKaaLiNKVIRavMuS0cDvUbkSwP9UTMjrJOnYC9HCUeaqPTx2SrnRZTCRY8yE0VHJT/V5TPbI6kGgU+N2/IpC2FK7fsoB+uNW3y9PplGKSPnmPTQ== 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=WhDtfvRDJLQQEx6FBz1tV1+D+StUUIbatEyD1ujWtxY=; b=IdODSCibVLur5Af4PjhPcIMbduuF0fNYR1PdGtsYZkt1yuqo76mpB9xF/ymHjXkx8Uv+4PUwKRqA/xG5l9Fhy6xXG7x6qkc2s2NuRUtbNFyRGke2Na3Z7Kwq0qjuS8OC/xX8m9rHTIEhguNpeN4boai6wr0VbcQeJ2kwopdSxR9cRIT4wMRzHIIi049Gvmk8t3XOEAusAF1lwPsrlTYL4Efwu3M2HDAQjq9US9vqPXVPEpLhq0ijY4o9DTJJb1JYbqGc101LaGccjhNwa+1bozIwNn5x+EtjqP3mMEVlXQ6RGZP8RnQ0rFFEgIawWdLNlusewnehmOnQkvWX+b4JXA== 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=WhDtfvRDJLQQEx6FBz1tV1+D+StUUIbatEyD1ujWtxY=; b=HSogceWpmMNWAEbbfevIrDMqNjFd5m/IMAGvj0K1Ac/lex8S8wpKsyUHFfh08c5nqCKvbjAHyTYMokEoHKToH5DDBhxms/VDslkH+CUszg9ILS8LalNBk5jULQLmcEHzgK7I2MVdPNI3KRBblhTck1IoIrdqlGKevi1d7lfnbeg= 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 PAXPR04MB8653.eurprd04.prod.outlook.com (2603:10a6:102:21c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Wed, 18 Oct 2023 20:59: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.6907.022; Wed, 18 Oct 2023 20:59:57 +0000 From: Frank Li To: miquel.raynal@bootlin.com Cc: Frank.Li@nxp.com, alexandre.belloni@bootlin.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/6] i3c: master: svc return actual transfer data len Date: Wed, 18 Oct 2023 16:59:28 -0400 Message-Id: <20231018205929.3435110-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018205929.3435110-1-Frank.Li@nxp.com> References: <20231018205929.3435110-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR10CA0027.namprd10.prod.outlook.com (2603:10b6:a03:255::32) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PAXPR04MB8653:EE_ X-MS-Office365-Filtering-Correlation-Id: ae579055-1f4f-4ac6-2e11-08dbd01d2fb3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5fA9xrhPnbvTfVARSNAGeqbt0obl8qBTlbf2nrK3zRsU6NceKveTifqJ/qqXw9jMGoh/SajPvPp1wMAkOAT+7WO8IXwsZhEBJAjAS4z8mtM7daA3eX8lA8wUd/kT6Y4tODYiKnGJOUbPKVdiFstuf36x6b2o2bBde1ptn1714FrvLD2LihCUJETfr2SEuhe5JGwTFGiIOntq80HRPaQpjmbFlOLXKEVREtU5QQIrNKqFCEJp+caPA4hbPxyrdiFuBjnstgRXM8RH79WNTLB/oxTHS/rmHwYZFQEox0dMexEwnRYh7CZ+d6DEt8LlZzwtUTeNn3L4TyoJ9m8oH7Ex8Hx6v/BsUEXJxOT23ukCjI36UnPbri7dR6BfSJQaZo+y9OzveN76/x9392gP9sh+iS4woy+oZG7OoetQVcfX+E2xJRS9XKueqmLpVU/DFoDiEae2SuhDeSQxRo47oaVuRJdhpBQfEqTBFH8x0veSQG1yG+6uh5RTIFzLhMabJM7/9duM7TmxAXJlqdOXyKl24KGYNhQQTjRu2W6gjxfkoMz9YLj6tyrh31NkKhyZSlVaccA163UTrURwAAgVGljkclyVhdJyaKcmfqoVnI7smCmQ6o3MJpUFs/AmdFexOOxM 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)(136003)(346002)(366004)(376002)(396003)(39860400002)(230922051799003)(1800799009)(186009)(451199024)(64100799003)(6512007)(6666004)(6506007)(52116002)(2906002)(4326008)(41300700001)(478600001)(38350700005)(6486002)(1076003)(26005)(83380400001)(2616005)(36756003)(66476007)(66946007)(6916009)(316002)(66556008)(86362001)(8936002)(8676002)(38100700002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HmTj7euQlg8AZ4rOVj+Xa1qf9JkOR0fbkfHU4dus6Ipc2Oxde0inDj3oS1cvcwYdxUiPVaD+JwRKNBsA+mVYwW1Wz1BiBFHC0KXOvCjoqRW5OcMuEkAhD15bWKGbvs8zM1ih0sFD0XcPnnKWDwMqifogKg5tkhJaNFqEBYhFzRScymiCBlZVF/GgX+ExkCjaAUK8FEwBtnoDQfbwTe1ql7ai8Q/qBBuZThmvvtUCpxtsACNsaUzgzfb+tWGCxAfAHLDvtdl8IwY5at9eXlxwpit0E/IlTuRPoKJWR9hVj7/Z7KMou8XevEIiihndOwIMVonq1WpJpDy/+SbYizXG8m0Jbavq0H/74Xq4GDK5ZwY5Tuf2CphCfF/zu+hT8Sb6MPq8K3reMgy/aFpviEf8+LBDe5I17L7uYRdtv1BKo0XYmAvmlHjYk9xyy2laiIDpEYehRJ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WaCRhTVK+J3O6mppbbHLPx8YEGt7S0Cds8ax/CQWZ7evCt3IGDnhyZ1M/Bo= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae579055-1f4f-4ac6-2e11-08dbd01d2fb3 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 20:59:57.7393 (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: +5i6NmL/tsXZAqTArh/CCKdvFcVR9InZZfh/jWoJm1nsWvcIV0heTen2OeUwj5yB/oO+2VFA3IY4DCYsXODYiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8653 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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 18 Oct 2023 14:13:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780129309026428196 X-GMAIL-MSGID: 1780129309026428196 I3C allow devices early terminate data transfer. So set "actual_len" to indicate how much data get by i3c_priv_xfer. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 6cd4cab26141c..17e953a47b1bb 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; }; @@ -1052,6 +1053,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; } @@ -1069,6 +1071,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; } @@ -1164,6 +1167,10 @@ 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); + /* cmd->xfer is NULL if I2C or CCC transfer */ + if (cmd->xfer) + cmd->xfer->actual_len = cmd->actual_len; + if (ret) break; } @@ -1351,6 +1358,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;