# HG changeset patch
# User Hannu Savolainen <hannu@opensound.com>
# Date 1227908228 -7200
# Node ID 5a75f44925143c924a51dc474119035f4b08bf06
# Parent e138663cd973a1e35950fddf299017bfefd16bdc
Fixed devc=NULL problems left after changeset 502

--- a/attic/drv/oss_allegro/oss_allegro.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/attic/drv/oss_allegro/oss_allegro.c	Fri Nov 28 23:37:08 2008 +0200
@@ -876,7 +876,7 @@ init_allegro (allegro_devc * devc)
 					&allegro_audio_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+					AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/attic/drv/oss_als3xx/oss_als3xx.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/attic/drv/oss_als3xx/oss_als3xx.c	Fri Nov 28 23:37:08 2008 +0200
@@ -740,7 +740,7 @@ init_als300 (als300_devc * devc)
 					&als300_audio_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+					AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/attic/drv/oss_als4k/oss_als4k.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/attic/drv/oss_als4k/oss_als4k.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1018,7 +1018,7 @@ init_als4000 (als4000_devc * devc)
 					&als4000_audio_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+					AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/attic/drv/oss_maestro/oss_maestro.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/attic/drv/oss_maestro/oss_maestro.c	Fri Nov 28 23:37:08 2008 +0200
@@ -2181,7 +2181,7 @@ init_maestro (maestro_devc * devc)
 					&maestro_audio_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+					AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/attic/drv/oss_neomagic/oss_neomagic.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/attic/drv/oss_neomagic/oss_neomagic.c	Fri Nov 28 23:37:08 2008 +0200
@@ -730,7 +730,7 @@ neomagic_install (neomagic_devc * devc, 
 				 devc->chip_name,
 				 &neomagic_audio_driver,
 				 sizeof (audiodrv_t),
-				 0, AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+				 0, AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/attic/drv/oss_vortex/oss_vortex.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/attic/drv/oss_vortex/oss_vortex.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1449,7 +1449,7 @@ attach_channel (vortex_devc * devc, int 
 					&vortex_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+					AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return;
--- a/attic/drv/oss_vortex/oss_vortex2.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/attic/drv/oss_vortex/oss_vortex2.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1601,7 +1601,7 @@ attach_channel_vortex2 (vortex_devc * de
 					&vortex2_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+					AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return;
--- a/kernel/drv/oss_ali5455/oss_ali5455.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_ali5455/oss_ali5455.c	Fri Nov 28 23:37:08 2008 +0200
@@ -835,7 +835,7 @@ init_ALI (ALI_devc * devc)
 					  tmp_name,
 					  &ALI_audio_driver,
 					  sizeof (audiodrv_t), opts,
-					  formats, NULL, -1)) < 0)
+					  formats, devc, -1)) < 0)
 	{
 	  my_dev = -1;
 	  return 0;
--- a/kernel/drv/oss_atiaudio/oss_atiaudio.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_atiaudio/oss_atiaudio.c	Fri Nov 28 23:37:08 2008 +0200
@@ -946,7 +946,7 @@ init_ATI (ATI_devc * devc)
 					  tmp_name,
 					  &ATI_audio_driver,
 					  sizeof (audiodrv_t),
-					  opts, formats, NULL, -1,
+					  opts, formats, devc, -1,
 					  devfile_name)) < 0)
 	{
 	  my_dev = -1;
--- a/kernel/drv/oss_audigyls/oss_audigyls.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_audigyls/oss_audigyls.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1470,7 +1470,7 @@ install_audio_devices (audigyls_devc * d
 					names[i],
 					&audigyls_audio_driver,
 					sizeof (audiodrv_t),
-					flags, fmts, NULL, -1)) < 0)
+					flags, fmts, devc, -1)) < 0)
 	{
 	  return 0;
 	}
