[PATCH 058/156] drm/nouveau/nvif: add alternate version of nvif_event_ctor()

Ben Skeggs bskeggs at nvidia.com
Tue Apr 16 23:38:24 UTC 2024


- callers will transition to new args in upcoming patches
- some macro trickery to avoid temporary renames, will be removed later

Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
---
 drivers/gpu/drm/nouveau/include/nvif/event.h | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/include/nvif/event.h b/drivers/gpu/drm/nouveau/include/nvif/event.h
index 68bf6635841f..1683e138c7f8 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/event.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/event.h
@@ -24,12 +24,26 @@ int nvif_event_ctor_(struct nvif_object *, const char *, u32, nvif_event_func, b
 		     struct nvif_event_v0 *, u32, bool, struct nvif_event *);
 
 static inline int
-nvif_event_ctor(struct nvif_object *parent, const char *name, u32 handle, nvif_event_func func,
-		bool wait, struct nvif_event_v0 *args, u32 argc, struct nvif_event *event)
+nvif_event_ctor_0(struct nvif_object *parent, const char *name, u32 handle, nvif_event_func func,
+		  bool wait, struct nvif_event_v0 *args, u32 argc, struct nvif_event *event)
 {
 	return nvif_event_ctor_(parent, name, handle, func, wait, args, argc, true, event);
 }
 
+static inline void
+nvif_event_ctor_1(struct nvif_object *parent, const char *name, u32 handle,
+		  nvif_event_func func, struct nvif_event *event)
+{
+	nvif_object_ctor(parent, name ?: "nvifEvent", handle, 0, &event->object);
+	event->func = func;
+}
+
+#define nvif_event_ctor__(A,B,C,D,E,F,G,H,IMPL,...) IMPL
+#define nvif_event_ctor(A...) nvif_event_ctor__(A, nvif_event_ctor_0, \
+						   nvif_event_ctor__, \
+						   nvif_event_ctor__, \
+						   nvif_event_ctor_1)(A)
+
 void nvif_event_dtor(struct nvif_event *);
 int nvif_event_allow(struct nvif_event *);
 int nvif_event_block(struct nvif_event *);
-- 
2.41.0



More information about the Nouveau mailing list