[PATCH 041/156] drm/nouveau/nvkm: rename struct nvkm_control

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


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

Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
---
 drivers/gpu/drm/nouveau/nvkm/device/ctrl.c | 11 +++++++++--
 drivers/gpu/drm/nouveau/nvkm/device/ctrl.h |  7 -------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/device/ctrl.c b/drivers/gpu/drm/nouveau/nvkm/device/ctrl.c
index ce774579c89d..a74fb78ca7ab 100644
--- a/drivers/gpu/drm/nouveau/nvkm/device/ctrl.c
+++ b/drivers/gpu/drm/nouveau/nvkm/device/ctrl.c
@@ -31,6 +31,13 @@
 #include <nvif/ioctl.h>
 #include <nvif/unpack.h>
 
+#define nvkm_control nvif_control_priv
+
+struct nvif_control_priv {
+	struct nvkm_object object;
+	struct nvkm_device *device;
+};
+
 static int
 nvkm_control_mthd_pstate_info(struct nvkm_control *ctrl, void *data, u32 size)
 {
@@ -169,7 +176,7 @@ nvkm_control_mthd_pstate_user(struct nvkm_control *ctrl, void *data, u32 size)
 static int
 nvkm_control_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
 {
-	struct nvkm_control *ctrl = nvkm_control(object);
+	struct nvif_control_priv *ctrl = container_of(object, typeof(*ctrl), object);
 	switch (mthd) {
 	case NVIF_CONTROL_PSTATE_INFO:
 		return nvkm_control_mthd_pstate_info(ctrl, data, size);
@@ -192,7 +199,7 @@ static int
 nvkm_control_new(struct nvkm_device *device, const struct nvkm_oclass *oclass,
 		 void *data, u32 size, struct nvkm_object **pobject)
 {
-	struct nvkm_control *ctrl;
+	struct nvif_control_priv *ctrl;
 
 	if (!(ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL)))
 		return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/device/ctrl.h b/drivers/gpu/drm/nouveau/nvkm/device/ctrl.h
index 9f6d7f23af8d..d241329a1e7a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/device/ctrl.h
+++ b/drivers/gpu/drm/nouveau/nvkm/device/ctrl.h
@@ -1,13 +1,6 @@
 /* SPDX-License-Identifier: MIT */
 #ifndef __NVKM_DEVICE_CTRL_H__
 #define __NVKM_DEVICE_CTRL_H__
-#define nvkm_control(p) container_of((p), struct nvkm_control, object)
-#include <core/object.h>
-
-struct nvkm_control {
-	struct nvkm_object object;
-	struct nvkm_device *device;
-};
 
 extern const struct nvkm_device_oclass nvkm_control_oclass;
 #endif
-- 
2.41.0



More information about the Nouveau mailing list