Pull hp-machvec into release branch
[powerpc.git] / sound / core / memalloc.c
index dbc23e3..e72cec7 100644 (file)
@@ -105,7 +105,8 @@ struct snd_mem_list {
  */
 
 static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size,
-                                        dma_addr_t *dma_handle, int flags)
+                                        dma_addr_t *dma_handle,
+                                        gfp_t flags)
 {
        void *ret;
        u64 dma_mask, coherent_dma_mask;
@@ -511,7 +512,7 @@ static void free_all_reserved_pages(void)
  * proc file interface
  */
 #define SND_MEM_PROC_FILE      "driver/snd-page-alloc"
-struct proc_dir_entry *snd_mem_proc;
+static struct proc_dir_entry *snd_mem_proc;
 
 static int snd_mem_proc_read(char *page, char **start, off_t off,
                             int count, int *eof, void *data)
@@ -589,7 +590,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer,
 
                alloced = 0;
                pci = NULL;
-               while ((pci = pci_find_device(vendor, device, pci)) != NULL) {
+               while ((pci = pci_get_device(vendor, device, pci)) != NULL) {
                        if (mask > 0 && mask < 0xffffffff) {
                                if (pci_set_dma_mask(pci, mask) < 0 ||
                                    pci_set_consistent_dma_mask(pci, mask) < 0) {
@@ -603,6 +604,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer,
                                if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
                                                        size, &dmab) < 0) {
                                        printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size);
+                                       pci_dev_put(pci);
                                        return (int)count;
                                }
                                snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci));
@@ -654,8 +656,7 @@ static int __init snd_mem_init(void)
 
 static void __exit snd_mem_exit(void)
 {
-       if (snd_mem_proc)
-               remove_proc_entry(SND_MEM_PROC_FILE, NULL);
+       remove_proc_entry(SND_MEM_PROC_FILE, NULL);
        free_all_reserved_pages();
        if (snd_allocated_pages > 0)
                printk(KERN_ERR "snd-malloc: Memory leak?  pages not freed = %li\n", snd_allocated_pages);