patch-1.3.34 linux/drivers/sound/pas2_pcm.c

Next file: linux/drivers/sound/patmgr.c
Previous file: linux/drivers/sound/pas2_mixer.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.33/linux/drivers/sound/pas2_pcm.c linux/drivers/sound/pas2_pcm.c
@@ -103,7 +103,8 @@
   pcm_filter = tmp;
 #endif
 
-  DISABLE_INTR (flags);
+  save_flags (flags);
+  cli ();
 
   pas_write (tmp & ~(F_F_PCM_RATE_COUNTER | F_F_PCM_BUFFER_COUNTER), FILTER_FREQUENCY);
   pas_write (S_C_C_SAMPLE_RATE | S_C_C_LSB_THEN_MSB | S_C_C_SQUARE_WAVE, SAMPLE_COUNTER_CONTROL);
@@ -111,7 +112,7 @@
   pas_write ((foo >> 8) & 0xff, SAMPLE_RATE_TIMER);
   pas_write (tmp, FILTER_FREQUENCY);
 
-  RESTORE_INTR (flags);
+  restore_flags (flags);
 
   return pcm_speed;
 }
@@ -153,7 +154,7 @@
 }
 
 static int
-pas_pcm_ioctl (int dev, unsigned int cmd, unsigned int arg, int local)
+pas_pcm_ioctl (int dev, unsigned int cmd, ioctl_arg arg, int local)
 {
   TRACE (printk ("pas2_pcm.c: static int pas_pcm_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg));
 
@@ -161,62 +162,62 @@
     {
     case SOUND_PCM_WRITE_RATE:
       if (local)
-	return pcm_set_speed (arg);
-      return IOCTL_OUT (arg, pcm_set_speed (IOCTL_IN (arg)));
+	return pcm_set_speed ((int) arg);
+      return snd_ioctl_return ((int *) arg, pcm_set_speed (get_fs_long ((long *) arg)));
       break;
 
     case SOUND_PCM_READ_RATE:
       if (local)
 	return pcm_speed;
-      return IOCTL_OUT (arg, pcm_speed);
+      return snd_ioctl_return ((int *) arg, pcm_speed);
       break;
 
     case SNDCTL_DSP_STEREO:
       if (local)
-	return pcm_set_channels (arg + 1) - 1;
-      return IOCTL_OUT (arg, pcm_set_channels (IOCTL_IN (arg) + 1) - 1);
+	return pcm_set_channels ((int) arg + 1) - 1;
+      return snd_ioctl_return ((int *) arg, pcm_set_channels (get_fs_long ((long *) arg) + 1) - 1);
       break;
 
     case SOUND_PCM_WRITE_CHANNELS:
       if (local)
-	return pcm_set_channels (arg);
-      return IOCTL_OUT (arg, pcm_set_channels (IOCTL_IN (arg)));
+	return pcm_set_channels ((int) arg);
+      return snd_ioctl_return ((int *) arg, pcm_set_channels (get_fs_long ((long *) arg)));
       break;
 
     case SOUND_PCM_READ_CHANNELS:
       if (local)
 	return pcm_channels;
-      return IOCTL_OUT (arg, pcm_channels);
+      return snd_ioctl_return ((int *) arg, pcm_channels);
       break;
 
     case SNDCTL_DSP_SETFMT:
       if (local)
-	return pcm_set_bits (arg);
-      return IOCTL_OUT (arg, pcm_set_bits (IOCTL_IN (arg)));
+	return pcm_set_bits ((int) arg);
+      return snd_ioctl_return ((int *) arg, pcm_set_bits (get_fs_long ((long *) arg)));
       break;
 
     case SOUND_PCM_READ_BITS:
       if (local)
 	return pcm_bits;
-      return IOCTL_OUT (arg, pcm_bits);
+      return snd_ioctl_return ((int *) arg, pcm_bits);
 
     case SOUND_PCM_WRITE_FILTER:	/*
 					 * NOT YET IMPLEMENTED
 					 */
-      if (IOCTL_IN (arg) > 1)
-	return IOCTL_OUT (arg, RET_ERROR (EINVAL));
+      if (get_fs_long ((long *) arg) > 1)
+	return -EINVAL;
+      pcm_filter = get_fs_long ((long *) arg);
       break;
 
-      pcm_filter = IOCTL_IN (arg);
     case SOUND_PCM_READ_FILTER:
-      return IOCTL_OUT (arg, pcm_filter);
+      return snd_ioctl_return ((int *) arg, pcm_filter);
       break;
 
     default:
-      return RET_ERROR (EINVAL);
+      return -EINVAL;
     }
 
-  return RET_ERROR (EINVAL);
+  return -EINVAL;
 }
 
 static void
@@ -237,11 +238,6 @@
   if ((err = pas_set_intr (PAS_PCM_INTRBITS)) < 0)
     return err;
 
-  if (DMAbuf_open_dma (dev) < 0)
-    {
-      pas_remove_intr (PAS_PCM_INTRBITS);
-      return RET_ERROR (EBUSY);
-    }
 
   pcm_count = 0;
 
@@ -255,14 +251,14 @@
 
   TRACE (printk ("pas2_pcm.c: static void pas_pcm_close(void)\n"));
 
-  DISABLE_INTR (flags);
+  save_flags (flags);
+  cli ();
 
   pas_pcm_reset (dev);
-  DMAbuf_close_dma (dev);
   pas_remove_intr (PAS_PCM_INTRBITS);
   pcm_mode = PCM_NON;
 
-  RESTORE_INTR (flags);
+  restore_flags (flags);
 }
 
 static void
@@ -274,7 +270,7 @@
   TRACE (printk ("pas2_pcm.c: static void pas_pcm_output_block(char *buf = %P, int count = %X)\n", buf, count));
 
   cnt = count;
-  if (audio_devs[dev]->dmachan > 3)
+  if (audio_devs[dev]->dmachan1 > 3)
     cnt >>= 1;
 
   if (audio_devs[dev]->flags & DMA_AUTOMODE &&
@@ -284,7 +280,8 @@
 				 * Auto mode on. No need to react
 				 */
 
-  DISABLE_INTR (flags);
+  save_flags (flags);
+  cli ();
 
   pas_write (pas_read (PCM_CONTROL) & ~P_C_PCM_ENABLE,
 	     PCM_CONTROL);
@@ -292,7 +289,7 @@
   if (restart_dma)
     DMAbuf_start_dma (dev, buf, count, DMA_MODE_WRITE);
 
-  if (audio_devs[dev]->dmachan > 3)
+  if (audio_devs[dev]->dmachan1 > 3)
     count >>= 1;
 
   if (count != pcm_count)
@@ -310,7 +307,7 @@
 
   pcm_mode = PCM_DAC;
 
-  RESTORE_INTR (flags);
+  restore_flags (flags);
 }
 
 static void
@@ -323,7 +320,7 @@
   TRACE (printk ("pas2_pcm.c: static void pas_pcm_start_input(char *buf = %P, int count = %X)\n", buf, count));
 
   cnt = count;
-  if (audio_devs[dev]->dmachan > 3)
+  if (audio_devs[dev]->dmachan1 > 3)
     cnt >>= 1;
 
   if (audio_devs[my_devnum]->flags & DMA_AUTOMODE &&
@@ -333,12 +330,13 @@
 				 * Auto mode on. No need to react
 				 */
 
-  DISABLE_INTR (flags);
+  save_flags (flags);
+  cli ();
 
   if (restart_dma)
     DMAbuf_start_dma (dev, buf, count, DMA_MODE_READ);
 
-  if (audio_devs[dev]->dmachan > 3)
+  if (audio_devs[dev]->dmachan1 > 3)
     count >>= 1;
 
   if (count != pcm_count)
@@ -356,7 +354,7 @@
 
   pcm_mode = PCM_ADC;
 
-  RESTORE_INTR (flags);
+  restore_flags (flags);
 }
 
 static int
@@ -403,9 +401,8 @@
   if (num_audiodevs < MAX_AUDIO_DEV)
     {
       audio_devs[my_devnum = num_audiodevs++] = &pas_pcm_operations;
-      audio_devs[my_devnum]->dmachan = hw_config->dma;
-      audio_devs[my_devnum]->buffcount = 1;
-      audio_devs[my_devnum]->buffsize = 2 * DSP_BUFFSIZE;
+      audio_devs[my_devnum]->dmachan1 = hw_config->dma;
+      audio_devs[my_devnum]->buffsize = DSP_BUFFSIZE;
     }
   else
     printk ("PAS2: Too many PCM devices available\n");

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