Commit 4abe4389 authored by Thomas Hellstrom's avatar Thomas Hellstrom Committed by Dave Airlie

drm/ttm: Fix ttm_page_alloc.c

Fix a number of typos misspellings and checkpatch.pl warnings.
Replace "[ttm] " with TTM_PFX
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent e8613c0e
...@@ -77,7 +77,7 @@ struct ttm_page_pool { ...@@ -77,7 +77,7 @@ struct ttm_page_pool {
/** /**
* Limits for the pool. They are handled without locks because only place where * Limits for the pool. They are handled without locks because only place where
* they may change is in sysfs store. They won't have immediate effect anyway * they may change is in sysfs store. They won't have immediate effect anyway
* so forcing serialiazation to access them is pointless. * so forcing serialization to access them is pointless.
*/ */
struct ttm_pool_opts { struct ttm_pool_opts {
...@@ -165,15 +165,17 @@ static ssize_t ttm_pool_store(struct kobject *kobj, ...@@ -165,15 +165,17 @@ static ssize_t ttm_pool_store(struct kobject *kobj,
m->options.small = val; m->options.small = val;
else if (attr == &ttm_page_pool_alloc_size) { else if (attr == &ttm_page_pool_alloc_size) {
if (val > NUM_PAGES_TO_ALLOC*8) { if (val > NUM_PAGES_TO_ALLOC*8) {
printk(KERN_ERR "[ttm] Setting allocation size to %lu " printk(KERN_ERR TTM_PFX
"is not allowed. Recomended size is " "Setting allocation size to %lu "
"is not allowed. Recommended size is "
"%lu\n", "%lu\n",
NUM_PAGES_TO_ALLOC*(PAGE_SIZE >> 7), NUM_PAGES_TO_ALLOC*(PAGE_SIZE >> 7),
NUM_PAGES_TO_ALLOC*(PAGE_SIZE >> 10)); NUM_PAGES_TO_ALLOC*(PAGE_SIZE >> 10));
return size; return size;
} else if (val > NUM_PAGES_TO_ALLOC) { } else if (val > NUM_PAGES_TO_ALLOC) {
printk(KERN_WARNING "[ttm] Setting allocation size to " printk(KERN_WARNING TTM_PFX
"larger than %lu is not recomended.\n", "Setting allocation size to "
"larger than %lu is not recommended.\n",
NUM_PAGES_TO_ALLOC*(PAGE_SIZE >> 10)); NUM_PAGES_TO_ALLOC*(PAGE_SIZE >> 10));
} }
m->options.alloc_size = val; m->options.alloc_size = val;
...@@ -277,7 +279,7 @@ static void ttm_pages_put(struct page *pages[], unsigned npages) ...@@ -277,7 +279,7 @@ static void ttm_pages_put(struct page *pages[], unsigned npages)
{ {
unsigned i; unsigned i;
if (set_pages_array_wb(pages, npages)) if (set_pages_array_wb(pages, npages))
printk(KERN_ERR "[ttm] Failed to set %d pages to wb!\n", printk(KERN_ERR TTM_PFX "Failed to set %d pages to wb!\n",
npages); npages);
for (i = 0; i < npages; ++i) for (i = 0; i < npages; ++i)
__free_page(pages[i]); __free_page(pages[i]);
...@@ -313,7 +315,8 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free) ...@@ -313,7 +315,8 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free)
pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), pages_to_free = kmalloc(npages_to_free * sizeof(struct page *),
GFP_KERNEL); GFP_KERNEL);
if (!pages_to_free) { if (!pages_to_free) {
printk(KERN_ERR "Failed to allocate memory for pool free operation.\n"); printk(KERN_ERR TTM_PFX
"Failed to allocate memory for pool free operation.\n");
return 0; return 0;
} }
...@@ -390,7 +393,7 @@ static int ttm_pool_get_num_unused_pages(void) ...@@ -390,7 +393,7 @@ static int ttm_pool_get_num_unused_pages(void)
} }
/** /**
* Calback for mm to request pool to reduce number of page held. * Callback for mm to request pool to reduce number of page held.
*/ */
static int ttm_pool_mm_shrink(int shrink_pages, gfp_t gfp_mask) static int ttm_pool_mm_shrink(int shrink_pages, gfp_t gfp_mask)
{ {
...@@ -433,13 +436,15 @@ static int ttm_set_pages_caching(struct page **pages, ...@@ -433,13 +436,15 @@ static int ttm_set_pages_caching(struct page **pages,
case tt_uncached: case tt_uncached:
r = set_pages_array_uc(pages, cpages); r = set_pages_array_uc(pages, cpages);
if (r) if (r)
printk(KERN_ERR "[ttm] Failed to set %d pages to uc!\n", printk(KERN_ERR TTM_PFX
"Failed to set %d pages to uc!\n",
cpages); cpages);
break; break;
case tt_wc: case tt_wc:
r = set_pages_array_wc(pages, cpages); r = set_pages_array_wc(pages, cpages);
if (r) if (r)
printk(KERN_ERR "[ttm] Failed to set %d pages to wc!\n", printk(KERN_ERR TTM_PFX
"Failed to set %d pages to wc!\n",
cpages); cpages);
break; break;
default: default:
...@@ -458,7 +463,7 @@ static void ttm_handle_caching_state_failure(struct list_head *pages, ...@@ -458,7 +463,7 @@ static void ttm_handle_caching_state_failure(struct list_head *pages,
struct page **failed_pages, unsigned cpages) struct page **failed_pages, unsigned cpages)
{ {
unsigned i; unsigned i;
/* Failed pages has to be reed */ /* Failed pages have to be freed */
for (i = 0; i < cpages; ++i) { for (i = 0; i < cpages; ++i) {
list_del(&failed_pages[i]->lru); list_del(&failed_pages[i]->lru);
__free_page(failed_pages[i]); __free_page(failed_pages[i]);
...@@ -485,7 +490,8 @@ static int ttm_alloc_new_pages(struct list_head *pages, int gfp_flags, ...@@ -485,7 +490,8 @@ static int ttm_alloc_new_pages(struct list_head *pages, int gfp_flags,
caching_array = kmalloc(max_cpages*sizeof(struct page *), GFP_KERNEL); caching_array = kmalloc(max_cpages*sizeof(struct page *), GFP_KERNEL);
if (!caching_array) { if (!caching_array) {
printk(KERN_ERR "[ttm] unable to allocate table for new pages."); printk(KERN_ERR TTM_PFX
"Unable to allocate table for new pages.");
return -ENOMEM; return -ENOMEM;
} }
...@@ -493,12 +499,13 @@ static int ttm_alloc_new_pages(struct list_head *pages, int gfp_flags, ...@@ -493,12 +499,13 @@ static int ttm_alloc_new_pages(struct list_head *pages, int gfp_flags,
p = alloc_page(gfp_flags); p = alloc_page(gfp_flags);
if (!p) { if (!p) {
printk(KERN_ERR "[ttm] unable to get page %u\n", i); printk(KERN_ERR TTM_PFX "Unable to get page %u.\n", i);
/* store already allocated pages in the pool after /* store already allocated pages in the pool after
* setting the caching state */ * setting the caching state */
if (cpages) { if (cpages) {
r = ttm_set_pages_caching(caching_array, cstate, cpages); r = ttm_set_pages_caching(caching_array,
cstate, cpages);
if (r) if (r)
ttm_handle_caching_state_failure(pages, ttm_handle_caching_state_failure(pages,
ttm_flags, cstate, ttm_flags, cstate,
...@@ -590,7 +597,8 @@ static void ttm_page_pool_fill_locked(struct ttm_page_pool *pool, ...@@ -590,7 +597,8 @@ static void ttm_page_pool_fill_locked(struct ttm_page_pool *pool,
++pool->nrefills; ++pool->nrefills;
pool->npages += alloc_size; pool->npages += alloc_size;
} else { } else {
printk(KERN_ERR "[ttm] Failed to fill pool (%p).", pool); printk(KERN_ERR TTM_PFX
"Failed to fill pool (%p).", pool);
/* If we have any pages left put them to the pool. */ /* If we have any pages left put them to the pool. */
list_for_each_entry(p, &pool->list, lru) { list_for_each_entry(p, &pool->list, lru) {
++cpages; ++cpages;
...@@ -677,7 +685,8 @@ int ttm_get_pages(struct list_head *pages, int flags, ...@@ -677,7 +685,8 @@ int ttm_get_pages(struct list_head *pages, int flags,
p = alloc_page(gfp_flags); p = alloc_page(gfp_flags);
if (!p) { if (!p) {
printk(KERN_ERR "[ttm] unable to allocate page."); printk(KERN_ERR TTM_PFX
"Unable to allocate page.");
return -ENOMEM; return -ENOMEM;
} }
...@@ -709,7 +718,8 @@ int ttm_get_pages(struct list_head *pages, int flags, ...@@ -709,7 +718,8 @@ int ttm_get_pages(struct list_head *pages, int flags,
if (r) { if (r) {
/* If there is any pages in the list put them back to /* If there is any pages in the list put them back to
* the pool. */ * the pool. */
printk(KERN_ERR "[ttm] Failed to allocate extra pages " printk(KERN_ERR TTM_PFX
"Failed to allocate extra pages "
"for large request."); "for large request.");
ttm_put_pages(pages, 0, flags, cstate); ttm_put_pages(pages, 0, flags, cstate);
return r; return r;
...@@ -778,7 +788,7 @@ int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages) ...@@ -778,7 +788,7 @@ int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages)
if (atomic_add_return(1, &_manager.page_alloc_inited) > 1) if (atomic_add_return(1, &_manager.page_alloc_inited) > 1)
return 0; return 0;
printk(KERN_INFO "[ttm] Initializing pool allocator.\n"); printk(KERN_INFO TTM_PFX "Initializing pool allocator.\n");
ttm_page_pool_init_locked(&_manager.wc_pool, GFP_HIGHUSER, "wc"); ttm_page_pool_init_locked(&_manager.wc_pool, GFP_HIGHUSER, "wc");
...@@ -813,7 +823,7 @@ void ttm_page_alloc_fini() ...@@ -813,7 +823,7 @@ void ttm_page_alloc_fini()
if (atomic_sub_return(1, &_manager.page_alloc_inited) > 0) if (atomic_sub_return(1, &_manager.page_alloc_inited) > 0)
return; return;
printk(KERN_INFO "[ttm] Finilizing pool allocator.\n"); printk(KERN_INFO TTM_PFX "Finalizing pool allocator.\n");
ttm_pool_mm_shrink_fini(&_manager); ttm_pool_mm_shrink_fini(&_manager);
for (i = 0; i < NUM_POOLS; ++i) for (i = 0; i < NUM_POOLS; ++i)
......
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