From 5ef25f068c5a4a7bc5c1825b4d4bf70f48173e43 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 8 Feb 2021 11:30:21 +1000 Subject: [PATCH] drm/nouveau/nvkm: remove nvkm_subdev.index Signed-off-by: Ben Skeggs Reviewed-by: Lyude Paul --- drivers/gpu/drm/nouveau/include/nvkm/core/device.h | 2 -- drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h | 9 ++------- drivers/gpu/drm/nouveau/nvkm/core/subdev.c | 1 - drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 2 +- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h index aa0ac7bf9db0..a18b6cfda07e 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h @@ -5,8 +5,6 @@ #include enum nvkm_subdev_type; -#define nvkm_devidx nvkm_subdev_type - enum nvkm_device_type { NVKM_DEVICE_PCI, NVKM_DEVICE_AGP, diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h b/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h index 5e9a9cae66ed..1665738948fb 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h @@ -4,13 +4,9 @@ #include 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 -#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]; diff --git a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c index fab794372c36..a74b7acb6832 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c @@ -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); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c index 5ee675273fe3..35ad59c1aaaa 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c @@ -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; } -- 2.34.1