Skip to contentSkip to conversation

unify pfn_to_page take 2 [16/25] parisc funcs

PATCH In review KAMEZAWA Hiroyuki 2 participants 3 messages Feb 8, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unify pfn_to_page take 2 [16/25] parisc funcs

parisc can use generic funcs.

include/asm-parisc/mmzone.h +0 -16
Index: test-layout-free-zone/include/asm-parisc/mmzone.h
===================================================================
@@ -25,23 +25,7 @@ extern struct node_map_data node_data[];
 	pg_data_t *__pgdat = NODE_DATA(nid);				\
 	__pgdat->node_start_pfn + __pgdat->node_spanned_pages;		\
 })
-#define node_localnr(pfn, nid)		((pfn) - node_start_pfn(nid))
 
-#define pfn_to_page(pfn)						\
-({									\
-	unsigned long __pfn = (pfn);					\
-	int __node  = pfn_to_nid(__pfn);				\
-	&NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)];	\
-})
-
-#define page_to_pfn(pg)							\
-({									\
-	struct page *__page = pg;					\
-	struct zone *__zone = page_zone(__page);			\
-	BUG_ON(__zone == NULL);						\
-	(unsigned long)(__page - __zone->zone_mem_map)			\
-		+ __zone->zone_start_pfn;				\
-})
 
 /* We have these possible memory map layouts:
  * Astro: 0-3.75, 67.75-68, 4-64
include/asm-parisc/page.h +0 -2
Index: test-layout-free-zone/include/asm-parisc/page.h
===================================================================
@@ -130,8 +130,6 @@ extern int npmem_ranges;
 #define __va(x)			((void *)((unsigned long)(x)+PAGE_OFFSET))
 
 #ifndef CONFIG_DISCONTIGMEM
-#define pfn_to_page(pfn)	(mem_map + (pfn))
-#define page_to_pfn(page)	((unsigned long)((page) - mem_map))
 #define pfn_valid(pfn)		((pfn) < max_mapnr)
 #endif /* CONFIG_DISCONTIGMEM */
 
#1 lore raw
Quoted 2 lines · KAMEZAWA Hiroyuki

parisc can use generic funcs.

ACK... Looks fine to me. Maybe the BUG_ON(zone == NULL) in page_to_pfn might be worth keeping?

Cheers,
Kyle

#2 lore raw
Quoted 1 line · Kyle McMartin

ACK... Looks fine to me.

Thanks!

Quoted 2 lines

Maybe the BUG_ON(zone == NULL) in page_to_pfn might be worth keeping?

placeing BUG_ON(zone == NULL) in page_zone() seems better to me.

But can it happen ??

Regards,
-- Kame