drm/nouveau/nvkm: remove nvkm_subdev.index
authorBen Skeggs <bskeggs@redhat.com>
Mon, 8 Feb 2021 01:30:21 +0000 (11:30 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 11 Feb 2021 01:50:04 +0000 (11:50 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c

index aa0ac7bf9db0ad6fb7e3da36514b6e62793b878b..a18b6cfda07e4a605d0b6e32d798b69b667a3e64 100644 (file)
@@ -5,8 +5,6 @@
 #include <core/event.h>
 enum nvkm_subdev_type;
 
-#define nvkm_devidx nvkm_subdev_type
-
 enum nvkm_device_type {
        NVKM_DEVICE_PCI,
        NVKM_DEVICE_AGP,
index 5e9a9cae66ed4d1079c8e74a3f21ee771599dbcb..1665738948fb474127ec67d3b9ea64653c94b829 100644 (file)
@@ -4,13 +4,9 @@
 #include <core/device.h>
 
 enum nvkm_subdev_type {
-#define NVKM_LAYOUT_ONCE(t,s,p) t,
-#define NVKM_LAYOUT_INST_3(t) t, t##0 = t, t##1, t##2, t##_LAST = t##2,
-#define NVKM_LAYOUT_INST_9(t) t, t##0 = t, t##1, t##2, t##3, t##4, t##5, t##6, t##7, t##8, t##_LAST = t##8,
-#define NVKM_LAYOUT_INST(t,s,p,c) NVKM_LAYOUT_INST_##c(t)
+#define NVKM_LAYOUT_ONCE(t,s,p,...) t,
+#define NVKM_LAYOUT_INST NVKM_LAYOUT_ONCE
 #include <core/layout.h>
-#undef NVKM_LAYOUT_INST_9
-#undef NVKM_LAYOUT_INST_3
 #undef NVKM_LAYOUT_INST
 #undef NVKM_LAYOUT_ONCE
        NVKM_SUBDEV_NR
@@ -19,7 +15,6 @@ enum nvkm_subdev_type {
 struct nvkm_subdev {
        const struct nvkm_subdev_func *func;
        struct nvkm_device *device;
-       enum nvkm_devidx index;
        enum nvkm_subdev_type type;
        int inst;
        char name[16];
index fab794372c36dabd9ba170737fdd0b9d7ed57990..a74b7acb6832e55540d2229c0dd16f9288af8a08 100644 (file)
@@ -174,7 +174,6 @@ nvkm_subdev_ctor(const struct nvkm_subdev_func *func, struct nvkm_device *device
        subdev->device = device;
        subdev->type = type;
        subdev->inst = inst < 0 ? 0 : inst;
-       subdev->index = type + subdev->inst;
 
        if (inst >= 0)
                snprintf(subdev->name, sizeof(subdev->name), "%s%d", nvkm_subdev_type[type], inst);
index 5ee675273fe31b5a45d6ebb3a139720f5624929d..35ad59c1aaaa87626ff8d1ddb9b1cfeaf85a798f 100644 (file)
@@ -2645,7 +2645,7 @@ nvkm_device_subdev(struct nvkm_device *device, int type, int inst)
        struct nvkm_subdev *subdev;
 
        list_for_each_entry(subdev, &device->subdev, head) {
-               if (subdev->index == type + inst)
+               if (subdev->type == type && subdev->inst == inst)
                        return subdev;
        }