patch-1.3.28 linux/drivers/sound/soundcard.c

Next file: linux/fs/binfmt_elf.c
Previous file: linux/drivers/sound/dmabuf.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.27/linux/drivers/sound/soundcard.c linux/drivers/sound/soundcard.c
@@ -58,14 +58,13 @@
 {
   int             dev;
 
-  dev = inode->i_rdev;
-  dev = MINOR (dev);
+  dev = MINOR(inode->i_rdev);
 
   return sound_read_sw (dev, &files[dev], buf, count);
 }
 
 static int
-sound_write (struct inode *inode, struct file *file, char *buf, int count)
+sound_write (struct inode *inode, struct file *file, const char *buf, int count)
 {
   int             dev;
 
@@ -74,8 +73,7 @@
 
 #endif
 
-  dev = inode->i_rdev;
-  dev = MINOR (dev);
+  dev = MINOR(inode->i_rdev);
 
   return sound_write_sw (dev, &files[dev], buf, count);
 }
@@ -92,8 +90,7 @@
   int             dev, retval;
   struct fileinfo tmp_file;
 
-  dev = inode->i_rdev;
-  dev = MINOR (dev);
+  dev = MINOR(inode->i_rdev);
 
   if (!soundcard_configured && dev != SND_DEV_CTL && dev != SND_DEV_STATUS)
     {
@@ -127,8 +124,7 @@
 {
   int             dev;
 
-  dev = inode->i_rdev;
-  dev = MINOR (dev);
+  dev = MINOR(inode->i_rdev);
 
   sound_release_sw (dev, &files[dev]);
 #ifdef MODULE
@@ -142,8 +138,7 @@
 {
   int             dev;
 
-  dev = inode->i_rdev;
-  dev = MINOR (dev);
+  dev = MINOR(inode->i_rdev);
 
   if (cmd & IOC_INOUT)
     {
@@ -176,8 +171,7 @@
 {
   int             dev;
 
-  dev = inode->i_rdev;
-  dev = MINOR (dev);
+  dev = MINOR(inode->i_rdev);
 
   DEB (printk ("sound_select(dev=%d, type=0x%x)\n", dev, sel_type));
 
@@ -438,6 +432,7 @@
   int             dev, ret = 0;
   unsigned long   dma_pagesize;
   char           *start_addr, *end_addr;
+  int		  order, size;
   struct dma_buffparms *dmap;
 
   for (dev = 0; dev < num_audiodevs; dev++)
@@ -497,8 +492,10 @@
 		  }
 	      }
 #else
-	    start_addr = kmalloc (audio_devs[dev]->buffsize,
-				  GFP_DMA | GFP_KERNEL);
+	    for (order = 0, size = PAGE_SIZE;
+		 size < audio_devs[dev]->buffsize;
+		 order++, size <<= 1);
+	    start_addr = (char *) __get_free_pages(GFP_KERNEL, order, MAX_DMA_ADDRESS);
 #endif
 	    if (start_addr == NULL)
 	      ret = -ENOMEM;	/* Can't stop the loop in this case, because
@@ -545,8 +542,12 @@
     }
 #else
   int             dev, i;
+  int		  order, size;
 
-  for (dev = 0; dev < num_audiodevs; dev++)
+  for (dev = 0; dev < num_audiodevs; dev++) {
+    for (order = 0, size = PAGE_SIZE;
+	 size < audio_devs[dev]->buffsize;
+	 order++, size <<= 1);
     if (audio_devs[dev]->buffcount > 0 && audio_devs[dev]->dmachan >= 0)
       {
 	for (i = 0; i < audio_devs[dev]->buffcount; i++)
@@ -555,9 +556,11 @@
 	      if (debugmem)
 		printk ("sound: freeing 0x%lx\n",
 			(long) (audio_devs[dev]->dmap->raw_buf[i]));
-	      kfree (audio_devs[dev]->dmap->raw_buf[i]);
+	      free_pages((unsigned long) audio_devs[dev]->dmap->raw_buf[i], 
+			 order);
 	    }
       }
+  }
 #endif
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this