[PATCH 015/156] drm/nouveau: store nvkm_device pointer in nouveau_drm
Ben Skeggs
bskeggs at nvidia.com
Tue Apr 16 23:37:41 UTC 2024
- removes the need for a nvkm_device_find(), which is going away
- will be needed later when cleaning up nvif_driver init
Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
---
drivers/gpu/drm/nouveau/nouveau_drm.c | 13 +++++--------
drivers/gpu/drm/nouveau/nouveau_drv.h | 1 +
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index c0d74be4c47b..8d34a4cf2900 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -561,7 +561,7 @@ nouveau_parent = {
};
static int
-nouveau_drm_device_init(struct drm_device *dev)
+nouveau_drm_device_init(struct drm_device *dev, struct nvkm_device *nvkm)
{
static const struct nvif_mclass
mmus[] = {
@@ -577,6 +577,7 @@ nouveau_drm_device_init(struct drm_device *dev)
return -ENOMEM;
dev->dev_private = drm;
drm->dev = dev;
+ drm->nvkm = nvkm;
nvif_parent_ctor(&nouveau_parent, &drm->parent);
@@ -863,7 +864,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, drm_dev);
- ret = nouveau_drm_device_init(drm_dev);
+ ret = nouveau_drm_device_init(drm_dev, device);
if (ret)
goto fail_pci;
@@ -894,14 +895,10 @@ void
nouveau_drm_device_remove(struct drm_device *dev)
{
struct nouveau_drm *drm = nouveau_drm(dev);
- struct nvkm_client *client;
- struct nvkm_device *device;
+ struct nvkm_device *device = drm->nvkm;
drm_dev_unplug(dev);
- client = nvxx_client(&drm->client.base);
- device = nvkm_device_find(client->device);
-
nouveau_drm_device_fini(dev);
drm_dev_put(dev);
nvkm_device_del(&device);
@@ -1409,7 +1406,7 @@ nouveau_platform_device_create(const struct nvkm_device_tegra_func *func,
goto err_free;
}
- err = nouveau_drm_device_init(drm);
+ err = nouveau_drm_device_init(drm, *pdevice);
if (err)
goto err_put;
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 683600db4ff9..35dfc95b32ed 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -201,6 +201,7 @@ u_memcpya(uint64_t user, unsigned int nmemb, unsigned int size)
#include <nvif/parent.h>
struct nouveau_drm {
+ struct nvkm_device *nvkm;
struct nvif_parent parent;
struct mutex client_mutex;
struct nvif_client _client;
--
2.41.0
More information about the Nouveau
mailing list