summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/radeon_agp.c
diff options
context:
space:
mode:
authorJohn Kacur <jkacur@redhat.com>2010-01-31 22:38:03 +0300
committerDave Airlie <airlied@redhat.com>2010-02-01 04:19:31 +0300
commit2dea2e29b9fad48c759aa406b5ea426bff4339af (patch)
treedf7ef0a169d7bb96b326595affef6836e9f588d7 /drivers/gpu/drm/radeon/radeon_agp.c
parentcdb6e375c3c84558ed2c13c5461b22e8f7b7980e (diff)
downloadlinux-2dea2e29b9fad48c759aa406b5ea426bff4339af.tar.xz
drm/kms/radeon/agp: Move the check of the aper_size after drm_acp_acquire and drm_agp_info
First call drm_agp_acquire to check if agp has been acquired. Second call drm_agp_info to fill in the info data struct, including aper_size. Finally do the check to see if the aper_size makes sense. Signed-off-by: John Kacur <jkacur@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_agp.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_agp.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_agp.c b/drivers/gpu/drm/radeon/radeon_agp.c
index f58c5f462438..b634d9847667 100644
--- a/drivers/gpu/drm/radeon/radeon_agp.c
+++ b/drivers/gpu/drm/radeon/radeon_agp.c
@@ -133,13 +133,6 @@ int radeon_agp_init(struct radeon_device *rdev)
bool is_v3;
int ret;
- if (rdev->ddev->agp->agp_info.aper_size < 32) {
- dev_warn(rdev->dev, "AGP aperture too small (%zuM) "
- "need at least 32M, disabling AGP\n",
- rdev->ddev->agp->agp_info.aper_size);
- return -EINVAL;
- }
-
/* Acquire AGP. */
if (!rdev->ddev->agp->acquired) {
ret = drm_agp_acquire(rdev->ddev);
@@ -154,6 +147,14 @@ int radeon_agp_init(struct radeon_device *rdev)
DRM_ERROR("Unable to get AGP info: %d\n", ret);
return ret;
}
+
+ if (rdev->ddev->agp->agp_info.aper_size < 32) {
+ dev_warn(rdev->dev, "AGP aperture too small (%zuM) "
+ "need at least 32M, disabling AGP\n",
+ rdev->ddev->agp->agp_info.aper_size);
+ return -EINVAL;
+ }
+
mode.mode = info.mode;
agp_status = (RREG32(RADEON_AGP_STATUS) | RADEON_AGPv3_MODE) & mode.mode;
is_v3 = !!(agp_status & RADEON_AGPv3_MODE);