From: Zhi Wang <zhiw@nvidia.com>
To: <nouveau@lists.freedesktop.org>
Cc: <airlied@gmail.com>, <daniel@ffwll.ch>, <dakr@kernel.org>,
<bskeggs@nvidia.com>, <acurrid@nvidia.com>, <cjia@nvidia.com>,
<smitra@nvidia.com>, <ankita@nvidia.com>, <aniketa@nvidia.com>,
<kwankhede@nvidia.com>, <targupta@nvidia.com>, <zhiw@nvidia.com>,
<zhiwang@kernel.org>
Subject: [PATCH v3 03/15] nvkm: rename "argv" to what it represnts on the GSP message send path
Date: Thu, 31 Oct 2024 01:52:38 -0700 [thread overview]
Message-ID: <20241031085250.2941482-4-zhiw@nvidia.com> (raw)
In-Reply-To: <20241031085250.2941482-1-zhiw@nvidia.com>
The name "argv" has different meanings in different functions.
To improve the readability, it's better to refine it to a name that
reflects what it represents.
Rename "repc" to what it represents in the GSP message send path.
Wrap the long container_of() into to_gsp_hdr() to make checkpatch.pl
happy.
No functional change is intended.
Signed-off-by: Zhi Wang <zhiw@nvidia.com>
---
.../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 27 ++++++++++---------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
index f6ed51921e50..6a9315addacb 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
@@ -121,6 +121,9 @@ struct r535_gsp_msg {
#define GSP_MSG_HDR_SIZE offsetof(struct r535_gsp_msg, data)
+#define to_gsp_hdr(p, header) \
+ container_of((void *)p, typeof(*header), data)
+
static int
r535_rpc_status_to_errno(uint32_t rpc_status)
{
@@ -203,9 +206,9 @@ r535_gsp_msgq_recv(struct nvkm_gsp *gsp, u32 gsp_rpc_len, int *ptime)
}
static int
-r535_gsp_cmdq_push(struct nvkm_gsp *gsp, void *argv)
+r535_gsp_cmdq_push(struct nvkm_gsp *gsp, void *rpc)
{
- struct r535_gsp_msg *cmd = container_of(argv, typeof(*cmd), data);
+ struct r535_gsp_msg *cmd = to_gsp_hdr(rpc, cmd);
struct r535_gsp_msg *cqe;
u32 argc = cmd->checksum;
u64 *ptr = (void *)cmd;
@@ -420,10 +423,10 @@ r535_gsp_rpc_poll(struct nvkm_gsp *gsp, u32 fn)
}
static void *
-r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *argv, bool wait,
+r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *payload, bool wait,
u32 gsp_rpc_len)
{
- struct nvfw_gsp_rpc *rpc = container_of(argv, typeof(*rpc), data);
+ struct nvfw_gsp_rpc *rpc = to_gsp_hdr(payload, rpc);
struct nvfw_gsp_rpc *msg;
u32 fn = rpc->function;
void *repv = NULL;
@@ -777,11 +780,11 @@ r535_gsp_rpc_get(struct nvkm_gsp *gsp, u32 fn, u32 argc)
}
static void *
-r535_gsp_rpc_push(struct nvkm_gsp *gsp, void *argv, bool wait,
+r535_gsp_rpc_push(struct nvkm_gsp *gsp, void *payload, bool wait,
u32 gsp_rpc_len)
{
- struct nvfw_gsp_rpc *rpc = container_of(argv, typeof(*rpc), data);
- struct r535_gsp_msg *cmd = container_of((void *)rpc, typeof(*cmd), data);
+ struct nvfw_gsp_rpc *rpc = to_gsp_hdr(payload, rpc);
+ struct r535_gsp_msg *cmd = to_gsp_hdr(rpc, cmd);
const u32 max_msg_size = (16 * 0x1000) - sizeof(struct r535_gsp_msg);
const u32 max_rpc_size = max_msg_size - sizeof(*rpc);
u32 rpc_size = rpc->length - sizeof(*rpc);
@@ -795,11 +798,11 @@ r535_gsp_rpc_push(struct nvkm_gsp *gsp, void *argv, bool wait,
rpc->length = sizeof(*rpc) + max_rpc_size;
cmd->checksum = rpc->length;
- repv = r535_gsp_rpc_send(gsp, argv, false, 0);
+ repv = r535_gsp_rpc_send(gsp, payload, false, 0);
if (IS_ERR(repv))
goto done;
- argv += max_rpc_size;
+ payload += max_rpc_size;
rpc_size -= max_rpc_size;
/* Remaining chunks sent as CONTINUATION_RECORD RPCs. */
@@ -813,13 +816,13 @@ r535_gsp_rpc_push(struct nvkm_gsp *gsp, void *argv, bool wait,
goto done;
}
- memcpy(next, argv, size);
+ memcpy(next, payload, size);
repv = r535_gsp_rpc_send(gsp, next, false, 0);
if (IS_ERR(repv))
goto done;
- argv += size;
+ payload += size;
rpc_size -= size;
}
@@ -834,7 +837,7 @@ r535_gsp_rpc_push(struct nvkm_gsp *gsp, void *argv, bool wait,
repv = NULL;
}
} else {
- repv = r535_gsp_rpc_send(gsp, argv, wait, gsp_rpc_len);
+ repv = r535_gsp_rpc_send(gsp, payload, wait, gsp_rpc_len);
}
done:
--
2.34.1
next prev parent reply other threads:[~2024-10-31 8:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 8:52 [PATCH v3 00/15] NVKM GSP RPC kernel docs, cleanups and fixes Zhi Wang
2024-10-31 8:52 ` [PATCH v3 01/15] nvkm: add a kernel doc to introduce the GSP RPC Zhi Wang
2024-12-11 10:14 ` Danilo Krummrich
2024-12-13 14:11 ` Zhi Wang
2024-10-31 8:52 ` [PATCH v3 02/15] nvkm: rename "repc" to "gsp_rpc_len" on the GSP message recv path Zhi Wang
2024-12-11 10:26 ` Danilo Krummrich
2024-12-13 14:12 ` Zhi Wang
2024-10-31 8:52 ` Zhi Wang [this message]
2024-10-31 8:52 ` [PATCH v3 04/15] nvkm: remove unused param repc in *rm_alloc_push() Zhi Wang
2024-10-31 8:52 ` [PATCH v3 05/15] nvkm: rename "argv" to what it represents in *rm_{alloc, ctrl}_*() Zhi Wang
2024-10-31 8:52 ` [PATCH v3 06/15] nvkm: rename "argc" to what it represents in GSP RPC routines Zhi Wang
2024-10-31 8:52 ` [PATCH v3 07/15] nvkm: fix the broken marco GSP_MSG_MAX_SIZE Zhi Wang
2024-10-31 8:52 ` [PATCH v3 08/15] nvkm: remove the magic number in r535_gsp_rpc_push() Zhi Wang
2024-10-31 8:52 ` [PATCH v3 09/15] nvkm: refine the variable names " Zhi Wang
2024-10-31 8:52 ` [PATCH v3 10/15] nvkm: refine the variable names in r535_gsp_msg_recv() Zhi Wang
2024-10-31 14:27 ` Timur Tabi
2024-10-31 15:49 ` Zhi Wang
2024-10-31 16:11 ` Timur Tabi
2024-10-31 18:18 ` Zhi Wang
2024-10-31 8:52 ` [PATCH v3 11/15] nvkm: rename the variable "cmd" to "msg" in r535_gsp_cmdq_{get, push}() Zhi Wang
2024-10-31 8:52 ` [PATCH v3 12/15] nvkm: factor out r535_gsp_msgq_peek() Zhi Wang
2024-12-11 13:16 ` Danilo Krummrich
2024-10-31 8:52 ` [PATCH v3 13/15] nvkm: factor out r535_gsp_msgq_recv_one_elem() Zhi Wang
2024-10-31 8:52 ` [PATCH v3 14/15] nvkm: support handling the return of large GSP message Zhi Wang
2024-10-31 8:52 ` [PATCH v3 15/15] nvkm: consume " Zhi Wang
2024-10-31 9:05 ` [PATCH v3 00/15] NVKM GSP RPC kernel docs, cleanups and fixes Danilo Krummrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241031085250.2941482-4-zhiw@nvidia.com \
--to=zhiw@nvidia.com \
--cc=acurrid@nvidia.com \
--cc=airlied@gmail.com \
--cc=aniketa@nvidia.com \
--cc=ankita@nvidia.com \
--cc=bskeggs@nvidia.com \
--cc=cjia@nvidia.com \
--cc=dakr@kernel.org \
--cc=daniel@ffwll.ch \
--cc=kwankhede@nvidia.com \
--cc=nouveau@lists.freedesktop.org \
--cc=smitra@nvidia.com \
--cc=targupta@nvidia.com \
--cc=zhiwang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.