linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PATCH: switch maestro3 to new ac97
@ 2003-07-11 18:15 Alan Cox
  2003-07-11 18:48 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2003-07-11 18:15 UTC (permalink / raw)
  To: linux-kernel, torvalds

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.75/sound/oss/maestro3.c linux-2.5.75-ac1/sound/oss/maestro3.c
--- linux-2.5.75/sound/oss/maestro3.c	2003-07-10 21:14:15.000000000 +0100
+++ linux-2.5.75-ac1/sound/oss/maestro3.c	2003-07-11 16:47:14.000000000 +0100
@@ -2301,9 +2301,8 @@
 {
     struct ac97_codec *codec;
 
-    if ((codec = kmalloc(sizeof(struct ac97_codec), GFP_KERNEL)) == NULL)
+    if ((codec = ac97_alloc_codec()) == NULL)
         return -ENOMEM;
-    memset(codec, 0, sizeof(struct ac97_codec));
 
     codec->private_data = card;
     codec->codec_read = m3_ac97_read;
@@ -2313,13 +2312,13 @@
 
     if (ac97_probe_codec(codec) == 0) {
         printk(KERN_ERR PFX "codec probe failed\n");
-        kfree(codec);
+        ac97_release_codec(codec);
         return -1;
     }
 
     if ((codec->dev_mixer = register_sound_mixer(&m3_mixer_fops, -1)) < 0) {
         printk(KERN_ERR PFX "couldn't register mixer!\n");
-        kfree(codec);
+        ac97_release_codec(codec);
         return -1;
     }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: switch maestro3 to new ac97
  2003-07-11 18:15 PATCH: switch maestro3 to new ac97 Alan Cox
@ 2003-07-11 18:48 ` Jeff Garzik
  2003-07-11 21:56   ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2003-07-11 18:48 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, torvalds

On Fri, Jul 11, 2003 at 07:15:26PM +0100, Alan Cox wrote:
> diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.75/sound/oss/maestro3.c linux-2.5.75-ac1/sound/oss/maestro3.c
> --- linux-2.5.75/sound/oss/maestro3.c	2003-07-10 21:14:15.000000000 +0100
> +++ linux-2.5.75-ac1/sound/oss/maestro3.c	2003-07-11 16:47:14.000000000 +0100
> @@ -2301,9 +2301,8 @@
>  {
>      struct ac97_codec *codec;
>  
> -    if ((codec = kmalloc(sizeof(struct ac97_codec), GFP_KERNEL)) == NULL)
> +    if ((codec = ac97_alloc_codec()) == NULL)
>          return -ENOMEM;
> -    memset(codec, 0, sizeof(struct ac97_codec));
>  
>      codec->private_data = card;
>      codec->codec_read = m3_ac97_read;
> @@ -2313,13 +2312,13 @@
>  
>      if (ac97_probe_codec(codec) == 0) {
>          printk(KERN_ERR PFX "codec probe failed\n");
> -        kfree(codec);
> +        ac97_release_codec(codec);
>          return -1;
>      }
>  
>      if ((codec->dev_mixer = register_sound_mixer(&m3_mixer_fops, -1)) < 0) {
>          printk(KERN_ERR PFX "couldn't register mixer!\n");
> -        kfree(codec);
> +        ac97_release_codec(codec);


I note another positive attribute as well:

This new AC97 stuff makes object lifetime much more obvious, and makes
it easy for someone to add refcounting later, if that comes up.

This patch is an excellent example of such.

	Jeff




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: switch maestro3 to new ac97
  2003-07-11 18:48 ` Jeff Garzik
@ 2003-07-11 21:56   ` Alan Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2003-07-11 21:56 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Linux Kernel Mailing List, Linus Torvalds

On Gwe, 2003-07-11 at 19:48, Jeff Garzik wrote:
> I note another positive attribute as well:
> 
> This new AC97 stuff makes object lifetime much more obvious, and makes
> it easy for someone to add refcounting later, if that comes up.
> 
> This patch is an excellent example of such.

Thats actually intentional. The current stuff doesn't need the
ref counting because it uses the coded locks for unload v I/O
locking, but people are adding a lot of stuff to ac97 now.

AC97 is DAC/ADC and GPIO pins, hence its showing up used for battery
reporting, touchscreens and other goodies.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-07-11 21:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-11 18:15 PATCH: switch maestro3 to new ac97 Alan Cox
2003-07-11 18:48 ` Jeff Garzik
2003-07-11 21:56   ` Alan Cox

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).