Commit 8877f6e2 authored by Rik van Riel's avatar Rik van Riel Committed by Linus Torvalds

- janitor: clean up i810_dma.c and agpgart_be.c to use the macros

  from mm.h instead of set_bit/clear_bit
- access page->count only through the atomic macros, remove the
  broken init_page_count thing  (DaveM)
parent c39e9205
......@@ -622,7 +622,7 @@ static int agp_generic_create_gatt_table(void)
table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
set_bit(PG_reserved, &page->flags);
SetPageReserved(page);
agp_bridge.gatt_table_real = (unsigned long *) table;
CACHE_FLUSH();
......@@ -632,7 +632,7 @@ static int agp_generic_create_gatt_table(void)
if (agp_bridge.gatt_table == NULL) {
for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
clear_bit(PG_reserved, &page->flags);
ClearPageReserved(page);
free_pages((unsigned long) table, page_order);
......@@ -699,7 +699,7 @@ static int agp_generic_free_gatt_table(void)
table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
clear_bit(PG_reserved, &page->flags);
ClearPageReserved(page);
free_pages((unsigned long) agp_bridge.gatt_table_real, page_order);
return 0;
......@@ -812,8 +812,8 @@ static unsigned long agp_generic_alloc_page(void)
if (page == NULL) {
return 0;
}
atomic_inc(&page->count);
set_bit(PG_locked, &page->flags);
get_page(page);
LockPage(page);
atomic_inc(&agp_bridge.current_memory_agp);
return (unsigned long)page_address(page);
}
......@@ -828,9 +828,8 @@ static void agp_generic_destroy_page(unsigned long addr)
}
page = virt_to_page(pt);
atomic_dec(&page->count);
clear_bit(PG_locked, &page->flags);
wake_up_page(page);
put_page(page);
UnlockPage(page);
free_page((unsigned long) pt);
atomic_dec(&agp_bridge.current_memory_agp);
}
......@@ -2278,13 +2277,12 @@ static int amd_create_page_map(amd_page_map *page_map)
if (page_map->real == NULL) {
return -ENOMEM;
}
set_bit(PG_reserved, &virt_to_page(page_map->real)->flags);
SetPageReserved(virt_to_page(page_map->real));
CACHE_FLUSH();
page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
PAGE_SIZE);
if (page_map->remapped == NULL) {
clear_bit(PG_reserved,
&virt_to_page(page_map->real)->flags);
ClearPageReserved(virt_to_page(page_map->real));
free_page((unsigned long) page_map->real);
page_map->real = NULL;
return -ENOMEM;
......@@ -2301,8 +2299,7 @@ static int amd_create_page_map(amd_page_map *page_map)
static void amd_free_page_map(amd_page_map *page_map)
{
iounmap(page_map->remapped);
clear_bit(PG_reserved,
&virt_to_page(page_map->real)->flags);
ClearPageReserved(virt_to_page(page_map->real));
free_page((unsigned long) page_map->real);
}
......@@ -2790,8 +2787,8 @@ static unsigned long ali_alloc_page(void)
if (page == NULL)
return 0;
atomic_inc(&page->count);
set_bit(PG_locked, &page->flags);
get_page(page);
LockPage(page);
atomic_inc(&agp_bridge.current_memory_agp);
global_cache_flush();
......@@ -2826,9 +2823,8 @@ static void ali_destroy_page(unsigned long addr)
}
page = virt_to_page(pt);
atomic_dec(&page->count);
clear_bit(PG_locked, &page->flags);
wake_up_page(page);
put_page(page);
UnlockPage(page);
free_page((unsigned long) pt);
atomic_dec(&agp_bridge.current_memory_agp);
}
......@@ -2910,13 +2906,12 @@ static int serverworks_create_page_map(serverworks_page_map *page_map)
if (page_map->real == NULL) {
return -ENOMEM;
}
set_bit(PG_reserved, &virt_to_page(page_map->real)->flags);
SetPageReserved(virt_to_page(page_map->real));
CACHE_FLUSH();
page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
PAGE_SIZE);
if (page_map->remapped == NULL) {
clear_bit(PG_reserved,
&virt_to_page(page_map->real)->flags);
ClearPageReserved(virt_to_page(page_map->real));
free_page((unsigned long) page_map->real);
page_map->real = NULL;
return -ENOMEM;
......@@ -2933,8 +2928,7 @@ static int serverworks_create_page_map(serverworks_page_map *page_map)
static void serverworks_free_page_map(serverworks_page_map *page_map)
{
iounmap(page_map->remapped);
clear_bit(PG_reserved,
&virt_to_page(page_map->real)->flags);
ClearPageReserved(virt_to_page(page_map->real));
free_page((unsigned long) page_map->real);
}
......
......@@ -286,8 +286,8 @@ static unsigned long i810_alloc_page(drm_device_t *dev)
if(address == 0UL)
return 0;
atomic_inc(&virt_to_page(address)->count);
set_bit(PG_locked, &virt_to_page(address)->flags);
get_page(virt_to_page(address));
LockPage(virt_to_page(address));
return address;
}
......@@ -296,9 +296,8 @@ static void i810_free_page(drm_device_t *dev, unsigned long page)
{
if (page) {
struct page *p = virt_to_page(page);
atomic_dec(p);
clear_bit(PG_locked, &p->flags);
wake_up_page(p);
put_page(p);
UnlockPage(p);
free_page(page);
}
}
......
......@@ -193,11 +193,6 @@ typedef struct page {
#define page_count(p) atomic_read(&(p)->count)
#define set_page_count(p,v) atomic_set(&(p)->count, v)
static inline void init_page_count(struct page *page)
{
page->count.counter = 0;
}
/*
* Various page->flags bits:
*
......
......@@ -811,7 +811,7 @@ void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap,
for (i = 0; i < size; i++) {
struct page *page = mem_map + offset + i;
set_page_zone(page, nid * MAX_NR_ZONES + j);
init_page_count(page);
set_page_count(page, 0);
__SetPageReserved(page);
memlist_init(&page->list);
if (j != ZONE_HIGHMEM)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment