From patchwork Fri Dec 1 22:25:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13476537 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A23D8C4167B for ; Fri, 1 Dec 2023 22:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1c5F4zWPCl8nWO5AZ9s+7+KXWKpUrf81bbCJyycpWvs=; b=bawYEnqcI6rY1x AqyzBwc7+ey3u4lv2qQREYgc8GlNyUOUbS3LrEiGPjn2yD2kwTm10toCL8VbsBGZUmD648uu0sox1 zjWwhVSHEilAYu83JhrB95RADR3sTZhikrLpFJyf1bnHyuHJyB37qS/j33zFtDooSSzNBsMd+GYQP akm1zHr6xoA724Wz3NihLnmpodTVYmHIdiWhlHYjLjG8YIOTrQU0+w++saCQgJG8xfKQ1Y6BnCXi0 cMbAz5EBdLMSsEsY+VYCDVgdVLBrybarN6TFkQWGO2T4/EcdhAB8sOwKhQt6wV0mu0VnP+i1PLvUZ 9dE/adp2EMk+rn5xRWAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r9CBQ-00Em8A-19; Fri, 01 Dec 2023 22:40:28 +0000 Received: from mail-db8eur05on20619.outbound.protection.outlook.com ([2a01:111:f400:7e1a::619] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r9CBN-00Em6u-2F for linux-i3c@lists.infradead.org; Fri, 01 Dec 2023 22:40:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NSWHchDzwVSO6I+2RcooBdWwGwhwblMKBQl11kupf48CmiaOxtCfYjQyLRQV94mcGuD3GOGUIn+TUIRjngJyZEv9+FNZ6ElY+7gCYcS7TDFVD1z+RRdxPxwv6A2DKAHy4yUUxhH5jlaqnvXzMcvLlisx7BYpSRbLxjQfjjTTeZnU7vOi5nqk7Gw+2QwUEJ2tmYIjrwpfgCAzcB6pA/3R56O2HbAN+QbNRHv04hltCtUbnEZ99/MlHAAyui/2V+O53eznN5KxAyA2vzRY8rIm8j55ddmwecW6csEF65eoxirWc3s2xECqp6I+MXw1LUPtr69Gblgz0WTsFwzQUr2ltw== 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=QZK3nbhXsExbv0Znn3D5HF/BW5CgmYGvGvpxgFhIT0s=; b=j3M5CSYXH9+yVy35GhAATf2hepFfDTdfI4Qh+6dbQsblAxGwJMAVGn843scHkY2yZxVPyYC75q64AdLb/fex7PZw4/3NKFKJHCmQWAyQnaDXEJ6N9idZrI8R6hZGFT0KU+6sd/iq7Hkn3F6x+fSRN9/TvoC4t88y6T/l9gi7qdolvtQcl13muXE59i8XVF3CofSMsXn9TQhSNl7UZaqkrMtHpSoOFBv1jML3pjok4ni0APLiqvJDbfuhS/LxMnIPRYO7QR+6vz622OZX9nfcHCh85C6Mcw9AViwXyQw2WM8C0ZQp2wbhNfxigFMYwAz3RGbjmc1elN8U60YPaFOBrQ== 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=QZK3nbhXsExbv0Znn3D5HF/BW5CgmYGvGvpxgFhIT0s=; b=M3fbhi1Uuar5MdcfOk4AeIpkb7dOadZ+1RexnoPFBXNJjY0eQd8N82s3tBGxEL2Odj3zG2Hs6fnvUxCj++vOFtCzA4hcjUxRPobXLQu3mdGnOfoWVeDjry+G/+4Og7ICgKmvgiL7cJ2yplrwkCJU8svNs+q4GIDkd6rkM4QBSxk= 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 AS4PR04MB9573.eurprd04.prod.outlook.com (2603:10a6:20b:4fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.13; Fri, 1 Dec 2023 22:26:08 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%6]) with mapi id 15.20.7068.016; Fri, 1 Dec 2023 22:26:08 +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, zbigniew.lukwinski@linux.intel.com Subject: [v5 resend 5/6] i3c: master: svc: return actual transfer data len Date: Fri, 1 Dec 2023 17:25:31 -0500 Message-Id: <20231201222532.2431484-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231201222532.2431484-1-Frank.Li@nxp.com> References: <20231201222532.2431484-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR17CA0022.namprd17.prod.outlook.com (2603:10b6:a03:1b8::35) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS4PR04MB9573:EE_ X-MS-Office365-Filtering-Correlation-Id: 366b7918-1f91-4312-e94a-08dbf2bc83bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1jjMXqum+sE/hGrx8e3XaUUDC5r82rKoAK4Ney2fxyHM0yhinVOG0ixBJuUB1i5QcaI3cdH3YNER25mPM6KGwNBgEG92k8FEsCa0x8+InVnFJ+BfA5vsHMMBPb2Fik9875CJsO/Dj5KCHyy0TVjJ1WTrq2nTJHZ/0bcyeh92ughizlrlFCRh0k2iZwOLKGmmlI3r97N2KdEXJS4lidsVDMOflzvkioEUTmcUumxkVWWaVehjB365BusXe8YkWQrfvPN6neI77+NkOd0uUFbkFdm+2F1/rWZdjZW8Lg69TU97BUw9qiuEBap7Zlu3mSgdy6pfNc29I5sNMV1M2JKP5xQsrWo+llHo/B4vl7ACB9I2e9BhhdmWBV0l7jsQVHNd+3w7YDZfRLQeprV+Id4PWUD5qLan5YzAPQsgJjttirSlxM2yGsLhq6NXLl1ZcIWHz+MKUz+qO48MgKE0RxDO+rLYgYVSC6EU2/0drw28d/rCnJ0HGYBoMBDqCSYH0YYgxrujQU/FyHzxWIcGaMLzh2DqlfucdNrRSemfcEGHJ99OCZgR2QwqESBYOwX6HcYEc8Jgk06FfGuBMd0dxZnOHojf2w5CUEy6VqvY8Os7GWoIa0+WHo+cHfIeFswdb26f 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)(346002)(376002)(136003)(396003)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(83380400001)(86362001)(6506007)(26005)(1076003)(6666004)(52116002)(2616005)(6512007)(41300700001)(5660300002)(8936002)(8676002)(6486002)(478600001)(2906002)(4326008)(316002)(66556008)(6916009)(66476007)(36756003)(38100700002)(66946007)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6J+m3IeuWmiOylioAIIPL0x+9yFnigaqYLlOvn9Ft3gZUUnxcU18cpfUW5m6dz7sgHSo0Q4GmLztUdgLQfep5pGpzKe2wFVUkaqHlN7NWxWs12j7uAscWEr6Idc9sNdIZ0h7AdXuzFOrJvWfqaI+4+RrYFImDyXQXCsHOL+NyQWAit1hU6940D7vzBWIVw9EV4LVOgAFG5NllDF1vn1P82pr2QF1hAZiqNWgWbHvaQqdm75oLT1ItqlogpwZeYPKjcCFZt5g2lEB1Q0fe6YtxL3bcaQID0sRcjNf2NgB8FNg+++UCbYHye8IF8doZ/jVt6e8PNHbvuM3Llhhxr7zBgWF8B6x1X0xsH9wJAV4Il/Ca4+SqdIPa2ebOGf8wg1dT5trAV6ThtPP0WkuWO+DYXKSuLmGkqHJsUyQVNgWq+Ox7GDH/p8ie2lwiVfmKX6awP2juQYnzCyyk0Q4d13uVIdd8anulOUhkUf8Tmy0NKnxk/LKkrrPindCQcUnpxaGmLv7QobeQJXsDspyLUUJaejm45QmbghEcFZ6pFLwn4HI4sCB/6snViOR1iVyQpOdR2pf/XgMvc45XniUcbperBBza9Vou8MNEJ94BbmZ6tLUFawwSKMAOWsIMTvIkKbxUsaT5VD8sfhvw7cKosWSJqd9YFRRD4tamzMp8UTDtAdJ2uv8twvGAEfnETgo++ntGFFQx0uzLR1v2yVVkzvOIUzSnhgqA9+2A04vx8BSkpCtk8GJxTN92INYAhumlpJkVeIBlewx1968O1rI+fGFxmc6En+TBvxx/f9m5mz0YbKdOyghNhqkhadJZzx1VRbd+aTa2QfFQVOG5f5ZV6OBGRqkG2QDiOVn4he96s+MYeADjpawbJWv2I5WzbWLClpHr+HwN6A+NbxuVUb9c+LPiNADxzjj2r8Zj6SIgrGXuWPw0Xxq4uF1UDsmjeg+d7n9MuRG1e+0tW2ntqJvKEqbbgz70jS496uT/2Kh906MjDl4c4tQu+OpG5iulzPujbNKdZIKQSbCwSNBNSrOcI1ADoXkMYZxPFEs7RMt5Zo6nIahiI03J+KIX2E4vX/9tH9WbKOigcCAzWauvApz9T2vK7rnbT2HaFfq/8ly6B18G56+7U+oFAORJdvSHrV1/pVjwTuavwWaluwvQ6HCoZ/F1ClM/b/z1S8+mX97CgIB+ptWURW1mYvCvxIlmbWNN0N7r07SWuZOCeBaiRgA1T3E20v4bxnqio6vN6ZK+r1Ss5KHhsjUjW/dkQlDMuuyJxqM7RXSD0txNCf7d4kcLEH/ZammhQujz05VhNJSBHFTlGZPE2nynauo01jO8QhGCpM7Rcbf+Ib88PMoeGCBgAv24LoCGbsiO1pdAUZnhdK8vtruuMWeXrThbxYIAtzrEohz2Na0SpWUQZxXYqqv2o3r+yhvq9PvgrCnDh1MlJGTx9uuUOX9oVm0C+7yp9JRn1M+Wf8NZppYw5/hD353WLrKEk6I+OSHTXrlOxHb8dZ9ucECjuEfcZkm0xQ5PCNiZEjX8feXGlfcV1cXntCB7ZriqVilnSQR870F11NhHpuiafiQggmTblFiDKSeDaqbW7kg X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 366b7918-1f91-4312-e94a-08dbf2bc83bb X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2023 22:26:08.2467 (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: 7dVlk5+EshCdBsMS2KGVvvvbqI0syIe7AGdj0IJ66CeXtFIiW/KN658rZdefg82As4ozqZawA7lLqznwDsMaDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9573 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231201_144025_735443_7FA0B01B X-CRM114-Status: GOOD ( 11.10 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org I3C allow devices early terminate data transfer. So set "actual_len" to indicate how much data get by i3c_priv_xfer. Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Notes: change from v4 to v5 update prefix add Miquel's review tag 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 13a8b3c2aa541..bd10bb698da0f 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; }; @@ -1061,6 +1062,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; } @@ -1078,6 +1080,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; } @@ -1173,6 +1176,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; } @@ -1360,6 +1367,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;