From 87832bc81a56ad8abb135628ac906ba9aa4a155b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 21 Jun 2004 11:46:52 +0000 Subject: [PATCH] fix bug with pci_disable_device in the wrong place (Paul Mackerras) remove hack code from me.. --- linux-core/drm_drv.c | 9 +++------ linux/drm_drv.h | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 00aa187..1a01db5 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -548,8 +548,6 @@ static int DRM(takedown)( drm_device_t *dev ) wake_up_interruptible( &dev->lock.lock_queue ); } - if (DRM(fb_loaded)==0) - pci_disable_device(dev->pdev); up( &dev->struct_sem ); return 0; @@ -708,18 +706,14 @@ static int __init drm_init( void ) pdev = pci_get_subsys(DRM(pciidlist[i]).vendor, DRM(pciidlist[i]).device, DRM(pciidlist[i]).subvendor, DRM(pciidlist[i]).subdevice, NULL); if (pdev) { -#ifndef __MACH64_H__ pdriver = pci_dev_driver(pdev); if (pdriver) { -#endif DRM(fb_loaded)=1; drm_probe(pdev, &DRM(pciidlist[i])); -#ifndef __MACH64_H__ } else pci_dev_put(pdev); -#endif } } @@ -747,6 +741,9 @@ static void __exit drm_cleanup( drm_device_t *dev ) DRM(takedown)(dev); + if (DRM(fb_loaded)==0) + pci_disable_device(dev->pdev); + if ( DRM(stub_unregister)(dev->minor) ) { DRM_ERROR( "Cannot unload module\n" ); } else { diff --git a/linux/drm_drv.h b/linux/drm_drv.h index 00aa187..1a01db5 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -548,8 +548,6 @@ static int DRM(takedown)( drm_device_t *dev ) wake_up_interruptible( &dev->lock.lock_queue ); } - if (DRM(fb_loaded)==0) - pci_disable_device(dev->pdev); up( &dev->struct_sem ); return 0; @@ -708,18 +706,14 @@ static int __init drm_init( void ) pdev = pci_get_subsys(DRM(pciidlist[i]).vendor, DRM(pciidlist[i]).device, DRM(pciidlist[i]).subvendor, DRM(pciidlist[i]).subdevice, NULL); if (pdev) { -#ifndef __MACH64_H__ pdriver = pci_dev_driver(pdev); if (pdriver) { -#endif DRM(fb_loaded)=1; drm_probe(pdev, &DRM(pciidlist[i])); -#ifndef __MACH64_H__ } else pci_dev_put(pdev); -#endif } } @@ -747,6 +741,9 @@ static void __exit drm_cleanup( drm_device_t *dev ) DRM(takedown)(dev); + if (DRM(fb_loaded)==0) + pci_disable_device(dev->pdev); + if ( DRM(stub_unregister)(dev->minor) ) { DRM_ERROR( "Cannot unload module\n" ); } else { -- 2.7.4