From patchwork Thu Nov 30 22:44:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13475137 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 B429AC10F04 for ; Thu, 30 Nov 2023 22:44:46 +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=k8eGGgEjz1oblNDd16RLvCOFBB/unow5f75q9Bz5PJQ=; b=Zp9wyTg+HwTi76 nKJEFur1WxkauyidI7xzOFV+j+DREmwKSdtTpVWoXcI0l+bSb897nAXy7rx2+jNHF2oWh8eMyi4PN n4pAof3JDdslONmiyiltrQvtwv21B+gAoQGZlUQGmyaCD+JXhhNO9XNxxLxa0FGKsCRIqRifggPUO By6Awq2EGhs/LFbzHZPFuTvGT5n97MGuaA8fYuHE12EdZbvk4TXr/CZcDk0LdNT6nKdlzJUffjZxD 9Sb9S+SK5WvkjLZKjMeRk+am1AcZgaRrzd0TDzCc2P5T5QgUCao9TmnxyFXT0Ksk7DER62zJIDjaS dKmZie1q27xkVeYAt7sQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8pm2-00C5gV-1X; Thu, 30 Nov 2023 22:44:46 +0000 Received: from mail-dbaeur03on2062f.outbound.protection.outlook.com ([2a01:111:f400:fe1a::62f] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r8pm0-00C5as-14 for linux-i3c@lists.infradead.org; Thu, 30 Nov 2023 22:44:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dBSjOU8IfeGqRnRRPIfVLeYe/pBTWm7ip6qpB1g72F+DWELNjgc1dx+mbtcPL12fJ2A4YSb3CZ+zmF6l9XoFlCSAQyDS/b6KIm5pu7nIZY67c5Y8t+uwYcwqX95OWWNnfh+iAalpzHJ9QW7lhjhA4ULnYr5G6+KWidwxJgKVegrr1j7xlUjq1q15vV403nxAD1BLn7Ij6IqPaUaYOD57oaToHYFB2Am0HSwmODDTVghgsztm5zu5dhu4MKtyOHIJ/Xu32IgKbt4eWsYyIp6auWPzDqi2YrSizrOZN99BvETc+5LuzbmsQwEbMBFYrevIP6Z+U6K56u3XbNuiUknOTA== 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=XXDAhNm+DCe1srAC+lBUWMnfd6Ayz3DSi20A50myyuQ=; b=n0x/ldLT+sd2GLxdN3cXpb1pFEd3A3OePkdrupFtBBkbpxsQn8SjX/9QiGhe7y/yD6RzjnWKgG6biY5pfrqdHdiEddHKyly3NSFZjy/drZGPI7fwPSCHS4pw1Ks1iIzv6SgxVSsmBeOqwRk6cTTHi4P5tvj8o08VoLP8QUhH1K1+vBMV4NpI/jhR98IG7l22Gx5kkC7FzXRZ4NHyh9ZgfkFfsJZjL45NnpIvSl/+8pbFGmqXtJre3VkEUi+1MOpHhX2Gr2rxE3fWMU/17eu0M39PiB6Kd0GbtxsIdbU4M6P07UvSukCMsrxKImGsurBWhZuXpd4ugXX5Yp3oOE7aZw== 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=XXDAhNm+DCe1srAC+lBUWMnfd6Ayz3DSi20A50myyuQ=; b=bamEUMo3WldkGBMya2I61xEn5kJ9sFOKNq5lIz8EqHKg3pLAw8jkOUzi704YRPyzOlXzRxWSlXq/QgdYPGFMhoLXiw5SfTr4iz+ws9NUUH4+D0k2AtC3WE9McfaB6XdJgD0uiITtM841aelb6aYvWzSVgcWEp7cHVgVGcqLxxbQ= 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 AS8PR04MB8851.eurprd04.prod.outlook.com (2603:10a6:20b:42e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.13; Thu, 30 Nov 2023 22:44:41 +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.7046.015; Thu, 30 Nov 2023 22:44:40 +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, gregkh@linuxfoundation.org, jirislaby@kernel.org, linux-serial@vger.kernel.org Subject: [PATCH v5 4/7] i3c: master: svc: rename read_len as actual_len Date: Thu, 30 Nov 2023 17:44:05 -0500 Message-Id: <20231130224408.3591288-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231130224408.3591288-1-Frank.Li@nxp.com> References: <20231130224408.3591288-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0212.namprd03.prod.outlook.com (2603:10b6:a03:39f::7) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB8851:EE_ X-MS-Office365-Filtering-Correlation-Id: 0641e87c-b724-49aa-8836-08dbf1f5f087 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o3IrbjDB+WX3leaGPijqF313mH1qiw6ooFkMauAGED+19dCqodMxCCyOcJ3Nuq7YWdymAFSL4LVyAhZlgKVgiK6AsJ6BHOjlqd7cpHgKhrnHl13emGp8EEU4rATT6DFAyOeUliUQK38LQoAkH6aTtGaG4dk33TSaBGxlwIdhOjk32cOp1NyeR3cFRjoy+MNo1n9GF6Owv+CgUYVLv5zAqGFFxHTTR+5Yi94BC5C4CTuIG/kFheNTmwdi74gOHkpUigxWRjFpc5lYq9F5+1obTqkUQJq+dhPRtda00OPEcdnZXnI9U38uYZewgiLY7mgPwMvNfONcDSFcirEb4IXlBcWAmNOG1tOaR/ZMd7TvtwG2/R5OkSMLQm4VvUHyrS4f5dObxOW4cThTjWkvcvl5KRjn22HG1zVNefXHEnSGdyHcQ99lBOTw1Pp2Skv9g0cXpM3wxB3457zl3Mg3ODzRUgMskyg6X+T/MXzYN+z9uI4bB5Iy09yajke81DidOFdhQPRxCjJqe37Mx2ajadJ7x/qb6YKb9ISXjXMyCpXwxh6EULIdvZCwM7k47NrF2Cre3c0NnmsF61x+HBUlzNM+y+I+SNdF0GUBqcCvDlKiHRbNYGX4Fshr0+Scgi/pMM4ZoB/exxO1UZJFCsgcoQUyx8oHbbZgX7wOOXdslUDxDb4= 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)(346002)(39860400002)(396003)(136003)(366004)(376002)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(86362001)(6512007)(5660300002)(36756003)(41300700001)(6506007)(38350700005)(8676002)(52116002)(478600001)(2906002)(6486002)(6666004)(26005)(83380400001)(7416002)(2616005)(1076003)(4326008)(8936002)(66946007)(6916009)(66476007)(66556008)(38100700002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Mm2wkNJDtQP26COCpJb84QjErefWJUGPiYA20nFtkF64tyIarsoj074RwMknBM/OoMxhtth52ZHN6c9Xw0UHOgenRgsl+Jog/WoYVyjZC/GcwK3gc54ABE6YVf39g57p/spxlJz7P+zD6UZCvvOo3x1JyB5GxTM70Mi0QzQNChuPyjn84j2wvqL8u5B6S2+rnAcD9ja+ahrlDlK3asIEh6pE7IMYbaZejF7GMX4aJLXz8PCqJx+O4od/Ai0BuHcprNgBIGQIC/zqKgil8ytyIy1n/do+V8LLtowdZqM0MgSY2euWb+nQQ5a1YazKQwIwzcatxVmEyvHM4JizKtEzKluezT7RvAAceKU1MD6F9jghKNy4+IFfeXHZRiRDi9g5xIWjA4lzWuITdpuDEc911XU0kR8y9hrYohg0XPaTZ0KaVKWeOe7KiUIxVFOVxmpHuuQJPyqx6joRiXJbB3qhTiwQBVzFvT/xvYYqAYNBg9pKseO2MeCA9ApBxFA60QJSqGEgd5RTS3HNxn7swS/aBada4SEEuAQaetnlZ9ZwLpHEo3FRZHFnRiIk/AbdHSLo2wx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b724-49aa-8836-08dbf1f5f087 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 22:44:40.9229 (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: j2YtxpGgr2B4jjDO0JeOwgbqOPlzdYKoku3sD6Z2cb0zdT36Eskzq+yjmKwZxLnJoB3uzwX/Cr4zWLFAihNcwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8851 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231130_144444_374858_A5E688E0 X-CRM114-Status: GOOD ( 12.58 ) 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 transfer (SDR), target can early terminate read transfer. I3C transfer (HDR), target can end write transfer. I2C transfer, target can NACK write transfer. 'actual_len' is better name than 'read_len'. Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Notes: change from v4 to v5: use i3c: master: svc: prefix drivers/i3c/master/svc-i3c-master.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index f2058a36f869b..13a8b3c2aa541 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -137,7 +137,7 @@ struct svc_i3c_cmd { u8 *in; const void *out; unsigned int len; - unsigned int read_len; + unsigned int actual_len; bool continued; }; @@ -1038,7 +1038,7 @@ static int svc_i3c_master_write(struct svc_i3c_master *master, static int svc_i3c_master_xfer(struct svc_i3c_master *master, bool rnw, unsigned int xfer_type, u8 addr, u8 *in, const u8 *out, unsigned int xfer_len, - unsigned int *read_len, bool continued) + unsigned int *actual_len, bool continued) { u32 reg; int ret; @@ -1051,7 +1051,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, SVC_I3C_MCTRL_IBIRESP_NACK | SVC_I3C_MCTRL_DIR(rnw) | SVC_I3C_MCTRL_ADDR(addr) | - SVC_I3C_MCTRL_RDTERM(*read_len), + SVC_I3C_MCTRL_RDTERM(*actual_len), master->regs + SVC_I3C_MCTRL); ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, @@ -1089,7 +1089,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, goto emit_stop; if (rnw) - *read_len = ret; + *actual_len = ret; ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, SVC_I3C_MSTATUS_COMPLETE(reg), 0, 1000); @@ -1171,7 +1171,7 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) ret = svc_i3c_master_xfer(master, cmd->rnw, xfer->type, cmd->addr, cmd->in, cmd->out, - cmd->len, &cmd->read_len, + cmd->len, &cmd->actual_len, cmd->continued); if (ret) break; @@ -1257,7 +1257,7 @@ static int svc_i3c_master_send_bdcast_ccc_cmd(struct svc_i3c_master *master, cmd->in = NULL; cmd->out = buf; cmd->len = xfer_len; - cmd->read_len = 0; + cmd->actual_len = 0; cmd->continued = false; mutex_lock(&master->lock); @@ -1277,7 +1277,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, struct i3c_ccc_cmd *ccc) { unsigned int xfer_len = ccc->dests[0].payload.len; - unsigned int read_len = ccc->rnw ? xfer_len : 0; + unsigned int actual_len = ccc->rnw ? xfer_len : 0; struct svc_i3c_xfer *xfer; struct svc_i3c_cmd *cmd; int ret; @@ -1295,7 +1295,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, cmd->in = NULL; cmd->out = &ccc->id; cmd->len = 1; - cmd->read_len = 0; + cmd->actual_len = 0; cmd->continued = true; /* Directed message */ @@ -1305,7 +1305,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, cmd->in = ccc->rnw ? ccc->dests[0].payload.data : NULL; cmd->out = ccc->rnw ? NULL : ccc->dests[0].payload.data, cmd->len = xfer_len; - cmd->read_len = read_len; + cmd->actual_len = actual_len; cmd->continued = false; mutex_lock(&master->lock); @@ -1314,8 +1314,8 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, svc_i3c_master_dequeue_xfer(master, xfer); mutex_unlock(&master->lock); - if (cmd->read_len != xfer_len) - ccc->dests[0].payload.len = cmd->read_len; + if (cmd->actual_len != xfer_len) + ccc->dests[0].payload.len = cmd->actual_len; ret = xfer->ret; svc_i3c_master_free_xfer(xfer); @@ -1365,7 +1365,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL; cmd->out = xfers[i].rnw ? NULL : xfers[i].data.out; cmd->len = xfers[i].len; - cmd->read_len = xfers[i].rnw ? xfers[i].len : 0; + cmd->actual_len = xfers[i].rnw ? xfers[i].len : 0; cmd->continued = (i + 1) < nxfers; } @@ -1405,7 +1405,7 @@ static int svc_i3c_master_i2c_xfers(struct i2c_dev_desc *dev, cmd->in = cmd->rnw ? xfers[i].buf : NULL; cmd->out = cmd->rnw ? NULL : xfers[i].buf; cmd->len = xfers[i].len; - cmd->read_len = cmd->rnw ? xfers[i].len : 0; + cmd->actual_len = cmd->rnw ? xfers[i].len : 0; cmd->continued = (i + 1 < nxfers); }