[PATCH 061/156] drm/nouveau/nvkm: remove device list

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


- now unused

Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
---
 .../drm/nouveau/include/nvkm/core/device.h    |  3 --
 drivers/gpu/drm/nouveau/nvkm/device/base.c    | 34 -------------------
 2 files changed, 37 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h
index 46afb877a296..efe1a0048328 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h
@@ -22,7 +22,6 @@ struct nvkm_device {
 	const char *cfgopt;
 	const char *dbgopt;
 
-	struct list_head head;
 	struct mutex mutex;
 	int refcount;
 
@@ -108,8 +107,6 @@ struct nvkm_device_chip {
 #undef NVKM_LAYOUT_ONCE
 };
 
-struct nvkm_device *nvkm_device_find(u64 name);
-
 /* privileged register interface accessor macros */
 #define nvkm_rd08(d,a) ioread8((d)->pri + (a))
 #define nvkm_rd16(d,a) ioread16_native((d)->pri + (a))
diff --git a/drivers/gpu/drm/nouveau/nvkm/device/base.c b/drivers/gpu/drm/nouveau/nvkm/device/base.c
index 3ce42de55aa9..036106ed09a5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/device/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/device/base.c
@@ -29,30 +29,6 @@
 #include <subdev/bios.h>
 #include <subdev/therm.h>
 
-static DEFINE_MUTEX(nv_devices_mutex);
-static LIST_HEAD(nv_devices);
-
-static struct nvkm_device *
-nvkm_device_find_locked(u64 handle)
-{
-	struct nvkm_device *device;
-	list_for_each_entry(device, &nv_devices, head) {
-		if (device->handle == handle)
-			return device;
-	}
-	return NULL;
-}
-
-struct nvkm_device *
-nvkm_device_find(u64 handle)
-{
-	struct nvkm_device *device;
-	mutex_lock(&nv_devices_mutex);
-	device = nvkm_device_find_locked(handle);
-	mutex_unlock(&nv_devices_mutex);
-	return device;
-}
-
 static const struct nvkm_device_chip
 nv4_chipset = {
 	.name = "NV04",
@@ -2946,8 +2922,6 @@ nvkm_device_del(struct nvkm_device **pdevice)
 	struct nvkm_device *device = *pdevice;
 	struct nvkm_subdev *subdev, *subtmp;
 	if (device) {
-		mutex_lock(&nv_devices_mutex);
-
 		nvkm_intr_dtor(device);
 
 		list_for_each_entry_safe_reverse(subdev, subtmp, &device->subdev, head)
@@ -2955,11 +2929,9 @@ nvkm_device_del(struct nvkm_device **pdevice)
 
 		if (device->pri)
 			iounmap(device->pri);
-		list_del(&device->head);
 
 		if (device->func->dtor)
 			*pdevice = device->func->dtor(device);
-		mutex_unlock(&nv_devices_mutex);
 
 		kfree(*pdevice);
 		*pdevice = NULL;
@@ -3010,10 +2982,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
 	int ret = -EEXIST, j;
 	unsigned chipset;
 
-	mutex_lock(&nv_devices_mutex);
-	if (nvkm_device_find_locked(handle))
-		goto done;
-
 	device->func = func;
 	device->quirk = quirk;
 	device->dev = dev;
@@ -3022,7 +2990,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
 	device->cfgopt = cfg;
 	device->dbgopt = dbg;
 	device->name = name;
-	list_add_tail(&device->head, &nv_devices);
 	device->debug = nvkm_dbgopt(device->dbgopt, "device");
 	INIT_LIST_HEAD(&device->subdev);
 
@@ -3305,6 +3272,5 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
 		iounmap(device->pri);
 		device->pri = NULL;
 	}
-	mutex_unlock(&nv_devices_mutex);
 	return ret;
 }
-- 
2.41.0



More information about the Nouveau mailing list