[PATCH 15/21] drm/nouveau/nvkm: move pci probe() enable/disable handling from drm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]<

 



Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx>
---
 .../gpu/drm/nouveau/include/nvkm/core/pci.h   |  1 -
 drivers/gpu/drm/nouveau/nouveau_drm.c         | 11 +-------
 drivers/gpu/drm/nouveau/nvkm/device/pci.c     | 28 ++-----------------
 3 files changed, 3 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/pci.h b/drivers/gpu/drm/nouveau/include/nvkm/core/pci.h
index b9e10dad6ee9..0797225ab038 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/pci.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/pci.h
@@ -6,7 +6,6 @@
 struct nvkm_device_pci {
 	struct nvkm_device device;
 	struct pci_dev *pdev;
-	bool suspend;
 
 	struct dev_pm_domain vga_pm_domain;
 };
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index be31e8ea4fee..4bcfc2291c4d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -804,8 +804,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 
 	device = pci_get_drvdata(pdev);
 
-	pci_set_master(pdev);
-
 	if (nouveau_atomic)
 		driver_pci.driver_features |= DRIVER_ATOMIC;
 
@@ -815,13 +813,9 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 		goto fail_nvkm;
 	}
 
-	ret = pci_enable_device(pdev);
-	if (ret)
-		goto fail_drm;
-
 	ret = nouveau_drm_device_init(drm);
 	if (ret)
-		goto fail_pci;
+		goto fail_drm;
 
 	if (drm->device.impl->ram_size <= 32 * 1024 * 1024)
 		drm_fbdev_ttm_setup(drm->dev, 8);
@@ -831,8 +825,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 	quirk_broken_nv_runpm(pdev);
 	return 0;
 
-fail_pci:
-	pci_disable_device(pdev);
 fail_drm:
 	nouveau_drm_device_del(drm);
 fail_nvkm:
@@ -858,7 +850,6 @@ nouveau_drm_remove(struct pci_dev *pdev)
 	if (drm->old_pm_cap)
 		pdev->pm_cap = drm->old_pm_cap;
 	nouveau_drm_device_remove(drm);
-	pci_disable_device(pdev);
 
 	nvkm_device_pci_driver.remove(pdev);
 }
diff --git a/drivers/gpu/drm/nouveau/nvkm/device/pci.c b/drivers/gpu/drm/nouveau/nvkm/device/pci.c
index 7d0ddc968246..d9b8e3bc4169 100644
--- a/drivers/gpu/drm/nouveau/nvkm/device/pci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/device/pci.c
@@ -1585,30 +1585,6 @@ nvkm_device_pci_irq(struct nvkm_device *device)
 	return nvkm_device_pci(device)->pdev->irq;
 }
 
-static void
-nvkm_device_pci_fini(struct nvkm_device *device, bool suspend)
-{
-	struct nvkm_device_pci *pdev = nvkm_device_pci(device);
-	if (suspend) {
-		pci_disable_device(pdev->pdev);
-		pdev->suspend = true;
-	}
-}
-
-static int
-nvkm_device_pci_preinit(struct nvkm_device *device)
-{
-	struct nvkm_device_pci *pdev = nvkm_device_pci(device);
-	if (pdev->suspend) {
-		int ret = pci_enable_device(pdev->pdev);
-		if (ret)
-			return ret;
-		pci_set_master(pdev->pdev);
-		pdev->suspend = false;
-	}
-	return 0;
-}
-
 static int
 nvkm_device_pci_oneinit(struct nvkm_device *device)
 {
@@ -1630,9 +1606,7 @@ static const struct nvkm_device_func
 nvkm_device_pci_func = {
 	.pci = nvkm_device_pci,
 	.dtor = nvkm_device_pci_dtor,
-	.preinit = nvkm_device_pci_preinit,
 	.oneinit = nvkm_device_pci_oneinit,
-	.fini = nvkm_device_pci_fini,
 	.irq = nvkm_device_pci_irq,
 	.resource_addr = nvkm_device_pci_resource_addr,
 	.resource_size = nvkm_device_pci_resource_size,
@@ -1700,6 +1674,8 @@ nvkm_device_pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
 		return ret;
 	}
 
+	pci_set_master(pci_dev);
+
 	ret = nvkm_device_ctor(&nvkm_device_pci_func, quirk, &pci_dev->dev,
 			       pci_is_pcie(pci_dev) ? NVKM_DEVICE_PCIE :
 			       pci_find_capability(pci_dev, PCI_CAP_ID_AGP) ?
-- 
2.44.0




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux