Commit 1c14cfbb authored by Andrew Morton's avatar Andrew Morton Committed by Dave Jones

[AGPGART] allow drm populated agp memory types cleanups

Fix whitespace, braces, use kzalloc().

Cc: Dave Airlie <airlied@linux.ie>
Cc: Thomas Hellstrom <thomas@tungstengraphics.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 1eaf122c
...@@ -112,9 +112,8 @@ void agp_alloc_page_array(size_t size, struct agp_memory *mem) ...@@ -112,9 +112,8 @@ void agp_alloc_page_array(size_t size, struct agp_memory *mem)
mem->memory = NULL; mem->memory = NULL;
mem->vmalloc_flag = 0; mem->vmalloc_flag = 0;
if (size <= 2*PAGE_SIZE) { if (size <= 2*PAGE_SIZE)
mem->memory = kmalloc(size, GFP_KERNEL | __GFP_NORETRY); mem->memory = kmalloc(size, GFP_KERNEL | __GFP_NORETRY);
}
if (mem->memory == NULL) { if (mem->memory == NULL) {
mem->memory = vmalloc(size); mem->memory = vmalloc(size);
mem->vmalloc_flag = 1; mem->vmalloc_flag = 1;
...@@ -138,12 +137,10 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages) ...@@ -138,12 +137,10 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages)
struct agp_memory *new; struct agp_memory *new;
unsigned long alloc_size = num_agp_pages*sizeof(struct page *); unsigned long alloc_size = num_agp_pages*sizeof(struct page *);
new = kmalloc(sizeof(struct agp_memory), GFP_KERNEL); new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL);
if (new == NULL) if (new == NULL)
return NULL; return NULL;
memset(new, 0, sizeof(struct agp_memory));
new->key = agp_get_key(); new->key = agp_get_key();
if (new->key < 0) { if (new->key < 0) {
...@@ -162,7 +159,6 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages) ...@@ -162,7 +159,6 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages)
return new; return new;
} }
struct agp_memory *agp_create_memory(int scratch_pages) struct agp_memory *agp_create_memory(int scratch_pages)
{ {
struct agp_memory *new; struct agp_memory *new;
...@@ -1071,9 +1067,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type) ...@@ -1071,9 +1067,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
num_entries -= agp_memory_reserved/PAGE_SIZE; num_entries -= agp_memory_reserved/PAGE_SIZE;
if (num_entries < 0) num_entries = 0; if (num_entries < 0) num_entries = 0;
if (type != mem->type) { if (type != mem->type)
return -EINVAL; return -EINVAL;
}
mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); mask_type = bridge->driver->agp_type_to_mask_type(bridge, type);
if (mask_type != 0) { if (mask_type != 0) {
...@@ -1143,14 +1138,12 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) ...@@ -1143,14 +1138,12 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
} }
EXPORT_SYMBOL(agp_generic_remove_memory); EXPORT_SYMBOL(agp_generic_remove_memory);
struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type) struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type)
{ {
return NULL; return NULL;
} }
EXPORT_SYMBOL(agp_generic_alloc_by_type); EXPORT_SYMBOL(agp_generic_alloc_by_type);
void agp_generic_free_by_type(struct agp_memory *curr) void agp_generic_free_by_type(struct agp_memory *curr)
{ {
agp_free_page_array(curr); agp_free_page_array(curr);
...@@ -1170,9 +1163,8 @@ struct agp_memory *agp_generic_alloc_user(size_t page_count, int type) ...@@ -1170,9 +1163,8 @@ struct agp_memory *agp_generic_alloc_user(size_t page_count, int type)
if (new == NULL) if (new == NULL)
return NULL; return NULL;
for (i = 0; i < page_count; i++) { for (i = 0; i < page_count; i++)
new->memory[i] = 0; new->memory[i] = 0;
}
new->page_count = 0; new->page_count = 0;
new->type = type; new->type = type;
new->num_scratch_pages = pages; new->num_scratch_pages = pages;
...@@ -1181,7 +1173,6 @@ struct agp_memory *agp_generic_alloc_user(size_t page_count, int type) ...@@ -1181,7 +1173,6 @@ struct agp_memory *agp_generic_alloc_user(size_t page_count, int type)
} }
EXPORT_SYMBOL(agp_generic_alloc_user); EXPORT_SYMBOL(agp_generic_alloc_user);
/* /*
* Basic Page Allocation Routines - * Basic Page Allocation Routines -
* These routines handle page allocation and by default they reserve the allocated * These routines handle page allocation and by default they reserve the allocated
......
...@@ -89,7 +89,6 @@ static struct _intel_i810_private { ...@@ -89,7 +89,6 @@ static struct _intel_i810_private {
int num_dcache_entries; int num_dcache_entries;
} intel_i810_private; } intel_i810_private;
static int intel_i810_fetch_size(void) static int intel_i810_fetch_size(void)
{ {
u32 smram_miscc; u32 smram_miscc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment