patch-2.2.4 linux/drivers/sbus/audio/audio.c

Next file: linux/drivers/sbus/audio/cs4215.h
Previous file: linux/drivers/pci/oldproc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.3/linux/drivers/sbus/audio/audio.c linux/drivers/sbus/audio/audio.c
@@ -136,7 +136,7 @@
 
 	drv->output_buffer = kmalloc((drv->output_buffer_size * 
 					       drv->num_output_buffers),
-					      GFP_KERNEL);
+					      (GFP_DMA | GFP_KERNEL));
 	if (!drv->output_buffer) goto kmalloc_failed2;
 
         /* Allocate the pages for each output buffer. */
@@ -167,7 +167,7 @@
 	if (duplex == 1) {
 	  drv->input_buffer = kmalloc((drv->input_buffer_size * 
 						drv->num_input_buffers), 
-					       GFP_KERNEL);
+					       (GFP_DMA | GFP_KERNEL));
 	  if (!drv->input_buffer) goto kmalloc_failed4;
 
 	  for (i = 0; i < drv->num_input_buffers; i++) {
@@ -634,7 +634,29 @@
 					   SPARCAUDIO_DEVICE_SHIFT)];
   unsigned long i = 0, j = 0, k = 0;
 
-  k = (unsigned long) &arg;
+  k = arg;
+
+  if(cmd == SOUND_MIXER_INFO) {
+          audio_device_t tmp;
+          mixer_info info;
+          int retval = -EINVAL;
+
+          if(drv->ops->sunaudio_getdev) {
+                  drv->ops->sunaudio_getdev(drv, &tmp);
+                  memset(&info, 0, sizeof(info));
+                  strncpy(info.id, tmp.name, sizeof(info.id));
+                  strncpy(info.name, "Sparc Audio", sizeof(info.name));
+
+                  /* XXX do this right... */
+                  info.modify_counter = 0;
+
+                  if(copy_to_user((char *)arg, &info, sizeof(info)))
+                          retval = -EFAULT;
+                  else
+                          retval = 0;
+          }
+          return retval;
+  }
 
   switch (cmd) {
   case SOUND_MIXER_WRITE_RECLEV:
@@ -1022,12 +1044,14 @@
 		  break;
 		}
 	      } else if (k == 16) {
+		switch (j) {
 		case AUDIO_ENCODING_LINEAR:
 		  i = AFMT_S16_BE;
 		  break;
 		case AUDIO_ENCODING_LINEARLE:
 		  i = AFMT_S16_LE;
 		  break;
+                }
 	      } 
 	      COPY_OUT(arg, i);
 	      break;
@@ -1872,6 +1896,11 @@
 	/* A low-level audio driver must exist. */
 	if (!drv)
 		return -ENODEV;
+
+#ifdef S_ZERO_WR
+        /* This is how 2.0 ended up dealing with 0 len writes */
+        inode->i_flags |= S_ZERO_WR;
+#endif
 
 	switch (minor & 0xf) {
 	case SPARCAUDIO_AUDIOCTL_MINOR:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)