diff options
author | Andrew Morton <akpm@osdl.org> | 2007-02-05 19:09:35 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2007-02-10 19:56:36 -0500 |
commit | 1c14cfbbe7a9f2240c73f420c3c6336fc521cd64 (patch) | |
tree | b58d41d52cc54880f969987202c14e705d0e53aa /drivers | |
parent | 1eaf122cda2c135f90b9e610a847e6d4627b577c (diff) |
[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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/agp/generic.c | 17 | ||||
-rw-r--r-- | drivers/char/agp/intel-agp.c | 1 |
2 files changed, 4 insertions, 14 deletions
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index a627b771c2eb..7923337c3d26 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -112,9 +112,8 @@ void agp_alloc_page_array(size_t size, struct agp_memory *mem) | |||
112 | mem->memory = NULL; | 112 | mem->memory = NULL; |
113 | mem->vmalloc_flag = 0; | 113 | mem->vmalloc_flag = 0; |
114 | 114 | ||
115 | if (size <= 2*PAGE_SIZE) { | 115 | if (size <= 2*PAGE_SIZE) |
116 | mem->memory = kmalloc(size, GFP_KERNEL | __GFP_NORETRY); | 116 | mem->memory = kmalloc(size, GFP_KERNEL | __GFP_NORETRY); |
117 | } | ||
118 | if (mem->memory == NULL) { | 117 | if (mem->memory == NULL) { |
119 | mem->memory = vmalloc(size); | 118 | mem->memory = vmalloc(size); |
120 | mem->vmalloc_flag = 1; | 119 | mem->vmalloc_flag = 1; |
@@ -138,12 +137,10 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages) | |||
138 | struct agp_memory *new; | 137 | struct agp_memory *new; |
139 | unsigned long alloc_size = num_agp_pages*sizeof(struct page *); | 138 | unsigned long alloc_size = num_agp_pages*sizeof(struct page *); |
140 | 139 | ||
141 | new = kmalloc(sizeof(struct agp_memory), GFP_KERNEL); | 140 | new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL); |
142 | |||
143 | if (new == NULL) | 141 | if (new == NULL) |
144 | return NULL; | 142 | return NULL; |
145 | 143 | ||
146 | memset(new, 0, sizeof(struct agp_memory)); | ||
147 | new->key = agp_get_key(); | 144 | new->key = agp_get_key(); |
148 | 145 | ||
149 | if (new->key < 0) { | 146 | if (new->key < 0) { |
@@ -162,7 +159,6 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages) | |||
162 | return new; | 159 | return new; |
163 | } | 160 | } |
164 | 161 | ||
165 | |||
166 | struct agp_memory *agp_create_memory(int scratch_pages) | 162 | struct agp_memory *agp_create_memory(int scratch_pages) |
167 | { | 163 | { |
168 | struct agp_memory *new; | 164 | struct agp_memory *new; |
@@ -1071,9 +1067,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type) | |||
1071 | num_entries -= agp_memory_reserved/PAGE_SIZE; | 1067 | num_entries -= agp_memory_reserved/PAGE_SIZE; |
1072 | if (num_entries < 0) num_entries = 0; | 1068 | if (num_entries < 0) num_entries = 0; |
1073 | 1069 | ||
1074 | if (type != mem->type) { | 1070 | if (type != mem->type) |
1075 | return -EINVAL; | 1071 | return -EINVAL; |
1076 | } | ||
1077 | 1072 | ||
1078 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); | 1073 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); |
1079 | if (mask_type != 0) { | 1074 | if (mask_type != 0) { |
@@ -1143,14 +1138,12 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
1143 | } | 1138 | } |
1144 | EXPORT_SYMBOL(agp_generic_remove_memory); | 1139 | EXPORT_SYMBOL(agp_generic_remove_memory); |
1145 | 1140 | ||
1146 | |||
1147 | struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type) | 1141 | struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type) |
1148 | { | 1142 | { |
1149 | return NULL; | 1143 | return NULL; |
1150 | } | 1144 | } |
1151 | EXPORT_SYMBOL(agp_generic_alloc_by_type); | 1145 | EXPORT_SYMBOL(agp_generic_alloc_by_type); |
1152 | 1146 | ||
1153 | |||
1154 | void agp_generic_free_by_type(struct agp_memory *curr) | 1147 | void agp_generic_free_by_type(struct agp_memory *curr) |
1155 | { | 1148 | { |
1156 | agp_free_page_array(curr); | 1149 | agp_free_page_array(curr); |
@@ -1170,9 +1163,8 @@ struct agp_memory *agp_generic_alloc_user(size_t page_count, int type) | |||
1170 | if (new == NULL) | 1163 | if (new == NULL) |
1171 | return NULL; | 1164 | return NULL; |
1172 | 1165 | ||
1173 | for (i = 0; i < page_count; i++) { | 1166 | for (i = 0; i < page_count; i++) |
1174 | new->memory[i] = 0; | 1167 | new->memory[i] = 0; |
1175 | } | ||
1176 | new->page_count = 0; | 1168 | new->page_count = 0; |
1177 | new->type = type; | 1169 | new->type = type; |
1178 | new->num_scratch_pages = pages; | 1170 | new->num_scratch_pages = pages; |
@@ -1181,7 +1173,6 @@ struct agp_memory *agp_generic_alloc_user(size_t page_count, int type) | |||
1181 | } | 1173 | } |
1182 | EXPORT_SYMBOL(agp_generic_alloc_user); | 1174 | EXPORT_SYMBOL(agp_generic_alloc_user); |
1183 | 1175 | ||
1184 | |||
1185 | /* | 1176 | /* |
1186 | * Basic Page Allocation Routines - | 1177 | * Basic Page Allocation Routines - |
1187 | * These routines handle page allocation and by default they reserve the allocated | 1178 | * These routines handle page allocation and by default they reserve the allocated |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 6b9fb2179264..06b0bb6d982f 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -89,7 +89,6 @@ static struct _intel_i810_private { | |||
89 | int num_dcache_entries; | 89 | int num_dcache_entries; |
90 | } intel_i810_private; | 90 | } intel_i810_private; |
91 | 91 | ||
92 | |||
93 | static int intel_i810_fetch_size(void) | 92 | static int intel_i810_fetch_size(void) |
94 | { | 93 | { |
95 | u32 smram_miscc; | 94 | u32 smram_miscc; |