public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Shaohua Li <shaohua.li@intel.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Dave Airlie <airlied@gmail.com>, Ingo Molnar <mingo@elte.hu>,
	Arjan van de Ven <arjan@infradead.org>
Subject: Re: [3/4] add agp_generic_destroy_pages()
Date: Wed, 20 Aug 2008 20:08:07 -0700	[thread overview]
Message-ID: <20080820200807.324aa671.akpm@linux-foundation.org> (raw)
In-Reply-To: <1219286777.18007.41.camel@sli10-desk.sh.intel.com>

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'.

  reply	other threads:[~2008-08-21  3:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21  2:46 [3/4] add agp_generic_destroy_pages() Shaohua Li
2008-08-21  3:08 ` Andrew Morton [this message]
2008-08-21 11:49   ` Ingo Molnar

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=20080820200807.324aa671.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=airlied@gmail.com \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=shaohua.li@intel.com \
    /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