patch-1.3.38 linux/drivers/sound/sound_switch.c

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

diff -u --recursive --new-file v1.3.37/linux/drivers/sound/sound_switch.c linux/drivers/sound/sound_switch.c
@@ -131,75 +131,83 @@
   if (!put_status ("\n\nInstalled drivers: \n"))
     return;
 
-  for (i = 0; i < (num_sound_drivers - 1); i++)
-    {
-      if (!put_status ("Type "))
-	return;
-      if (!put_status_int (sound_drivers[i].card_type, 10))
-	return;
-      if (!put_status (": "))
-	return;
-      if (!put_status (sound_drivers[i].name))
-	return;
+  for (i = 0; i < num_sound_drivers; i++)
+    if (sound_drivers[i].card_type != 0)
+      {
+	if (!put_status ("Type "))
+	  return;
+	if (!put_status_int (sound_drivers[i].card_type, 10))
+	  return;
+	if (!put_status (": "))
+	  return;
+	if (!put_status (sound_drivers[i].name))
+	  return;
 
-      if (!put_status ("\n"))
-	return;
-    }
+	if (!put_status ("\n"))
+	  return;
+      }
 
   if (!put_status ("\n\nCard config: \n"))
     return;
 
-  for (i = 0; i < (num_sound_cards - 1); i++)
-    {
-      int             drv, tmp;
+  for (i = 0; i < num_sound_cards; i++)
+    if (snd_installed_cards[i].card_type != 0)
+      {
+	int             drv, tmp;
 
-      if (!snd_installed_cards[i].enabled)
-	if (!put_status ("("))
-	  return;
+	if (!snd_installed_cards[i].enabled)
+	  if (!put_status ("("))
+	    return;
+
+	/*
+	 * if (!put_status_int(snd_installed_cards[i].card_type, 10)) return;
+	 * if (!put_status (": ")) return;
+	 */
 
-      /*
-       * if (!put_status_int(snd_installed_cards[i].card_type, 10)) return;
-       * if (!put_status (": ")) return;
-       */
+	if ((drv = snd_find_driver (snd_installed_cards[i].card_type)) != -1)
+	  if (!put_status (sound_drivers[drv].name))
+	    return;
 
-      if ((drv = snd_find_driver (snd_installed_cards[i].card_type)) != -1)
-	if (!put_status (sound_drivers[drv].name))
+	if (!put_status (" at 0x"))
+	  return;
+	if (!put_status_int (snd_installed_cards[i].config.io_base, 16))
 	  return;
 
-      if (!put_status (" at 0x"))
-	return;
-      if (!put_status_int (snd_installed_cards[i].config.io_base, 16))
-	return;
+	if (!put_status (" irq "))
+	  return;
+	tmp = snd_installed_cards[i].config.irq;
+	if (tmp < 0)
+	  tmp = -tmp;
+	if (!put_status_int (tmp, 10))
+	  return;
 
-      if (!put_status (" irq "))
-	return;
-      tmp = snd_installed_cards[i].config.irq;
-      if (tmp < 0)
-	tmp = -tmp;
-      if (!put_status_int (tmp, 10))
-	return;
+	if (snd_installed_cards[i].config.dma != -1)
+	  {
+	    if (!put_status (" drq "))
+	      return;
+	    if (!put_status_int (snd_installed_cards[i].config.dma, 10))
+	      return;
+	    if (snd_installed_cards[i].config.dma2 != -1)
+	      {
+		if (!put_status (","))
+		  return;
+		if (!put_status_int (snd_installed_cards[i].config.dma2, 10))
+		  return;
+	      }
+	  }
 
-      if (snd_installed_cards[i].config.dma != -1)
-	{
-	  if (!put_status (" drq "))
-	    return;
-	  if (!put_status_int (snd_installed_cards[i].config.dma, 10))
+	if (!snd_installed_cards[i].enabled)
+	  if (!put_status (")"))
 	    return;
-	  if (snd_installed_cards[i].config.dma2 != -1)
-	    {
-	      if (!put_status (","))
-		return;
-	      if (!put_status_int (snd_installed_cards[i].config.dma2, 10))
-		return;
-	    }
-	}
 
-      if (!snd_installed_cards[i].enabled)
-	if (!put_status (")"))
+	if (!put_status ("\n"))
 	  return;
+      }
 
-      if (!put_status ("\n"))
-	return;
+  if (!sound_started)
+    {
+      put_status ("\n\n***** Sound driver not started *****\n\n");
+      return;
     }
 
 #ifdef EXCLUDE_AUDIO
@@ -331,16 +339,20 @@
       return read_status (buf, count);
       break;
 
+#ifndef EXCLUDE_AUDIO
     case SND_DEV_DSP:
     case SND_DEV_DSP16:
     case SND_DEV_AUDIO:
       return audio_read (dev, file, buf, count);
       break;
+#endif
 
+#ifndef EXCLUDE_SEQUENCER
     case SND_DEV_SEQ:
     case SND_DEV_SEQ2:
       return sequencer_read (dev, file, buf, count);
       break;
+#endif
 
 #ifndef EXCLUDE_MIDI
     case SND_DEV_MIDIN:
@@ -363,16 +375,20 @@
   switch (dev & 0x0f)
     {
 
+#ifndef EXCLUDE_SEQUENCER
     case SND_DEV_SEQ:
     case SND_DEV_SEQ2:
       return sequencer_write (dev, file, buf, count);
       break;
+#endif
 
+#ifndef EXCLUDE_AUDIO
     case SND_DEV_DSP:
     case SND_DEV_DSP16:
     case SND_DEV_AUDIO:
       return audio_write (dev, file, buf, count);
       break;
+#endif
 
 #ifndef EXCLUDE_MIDI
     case SND_DEV_MIDIN:
@@ -415,11 +431,13 @@
       return 0;
       break;
 
+#ifndef EXCLUDE_SEQUENCER
     case SND_DEV_SEQ:
     case SND_DEV_SEQ2:
       if ((retval = sequencer_open (dev, file)) < 0)
 	return retval;
       break;
+#endif
 
 #ifndef EXCLUDE_MIDI
     case SND_DEV_MIDIN:
@@ -428,12 +446,14 @@
       break;
 #endif
 
+#ifndef EXCLUDE_AUDIO
     case SND_DEV_DSP:
     case SND_DEV_DSP16:
     case SND_DEV_AUDIO:
       if ((retval = audio_open (dev, file)) < 0)
 	return retval;
       break;
+#endif
 
     default:
       printk ("Invalid minor device %d\n", dev);
@@ -464,10 +484,12 @@
     case SND_DEV_CTL:
       break;
 
+#ifndef EXCLUDE_SEQUENCER
     case SND_DEV_SEQ:
     case SND_DEV_SEQ2:
       sequencer_release (dev, file);
       break;
+#endif
 
 #ifndef EXCLUDE_MIDI
     case SND_DEV_MIDIN:
@@ -475,11 +497,13 @@
       break;
 #endif
 
+#ifndef EXCLUDE_AUDIO
     case SND_DEV_DSP:
     case SND_DEV_DSP16:
     case SND_DEV_AUDIO:
       audio_release (dev, file);
       break;
+#endif
 
     default:
       printk ("Sound error: Releasing unknown device 0x%02x\n", dev);
@@ -503,6 +527,7 @@
 
 	switch (dtype)
 	  {
+#ifndef EXCLUDE_AUDIO
 	  case SND_DEV_DSP:
 	  case SND_DEV_DSP16:
 	  case SND_DEV_AUDIO:
@@ -511,6 +536,7 @@
 	      return -ENXIO;
 	    return mixer_devs[mixdev]->ioctl (mixdev, cmd, arg);
 	    break;
+#endif
 
 	  default:
 	    return mixer_devs[0]->ioctl (0, cmd, arg);
@@ -533,16 +559,20 @@
       return mixer_devs[dev]->ioctl (dev, cmd, arg);
       break;
 
+#ifndef EXCLUDE_SEQUENCER
     case SND_DEV_SEQ:
     case SND_DEV_SEQ2:
       return sequencer_ioctl (dev, file, cmd, arg);
       break;
+#endif
 
+#ifndef EXCLUDE_AUDIO
     case SND_DEV_DSP:
     case SND_DEV_DSP16:
     case SND_DEV_AUDIO:
       return audio_ioctl (dev, file, cmd, arg);
       break;
+#endif
 
 #ifndef EXCLUDE_MIDI
     case SND_DEV_MIDIN:

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