mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Johannes Hirte <johannes.hirte@fem.tu-ilmenau.de>,
	Kevin Winchester <kjwinchester@gmail.com>,
	Dave Airlie <airlied@linux.ie>,
	dri-devel <dri-devel@lists.sf.net>,
	Alex Deucher <alexdeucher@gmail.com>,
	Jerome Glisse <jglisse@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	John Kacur <jkacur@redhat.com>
Subject: [PATCH] radeon_agp: Move the check of the aper_size after drm_acp_acquire and drm_agp_info
Date: Sat, 30 Jan 2010 21:51:10 +0100	[thread overview]
Message-ID: <1264884670-28211-3-git-send-email-jkacur@redhat.com> (raw)
In-Reply-To: <1264884670-28211-1-git-send-email-jkacur@redhat.com>

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>
---
 drivers/gpu/drm/radeon/radeon_agp.c |   15 ++++++++-------
 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 1c4e523..ad168ee 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 to 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 to 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);
-- 
1.6.0.6


      parent reply	other threads:[~2010-01-30 20:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-30 20:51 [PATCH] radeon_agp_init fixes John Kacur
2010-01-30 20:51 ` [PATCH] radeon_agp: Fix warning, format ‘%d’ expects type ‘int’, but argument 4 has type ‘size_t’ John Kacur
2010-01-31 19:02   ` Dan Nicholson
2010-01-31 19:29     ` John Kacur
2010-01-30 20:51 ` John Kacur [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1264884670-28211-3-git-send-email-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=airlied@linux.ie \
    --cc=alexdeucher@gmail.com \
    --cc=dri-devel@lists.sf.net \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=jglisse@redhat.com \
    --cc=johannes.hirte@fem.tu-ilmenau.de \
    --cc=kjwinchester@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®