@@ -1484,6 +1484,7 @@ install_audio_devices (audigyls_devc * d
       audio_engines[adev]->rate_source = frontdev;
       audio_engines[adev]->mixer_dev = devc->mixer_dev;
       audio_engines[adev]->binding = bindings[i];
+      audio_engines[adev]->dmabuf_maxaddr = MEMLIMIT_ISA;
       if (audio_engines[adev]->flags & ADEV_FIXEDRATE)
 	{
 	  audio_engines[adev]->fixed_rate = DEFAULT_RATE;
--- a/kernel/drv/oss_audiopci/oss_audiopci.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_audiopci/oss_audiopci.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1384,7 +1384,7 @@ init_apci (apci_devc * devc)
 					&apci_audio_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+					AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/kernel/drv/oss_cmi878x/oss_cmi878x.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_cmi878x/oss_cmi878x.c	Fri Nov 28 23:37:08 2008 +0200
@@ -2396,7 +2396,7 @@ init_cmi8788 (cmi8788_devc * devc)
 				 devc->osdev, tmp_name,
 				 &cmi8788_audio_driver,
 				 sizeof (audiodrv_t), caps, fmt,
-				 NULL, -1)) < 0)
+				 devc, -1)) < 0)
 	{
 	  return 0;
 	}
--- a/kernel/drv/oss_cmpci/oss_cmpci.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_cmpci/oss_cmpci.c	Fri Nov 28 23:37:08 2008 +0200
@@ -2212,7 +2212,7 @@ init_cmpci (cmpci_devc * devc)
 						   sizeof (audiodrv_t),
 						   caps,
 						   AFMT_U8 | AFMT_S16_LE |
-						   AFMT_AC3, NULL, -1)) < 0)
+						   AFMT_AC3, devc, -1)) < 0)
 	{
 	  return 0;
 	}
--- a/kernel/drv/oss_cs4281/oss_cs4281.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_cs4281/oss_cs4281.c	Fri Nov 28 23:37:08 2008 +0200
@@ -909,7 +909,7 @@ init_cs4281 (cs4281_devc * devc)
 					&cs4281_audio_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_S16_LE | AFMT_U8, NULL, -1)) < 0)
+					AFMT_S16_LE | AFMT_U8, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/kernel/drv/oss_cs461x/oss_cs461x.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_cs461x/oss_cs461x.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1719,7 +1719,7 @@ init_cs461x (cs461x_devc * devc)
 					&cs461x_audio_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_S16_LE | AFMT_U8, NULL, -1)) < 0)
