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 v4 05/15] drm/nouveau: rename "argv" to what it represents in *rm_{alloc, ctrl}_*()
Date: Fri, 24 Jan 2025 10:29:48 -0800 [thread overview]
Message-ID: <20250124182958.2040494-6-zhiw@nvidia.com> (raw)
In-Reply-To: <20250124182958.2040494-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 "argv" to what it represents. Wrap the long container_of() into
to_payload_header() to denote a clear meaning and 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 | 25 +++++++++++--------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
index eb82e589381a..3bc5f25f1e8c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
@@ -126,6 +126,9 @@ struct r535_gsp_msg {
#define to_gsp_hdr(p, header) \
container_of((void *)p, typeof(*header), data)
+#define to_payload_hdr(p, header) \
+ container_of((void *)p, typeof(*header), params)
+
static int
r535_rpc_status_to_errno(uint32_t rpc_status)
{
@@ -639,17 +642,17 @@ r535_gsp_rpc_rm_free(struct nvkm_gsp_object *object)
}
static void
-r535_gsp_rpc_rm_alloc_done(struct nvkm_gsp_object *object, void *repv)
+r535_gsp_rpc_rm_alloc_done(struct nvkm_gsp_object *object, void *params)
{
- rpc_gsp_rm_alloc_v03_00 *rpc = container_of(repv, typeof(*rpc), params);
+ rpc_gsp_rm_alloc_v03_00 *rpc = to_payload_hdr(params, rpc);
nvkm_gsp_rpc_done(object->client->gsp, rpc);
}
static void *
-r535_gsp_rpc_rm_alloc_push(struct nvkm_gsp_object *object, void *argv)
+r535_gsp_rpc_rm_alloc_push(struct nvkm_gsp_object *object, void *params)
{
- rpc_gsp_rm_alloc_v03_00 *rpc = container_of(argv, typeof(*rpc), params);
+ rpc_gsp_rm_alloc_v03_00 *rpc = to_payload_hdr(params, rpc);
struct nvkm_gsp *gsp = object->client->gsp;
void *ret = NULL;
@@ -692,25 +695,25 @@ r535_gsp_rpc_rm_alloc_get(struct nvkm_gsp_object *object, u32 oclass, u32 argc)
}
static void
-r535_gsp_rpc_rm_ctrl_done(struct nvkm_gsp_object *object, void *repv)
+r535_gsp_rpc_rm_ctrl_done(struct nvkm_gsp_object *object, void *params)
{
- rpc_gsp_rm_control_v03_00 *rpc = container_of(repv, typeof(*rpc), params);
+ rpc_gsp_rm_control_v03_00 *rpc = to_payload_hdr(params, rpc);
- if (!repv)
+ if (!params)
return;
nvkm_gsp_rpc_done(object->client->gsp, rpc);
}
static int
-r535_gsp_rpc_rm_ctrl_push(struct nvkm_gsp_object *object, void **argv, u32 repc)
+r535_gsp_rpc_rm_ctrl_push(struct nvkm_gsp_object *object, void **params, u32 repc)
{
- rpc_gsp_rm_control_v03_00 *rpc = container_of((*argv), typeof(*rpc), params);
+ rpc_gsp_rm_control_v03_00 *rpc = to_payload_hdr((*params), rpc);
struct nvkm_gsp *gsp = object->client->gsp;
int ret = 0;
rpc = nvkm_gsp_rpc_push(gsp, rpc, true, repc);
if (IS_ERR_OR_NULL(rpc)) {
- *argv = NULL;
+ *params = NULL;
return PTR_ERR(rpc);
}
@@ -722,7 +725,7 @@ r535_gsp_rpc_rm_ctrl_push(struct nvkm_gsp_object *object, void **argv, u32 repc)
}
if (repc)
- *argv = rpc->params;
+ *params = rpc->params;
else
nvkm_gsp_rpc_done(gsp, rpc);
--
2.34.1
next prev parent reply other threads:[~2025-01-24 18:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 18:29 [PATCH v4 00/15] NVKM GSP RPC kernel docs, cleanups and fixes Zhi Wang
2025-01-24 18:29 ` [PATCH v4 01/15] drm/nouveau: add a kernel doc to introduce the GSP RPC Zhi Wang
2025-01-24 18:29 ` [PATCH v4 02/15] drm/nouveau: rename "repc" to "gsp_rpc_len" on the GSP message recv path Zhi Wang
2025-01-24 18:29 ` [PATCH v4 03/15] drm/nouveau: rename "argv" to what it represents on the GSP message send path Zhi Wang
2025-01-24 18:29 ` [PATCH v4 04/15] drm/nouveau: remove unused param repc in *rm_alloc_push() Zhi Wang
2025-01-24 18:29 ` Zhi Wang [this message]
2025-01-24 18:29 ` [PATCH v4 06/15] drm/nouveau: rename "argc" to what it represents in GSP RPC routines Zhi Wang
2025-01-24 18:29 ` [PATCH v4 07/15] drm/nouveau: fix the broken marco GSP_MSG_MAX_SIZE Zhi Wang
2025-01-24 18:29 ` [PATCH v4 08/15] drm/nouveau: remove the magic number in r535_gsp_rpc_push() Zhi Wang
2025-01-24 18:29 ` [PATCH v4 09/15] drm/nouveau: refine the variable names " Zhi Wang
2025-01-24 18:29 ` [PATCH v4 10/15] drm/nouveau: refine the variable names in r535_gsp_msg_recv() Zhi Wang
2025-01-24 18:29 ` [PATCH v4 11/15] drm/nouveau: rename the variable "cmd" to "msg" in r535_gsp_cmdq_{get, push}() Zhi Wang
2025-01-24 18:29 ` [PATCH v4 12/15] drm/nouveau: factor out r535_gsp_msgq_peek() Zhi Wang
2025-01-24 18:29 ` [PATCH v4 13/15] drm/nouveau: factor out r535_gsp_msgq_recv_one_elem() Zhi Wang
2025-01-24 18:29 ` [PATCH v4 14/15] drm/nouveau: support handling the return of large GSP message Zhi Wang
2025-01-24 18:29 ` [PATCH v4 15/15] drm/nouveau: consume " Zhi Wang
2025-01-24 23:57 ` [PATCH v4 00/15] NVKM GSP RPC kernel docs, cleanups and fixes Danilo Krummrich
2025-01-25 12:52 ` Zhi Wang
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=20250124182958.2040494-6-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.