Commit 993f5d11 authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman

firmware: Use kvmalloc for page tables

This is a minor optimization to use kvmalloc() variant for allocating
the page table for the SG-buffer.  They aren't so big in general, so
kmalloc() would fit often better.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8f58570b
...@@ -232,7 +232,7 @@ static int map_fw_priv_pages(struct fw_priv *fw_priv) ...@@ -232,7 +232,7 @@ static int map_fw_priv_pages(struct fw_priv *fw_priv)
return -ENOMEM; return -ENOMEM;
/* page table is no longer needed after mapping, let's free */ /* page table is no longer needed after mapping, let's free */
vfree(fw_priv->pages); kvfree(fw_priv->pages);
fw_priv->pages = NULL; fw_priv->pages = NULL;
return 0; return 0;
...@@ -397,7 +397,8 @@ static int fw_realloc_pages(struct fw_sysfs *fw_sysfs, int min_size) ...@@ -397,7 +397,8 @@ static int fw_realloc_pages(struct fw_sysfs *fw_sysfs, int min_size)
fw_priv->page_array_size * 2); fw_priv->page_array_size * 2);
struct page **new_pages; struct page **new_pages;
new_pages = vmalloc(array_size(new_array_size, sizeof(void *))); new_pages = kvmalloc_array(new_array_size, sizeof(void *),
GFP_KERNEL);
if (!new_pages) { if (!new_pages) {
fw_load_abort(fw_sysfs); fw_load_abort(fw_sysfs);
return -ENOMEM; return -ENOMEM;
...@@ -406,7 +407,7 @@ static int fw_realloc_pages(struct fw_sysfs *fw_sysfs, int min_size) ...@@ -406,7 +407,7 @@ static int fw_realloc_pages(struct fw_sysfs *fw_sysfs, int min_size)
fw_priv->page_array_size * sizeof(void *)); fw_priv->page_array_size * sizeof(void *));
memset(&new_pages[fw_priv->page_array_size], 0, sizeof(void *) * memset(&new_pages[fw_priv->page_array_size], 0, sizeof(void *) *
(new_array_size - fw_priv->page_array_size)); (new_array_size - fw_priv->page_array_size));
vfree(fw_priv->pages); kvfree(fw_priv->pages);
fw_priv->pages = new_pages; fw_priv->pages = new_pages;
fw_priv->page_array_size = new_array_size; fw_priv->page_array_size = new_array_size;
} }
......
...@@ -276,7 +276,7 @@ void fw_free_paged_buf(struct fw_priv *fw_priv) ...@@ -276,7 +276,7 @@ void fw_free_paged_buf(struct fw_priv *fw_priv)
for (i = 0; i < fw_priv->nr_pages; i++) for (i = 0; i < fw_priv->nr_pages; i++)
__free_page(fw_priv->pages[i]); __free_page(fw_priv->pages[i]);
vfree(fw_priv->pages); kvfree(fw_priv->pages);
fw_priv->pages = NULL; fw_priv->pages = NULL;
fw_priv->page_array_size = 0; fw_priv->page_array_size = 0;
fw_priv->nr_pages = 0; fw_priv->nr_pages = 0;
......
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