Actually check for drm_fb_loaded before trying to initialize the sysdev

approach.
main
Alan Hourihane 2005-05-28 00:08:53 +00:00
parent 45f1db8db9
commit 54fbf85125
2 changed files with 11 additions and 8 deletions

View File

@ -265,7 +265,8 @@ int drm_takedown(drm_device_t * dev)
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
drm_dma_takedown(dev); drm_dma_takedown(dev);
drm_pm_takedown(dev); if (drm_fb_loaded)
drm_pm_takedown(dev);
if (dev->lock.hw_lock) { if (dev->lock.hw_lock) {
dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */ dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */
@ -312,8 +313,6 @@ int drm_init(struct drm_driver *driver,
drm_mem_init(); drm_mem_init();
drm_pm_init();
for (i = 0; (pciidlist[i].vendor != 0) && !drm_fb_loaded; i++) { for (i = 0; (pciidlist[i].vendor != 0) && !drm_fb_loaded; i++) {
pid = &pciidlist[i]; pid = &pciidlist[i];
@ -336,9 +335,10 @@ int drm_init(struct drm_driver *driver,
} }
} }
if (drm_fb_loaded == 0) if (!drm_fb_loaded)
pci_register_driver(&driver->pci_driver); pci_register_driver(&driver->pci_driver);
else { else {
drm_pm_init();
for (i = 0; pciidlist[i].vendor != 0; i++) { for (i = 0; pciidlist[i].vendor != 0; i++) {
pid = &pciidlist[i]; pid = &pciidlist[i];
@ -422,7 +422,8 @@ static void __exit drm_cleanup(drm_device_t * dev)
drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS); drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
dev->maplist = NULL; dev->maplist = NULL;
} }
if (drm_fb_loaded == 0)
if (!drm_fb_loaded)
pci_disable_device(dev->pdev); pci_disable_device(dev->pdev);
drm_ctxbitmap_cleanup(dev); drm_ctxbitmap_cleanup(dev);
@ -436,6 +437,9 @@ static void __exit drm_cleanup(drm_device_t * dev)
DRM_DEBUG("mtrr_del=%d\n", retval); DRM_DEBUG("mtrr_del=%d\n", retval);
} }
if (drm_fb_loaded)
drm_pm_cleanup();
if (drm_core_has_AGP(dev) && dev->agp) { if (drm_core_has_AGP(dev) && dev->agp) {
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
dev->agp = NULL; dev->agp = NULL;
@ -443,8 +447,6 @@ static void __exit drm_cleanup(drm_device_t * dev)
if (dev->driver->postcleanup) if (dev->driver->postcleanup)
dev->driver->postcleanup(dev); dev->driver->postcleanup(dev);
drm_pm_cleanup();
drm_put_head(&dev->primary); drm_put_head(&dev->primary);
if (drm_put_dev(dev)) if (drm_put_dev(dev))
DRM_ERROR("Cannot unload module\n"); DRM_ERROR("Cannot unload module\n");

View File

@ -67,7 +67,8 @@ static int fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
dev->pdev = pdev; dev->pdev = pdev;
drm_pm_setup( dev ); if (drm_fb_loaded)
drm_pm_setup( dev );
#ifdef __alpha__ #ifdef __alpha__
dev->hose = pdev->sysdata; dev->hose = pdev->sysdata;