[PATCH 038/156] drm/nouveau/nvkm: rename struct nvkm_uevent

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


- preparation for upcoming patches
- open-code current nvkm_uevent() macro
- alias remaining use of nvkm_uevent to nvif_event_priv, removed later

Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
---
 drivers/gpu/drm/nouveau/include/nvkm/core/os.h |  2 ++
 drivers/gpu/drm/nouveau/nvkm/core/uevent.c     | 17 ++++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/os.h b/drivers/gpu/drm/nouveau/include/nvkm/core/os.h
index 9b05612e6490..668338d7bda3 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/os.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/os.h
@@ -30,4 +30,6 @@ nvkm_blob_dtor(struct nvkm_blob *blob)
 	(p = container_of((h), typeof(*p), m), nvkm_list_find_next(p, (h), m, (c)))
 #define nvkm_list_foreach(p,h,m,c)                                                           \
 	for (p = nvkm_list_find(p, (h), m, (c)); p; p = nvkm_list_find_next(p, (h), m, (c)))
+
+#define nvkm_uevent nvif_event_priv
 #endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/uevent.c b/drivers/gpu/drm/nouveau/nvkm/core/uevent.c
index cc254c390a57..900814c9a6bd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/uevent.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/uevent.c
@@ -19,13 +19,12 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
-#define nvkm_uevent(p) container_of((p), struct nvkm_uevent, object)
 #include <core/event.h>
 #include <core/client.h>
 
 #include <nvif/if000e.h>
 
-struct nvkm_uevent {
+struct nvif_event_priv {
 	struct nvkm_object object;
 	struct nvkm_object *parent;
 	nvkm_uevent_func func;
@@ -60,7 +59,7 @@ nvkm_uevent_mthd_allow(struct nvkm_uevent *uevent, union nvif_event_allow_args *
 static int
 nvkm_uevent_mthd(struct nvkm_object *object, u32 mthd, void *argv, u32 argc)
 {
-	struct nvkm_uevent *uevent = nvkm_uevent(object);
+	struct nvif_event_priv *uevent = container_of(object, typeof(*uevent), object);
 
 	switch (mthd) {
 	case NVIF_EVENT_V0_ALLOW: return nvkm_uevent_mthd_allow(uevent, argv, argc);
@@ -75,7 +74,7 @@ nvkm_uevent_mthd(struct nvkm_object *object, u32 mthd, void *argv, u32 argc)
 static int
 nvkm_uevent_fini(struct nvkm_object *object, bool suspend)
 {
-	struct nvkm_uevent *uevent = nvkm_uevent(object);
+	struct nvif_event_priv *uevent = container_of(object, typeof(*uevent), object);
 
 	nvkm_event_ntfy_block(&uevent->ntfy);
 	return 0;
@@ -84,7 +83,7 @@ nvkm_uevent_fini(struct nvkm_object *object, bool suspend)
 static int
 nvkm_uevent_init(struct nvkm_object *object)
 {
-	struct nvkm_uevent *uevent = nvkm_uevent(object);
+	struct nvif_event_priv *uevent = container_of(object, typeof(*uevent), object);
 
 	if (atomic_read(&uevent->allowed))
 		nvkm_event_ntfy_allow(&uevent->ntfy);
@@ -95,7 +94,7 @@ nvkm_uevent_init(struct nvkm_object *object)
 static void *
 nvkm_uevent_dtor(struct nvkm_object *object)
 {
-	struct nvkm_uevent *uevent = nvkm_uevent(object);
+	struct nvif_event_priv *uevent = container_of(object, typeof(*uevent), object);
 
 	nvkm_event_ntfy_del(&uevent->ntfy);
 	return uevent;
@@ -112,7 +111,7 @@ nvkm_uevent = {
 static int
 nvkm_uevent_ntfy(struct nvkm_event_ntfy *ntfy, u32 bits)
 {
-	struct nvkm_uevent *uevent = container_of(ntfy, typeof(*uevent), ntfy);
+	struct nvif_event_priv *uevent = container_of(ntfy, typeof(*uevent), ntfy);
 	struct nvkm_client *client = uevent->object.client;
 
 	if (uevent->func)
@@ -122,7 +121,7 @@ nvkm_uevent_ntfy(struct nvkm_event_ntfy *ntfy, u32 bits)
 }
 
 int
-nvkm_uevent_add(struct nvkm_uevent *uevent, struct nvkm_event *event, int id, u32 bits,
+nvkm_uevent_add(struct nvif_event_priv *uevent, struct nvkm_event *event, int id, u32 bits,
 		nvkm_uevent_func func)
 {
 	if (WARN_ON(uevent->func))
@@ -138,7 +137,7 @@ nvkm_uevent_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
 		struct nvkm_object **pobject)
 {
 	struct nvkm_object *parent = oclass->parent;
-	struct nvkm_uevent *uevent;
+	struct nvif_event_priv *uevent;
 	union nvif_event_args *args = argv;
 
 	if (argc < sizeof(args->v0) || args->v0.version != 0)
-- 
2.41.0



More information about the Nouveau mailing list