From: "Michel Dänzer" <michel@daenzer.net>
To: David Airlie <airlied@linux.ie>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 1/2] agp/uninorth: Also handle user memory types in u3_remove_memory().
Date: Sun, 6 Dec 2009 13:15:55 +0100 [thread overview]
Message-ID: <1260101756-22645-2-git-send-email-michel@daenzer.net> (raw)
In-Reply-To: <1260101756-22645-1-git-send-email-michel@daenzer.net>
From: Michel Dänzer <daenzer@vmware.com>
Also short-circuit empty updates.
Signed-off-by: Michel Dänzer <daenzer@vmware.com>
---
drivers/char/agp/uninorth-agp.c | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 703959e..4e05021 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -151,9 +151,6 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
void *temp;
int mask_type;
- temp = agp_bridge->current_size;
- num_entries = A_SIZE_32(temp)->num_entries;
-
if (type != mem->type)
return -EINVAL;
@@ -163,6 +160,12 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
return -EINVAL;
}
+ if (mem->page_count == 0)
+ return 0;
+
+ temp = agp_bridge->current_size;
+ num_entries = A_SIZE_32(temp)->num_entries;
+
if ((pg_start + mem->page_count) > num_entries)
return -EINVAL;
@@ -194,9 +197,6 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
u32 *gp;
int mask_type;
- temp = agp_bridge->current_size;
- num_entries = A_SIZE_32(temp)->num_entries;
-
if (type != mem->type)
return -EINVAL;
@@ -206,6 +206,12 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
return -EINVAL;
}
+ if (mem->page_count == 0)
+ return 0;
+
+ temp = agp_bridge->current_size;
+ num_entries = A_SIZE_32(temp)->num_entries;
+
if ((pg_start + mem->page_count) > num_entries)
return -EINVAL;
@@ -234,10 +240,19 @@ int u3_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
{
size_t i;
u32 *gp;
+ int mask_type;
+
+ if (type != mem->type)
+ return -EINVAL;
- if (type != 0 || mem->type != 0)
+ mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type);
+ if (mask_type != 0) {
/* We know nothing of memory types */
return -EINVAL;
+ }
+
+ if (mem->page_count == 0)
+ return 0;
gp = (u32 *) &agp_bridge->gatt_table[pg_start];
for (i = 0; i < mem->page_count; ++i)
--
1.6.5.3
next prev parent reply other threads:[~2009-12-06 12:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-06 12:15 [RESEND][PATCH 0/2] Uninorth AGP fix / cleanup Michel Dänzer
2009-12-06 12:15 ` Michel Dänzer [this message]
2009-12-06 12:15 ` [PATCH 2/2] agp/uninorth: Unify U3 and pre-U3 insert_memory and remove_memory hooks Michel Dänzer
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=1260101756-22645-2-git-send-email-michel@daenzer.net \
--to=michel@daenzer.net \
--cc=airlied@linux.ie \
--cc=linuxppc-dev@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).