summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/drm_drv.c5
-rw-r--r--linux/drm_drv.h5
-rw-r--r--shared-core/radeon_cp.c31
-rw-r--r--shared/radeon_cp.c31
4 files changed, 8 insertions, 64 deletions
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 12d2a532..09e50382 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -464,8 +464,10 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return -ENODEV;
dev = &(DRM(device)[DRM(numdevs)]);
- if (DRM(fb_loaded)==0)
+ if (DRM(fb_loaded)==0) {
pci_set_drvdata(pdev, dev);
+ pci_request_regions(pdev, DRIVER_NAME);
+ }
memset( (void *)dev, 0, sizeof(*dev) );
dev->count_lock = SPIN_LOCK_UNLOCKED;
@@ -568,6 +570,7 @@ static void __exit drm_cleanup_pci(struct pci_dev *pdev)
pci_set_drvdata(pdev, NULL);
drm_cleanup(dev);
+ pci_release_regions(pdev);
}
static struct pci_driver drm_driver = {
diff --git a/linux/drm_drv.h b/linux/drm_drv.h
index 12d2a532..09e50382 100644
--- a/linux/drm_drv.h
+++ b/linux/drm_drv.h
@@ -464,8 +464,10 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return -ENODEV;
dev = &(DRM(device)[DRM(numdevs)]);
- if (DRM(fb_loaded)==0)
+ if (DRM(fb_loaded)==0) {
pci_set_drvdata(pdev, dev);
+ pci_request_regions(pdev, DRIVER_NAME);
+ }
memset( (void *)dev, 0, sizeof(*dev) );
dev->count_lock = SPIN_LOCK_UNLOCKED;
@@ -568,6 +570,7 @@ static void __exit drm_cleanup_pci(struct pci_dev *pdev)
pci_set_drvdata(pdev, NULL);
drm_cleanup(dev);
+ pci_release_regions(pdev);
}
static struct pci_driver drm_driver = {
diff --git a/shared-core/radeon_cp.c b/shared-core/radeon_cp.c
index 1e87ff37..c5ff768a 100644
--- a/shared-core/radeon_cp.c
+++ b/shared-core/radeon_cp.c
@@ -1732,32 +1732,9 @@ int radeon_cp_buffers( DRM_IOCTL_ARGS )
return ret;
}
-static int radeon_register_regions(struct pci_dev *pdev) {
- int retcode = -EINVAL;
-
- /* request the mem regions */
- if (!request_mem_region (pci_resource_start( pdev, 2 ),
- pci_resource_len(pdev, 2), DRIVER_NAME)) {
- DRM_ERROR("cannot reserve MMIO region\n");
- return retcode;
- }
- if (!request_mem_region (pci_resource_start( pdev, 0 ),
- pci_resource_len(pdev, 0), DRIVER_NAME)) {
- DRM_ERROR("cannot reserve FB region\n");
- return retcode;
- }
- return 0;
-}
-
-static void radeon_release_regions(struct pci_dev *pdev) {
- release_mem_region (pci_resource_start( pdev, 2 ), pci_resource_len(pdev, 2));
- release_mem_region (pci_resource_start( pdev, 0 ), pci_resource_len(pdev, 0));
-}
-
/* Always create a map record for MMIO and FB memory, done from DRIVER_POSTINIT */
int radeon_preinit( struct drm_device *dev, unsigned long flags )
{
- int retcode = -EINVAL;
u32 save, temp;
drm_radeon_private_t *dev_priv;
@@ -1769,11 +1746,6 @@ int radeon_preinit( struct drm_device *dev, unsigned long flags )
dev->dev_private = (void *)dev_priv;
dev_priv->flags = flags;
- /* request the mem regions */
- if (!DRM(fb_loaded))
- if ((retcode = radeon_register_regions(dev->pdev)) != 0)
- return retcode;
-
/* There are signatures in BIOS and PCI-SSID for a PCI card, but they are not very reliable.
Following detection method works for all cards tested so far.
Note, checking AGP_ENABLE bit after drmAgpEnable call can also give the correct result.
@@ -1802,9 +1774,6 @@ int radeon_postcleanup( struct drm_device *dev )
DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
- if (!DRM(fb_loaded))
- radeon_release_regions(dev->pdev);
-
dev->dev_private = NULL;
return 0;
}
diff --git a/shared/radeon_cp.c b/shared/radeon_cp.c
index 1e87ff37..c5ff768a 100644
--- a/shared/radeon_cp.c
+++ b/shared/radeon_cp.c
@@ -1732,32 +1732,9 @@ int radeon_cp_buffers( DRM_IOCTL_ARGS )
return ret;
}
-static int radeon_register_regions(struct pci_dev *pdev) {
- int retcode = -EINVAL;
-
- /* request the mem regions */
- if (!request_mem_region (pci_resource_start( pdev, 2 ),
- pci_resource_len(pdev, 2), DRIVER_NAME)) {
- DRM_ERROR("cannot reserve MMIO region\n");
- return retcode;
- }
- if (!request_mem_region (pci_resource_start( pdev, 0 ),
- pci_resource_len(pdev, 0), DRIVER_NAME)) {
- DRM_ERROR("cannot reserve FB region\n");
- return retcode;
- }
- return 0;
-}
-
-static void radeon_release_regions(struct pci_dev *pdev) {
- release_mem_region (pci_resource_start( pdev, 2 ), pci_resource_len(pdev, 2));
- release_mem_region (pci_resource_start( pdev, 0 ), pci_resource_len(pdev, 0));
-}
-
/* Always create a map record for MMIO and FB memory, done from DRIVER_POSTINIT */
int radeon_preinit( struct drm_device *dev, unsigned long flags )
{
- int retcode = -EINVAL;
u32 save, temp;
drm_radeon_private_t *dev_priv;
@@ -1769,11 +1746,6 @@ int radeon_preinit( struct drm_device *dev, unsigned long flags )
dev->dev_private = (void *)dev_priv;
dev_priv->flags = flags;
- /* request the mem regions */
- if (!DRM(fb_loaded))
- if ((retcode = radeon_register_regions(dev->pdev)) != 0)
- return retcode;
-
/* There are signatures in BIOS and PCI-SSID for a PCI card, but they are not very reliable.
Following detection method works for all cards tested so far.
Note, checking AGP_ENABLE bit after drmAgpEnable call can also give the correct result.
@@ -1802,9 +1774,6 @@ int radeon_postcleanup( struct drm_device *dev )
DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
- if (!DRM(fb_loaded))
- radeon_release_regions(dev->pdev);
-
dev->dev_private = NULL;
return 0;
}