lkml.org 
[lkml]   [2008]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [3/4] add agp_generic_destroy_pages()
On Thu, 21 Aug 2008 10:46:17 +0800 Shaohua Li <shaohua.li@intel.com> wrote:

> --- linux.orig/drivers/char/agp/generic.c 2008-08-21 10:01:34.000000000 +0800
> +++ linux/drivers/char/agp/generic.c 2008-08-21 10:01:40.000000000 +0800
> @@ -201,14 +201,22 @@ void agp_free_memory(struct agp_memory *
> return;
> }
> if (curr->page_count != 0) {
> - for (i = 0; i < curr->page_count; i++) {
> - curr->memory[i] = (unsigned long)gart_to_virt(curr->memory[i]);
> - curr->bridge->driver->agp_destroy_page((void *)curr->memory[i],
> - AGP_PAGE_DESTROY_UNMAP);
> - }
> - for (i = 0; i < curr->page_count; i++) {
> - curr->bridge->driver->agp_destroy_page((void *)curr->memory[i],
> - AGP_PAGE_DESTROY_FREE);
> + if (curr->bridge->driver->agp_destroy_pages) {
> + curr->bridge->driver->agp_destroy_pages(curr);
> + } else {

stylistic nit:

> +
> + for (i = 0; i < curr->page_count; i++) {
> + curr->memory[i] = (unsigned long)gart_to_virt(
> + curr->memory[i]);
> + curr->bridge->driver->agp_destroy_page(
> + (void *)curr->memory[i],
> + AGP_PAGE_DESTROY_UNMAP);
> + }
> + for (i = 0; i < curr->page_count; i++) {
> + curr->bridge->driver->agp_destroy_page(
> + (void *)curr->memory[i],
> + AGP_PAGE_DESTROY_FREE);
> + }

Make the above code a standalone function and call it here.

Then convert all drivers over so their .agp_destroy_pages points at
that new function.

Then remove the `if'.


\
 
 \ /
  Last update: 2008-08-21 05:11    [W:0.041 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site