[PATCH 03/21] drm/nouveau/nvkm: add nvkm_client_event()
Ben Skeggs
bskeggs at nvidia.com
Thu Jun 13 16:59:55 UTC 2024
A later patch in this series moves the nvif_event callback function,
but all the callers directly dereference object->client->event().
Add a helper function so this only has to be changed in one place.
Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
---
drivers/gpu/drm/nouveau/include/nvkm/core/client.h | 1 +
drivers/gpu/drm/nouveau/nvkm/core/client.c | 6 ++++++
drivers/gpu/drm/nouveau/nvkm/core/uevent.c | 2 +-
drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.c | 6 +++---
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/client.h b/drivers/gpu/drm/nouveau/include/nvkm/core/client.h
index 2da9dfbf0d56..5c9a54d4bd64 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/client.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/client.h
@@ -19,6 +19,7 @@ struct nvkm_client {
int nvkm_client_new(const char *name, struct nvkm_device *, int (*event)(u64, void *, u32),
const struct nvif_client_impl **, struct nvif_client_priv **);
+int nvkm_client_event(struct nvkm_client *client, u64 token, void *repv, u32 repc);
/* logging for client-facing objects */
#define nvif_printk(o,l,p,f,a...) do { \
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/client.c b/drivers/gpu/drm/nouveau/nvkm/core/client.c
index 6471edda8a96..beb966d65daf 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/client.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/client.c
@@ -31,6 +31,12 @@
#include <nvif/event.h>
#include <nvif/unpack.h>
+int
+nvkm_client_event(struct nvkm_client *client, u64 token, void *repv, u32 repc)
+{
+ return client->event(token, repv, repc);
+}
+
static int
nvkm_client_new_device(struct nvif_client_priv *client,
const struct nvif_device_impl **pimpl, struct nvif_device_priv **ppriv)
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/uevent.c b/drivers/gpu/drm/nouveau/nvkm/core/uevent.c
index 365e41134f3d..fccf6477d3d1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/uevent.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/uevent.c
@@ -111,7 +111,7 @@ nvkm_uevent_ntfy(struct nvkm_event_ntfy *ntfy, u32 bits)
if (uevent->func)
return uevent->func(uevent->parent, uevent->object.object, bits);
- return client->event(uevent->object.object, NULL, 0);
+ return nvkm_client_event(client, uevent->object.object, NULL, 0);
}
int
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.c
index 9c7b83c99b80..4284e7b924fc 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.c
@@ -50,7 +50,7 @@ nvkm_uconn_uevent_gsp(struct nvkm_object *object, u64 token, u32 bits)
if (bits & NVKM_DPYID_IRQ)
args.v0.types |= NVIF_CONN_EVENT_V0_IRQ;
- return object->client->event(token, &args, sizeof(args.v0));
+ return nvkm_client_event(object->client, token, &args, sizeof(args.v0));
}
static int
@@ -67,7 +67,7 @@ nvkm_uconn_uevent_aux(struct nvkm_object *object, u64 token, u32 bits)
if (bits & NVKM_I2C_IRQ)
args.v0.types |= NVIF_CONN_EVENT_V0_IRQ;
- return object->client->event(token, &args, sizeof(args.v0));
+ return nvkm_client_event(object->client, token, &args, sizeof(args.v0));
}
static int
@@ -82,7 +82,7 @@ nvkm_uconn_uevent_gpio(struct nvkm_object *object, u64 token, u32 bits)
if (bits & NVKM_GPIO_LO)
args.v0.types |= NVIF_CONN_EVENT_V0_UNPLUG;
- return object->client->event(token, &args, sizeof(args.v0));
+ return nvkm_client_event(object->client, token, &args, sizeof(args.v0));
}
static bool
--
2.44.0
More information about the Nouveau
mailing list