+					AFMT_S16_LE | AFMT_U8, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/kernel/drv/oss_emu10k1x/oss_emu10k1x.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_emu10k1x/oss_emu10k1x.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1038,7 +1038,7 @@ install_audio_devices (emu10k1x_devc * d
 					name,
 					&emu10k1x_audio_driver,
 					sizeof (audiodrv_t),
-					flags, AFMT_S16_LE | AFMT_AC3, NULL,
+					flags, AFMT_S16_LE | AFMT_AC3, devc,
 					-1)) < 0)
 	{
 	  return;
--- a/kernel/drv/oss_envy24/envy24_direct.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_envy24/envy24_direct.c	Fri Nov 28 23:37:08 2008 +0200
@@ -342,7 +342,7 @@ envy24d_install (envy24_devc * devc)
 				    sizeof (audiodrv_t),
 				    ADEV_NOVIRTUAL | ADEV_NOINPUT | ADEV_COLD
 				    | ADEV_SPECIAL | ADEV_32BITONLY,
-				    AFMT_S32_LE, NULL, -1,
+				    AFMT_S32_LE, devc, -1,
 				    "10ch_out")) >= 0)
     {
       portc = &devc->direct_portc_out;
@@ -379,7 +379,7 @@ envy24d_install (envy24_devc * devc)
 				    sizeof (audiodrv_t),
 				    ADEV_NOVIRTUAL | ADEV_NOOUTPUT | ADEV_COLD
 				    | ADEV_SPECIAL | ADEV_32BITONLY,
-				    AFMT_S32_LE, NULL, -1,
+				    AFMT_S32_LE, devc, -1,
 				    "12ch_in")) >= 0)
     {
       portc = &devc->direct_portc_in;
--- a/kernel/drv/oss_envy24/oss_envy24.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_envy24/oss_envy24.c	Fri Nov 28 23:37:08 2008 +0200
@@ -3114,7 +3114,7 @@ install_adev (envy24_devc * devc, char *
 				   ADEV_AUTOMODE | ADEV_NOMMAP |
 				   flags | ADEV_NOVIRTUAL,
 				   fmts | AFMT_S16_LE | AFMT_S32_LE |
-				   AFMT_S24_LE, NULL, -1,
+				   AFMT_S24_LE, devc, -1,
 				   devfile_name)) < 0)
     {
       dev = -1;
--- a/kernel/drv/oss_fmedia/oss_fmedia.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_fmedia/oss_fmedia.c	Fri Nov 28 23:37:08 2008 +0200
@@ -925,7 +925,7 @@ init_fm801 (fm801_devc * devc)
 					&fm801_audio_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+					AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 1;
--- a/kernel/drv/oss_geode/oss_geode.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_geode/oss_geode.c	Fri Nov 28 23:37:08 2008 +0200
@@ -750,7 +750,7 @@ init_geode (geode_devc * devc)
 					tmp_name,
 					&geode_audio_driver,
 					sizeof (audiodrv_t),
-					caps, AFMT_S16_LE, NULL, -1)) < 0)
+					caps, AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/kernel/drv/oss_hdaudio/oss_hdaudio.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_hdaudio/oss_hdaudio.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1442,7 +1442,7 @@ install_outputdevs (hda_devc_t * devc)
 					       tmp_name,
 					       &hda_audio_driver,
 					       sizeof (audiodrv_t),
-					       opts, formats, NULL, -1,
+					       opts, formats, devc, -1,
 					       devfile_name)) < 0)
 	  {
 	    return;
@@ -1564,7 +1564,7 @@ install_inputdevs (hda_devc_t * devc)
 					     tmp_name,
 					     &hda_audio_driver,
 					     sizeof (audiodrv_t),
-					     opts, formats, NULL, -1,
+					     opts, formats, devc, -1,
 					     devfile_name)) < 0)
 	{
 	  return;
--- a/kernel/drv/oss_sblive/oss_sblive.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_sblive/oss_sblive.c	Fri Nov 28 23:37:08 2008 +0200
@@ -3806,7 +3806,7 @@ oss_sblive_attach (oss_device_t * osdev)
 				 tmp,
 				 &sblive_audio_driver,
 				 sizeof (audiodrv_t), caps,
-				 fmts | AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+				 fmts | AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  portc->audiodev = -1;
 	  return (i > 0);
--- a/kernel/drv/oss_sbpci/oss_sbpci.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_sbpci/oss_sbpci.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1231,7 +1231,7 @@ init_apci97 (apci97_devc * devc, int dev
 					tmp_name,
 					&apci97_audio_driver,
 					sizeof (audiodrv_t),
-					caps, fmts, NULL, -1)) < 0)
+					caps, fmts, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/kernel/drv/oss_solo/oss_solo.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_solo/oss_solo.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1051,7 +1051,7 @@ init_solo (solo_devc * devc)
 					&solo_audio_driver,
 					sizeof (audiodrv_t),
 					caps,
-					AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+					AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/kernel/drv/oss_trident/oss_trident.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_trident/oss_trident.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1348,7 +1348,7 @@ init_trident (trident_devc * devc)
 					sizeof (audiodrv_t),
 					caps,
 					AFMT_U8 | AFMT_S16_LE | AFMT_AC3,
