From patchwork Wed Oct 18 20:59:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13427907 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 44F87CDB47E for ; Wed, 18 Oct 2023 21:00:09 +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=xxxpLFVQuwdsXKfCYNnpLpOIDdLTBTwc+dAytiWldmc=; b=NSb8Wy/9uPXJWW RIT5awEMlZ5ocW86JX1iFr094OYXSTtO70F1HxuaqawC+L8PDn1SBIhmcqPooYZbB/twy3tKM6HGo c6yPhkSSd/Yknkcf2/O8JhIpbf32akfhfVE3Qn2gJjQFLI5CNowXNP0um1+V6rb3ksZNl4cI936lU vkNT+42yFkTo654+JUwzcY5XbaYt63XBSPGm5e0PgHdSYgjCsFOdFD9JSYYcIGmpuNGErWaQ8WsVz gfjpHEJjvc5liHKvyTzvA48jf/Y4NT81xnJ6xzmZLmyQdxUxUEm5zUwB0wCYUAcuCTj+OEEOvUlg5 1LMHOfbOfaUGic0ogq/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtDeC-00Fgqe-39; Wed, 18 Oct 2023 21:00:08 +0000 Received: from mail-vi1eur04on062e.outbound.protection.outlook.com ([2a01:111:f400:fe0e::62e] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtDe8-00Fgk7-3C for linux-i3c@lists.infradead.org; Wed, 18 Oct 2023 21:00:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZRghT4s+LZpzKBlc4IHOaUJXiyFY0dpbr2ZcUvzy1SVZlZ+AU7hq5BHoftPQbSzpdOutZ5zo3VDLODoNlL1pjc8+0GA4Z+Fxx4pUnKMaNzrhGkMbpOKM3cybe/3fH2SADeFNLmnS4uSdKWgHymDnk5dJVOV3eTNlGCgKFL9bzS/t162MGh6folX7lWSjQYV70VjCGop/aHW9MeNQZS45Ak53n9tYKbSfiPjL9Ndo3gqsX+ynm5xINXWbxDZXjEZB57FApl5IcPGuswE7KOqhcmohtYKha8uO+ZsJoNnYdnDI1Duka1EPRBxnLWjWliTamIQIHN8iqisM0hAaPAAWsg== 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=B6Cl60dnoPjAUbmXonCKZDXgPOEMJKNC0aDD2ikB6i0=; b=IUlXNjWAsOlHlblCN104+/aUdDnVUmzQbxmt1H+vHoWUnUPvf54wr86qzinnVOwAQ/JZLPEyth+JAptpp+xdJhm+VT+qsdcDstHJXQ1k1x8FMvjD/3U1psb077cwswWBWy7L9x6QWqFyAUUT6u+10Nu83Z7dE8ApasvIYnEkePGRRmILtKjlSrMsDjTA17pKy1vJDO6LblFRWSabx4/4eNwTepBv50qasvw0CVAJaTF1xRfyXvZP8/Eduj4CmV0wxY4mxCznNRg/AwHFv/F9+V7WazvvoJCK9YLabca8MGVgwJaaWYgCKqdUTjv41CFxrN6mgSJ5gkViy3oDWDyhYw== 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=B6Cl60dnoPjAUbmXonCKZDXgPOEMJKNC0aDD2ikB6i0=; b=ICX8KwTnYMtYPyggFhqvUAU/kahDnrwOIbVARL6WlTPhuwrzDze8suftIExPXclPZIbAwDFsE0obl9cHaESo+RS2l5Pnzk4bthdaeV7Lc3moaEJFiUn2vBV5uGLomp0vcOlGZmjCjRC73svryIL3IgWkg8EuQtpA1X99R/uGsyk= 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:55 +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:55 +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 4/6] i3c: svc: rename read_len as actual_len Date: Wed, 18 Oct 2023 16:59:27 -0400 Message-Id: <20231018205929.3435110-5-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: 91104df0-f2e1-49ed-0451-08dbd01d2e44 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 05+ovSc22uh0dv5Dk8/VPv9/zY7TEN/sQ0r4EyOTEdR0KyEyVi/MhoN+SRvYJxQEbwpYS5cERIc3Jl31W/yS8FlxSiELOz+GdQ+VaFjdEljuGE1FFraAtjmnpi90c5tIWKRDj+E94IUNQ63bJt/K+8mTdKlzsAlmeueBWhsEoWaq95uWwvIe0jySaod23jpOf+SXfeovxR4sv3O+VZ4WvNtKn6Zg1wSbb+358ElifC+c5j8JyA13f4OdbDdA+vPYYQPm5k4mdTLWWORFDxd8Foma2EvhlCgxTopb8aOWjtAhYsKXFqUOtt1EqojyObWFdDRFx254Va3rwOpiCGFIy1QQeykTAErRjIEaHUsnsSGZ3S1o0XJvw7DJUvya4yyksknIOpmfDA0TxBxkinGicOZ35j0tXbG4q3C2URSjNJKnSJz/pqyaFtnUHqa7JwqIcAM0mFov7uGG2T3hS7U0zoJm5ArkUUcYYY88loXQb5nTzW6vkfdC9Qnr15SKU+u3OcZ8qrRRxkRZ65h1oyF5rO3Sn9lN8UAiqSicpP9p1t5KahkKfwyMDviZb6dDQeYGXR+YVZu3nevy1+Rkb+pzsgtiRc3BskoaG0AIwqwVQ7khQdfa4Z6UkBCEwkbC8egO 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: /XaQ5kBo214J62ywOYeK3Z9XaqiMbXmyCdwmlSB6i54gRkrUWFZBg6QspaxVg8ABKFr7HSD53Ct3Ge7nXoIBRQo3oo6LrinFWROoAw8XWrpM8OJh3+5SYFXAioI52SfFzNNJRNauLuhksmLImbS7vGhUTm64JYOuimBW7OXnvY9ydmR5b5e/qb0Sjnl0eOdCwEN1XA9D3X33HYUw0ryNHOANqDitsSXAh3cDxZvraAVlmKBKMfx4bvJiNwH7eObHBpV977AEeQLIVmY3Z0cAra8x6jei5yTcIRj2JM/q771rO+blQBSSgIk31yDNvC3ipOJTMtV+Ze+R+yvLVWLfuVcIZb7hbdHF8IYL6ZEkIVSKouS49SzQOKFbOVbRxdHQpFsJs+YZXhOQPZwIOf4+M6gYQoA1nKjXHUixcOr62ewOY2JJk0snHfxJdCwQtGqqfdQpZJlIDi/TLpDTMsZrvBLO9YO7uO1QjH+a6DDD065tS3btEFubDjeZoW73p1sUFPsN8rWPYAu2yiOhDrOtov0R1cAptdgCPJhuUeK8mxLBzw5xTf65P/BdbGQc2/EF/9AtrNXwD3ZE9UznMcMpLzrOnEaGwYmbA4l/5Znw3ZSZrAGp3DhCbEzdJGftJqG9cIHvU6mSEvemhR/inR+QqTQXgLyfp+3Dbj8decRtd2OHe3gTGzKPB8Mv36nKOwTv8sddr7GkJNDugJtPoDIz/oUj3KnF+p5bvVfBudpGaNWVXq7tYcwqgNAG2a9uf5lNT18SvbLHLifdrIQIw4e7GCZEDYnSDk6TwJOHwK/OkqtPsw2Kgngo+9geys4C8nP039V3VQrE6UatQxlyIxSl2Rl9fXhRMEnAqovhb8gBBrtd92yDasa4dFoASENvIu9qMhgc1I9W9kUpnpV6YpWbqSXicdh+dURdpsUWMy91PPMAWAp7IwJ+qgEO8BtzYQczVYZ8Jt8TxT051aFpU2ld7S/8WBn4Ogy/1vW1i/pvw2m8sPpYq8jwSfIrcIAhmZlCSr2noyjwYJG1p/c7wtl16yJ8/rUcsn3DUKJeGUNNxk2G4bOgFCgq9JqJ/0QxnrJKv18WBmUITwAw7iHFXT7+cPXsV63esa9+CwVfYnyKyvOEP9164X27BaredUJ1inkzTV3Db24Nd48Hqvbbu/y7HVwVVDYKoGTKJrGENs6WTzN/G/pz0YtxkRNNYBVUoaaDxWFdBk64OZWbCqIDseb6H/jgNuB+JyPKdsC9+nsQOo5xKcZwreUwZBDWdmVxuzlkl3c1azTLsAxY81QbK/xaeKku9xNLk7geAq64h/pprV7qusR2DWqC16tcorUD9smXVjZAQhzJVfGQxfQfO4dyrNgI+6d2D+wo/c5GqbFJamy/MjGwkC3fTwBEjR6xvPODZIkacPCSxuszsx2PHhDhxjOE+Fa/QTGZssuOxKAjnL6GT+4/fYqSz6QiIXqkhfcljaMBJegixDeknQNQK/w17epcUOClqWyjZBpQSsT5528l1WQE1MWUdtHn4j31hvpyAT9R4Rd153YW/k3PDp5YRWUplc8jtm7SKDT78PnnqkM= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91104df0-f2e1-49ed-0451-08dbd01d2e44 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:55.3498 (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: 8aM0h3Gcphr1j3jPfVWwGDNrQBb1OhvRXiRWmbByPuY4CJeMw2BrrBCvE7+pgEucjhaR6QvJcSmC4XwBlSDgRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8653 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_140005_030540_32A24779 X-CRM114-Status: GOOD ( 12.00 ) 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 --- 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 d8467607602af..6cd4cab26141c 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; }; @@ -1029,7 +1029,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; @@ -1042,7 +1042,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, @@ -1080,7 +1080,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); @@ -1162,7 +1162,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; @@ -1248,7 +1248,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); @@ -1268,7 +1268,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; @@ -1286,7 +1286,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 */ @@ -1296,7 +1296,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); @@ -1305,8 +1305,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); @@ -1356,7 +1356,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; } @@ -1396,7 +1396,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); }