linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Rankin <rankinc@zip.com.au>
To: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org
Subject: PATCH for 2.4.0: assign ad1848 mixer operations to correct module
Date: Mon, 8 Jan 2001 13:08:44 +0000 (GMT)	[thread overview]
Message-ID: <200101081308.f08D8iv01511@wittsend.ukgateway.net> (raw)

Hi,

This patch fixes a problem that I was having with the ENSONIQ
SoundScape mixer: basically, the mixer device was owned by the ad1848
module but was being deallocated when the sscape module was
unloaded. This patch hands the mixer device to the sscape module
instead so that the sscape module -cannot- be unloaded while the mixer
is in use.

--- linux-vanilla/drivers/sound/ad1848.c  Fri Aug 11 16:26:43 2000
+++ linux-2.4.0-ac3/drivers/sound/ad1848.c  Mon Jan  8 12:36:30 2001
@@ -1986,6 +1986,10 @@
      if (sound_alloc_dma(dma_capture, devc->name))
        printk(KERN_WARNING "ad1848.c: Can't allocate DMA%d\n", dma_capture);
  }
+
+ if (owner)
+   ad1848_mixer_operations.owner = owner;
+
  if ((e = sound_install_mixer(MIXER_DRIVER_VERSION,
             dev_name,
             &ad1848_mixer_operations,

BTW Isn't it ever-so-slightly dodgy modifying the static
ad1848_mixer_operations structure like this? I have modified the mixer
operations in exactly the same way as the ad1848_audio_driver
structure, but doesn't this mean that the ad1848_init() function now
"remembers" the owner from the previous call?

Maybe a better patch would be:

--- linux-vanilla/drivers/sound/ad1848.c	Fri Aug 11 16:26:43 2000
+++ linux-2.4.0-ac3/drivers/sound/ad1848.c	Mon Jan  8 13:01:54 2001
@@ -1900,8 +1900,7 @@
 	if(portc==NULL)
 		return -1;
 
-	if (owner)
-		ad1848_audio_driver.owner = owner;
+	ad1848_audio_driver.owner = (owner ? owner : THIS_MODULE);
 	
 	if ((my_dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION,
 					     dev_name,
@@ -1986,6 +1985,9 @@
 			if (sound_alloc_dma(dma_capture, devc->name))
 				printk(KERN_WARNING "ad1848.c: Can't allocate DMA%d\n", dma_capture);
 	}
+
+	ad1848_mixer_operations.owner = (owner ? owner : THIS_MODULE);
+
 	if ((e = sound_install_mixer(MIXER_DRIVER_VERSION,
 				     dev_name,
 				     &ad1848_mixer_operations,

Or maybe the sound_install_XXXX() functions should accept "owner"
parameters, so that the static structs could become "const"?

Cheers,
Chris

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

             reply	other threads:[~2001-01-08 13:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-08 13:08 Chris Rankin [this message]
2001-01-08 14:37 ` PATCH for 2.4.0: assign ad1848 mixer operations to correct module Alan Cox
2001-01-08 17:33   ` Chris Rankin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200101081308.f08D8iv01511@wittsend.ukgateway.net \
    --to=rankinc@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).