-					NULL, -1)) < 0)
+					devc, -1)) < 0)
 
 	{
 	  adev = -1;
--- a/kernel/drv/oss_userdev/oss_userdev.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_userdev/oss_userdev.c	Fri Nov 28 23:37:08 2008 +0200
@@ -268,6 +268,7 @@ attach_control_device(void)
  * Create the control device files that are used to create client/server
  * device pairs and to redirect access to them.
  */
+  userdev_devc_t *devc = (userdev_devc_t*)0xdeadcafe; /* This should never get referenced */
 
   if ((client_dev = oss_install_audiodev_with_devname (OSS_AUDIO_DRIVER_VERSION,
 				    userdev_osdev,
@@ -275,7 +276,7 @@ attach_control_device(void)
 				    "User space audio device client side",
 				    &userdev_client_control_driver,
 				    sizeof (audiodrv_t),
-				    ADEV_AUTOMODE, AFMT_S16_NE, NULL, -1,
+				    ADEV_AUTOMODE, AFMT_S16_NE, devc, -1,
 				    "client")) < 0)
     {
       return;
@@ -289,7 +290,7 @@ attach_control_device(void)
 				    "User space audio device server side",
 				    &userdev_server_control_driver,
 				    sizeof (audiodrv_t),
-				    ADEV_AUTOMODE, AFMT_S16_NE, NULL, -1, 
+				    ADEV_AUTOMODE, AFMT_S16_NE, devc, -1, 
 				    "server")) < 0)
     {
       return;
--- a/kernel/drv/oss_via823x/oss_via823x.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_via823x/oss_via823x.c	Fri Nov 28 23:37:08 2008 +0200
@@ -813,7 +813,7 @@ via8233_init (via8233_devc * devc)
 					sizeof (audiodrv_t),
 					opts,
 					AFMT_U8 | AFMT_S16_LE | AFMT_AC3,
-					NULL, -1)) < 0)
+					devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 1;
--- a/kernel/drv/oss_via97/oss_via97.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_via97/oss_via97.c	Fri Nov 28 23:37:08 2008 +0200
@@ -742,7 +742,7 @@ init_via97 (via97_devc * devc)
 					&via97_audio_driver,
 					sizeof (audiodrv_t),
 					opts,
-					AFMT_U8 | AFMT_S16_LE, NULL, -1)) < 0)
+					AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/kernel/drv/oss_ymf7xx/oss_ymf7xx.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/drv/oss_ymf7xx/oss_ymf7xx.c	Fri Nov 28 23:37:08 2008 +0200
@@ -1314,7 +1314,7 @@ init_ymf7xx (ymf7xx_devc * devc)
 					sizeof (audiodrv_t),
 					caps,
 					AFMT_U8 | AFMT_S16_LE | AFMT_AC3,
-					NULL, -1)) < 0)
+					devc, -1)) < 0)
 	{
 	  adev = -1;
 	  return 0;
--- a/kernel/framework/audio/oss_audio_core.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/framework/audio/oss_audio_core.c	Fri Nov 28 23:37:08 2008 +0200
@@ -6242,6 +6242,12 @@ oss_install_audiodev_with_devname (int v
   int chdev_flags = 0;
   int devfile_num = 0;
 
+  if (devc == NULL)
+     {
+	     cmn_err(CE_WARN, "devc==NULL for %s. Cannot install audio device\n", name);
+	     return OSS_EINVAL;
+     }
+
   if (name == NULL)
     cmn_err (CE_CONT, "Name is really NULL\n");
   if (master_osdev == NULL)
--- a/kernel/framework/remux/oss_remux.c	Thu Nov 27 19:36:57 2008 +0200
+++ b/kernel/framework/remux/oss_remux.c	Fri Nov 28 23:37:08 2008 +0200
@@ -508,7 +508,7 @@ remux_install (char *name, oss_device_t 
 					       sizeof (audiodrv_t),
 					       ADEV_NOINPUT | ADEV_SPECIAL |
 					       ADEV_DISABLE_VIRTUAL |
-					       ADEV_NOSRC, AFMT_S16_NE, NULL,
+					       ADEV_NOSRC, AFMT_S16_NE, devc,
 					       -1)) < 0)
     {
       devc->audio_dev = -1;