From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>, Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH] MIPS: fix pfn_valid() for FLAGMEM
Date: Thu, 08 Oct 2009 13:58:35 +0400 [thread overview]
Message-ID: <4ACDB7CB.4030209@ru.mvista.com> (raw)
In-Reply-To: <1254992252-15923-1-git-send-email-wuzhangjin@gmail.com>
Hello.
Wu Zhangjin wrote:
> When CONFIG_FLAGMEM enabled, STD/Hiberation will fail on YeeLoong
>
You surely meant FLATMEM here and the subject.
> laptop, This patch fix it:
>
Fixes.
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
>
[...]
> diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
> index f266295..16903a6 100644
> --- a/arch/mips/include/asm/page.h
> +++ b/arch/mips/include/asm/page.h
> @@ -168,13 +168,10 @@ typedef struct { unsigned long pgprot; } pgprot_t;
>
> #ifdef CONFIG_FLATMEM
>
> -#define pfn_valid(pfn) \
> -({ \
> - unsigned long __pfn = (pfn); \
> - /* avoid <linux/bootmem.h> include hell */ \
> - extern unsigned long min_low_pfn; \
> - \
> - __pfn >= min_low_pfn && __pfn < max_mapnr; \
> +#define pfn_valid(pfn) \
> +({ \
> + extern int is_pfn_valid(unsigned long); \
> + is_pfn_valid(pfn); \
>
Why not just define pfn_valid() as *extern* function in this case?
> diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
> index f5c7375..48a4d2a 100644
> --- a/arch/mips/mm/page.c
> +++ b/arch/mips/mm/page.c
> @@ -689,3 +689,20 @@ void copy_page(void *to, void *from)
> }
>
> #endif /* CONFIG_SIBYTE_DMA_PAGEOPS */
> +
> +#ifdef CONFIG_FLATMEM
> +int is_pfn_valid(unsigned long pfn)
> +{
> + int i;
> +
> + for (i = 0; i < boot_mem_map.nr_map; i++) {
> + if (boot_mem_map.map[i].type == BOOT_MEM_RAM) {
> + if ((pfn >= PFN_DOWN(boot_mem_map.map[i].addr)) &&
> + ((pfn) <= (PFN_UP(boot_mem_map.map[i].addr +
>
Not <?
> + boot_mem_map.map[i].size))))
> + return 1;
> + }
> + }
> + return 0;
> +}
> +#endif
>
WBR, Sergei
next prev parent reply other threads:[~2009-10-08 9:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-08 8:57 [PATCH] MIPS: fix pfn_valid() for FLAGMEM Wu Zhangjin
2009-10-08 9:29 ` Pavel Machek
2009-10-08 10:33 ` Wu Zhangjin
2009-10-08 10:36 ` Pavel Machek
2009-10-08 10:57 ` Wu Zhangjin
2009-10-08 9:58 ` Sergei Shtylyov [this message]
2009-10-08 10:36 ` Wu Zhangjin
2009-10-08 14:42 ` Ralf Baechle
2009-10-08 15:46 ` Wu Zhangjin
2009-10-08 18:50 ` Ralf Baechle
2009-10-09 15:43 ` Sergei Shtylyov
2009-10-09 15:48 ` Sergei Shtylyov
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=4ACDB7CB.4030209@ru.mvista.com \
--to=sshtylyov@ru.mvista.com \
--cc=linux-mips@linux-mips.org \
--cc=pavel@ucw.cz \
--cc=ralf@linux-mips.org \
--cc=rjw@sisk.pl \
--cc=wuzhangjin@gmail.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;
as well as URLs for NNTP newsgroup(s).